var gCurSubMenu=new Array();

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ 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);
	objSubMenu.style.display='none';
	
	if (inLevel==1){
		objSubMenu.style.left=findPosX(inObj)+'px';
		objSubMenu.style.top=(parseInt(findPosY(inObj))+25)+'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';
		}
		
		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;
	
//	if (inColor=='over'){
//		inObj.style.backgroundColor='#ff0000';
//	}else{
//		inObj.style.backgroundColor='#ffffff';
//	}
	
}



//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ 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){
	
	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;
  
}
