var cssmenuids=["cssmenu1"] //Enter id(s) of CSS Horizontal UL menus, separated by commas
var csssubmenuoffset=0 //Offset of submenus from main menu. Default is 0 pixels.

function createcssmenu(){
	for (var i=0; i<cssmenuids.length; i++){
		var ultags=document.getElementById(cssmenuids[i]).getElementsByTagName("ul")
		for (var t=0; t<ultags.length; t++){
			ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px"
		    /*	var spanref=document.createElement("span")
					spanref.className="arrowdiv"
					spanref.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;"
					ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)*/
			
			ultags[t].parentNode.onmouseover=function(){
				this.style.zIndex=100
    			this.getElementsByTagName("ul")[0].style.visibility="visible"
				this.getElementsByTagName("ul")[0].style.zIndex=0
    		}
			
			ultags[t].parentNode.onmouseout=function(){
				this.style.zIndex=0
				this.getElementsByTagName("ul")[0].style.visibility="hidden"
				this.getElementsByTagName("ul")[0].style.zIndex=100
    		}
		}
	}
}

if (window.addEventListener)
	window.addEventListener("load", createcssmenu, false)
else if (window.attachEvent)
	window.attachEvent("onload", createcssmenu)

function chngBgColor(id,colorVal,imgName){
	var liId ="l"+id;
	var imgId ="img_"+id;

	document.getElementById(liId).style.backgroundColor=colorVal;
	if(colorVal.length>0){
		document.getElementById(imgId).src=imgName+"_h.gif";
	}else{
		document.getElementById(imgId).src=imgName+".gif";
	}
}

function hoverEffect(menuId, imageName){
	if(document.getElementById(menuId)!=null){
		document.getElementById(menuId).src=imageName;
		alert(imageName);
	}
}

function quoteTxt(){
	if(document.getElementById("quoteTxtHidden")!=null && document.getElementById("lCaptionstext")!=null){
		document.getElementById("lCaptions").style.display='block';
		document.getElementById("lCaptionstext").innerHTML = document.getElementById("quoteTxtHidden").innerHTML;
	}
}
quoteTxt();

function resize(){

	var currentWidth = document.documentElement.clientWidth;
	var minWidth=990;
	var maxWidth=1230;
	var currentHeight = document.documentElement.clientHeight;
	var minHeight=870;
	
	var menuProductsPadding = "15%";
	var menuPaddingAt =1100;
	var noOfMenu=4;
	
	if (currentHeight<minHeight)
		currentHeight = minHeight;
	
	if(currentWidth<minWidth)
		currentWidth = minWidth;
	else if(currentWidth>maxWidth)
		currentWidth = maxWidth;
	
	var menuWidth = currentWidth*0.77;
	var subMenuWidth = Math.round(menuWidth/noOfMenu);
	menuWidth = subMenuWidth * noOfMenu;
	
	document.getElementById("wrapper").style.width=currentWidth+"px";
	document.getElementById("mainNav").style.width=currentWidth+"px";
	document.getElementById("topNav").style.width=currentWidth+"px";
	document.getElementById("topNavBackground").style.width=currentWidth+"px";
	document.getElementById("menu").style.width=menuWidth+"px";
	
	if(document.getElementById("hdnews")!=null)
		document.getElementById("hdnews").style.width=currentWidth+"px";

	if(document.getElementById("slider1")!=null){
		document.getElementById("slider1").style.width=currentWidth+"px";
		document.getElementById("slider1").style.height=currentWidth/maxWidth*878+"px";
	}

	if(document.getElementById("mainImageOutline")!=null)
		document.getElementById("mainImageOutline").style.width=currentWidth+"px";

	if(document.getElementById("animate")!=null)
		document.getElementById("animate").style.width=currentWidth+"px";	
	
	if(document.getElementById("slideNews")!=null)
		document.getElementById("slideNews").style.width=subMenuWidth+"px";	
	
	if(document.getElementById("wrap")!=null) {
		document.getElementById("wrap").style.width=currentWidth+"px";
		document.getElementById("wrap").style.top=500*currentWidth/1230+"px";
		document.getElementById("footer").style.paddingTop=800*currentWidth/1230+10+"px";
	}

	if(document.getElementById("hdVideoPlayer")!=null){
		var slidingWrapperWidth = menuWidth*0.97;
		document.getElementById("hdVideoPlayer").style.width=slidingWrapperWidth+"px";
		document.getElementById("videoTabWrapper").style.width=menuWidth*0.98+"px";
		document.getElementById("videoShow").style.width=menuWidth*0.98+"px";
	}
	
	if(document.getElementById("slidingTabWrapper")!=null){
		var slidingWrapperWidth = menuWidth*0.98;
			document.getElementById("slidingTabWrapper").style.width=slidingWrapperWidth+"px";
			document.getElementById("ulSlidingTabPanel").style.width=slidingWrapperWidth+"px";
	}
	
	if(document.getElementById("slidingPanel")!=null){
		var maxTabWidth = 200;
		var tabBarWidth = menuWidth*0.98;
		document.getElementById("slidingPanel").style.width=tabBarWidth+"px";	
		
		if(document.getElementById("content_2")!=null){
			document.getElementById("content_2").style.width=tabBarWidth+"px";
			document.getElementById("content_2").style.paddingRight=0;
		}
		
		for(var lk=0; lk<tabs.length; lk++){
			var elementName = tabs[lk]+"Panel";
			var id=lk+1;
				document.getElementById(elementName).style.width=menuWidth*0.98+"px";
		}
	}
	
	if(document.getElementById("historyFlash")!=null){
		var flashScale = (currentWidth / 1230);
		var flashWidth = 894 * flashScale;
		var flashHeight = 350 * flashScale;
		document.getElementById("historyFlash").style.width=flashWidth+"px";
		document.getElementById("historyFlash").style.height=flashHeight+"px";
	}	
}
