

function formatTabs(){
	var tabOuterDiv,loc,hrefs,cLoc,haveSub,subhrefs,subTabs
	haveSub=0
	if(document.getElementById){
		tabOuterDiv=document.getElementById("tabRow");

		if(tabOuterDiv){
			loc=window.location.href.toLowerCase();
			hash="#";

			if(loc.indexOf(hash)>-1){locS=loc.split("#"); loc=locS[0]};

			hrefs=tabOuterDiv.getElementsByTagName("A");

			if(hrefs&&hrefs.length){
				for(i=0;i<hrefs.length;i++){
					cLoc=hrefs[i].href
					
					if(cLoc){
						cLoc=cLoc.toLowerCase();

						if(loc.indexOf(cLoc)>-1){//re-color active tab
							hrefs[i].getElementsByTagName("DIV")[0].className="activeEmptyBorder";
							hrefs[i].getElementsByTagName("DIV")[1].className="activeLeftBorder";
							hrefs[i].getElementsByTagName("DIV")[2].className="activeRightBorder";	
							hrefs[i].getElementsByTagName("DIV")[3].className="activeContentDiv";
								
							cLocS=cLoc.split("/")
							fileNameS=cLocS[cLocS.length-1].split(".")
							fileName=fileNameS[0]
							
							if(document.getElementById(fileName)){//re-format active tab - if sub menu is visible
								document.getElementById(fileName).style.display="block";
								
								if(document.getElementById(fileName).currentStyle){
									masterColor=document.getElementById(fileName).currentStyle.backgroundColor
								}else{
									masterColor=document.defaultView.getComputedStyle(document.getElementById(fileName),'').getPropertyValue("background-color")
								}
								document.getElementById("tabRow").style.backgroundColor=masterColor
								
								hrefs[i].getElementsByTagName("DIV")[3].style.paddingTop="4px";
								hrefs[i].getElementsByTagName("DIV")[3].style.paddingBottom="6px";	
									hrefs[i].getElementsByTagName("DIV")[1].style.borderBottom="0px";
									hrefs[i].getElementsByTagName("DIV")[1].style.borderBottomColor="#E9E9E9";
									hrefs[i].parentNode.parentNode.style.borderBottom="0";
									hrefs[i].parentNode.className="newBorderConnected";	
								haveSub=1			
							}
							break; //breakout
						}
					}
				}
			}
		}
		
		if(haveSub==0){//no sub row has been displayed yet - check sub rows to find a possible url match
			subTabs=document.getElementById("subTabsRow");
		
			if(subTabs){
				subhrefs=subTabs.getElementsByTagName("A");

				if(subhrefs&&subhrefs.length){
					for(j=0;j<subhrefs.length;j++){
						cLoc=subhrefs[j].href
						
						if(cLoc){
							cLoc=cLoc.toLowerCase();

							if(loc.indexOf(cLoc)>-1){
								targetDiv=subhrefs[j].parentNode.id
								if(document.getElementById(targetDiv)){
									document.getElementById(targetDiv).style.display="block";
									
									if(hrefs&&hrefs.length){
										for(i=0;i<hrefs.length;i++){
											cLoc=hrefs[i].href
					
											if(cLoc){
												cLoc=cLoc.toLowerCase();
												
												if(cLoc.indexOf(targetDiv)>-1){//re-color and re-format active tab
													hrefs[i].getElementsByTagName("DIV")[0].className="activeEmptyBorder";
													hrefs[i].getElementsByTagName("DIV")[1].className="activeLeftBorder";
													hrefs[i].getElementsByTagName("DIV")[2].className="activeRightBorder";	
													hrefs[i].getElementsByTagName("DIV")[3].className="activeContentDiv";
													
													cLocS=cLoc.split("/")
													fileNameS=cLocS[cLocS.length-1].split(".")
													fileName=fileNameS[0]
							
													if(document.getElementById(fileName).currentStyle){
														masterColor=document.getElementById(fileName).currentStyle.backgroundColor
													}else{
														masterColor=document.defaultView.getComputedStyle(document.getElementById(fileName),'').getPropertyValue("background-color")
													}
													document.getElementById("tabRow").style.backgroundColor=masterColor
													
													subhrefs[j].style.color="#CCCCCC"
													hrefs[i].getElementsByTagName("DIV")[3].style.paddingTop="4px";
													hrefs[i].getElementsByTagName("DIV")[3].style.paddingBottom="6px";	
														hrefs[i].getElementsByTagName("DIV")[1].style.borderBottom="0px";
														hrefs[i].getElementsByTagName("DIV")[1].style.borderBottomColor="#E9E9E9";
														hrefs[i].parentNode.parentNode.style.borderBottom="0";
														hrefs[i].parentNode.className="newBorderConnected";		
													break; //breakout
												}
											}										
										}
									}				
								}
								break; //breakout
							}
						}
					}
				}
			}
		}
	}
}


function hideNonLoadedImages(divid){
	document.getElementById(divid).style.display="block"
}

