
var selectedTab = 1;

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

window.addEvent('domready', function() {
	updateTabs();
	var currentPath = location.href;
	var currentPath = currentPath.substring(currentPath.lastIndexOf('/') + 1);
	if((/^Home\.jsp/.test(currentPath)) || (currentPath == '')){
		MM_preloadImages('/images/tab_1_over.jpg','/images/tab_2_over.jpg','/images/tab_3_over.jpg','/images/tab_4_over.jpg','/images/tab_5_over.jpg','/images/tab_6_over.jpg','/images/tab_7_over.jpg');
		document.getElementById('tabBoxContent').innerHTML = document.getElementById('tab1content').innerHTML;
		document.getElementById("content").style.padding="10px 10px 0 10px";
	}else if(/WSW\/Support\.jsp/.test(currentPath)) {
		document.getElementById("content").style.padding="0 10px 0 10px";
	}else{
		//document.getElementById("content").style.padding="18px 30px 20px 30px";
	}
	
	var accordion = new Accordion('h3.atStart', 'div.atStart', {
	opacity: false,
	onActive: function(toggler, element){
		toggler.setStyle('color', '#fff');
		toggler.setStyle('background', '#7C7F84');
		//toggler.setStyle('background', '#F8C26C');
		toggler.setStyle('padding', '5px 5px 5px 7px');
		toggler.setStyle('border', 'solid 1px #7C7F84');
		//toggler.setStyle('border', 'solid 1px #F8C26C');
		toggler.setStyle('cursor', 'pointer');
		toggler.setStyle('font-weight', 'bold');
		toggler.setStyle('margin', '5px');
		toggler.setStyle('font-size', '12px');
		toggler.setStyle('width', '47%');
		toggler.setStyle('float', 'left');
		element.setStyle('margin', '0 7px 0 7px');
	},
 
	onBackground: function(toggler, element){
		toggler.setStyle('color', '#000');
		toggler.setStyle('background', '#eee');
		toggler.setStyle('padding', '5px 5px 5px 7px');
		toggler.setStyle('border', 'solid 1px #ccc');
		toggler.setStyle('cursor', 'pointer');
		toggler.setStyle('font-weight', 'normal');
		toggler.setStyle('margin', '5px');
		toggler.setStyle('font-size', '12px');
		toggler.setStyle('width', '47%');
		toggler.setStyle('float', 'left');
		element.setStyle('margin', '0 7px 0 7px');
	}
}, $('accordion'));
	
});

function mouseoverTab(num){
	if(selectedTab != num){
		document.getElementById('Tab'+num).src="/images/tab_"+num+"_over.jpg";
	}
}

function mouseoutTab(num){
	if(selectedTab != num){
		document.getElementById('Tab'+num).src="/images/tab_"+num+".jpg";
	}
}

function selectTab(num){
	document.getElementById('Tab'+selectedTab).src="/images/tab_"+selectedTab+".jpg";
	selectedTab = num;
	document.getElementById('Tab'+num).src="/images/tab_"+num+"_selected.jpg";
	var html = document.getElementById('tab'+num+'content').innerHTML;
	var box = $('tabBoxContent');
	box.innerHTML = html;

}

function updateTabs(){
	var sPath = location.href;
	var sPath = sPath.substring(sPath.lastIndexOf('/') + 1);
	var mn=document.getElementById('nav');
			var as=mn.getElementsByTagName('a');
			for (var i=0;i<as.length;i++){
			
			//alert(as[i].href.substring(as[i].href.lastIndexOf('/') + 1));
			//alert(sPath);
			
				if(as[i].href.substring(as[i].href.lastIndexOf('/') + 1) == sPath){
					as[i].setAttribute("class", "activelink");
					as[i].setAttribute("className", "activelink");
				}else if((/^Home\.jsp/.test(sPath)) || (sPath == '')){
					as[0].setAttribute("class", "activelink");
					as[0].setAttribute("className", "activelink");
				}else if(/^QuickBooksShoppingCarts-Featured/.test(sPath)){
					as[2].setAttribute("class", "activelink");
					as[2].setAttribute("className", "activelink");
				}else if(/^QuickBooks-Integrated-Shopping-Cart-Features/.test(sPath)){
					as[3].setAttribute("class", "activelink");
					as[3].setAttribute("className", "activelink");
				}else if(/^QuickBooks-Integrated-Shopping-Cart-Pricing/.test(sPath)){
					as[4].setAttribute("class", "activelink");
					as[4].setAttribute("className", "activelink");
				}else if(/^QuickBooks-Integrated-Shopping-Cart-Demo/.test(sPath)){
					as[5].setAttribute("class", "activelink");
					as[5].setAttribute("className", "activelink");
				}else if(/^Quick/.test(sPath)){
					as[1].setAttribute("class", "activelink");
					as[1].setAttribute("className", "activelink");
				}
				
			}
}