/*--------------------------------------------------
Please declare all javascript functions that needed
inside this global.js
--------------------------------------------------*/


function adjustPosition(){
	var windowHeight=document.documentElement.clientHeight;
	var wrapperHeight=document.getElementById("wrapper").offsetHeight;
	var wrapperMarginTop=(windowHeight-wrapperHeight)/2;
	
	if(wrapperHeight<windowHeight){
	document.getElementById("wrapper").style.marginTop=wrapperMarginTop+'px';
	}
}

function mOverStyleChange(element){
element.style.backgroundColor="#1e3137";
/* element.style.color="#ff8a00"; */
element.style.color="white";
element.style.cursor="pointer";
}

function mOutStyleChange(element){
element.style.backgroundColor="#f1f1f1";
element.style.color="#1e3137";
}

function navigateParentMOver(element){
element.style.backgroundImage="url(images/header/chromebg-over.gif)";
element.style.cursor="pointer";
element.style.color="black";
}

function navigateParentMOut(element){
element.style.backgroundImage="url(images/header/chromebg.gif)";
element.style.color="white";
}

function adjustPopUpPosition(){
	var windowHeight=document.documentElement.clientHeight;
	var windowWidth=document.documentElement.clientWidth;
	var ErrorMessageDivTop=(windowHeight-630)/2;
	var ErrorMessageDivLeft=(windowWidth-780)/2;
	document.getElementById('popUp').style.top=ErrorMessageDivTop+'px';
	document.getElementById('popUp').style.left=ErrorMessageDivLeft+'px';
}

function redirectPage(url){
	window.location = url;
}

function submitEnquriesForm(){
	if(document.frm_enquires.e_name.value == "" || document.frm_enquires.e_contact_1.value == "" || document.frm_enquires.e_contact_1.value == "" || document.frm_enquires.e_email.value == ""){
		alert('Please fill in all the required field');
	}
	else if(validate_email(document.frm_enquires.e_email.value) == false){
		alert("Invalid Email Address");
	}
	else{
		document.frm_enquires.submit();
	}
}

function clearAll(){
	document.frm_enquires.reset();
}

function validate_email(field)
{
var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;

	if (field.search(emailRegEx) == -1) {
		return false;
	}
	else{
		return true;
	}
}
/* function adjustHeight(){
if((document.getElementById('content').offsetHeight>document.getElementById('sideBar').offsetHeight)&&(document.getElementById('content').offsetHeight>document.getElementById('sideBar').offsetHeight)){

}

} */
