$(function(){
	$('.tabholder').each(function(){
		if(jQuery(".tab", this).length){
			jQuery(".tab:not(.active)", this).hide();
			jQuery(".tab.active", this).show();
			jQuery(".htabs a", this).click(function(){
				obj = this;
				selecttab(obj);
				return false;
			});
		}
	});
});

function selecttab(obj){
	pobj = $(obj).parent().parent().parent();
	jQuery(".htabs li.active", pobj).removeClass('active');
	jQuery(obj).parent().addClass('active');
	stringref = jQuery(obj).attr("href").split('#')[1];
	id = stringref.substring(4);
	if ($('#top_menu #top_'+id).length == 1){
		$('#top_menu .current').html($('#top_menu .current b').text()).removeClass('current');;
		hl(id);
	}
	jQuery('.tab:not(#'+stringref+')', pobj).hide();
	jQuery('.tab#' + stringref, pobj).show();
	/*if (jQuery.browser.msie && jQuery.browser.version.substr(0,3) == "6.0") {
		jQuery('.tab#' + stringref, pobj).show();
	} else {
		jQuery('.tab#' + stringref, pobj).fadeIn();
	}*/
}

// =fixing png for IE. now you should only add class "png" to show the transparent *.png image in IE6
function PNG(element){
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)){
	var src;
	if (element.tagName=='IMG'){
			if (/\.png$/.test(element.src)){
				src = element.src;
				element.src = "/web/themes/default/img/t.gif"; // = 1*1px  transparent image and path for it
			}
		}
		else {
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
			if(src){
				src = src[1];
				element.runtimeStyle.backgroundImage="none";
			}
		}
	if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	}
}

function showPrintable(url) {
        var winSets = 'left=0,top=0,height=600,width=800,menubar=no,toolbar=no,resizable=yes,status=no,scrollbars=yes';
        var prWin = window.open( url, "winPrint", winSets);
}
