function showmenu(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hidemenu(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

	
	function getDim2(el){
	for (var lx=0,ly=0;el!=null;
		ly+=el.offsetTop,lx+=el.offsetLeft,el=el.offsetParent);
	return {y:ly}
}
    function getDim(el){
	for (var lx=0,ly=0;el!=null;
		lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
	return {x:lx}
}


function popUp(PopInfo,wid,hei)
{
var desktop=window.open(PopInfo,"_blank","toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width=" + wid + ",height=" + hei + "");
}

function LinkopM(obj) {
var el = document.getElementById(obj);
if ( el.style.display != 'none' ) {
el.style.display = 'none';
}
else {
el.style.display = '';
}
}

function checkData() {
		
		if (document.adv.Area.value == "") {
		alert("Please enter area you would like to search.");
		document.adv.Area.focus();
		return false; }
		
		if (document.adv.Area.value == "Type your location") {
		alert("Please enter area you would like to search.");
		document.adv.Area.focus();
		return false; }

		if (adv.MinP.selectedIndex <= 0) {
		alert("Please select your minimum price.");
		adv.MinP.focus();
		return (false);
		}
		
		if (adv.MaxP.selectedIndex <= 0) {
		alert("Please select your maximum price.");
		adv.MaxP.focus();
		return (false);
		}
		
		if (adv.MinB.selectedIndex <= 0) {
		alert("Please select your minimum number of bedrooms.");
		adv.MinP.focus();
		return (false);
		}
		
		if (adv.MaxB.selectedIndex <= 0) {
		alert("Please select your maximum number of bedrooms.");
		adv.MaxP.focus();
		return (false);
		}
		
	}
	
	function checkData2() {
		
		if (document.norm.search.value == "") {
		alert("Please enter a key word.");
		document.norm.search.focus();
		return false; }
		
		if (document.norm.search.value == "Type keywords here") {
		alert("Please enter a key word.");
		document.norm.search.focus();
		return false; }
		
	}

	function checkData3() {
		
		if (document.adv2.Area.value == "") {
		alert("Please enter area you would like to search.");
		document.adv2.Area.focus();
		return false; }
		
		if (document.adv2.Area.value == "Type your location") {
		alert("Please enter area you would like to search.");
		document.adv2.Area.focus();
		return false; }
		
		if (document.adv2.Ftext.value == "") {
		alert("Please enter brief description of the apartment or property you would like to find.");
		document.adv2.Ftext.focus();
		return false; }
		
		if (document.adv2.Ftext.value == "Type your text here") {
		alert("Please enter brief description of the apartment or property you would like to find.");
		document.adv2.Ftext.focus();
		return false; }
		
		if (adv2.MinP.selectedIndex <= 0) {
		alert("Please select your minimum price.");
		adv2.MinP.focus();
		return (false);
		}
		
		if (adv2.MaxP.selectedIndex <= 0) {
		alert("Please select your maximum price.");
		adv2.MaxP.focus();
		return (false);
		}
		
		if (adv2.MinB.selectedIndex <= 0) {
		alert("Please select your minimum number of bedrooms.");
		adv2.MinB.focus();
		return (false);
		}
		
		
	}
	
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 					
	}	
	
function checkData4() {
		
		if (document.AGForm.fname.value == "") {
		alert("Please enter first name.");
		document.AGForm.fname.focus();
		return false; }
		
		if (document.AGForm.lname.value == "") {
		alert("Please enter last name.");
		document.AGForm.lname.focus();
		return false; }
		
		var emailID=document.AGForm.eAdd;
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false ;}
		
		
	}

