//show and hide layers
function TVshow(id) {	  
	if (document.getElementById) {		  
		document.getElementById(id).style.display="block";
        document.getElementById(id).style.visibility="visible";
	} else if (document.all) {		  
		document.all[id].style.display="block";
        document.all[id].style.visibility="visible";		
	} else if (document.layers) {		  
		document.layers[id].display="block";
        document.layers[id].visibility="visible";		
	} 
} 

function getClientWidth() {
	/* Always returns an EVEN number - INTENTIONALLY - you must position layers on even boundaries to get perfect match */
/*	if (navigator.userAgent.indexOf('MSIE')>=0) {
		return (980);
	}
*/
/*	if (navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Mac')>=0) {
		return (980);
	}
*/
	if (window.innerWidth) {
		if (document.documentElement.scrollWidth) {
			if(document.documentElement.scrollWidth < window.innerWidth) {
				return (Math.floor(document.documentElement.scrollWidth/2)*2);
			}
		}
		else {
			return (Math.floor(window.innerWidth/2)*2);
		}
	}
	if (document.body) {
		if (document.body.offsetWidth > document.body.clientWidth) {
			return (Math.floor(document.body.clientWidth/2)*2);
		}
		return (Math.floor(document.body.offsetWidth/2)*2);
	}
	if (document.documentElement) {
		return (Math.floor(document.documentElement.clientWidth/2)*2);
	}
	return 980;

}

function showAt(id,L,T) {
    winmax980 = getClientWidth();
    if (winmax980 < 980) winmax980 = 980;
	if (document.getElementById) { /* DOM */		  
		document.getElementById(id).style.display="block";
        document.getElementById(id).style.visibility="visible";
		document.getElementById(id).style.left=L+((winmax980-980)/2);
        document.getElementById(id).style.top=T;
	} else if (document.all) { /* IE */
		document.all[id].style.display="block";
        document.all[id].style.visibility="visible";		
        document.all[id].style.pixelLeft=L+((winmax980-980)/2);		
        document.all[id].style.pixelTop=T;		
	} else if (document.layers) { /* NS */	  
		document.layers[id].display="block";
        document.layers[id].visibility="visible";		
        document.layers[id].left=L+((winmax980-980)/2);		
        document.layers[id].top=T;		
	} 
} 
function showLayerAt(id,L,T) {
	return showAt(id,L,T);
} 

function getLayerLeft(id) {
	result = 0;
	try {
		if (document.getElementById) { /* DOM */
			if (document.getElementById(id) === null) 
				result = 0;
			else
    	    	result = document.getElementById(id).style.left;
		} else if (document.all) { /* IE */
			if (document.all[id] === null)
				result = 0;
			else
    	    	result = document.all[id].style.pixelLeft;		
		} else if (document.layers) { /* NS */
			if (document.layers[id] === null)
				result = 0;
			else	  
    	    	result = document.layers[id].left;		
		} else {
			result = 0;
		}
		try { 
			result = parseInt(result);
		}
		catch (excep) {
			result = 0; 
		}
	}
	catch (except) {
	}
	if (isNaN(result)) 
		result = 0;
	return result;
} 

function getLayerTop(id) {
	result = 0;
	try {
		if (document.getElementById) { /* DOM */
			if (document.getElementById(id) === null) 
				result = 0;
			else
    	    	result = document.getElementById(id).style.top;
		} else if (document.all) { /* IE */
			if (document.all[id] === null)
				result = 0;
			else
    	    	result = document.all[id].style.pixelTop;	
		} else if (document.layers) { /* NS */
			if (document.layers[id] === null)
				result = 0;
			else	  
    	    	result = document.layers[id].top;		
		} else {
			result = 0;
		}
		try { 
			result = parseInt(result);
		}
		catch (excep) {
			result = 0; 
		}
	}
	catch (except) {
	}
	if (isNaN(result)) 
		result = 0;
	return result;
} 


function moveLayerTo(id,L,T) {
    winmax980 = getClientWidth();
    if (winmax980 < 980) winmax980 = 980;
	if (document.getElementById) { /* DOM */		  
		document.getElementById(id).style.display="block";
        document.getElementById(id).style.visibility="visible";
		document.getElementById(id).style.left=L+((winmax980-980)/2);
        document.getElementById(id).style.top=T;
	} else if (document.all) { /* IE */
		document.all[id].style.display="block";
        document.all[id].style.visibility="visible";		
        document.all[id].style.pixelLeft=L+((winmax980-980)/2);		
        document.all[id].style.pixelTop=T;		
	} else if (document.layers) { /* NS */	  
		document.layers[id].display="block";
        document.layers[id].visibility="visible";		
        document.layers[id].left=L+((winmax980-980)/2);		
        document.layers[id].top=T;		
	} 
} 

function reveal(id) {
	if (document.getElementById) {		  
		document.getElementById(id).style.display="block";
        document.getElementById(id).style.visibility="visible";
	} else if (document.all) {	
		document.all[id].style.display="block";
        document.all[id].style.visibility="visible";		
	} else if (document.layers) {
		document.layers[id].display="block";
        document.layers[id].visibility="visible";		
	} 
}

function TVhide(id) {
  	if (document.getElementById) {    
		document.getElementById(id).style.display="none";    
	} else if (document.all) {
		document.all[id].style.display="none";    } 
	else if (document.layers) {    
		document.layers[id].display="none";    
	} 
} 	

function TVparentShow(id) {	  
	if (document.getElementById) {		  
		parent.document.getElementById(id).style.display="block";
        parent.document.getElementById(id).style.visibility="visible";
	} else if (document.all) {		  
		parent.document.all[id].style.display="block";		
        parent.document.all[id].style.visibility="visible";
	} else if (document.layers) {		  
		parent.document.layers[id].display="block";
        parent.document.layers[id].visibility="visible";		
	} 
}

function setLayerText(id,text) {	  
	if (document.getElementById) {		  
		parent.document.getElementById(id).innerHTML=text;
	} else if (document.all) {		  
		parent.document.all[id].innerHTML=text;		
	} else if (document.layers) {		  
		parent.document.layers[id].innerHTML=text;
	} 
}

function setLayerIDText(layer,id,text) {	  
	if (document.getElementById) {		  
		layer.document.getElementById(id).innerHTML=text;
	} else if (document.all) {		  
		layer.document.all[id].innerHTML=text;		
	} else if (document.layers) {		  
		layer.document.layers[id].innerHTML=text;
	} 
}

function TVparentHide(id) {
  	if (document.getElementById) {    
		parent.document.getElementById(id).style.display="none";    
	} else if (document.all) {
		parent.document.all[id].style.display="none";    } 
	else if (document.layers) {    
		parent.document.layers[id].display="none";    
	} 
} 	
	
function closeParentLayer(id) {
		// parent.document.getElementById(id).style.display = 'none';
		if (parent.document.getElementById(id)) {
			parentHide(id);	
		}
	}	

/* Banners on all pages except home */
function floatMenus() {
	showLayerAt('mainmenu',190,30);
	showLayerAt('submenu',190,50);
}
function floatCommonLayers() {
	floatMenus();
}


