// JavaScript Document
jQuery(document).ready(function() {
	//activate scroll areas
	$('.scroll-pane').jScrollPane();
	
	//set source for tabs
	$('.tabimg').each(function (i) {
		this.offsrc = this.src;
		this.onsrc = this.src.replace(".png", "-on.png");	  
	});	
	
	if(!$.browser.msie || ($.browser.msie &&  $.browser.version >= 7)) {
		//nav
		$('.rollover').mouseover(function (i) {
			if(!$(this).hasClass(document.getElementsByTagName('body')[0].id)) {
				this.src = this.src.replace(".png", "-on.png");	
			}
		}).mouseout(function(i){
			if(!$(this).hasClass(document.getElementsByTagName('body')[0].id)) {
				this.src = this.src.replace("-on.png", ".png");	
			}
		}).each(function(i) {
			if($(this).hasClass(document.getElementsByTagName('body')[0].id)) {
				this.src = this.src.replace(".png", "-on.png");
			}
		});
		
		//click behavior for tabs
		$('.tabimg').click(function() {
			$('.tabimg').each(function(i) {
				this.src = this.offsrc;		  
			})
			this.src = this.onsrc;
		});
		
		
	} else {
		//nav for IE6
		$('.rollover').mouseover(function (i) {
			if(!$(this).hasClass(document.getElementsByTagName('body')[0].id)) {
				this.style.filter = this.style.filter.replace(".png", "-on.png");	
			}
		}).mouseout(function(i){
			if(!$(this).hasClass(document.getElementsByTagName('body')[0].id)) {
				this.style.filter = this.style.filter.replace("-on.png", ".png");	
			}
		}).each(function(i) {
			this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='scale', src='" + this.src + "')";
			this.src = "img/spacer.gif";
			if($(this).hasClass(document.getElementsByTagName('body')[0].id)) {
				this.style.filter = this.style.filter.replace(".png", "-on.png");		
			}
		});
		
		//click behavior for tabs IE6
		$('.tabimg').each(function(i) {
			this.src = "img/spacer.gif";
			this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='scale', src='" + this.offsrc + "')";					
		}).click(function() {
			$('.tabimg').each(function(i) {
				this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='scale', src='" + this.offsrc + "')";
				//this.src = this.offsrc;		  
			})
			this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='scale', src='" + this.onsrc + "')";
			//this.src = this.onsrc;
		});
		
	}
	$('.tabs > ul').tabs();
	
	//'turn on' tab in selected tab
		$('.ui-tabs-selected .tabimg').each(function(i) {
			if(!$.browser.msie || ($.browser.msie &&  $.browser.version >= 7)) {
				this.src = this.onsrc;
			} else {
				this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='scale', src='" + this.onsrc + "')";
			}
		});	
	
	$("img[@src$=png]").pngfix();
});

