// JavaScript Document




jQuery(document).ready(function(){

	jQuery("#tab1").click(function(){
		jQuery("#tab1").attr("class","tab1Active");
		jQuery("#tab2").attr("class","tab2");
		jQuery("#tab3").attr("class","tab3");
		jQuery("#shadow1").css("display","block");
		jQuery("#shadow2").css("display","none");
		jQuery("#shadow3").css("display","none");
		return false;
	});
	jQuery("#tab2").click(function(){
		jQuery("#tab1").attr("class","tab1");
		jQuery("#tab2").attr("class","tab2Active");
		jQuery("#tab3").attr("class","tab3");
		jQuery("#shadow1").css("display","none");
		jQuery("#shadow2").css("display","block");
		jQuery("#shadow3").css("display","none");
		return false;
	});
	jQuery("#tab3").click(function(){
		jQuery("#tab1").attr("class","tab1");
		jQuery("#tab2").attr("class","tab2");
		jQuery("#tab3").attr("class","tab3Active");
		jQuery("#shadow1").css("display","none");
		jQuery("#shadow2").css("display","none");
		jQuery("#shadow3").css("display","block");
		return false;
	});
	
	// Content Table
	jQuery("#navigation").treeview({
		//animated: "fast",
		persist: "location",
		collapsed: true,
		unique: false
	});						   
						   
	// Top panel function
	jQuery(".btn-slide").click(function(){
		jQuery("#top-panel").slideToggle("slow");
		jQuery(this).toggleClass("active"); return false;
	});
	
	// Advanced Options Show and hide
	jQuery("#advanced-options #contain").hide();
	jQuery("#advanced-options #title").click(function(){
		jQuery(this).next("div").slideToggle("fast")
		.siblings("div:visible").slideUp("fast");
		jQuery(this).toggleClass("active");
		jQuery(this).siblings("#advanced-options #title").removeClass("active");
	});
	//pngfix();
	 
});
// Top panel function

// START PNG FIX 
var clear="../images/clear.gif" //path to clear.gif

pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}
//console.log(window);
window.onload = pngfix;

// END PNG FIX



//  START IE6 HOVER Fix
   
   /**
   * Adds hover support to IE6 browsers
   * 
   * This jQuery plugin will parse the stylesheets
   * for any :hover rules and append them using Javascript
   * while creating a ne rule in the stylesheet with a .hover class
   *
   * Initilaize using:
   *  
   * $(document).ready(function(){
   *	  $.ie6CSSHover();
   * });
   *
   * Limitations:
   * This script is not meant to parse :hover pseudo classes
   * that contain :hover within a selector:
   *
   * Example:
   * div span:hover p{font-size:12px} // WILL NOT WORK
   * div span p:hover{font-size:12px} // WILL WORK
   *
   **/   
   
   jQuery.extend({
   
   	ie6CSSHover:function(){   
			if(jQuery.browser.msie && /6.0/.test(navigator.userAgent)){			
				var len=document.styleSheets.length;				
				for(z=0;z<len;z++){			
					var sheet=document.styleSheets[z];					
					var css =sheet.cssText;					
					var r=new RegExp(/[a-zA-Z0-9\.-_].*:hover\s?\{.[^\}]*\}/gi);					
					var m=css.match(r);					
					if(m!=null && m.length>0){					
						for(i=0;i<m.length;i++){   								
							var c=m[i].match(/\{(.[^\}]*)}/);							
							if(c[1]){							
								var seljq=m[i].replace(':hover','').replace(c[0],'');							
								var selcss=m[i].replace(':hover','.hover').replace(c[0],'');								
								var rule=c[1].replace(/^\s|\t|\sjQuery|\r|\n/g,'');								
								document.styleSheets[z].addRule(selcss,rule);								
								var grp=jQuery(seljq);								
								jQuery(seljq).hover(function(){jQuery(this).addClass('hover')},function(){jQuery(this).removeClass('hover')});							
							}					
						}				
					}   		
				}   	
   		} 
   	}
   
   })(jQuery);
   
   jQuery(document).ready(function(){
   	jQuery.ie6CSSHover();
   });

//  END IE6 HOVER Fix
