/********* Navigation Script *********/
prevDivId = "home";
function contentOnOff(divId){
	prevOnDivId = document.getElementById(prevDivId+"_cont");
	onDivId = document.getElementById(divId+"_cont");
	prevOnDivId.style.display = "none";
	onDivId.style.display = "block";
	prevDivId = divId;
}
/********* Button Roll Over Script *********/
prevTdId = "phaseII"
function contRollOver(tdId){
	prevOnTdId = document.getElementById(prevTdId);
	onTdId = document.getElementById(tdId);
	prevOnTdId.style.backgroundColor = "";
	onTdId.style.backgroundColor = "#fff";
	onTdId.style.cursor = "pointer";
	onTdId.style.border = 2;
	onTdId.style.borderColor = "#FF0000";
	prevTdId = tdId;
}
/********* Button Roll Out Script *********/
function contRollOut(tdId){
	onTdId = document.getElementById(tdId);
	onTdId.style.backgroundColor = "";	
	onTdId.style.cursor = "pointer";
}
/********* Open Popup Script *********/
function openPopup(fileName){
	newWindow = window.open(fileName, "_blank", "menubar=no, titlebar=no, toolbar=no, scrollbars=yes, screenX=0, screenY=0 left=0, top=0");
	newWindow.focus();
}
/********* Content Show Hide Script *********/
prevContId = "home"
function showContent(contID){
	prevCId = document.getElementById(prevContId+"_cont");
	cId = document.getElementById(contID+"_cont");
	prevCId.style.display = "none";
	cId.style.display = "block";
	prevContId = contID;
}

startMenu = function() {
	if (document.all&&document.getElementById) {
		cssmenu = document.getElementById("csstopmenu");
		for (i=0; i<cssmenu.childNodes.length; i++) {
			node = cssmenu.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function(){
					this.className=this.className.replace(" over", "")
				}
			}
		}
	}
}
if (window.attachEvent){
	window.attachEvent("onload", startMenu);
	window.attachEvent("onfocus", startMenu);
} else{
	window.onload=startMenu;
	window.onfocus=startMenu;
}
/********* Enquiry Form Script *********/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function validate(){
	if(document.housing.Customer_Name.value==""){
		alert("Please Enter your Name");
		document.housing.Customer_Name.focus();
		return false;
	}
	if(document.housing.Customer_Address.value==""){
		alert("Please Enter your Address");
		document.housing.Customer_Address.focus();
		return false;
	}
	if(document.housing.Customer_Tel.value==""){
		alert("Please Enter your Telephone No.");
		document.housing.Customer_Tel.focus();
		return false;
	}
	if(!checknumber(document.housing.Customer_Tel.value)){
		document.housing.Customer_Tel.value = "";
		document.housing.Customer_Tel.focus();
		return false;
	}
	if(document.housing.Customer_Email.value==""){
		alert("Please Enter your Email ID");
		document.housing.Customer_Email.focus();
		return false;
	}
	if((checkEmailAddress(document.housing.Customer_Email.value))){
		alert("Please fill the valid Email ID!");
		document.housing.Customer_Email.focus();
		return (false);
	}
	if(document.housing.Project.value=="select a project"){
		alert("Please Select The Project");
		document.housing.Project.focus();
		return false;
	}		
	return true;
}
	
	function checknumber(formVar){
		var x=formVar
		var anum=/(^\d+$)|(^\d+\.\d+$)/
			if (anum.test(x))
				testresult=true
			else{
				alert("Please input a valid number!")
				testresult=false
			}
	return (testresult)
	}
	
	function checkEmailAddress(sEmail){
		var oRegExp = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/g;
			if (oRegExp.test(sEmail))
			return false;	
			else
			return true;
	}
