var timer1 = null;
var timer2 = null;
var timer3 = null;
var timer4 = null;
var timer5 = null;
var timer6 = null;
var timer7 = null;
var timer8 = null;
var timer9 = null;

// Menubar functions
function isChildOf(parent, child) {
	if(child != null) {			
		while(child.parentNode) {
			if((child = child.parentNode) == parent) {
				return true;
			}
		}
	}
	return false;
}
function fixOnMouseOut(element, event, script) {
	var currentMouseTarget = null;
	if(event.toElement) {				
		currentMouseTarget  = event.toElement;
	} else if(event.relatedTarget) {				
		currentMouseTarget = event.relatedTarget;
	}
	if( !isChildOf(element, currentMouseTarget) && element != currentMouseTarget ) {
		eval(script);
	}
}

function menuItmSelect(pageId){
	for(var i=1; i<=9; i++){
		if(i == pageId){
			document.getElementById('menuItm'+i).className = 'menuItm activeMenuItm'+i;
			if(i == 1){
				document.getElementById('menuItm1Corner').src = document.getElementById('preLoadLeftActive').src;	
			}
			if(i == 9){
				document.getElementById('menuItm9Corner').src = document.getElementById('preLoadRightActive').src;	
			}
			if(document.getElementById('subMenuItem'+i)){
				document.getElementById('subMenuItem'+i).style.display = 'inline';
			}
		}
		else{
			document.getElementById('menuItm'+i).className = 'menuItm inactiveMenuItm'+i;
			if(i == 1){
				document.getElementById('menuItm1Corner').src = document.getElementById('preLoadLeftInactive').src;	
			}
			if(i == 9){
				document.getElementById('menuItm9Corner').src = document.getElementById('preLoadRightInactive').src;	
			}
			if(document.getElementById('subMenuItem'+i)){
				document.getElementById('subMenuItem'+i).style.display = 'none';
			}
		}
	}
}

function validateEmail(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(email) == false) {
      alert('Invalid Email Address');
      return false;
   }
   return true;
}
