document.write('<script type="text/javascript" language="JavaScript" src="/common/jsBrowserInfo.php"></script>');

var gCurSubMenu=new Array();

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ gInitPage()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function gInitPage(){
	
	objHolder=document.getElementById('divMainContentWrapper');
	//window.alert(objHolder.offsetHeight);
	colsHeight=objHolder.offsetHeight;
	
	objLeftCol=document.getElementById('divMainLeftCol');
	if (objLeftCol){ objLeftCol.style.height=colsHeight+'px'; }
	
	document.getElementById('divMainCenter').style.height=colsHeight+'px';
	
	objRightCol=document.getElementById('divMainRightCol');
	if (objRightCol){ objRightCol.style.height=colsHeight+'px'; }
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ showSubMenu()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function showSubMenu(inObj, inMenu, inLevel){
	
	winWidth=getWinWidth();
	
	objNavBar=document.getElementById('divNavBarWrapper');
	objSubMenu=document.getElementById('divSubMenu'+inMenu);
	
	//show menu behind other content to generate width value
	objSubMenu.style.zIndex=-1;
	objSubMenu.style.left=(parseInt(findPosX(objNavBar))+50)+'px';;
	objSubMenu.style.top=(parseInt(findPosY(objNavBar)) + 30) +'px';
	objSubMenu.style.display='block';
	curSubMenuWidth=findPosW(objSubMenu);
	if (inLevel=='1'){
		//make sure first sub menu is at least as wide as its parent
		parWidth=findPosW(inObj);
		if (parseInt(curSubMenuWidth)<parseInt(parWidth)){
			curSubMenuWidth=parseInt(parWidth)-1;
			objSubMenu.style.width=curSubMenuWidth+'px';
		}
		//window.alert(parWidth);
	}else{
		//second level plus, make sure first sub menu is at least 120px wide
		if (parseInt(curSubMenuWidth)<120){
			curSubMenuWidth=120;
			objSubMenu.style.width='120px';
		}
	}
	
	objSubMenu.style.display='none';
	curMenuHeight=findPosH(document.getElementById('divNavBarWrapper')); //.style.height;
	//window.alert(curMenuHeight);
	
	if (inLevel==1){
		objSubMenu.style.left=findPosX(inObj)+'px';
		//objSubMenu.style.top=(parseInt(findPosY(inObj))+25)+'px';
		
		curSubMenuTop=(parseInt(findPosY(inObj))+parseInt(curMenuHeight));
		objSubMenu.style.top=curSubMenuTop+'px';
		
	}else{
		parentMenuRight=( parseInt(findPosX(inObj)) + parseInt(findPosW(inObj)) + 1);
		
		if ( (parseInt(parentMenuRight)+parseInt(curSubMenuWidth))>=parseInt(winWidth) ){
			//too far right, try to the left
			farLeft=( parseInt(findPosX(inObj)) - parseInt(curSubMenuWidth));
			if (parseInt(farLeft)<0){
				//too long for the left, back to right
				objSubMenu.style.left= parentMenuRight+'px';
			}else{
				objSubMenu.style.left= farLeft+'px';
			}
			
		}else{
			objSubMenu.style.left= parentMenuRight+'px';
		}
		
		if (gBrowserType!='moz'){
			//f'in IE
			objSubMenu.style.top= (parseInt(findPosY(inObj)) - 0) +'px';
		}else{
			objSubMenu.style.top= (parseInt(findPosY(inObj)) + 1) +'px';
		}
		
		
		
	}
	gCurSubMenu[inLevel]=objSubMenu;
	objSubMenu.style.zIndex=2222;
	objSubMenu.style.display='block';
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ hideSubMenu()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function hideSubMenu(inLevel){
	
	if (gCurSubMenu[inLevel]){ gCurSubMenu[inLevel].style.display='none'; }
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ hideAllMenus()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function hideAllMenus(){
	
	for (var i=1; i<=5; i++){
		if (gCurSubMenu[i]){ gCurSubMenu[i].style.display='none'; }
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ hoverMenuItem()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function hoverMenuItem(inObj, inColor){
	
	//window.alert(inColor);
	inObj.style.backgroundColor=inColor;
	
}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ valReqForm()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function valReqForm(){
	
	tmpObj=document.getElementById('txtCntName');
	if (tmpObj.value==''){
		window.alert('Please enter your name!');
		tmpObj.focus();
		return false;
	}
	tmpObj=document.getElementById('txtCntPhone');
	if (tmpObj.value==''){
		tmpObj=document.getElementById('txtCntEmail');
		if (tmpObj.value==''){
			window.alert('Please enter either your phone number or email address!');
			//tmpObj.focus();
			return false;
		}
	}
	tmpObj=document.getElementById('txtCntComments');
	if (tmpObj.value==''){
		window.alert('Please give us your comments!');
		tmpObj.focus();
		return false;
	}
	
	objForm=document.getElementById('frmRequestForm');
	objForm.action='/thankyou.php';
	objForm.submit();
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ findPosX()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function findPosX(inObj){
	var curLeft = 0;
  
  if(inObj.offsetParent){
   	while(1){
   		curLeft += inObj.offsetLeft;
      if(!inObj.offsetParent){
      	break;
      }
      inObj = inObj.offsetParent;
    }
  }else if(inObj.x){
  	curLeft += inObj.x;
  }
  
  return curLeft;
  
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ findPosY()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function findPosY(inObj){
	var curTop = 0;
	
	if(inObj.offsetParent){
		while(1){
			curTop += inObj.offsetTop;
      if(!inObj.offsetParent){
      	break;
      }
      inObj = inObj.offsetParent;
    }
  }else if(inObj.y){
  	curTop += inObj.y;
  }
  
  return curTop;
  
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ findPosW()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function findPosW(inObj){
	
//	if (gJSBrowserType=='op5'){
//		xPos = inObj.style.pixelWidth;
//	}else{
//		xPos = inObj.offsetWidth;
//	}
	
	xPos = inObj.offsetWidth;
	
	return xPos;
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ findPosH()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function findPosH(inObj){
	gJSBrowserType='?';
	
	if (gJSBrowserType=='op5'){ 
		xPos = inObj.style.pixelHeight;
	}else{
		xPos = inObj.offsetHeight;
	}
	
	return xPos;
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ getWinWidth()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function getWinWidth(){
	var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
  
  return myWidth;
  
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ addToOnload()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function addToOnload(inFuncName){
	//remember to call this after any third party apps have been called
	//ie after the header
	//sample: <script>addToOnload('initPage()');</script>
	
	//window.alert(inFuncName);
	
	var nowOnload = window.onload; // Let's save the existing assignment, if any
	window.onload = function () {
		// Here is your precious function
		// You can call as many functions as you want here;
		
		setTimeout(inFuncName, 0); //myOnloadFunction1();
		
		// Now we call old function which was assigned to onLoad, thus playing nice
		if(nowOnload != null && typeof(nowOnload) == 'function') {
			nowOnload();
		}
	}
	
}

//addToOnload('gInitPage()');
