// JavaScript Document
var popupWindow;
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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a && (i<a.length&&(x=a[i])) && (x.oSrc);i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&(parent.frames.length)) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&(d.all)) x=d.all[n]; for (i=0;(!x) && (i<d.forms.length);i++) x=d.forms[i][n];
  for(i=0;(!x) && (d.layers) && (i<d.layers.length);i++) x=MM_findObj(n,d.layers[i].document);
  if((!x) && (d.getElementById)) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } 
  if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
function showTypes(){
		document.form1.flag.value='';
		form1.submit();
}
function rentType(frm){
		if (document.frm.type.value == "Rent"){
			docuemnt.frm.renttype.style = true;
		}
}
function confirmDel(frm,msg){
	if(confirm(msg) == true){
		frm.submit();
	}
}
function signup()
{
	var membership_choice = false;
	var errormsg="";
	for (counter = 0;  counter < frmsignup1.membership.length; counter++)
	{
		if (frmsignup1.membership[counter].checked)
		{
			membership_choice = true; 
		}
	}
	if (!membership_choice)
	{
		errormsg="Please select membership type.\n";
	}
	if (echeck(frmsignup1.UserId.value)==false)
	{
		errormsg+="Please enter valid email address in User Id.\n";
	}
	if (!frmsignup1.Terms.checked)
	{
		errormsg+="Please accept Terms & Conditions.\n";
	}
	if(errormsg.length > 0)
	{
		alert(errormsg);
		return false;
	}
	return (true);
}
function setMyFocus() 
{ 
	if ((popupWindow) && !(popupWindow.closed)) 
	{ 
		popupWindow.focus(); 
	} 
}
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){
		   return false
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}
		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }
		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		 if (str.indexOf(" ")!=-1){
		    return false
		 }
 		 return true					
	}
var checkflag = "false";
function check(field) {
	if (checkflag == "false") {
		for (i = 0; i < field.length; i++) {
			field[i].checked = true;
			}
			checkflag = "true";
			} else {
		for (i = 0; i < field.length; i++) {
			field[i].checked = false;
			}
			checkflag = "false";
			}
}
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else 
countfield.value = maxlimit - field.value.length;
}
function PaymentOption() {
	var o = document.all.otherContainer;
    	if(document.all.payment_detail.options[document.all.payment_detail.selectedIndex].value == 'Other'){
		o.style.visibility = 'visible';
		document.all.otheroption.focus();
		}else{
		o.style.visibility = 'hidden';
		}
}
function HidePrice() {
	var p = document.all.priceContainer;
		p2 = document.all.priceContainer2;
    	if(document.all.ftype.options[document.all.ftype.selectedIndex].value == 'Share'){
		p.style.visibility = 'visible';
		p2.style.visibility = 'visible';
		document.all.price_range.focus();
		}else{
		p.style.visibility = 'hidden';
		p2.style.visibility = 'hidden';
		}
}
<!-- Begin
function BookMark()
{
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
	var url="http://www.go-estates.com";
	var title="Real Estate Portal";
	document.write('<A HREF="javascript:window.ext');
	document.write('ernal.AddFavorite(url,title);" ');
	document.write('onMouseOver=" window.status=');
	document.write("'Add our site to your favorites!'; return true ");
	document.write('"onMouseOut=" window.status=');
	document.write("' '; return true ");
	document.write('">Add our site to your favorites!</a>');
	}
	else {
	var msg = "Don't forget to bookmark us!";
	if(navigator.appName == "Netscape") msg += " (CTRL-D)";
	document.write(msg);
	}
}
// End -->
function LocationVisibility(Show,Hide,thediv,thearr){
what = document.getElementById(thediv).style.display == 'none' ? 'block' : 'none' ;
document.getElementById(thediv).style.display=what;
if (what == 'none'){
	document.getElementById('AdsLink').innerHTML = Show;
	document.getElementById(thearr).src = 'http://www.go-estates.com/images/img-arrowB.jpg';
}
else{
document.getElementById('AdsLink').innerHTML = Hide;
document.getElementById(thearr).src = 'http://www.go-estates.com/images/img-errowdown.jpg';
}
return false;
}
function LocationVisibility2(thediv){
what = document.getElementById(thediv).style.display == 'none' ? 'block' : 'none' ;
document.getElementById(thediv).style.display=what;
return false;
}
function ShowHide(Show,Hide,thediv,thearr, Anchor){
	what = document.getElementById(thediv).style.display == 'none' ? 'block' : 'none' ;
	document.getElementById(thediv).style.display=what;
	if (what == 'none'){
		document.getElementById(Anchor).innerHTML = Show;
		document.getElementById(thearr).src = 'http://www.go-estates.com/images/img-arrowB.jpg';
	}
	else{
		document.getElementById(Anchor).innerHTML = Hide;
		document.getElementById(thearr).src = 'http://www.go-estates.com/images/img-errowdown.jpg';
	}
	return false;
}
function bookmarksite(url, title){
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}
function visitCompanies(){
var url = document.all.companies.options[document.all.companies.selectedIndex].value;
window.open(url,"PropertyWindow","menubar=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=yes,status=yes");
}
function Popupwin(filename,winname,w,h) 
{ 
     var winl = (screen.width - w) / 2;
     var wint = (screen.height - h) / 2;
     winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=1,resizable=0'
   window.open(filename, winname, winprops)
} 
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Created by: Jim Stiles: http://jdstiles.com/ -->
<!-- Begin
function mailpage()
{
  mail_str = "mailto:?subject=" + document.title + " - View Property";
  mail_str += "&body=" + document.title + ". Check out the property in the following URL ";
  mail_str += location.href; 
  location.href = mail_str;
}
// End -->
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
// End -->
function isCountryCode(str)
{
	var validchars = "+0123456789";
	var strChars;
	if(str.length == '0') return false;
	if(str.substring(0,1) != '+') return false;
	var str1 = str.substring(1,4);
	for(i=0;i<str.length;i++)
	{
		strChars = str1.charAt(i);
		if(validchars.indexOf(strChars) == -1) 
			return false;
	}
	return true;
}
function isNumeric(str)
{
	var validchars = "0123456789";
	var strChars;
	if(str.length == '0') return false;
	for(i=0;i<str.length;i++){
		strChars = str.charAt(i);
		if(validchars.indexOf(strChars) == -1) return false;
	}
	return true;
}
function TestFileType(fileName, fileTypes ) 
{
	if (!fileName) return false;
	dots = fileName.split(".")
	//get the part AFTER the LAST period.
	fileType = "." + dots[dots.length-1];
	fileType = fileType.toLowerCase();
	if(fileTypes.join(".").indexOf(fileType) == -1)
	{
		alert("Please only upload files that end in types: \n\n" + (fileTypes.join(" .")) + "\n\nPlease select a new file and try again.");
		return false;
	}
	return true;
}
function submitform(myform)
{
  document.myform.submit();
}
// Clock Starts
function startTime()
{
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var mydate=new Date();
var year=mydate.getYear();
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
if (year < 1000)
	year+=1900;
var day=mydate.getDay();
var month=mydate.getMonth();
var daym=mydate.getDate();
var hours=mydate.getHours()
daym=checkTime(daym);
var dn="AM"
if (hours>=12)
{
	dn="PM";
}
if (hours>12)
{
	hours=hours-12;
}
m=checkTime(m);
s=checkTime(s);
//comment on nov 9 date removed//document.getElementById('txt').innerHTML=dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" | " + hours+":"+m+":"+s+ " "+dn
t=setTimeout('startTime()',500)
}
function checkTime(i)
{
if (i<10) 
  {i="0" + i}
  return i
}
//home script
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&(parent.frames.length)) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&(d.all)) x=d.all[n]; for (i=0;!(x) && (i<d.forms.length);i++) x=d.forms[i][n];
  for(i=0;!(x)&&(d.layers)&& (i<d.layers.length);i++) x=MM_findObj(n,d.layers[i].document);
  if(!(x) && (d.getElementById)) x=d.getElementById(n); return x;
}
function P7_Snap() { //v2.65 by PVII
 var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
 if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
 if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
 a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
 da="document.all['"+args[k]+"']";if(document.getElementById){
 d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
 d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
 }else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
 p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
 }else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
 if(tw==0||((navigator.appVersion.indexOf("MSIE 4")>-1) && (navigator.appVersion.indexOf("Mac")>-1))){
  ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
  w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
  x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
 }else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
  dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
  break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
 if((navigator.appVersion.indexOf("MSIE 5")>-1) && (navigator.appVersion.indexOf("Mac")>-1)){
  xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
 e.left=xx+pa;e.top=yy+pa;}}}
}
//quick search
function CheckValues()
{
	var Err="";
	var boolCheckLocation=false;
	if(((document.QSearch.From.value != "") && (document.QSearch.To.value != "")) && (document.QSearch.From.value >= document.QSearch.To.value))
	{
		alert("Price from must be greater than price to");
		return false;
	}
	else if(document.QSearch.keyword.value=="Keyword / ID")
	{
		document.QSearch.keyword.value="";
		boolCheckLocation=true;
	}
	if(document.QSearch.location.value == "" && boolCheckLocation)
	{
		alert("Please Select Some Location");
		return false;
	}
	return true;
}
function CheckValues2(){
	var Err="";
	var boolCheckLocation=false;
	if(((document.QSearch.From.value != "") && (document.QSearch.To.value != "")) && ((document.QSearch.From.value/1) >= (document.QSearch.To.value/1)))	{
		alert("Price to must be greater than price from");
		return false;
	}
	else if(document.QSearch.keyword.value=="Keyword / ID")	{
		document.QSearch.keyword.value="";
		boolCheckLocation=true;
	}
	if(document.QSearch.location.value == "" && boolCheckLocation)	{
		alert("Please Select Some Location");
		return false;
	}
	return true;
}
//ijara
function Update(){
	var s = new String();
	s = CurrencyFormatted(document.Finance.Amount.value);
	s = CommaFormatted(s);
	document.Finance.Amount.value = s;
} 
function AmlakCompany(url,win){
	if(url != ""){
		//var url = document.all.AMC.options[document.all.AMC.selectedIndex].value;
		window.open(url, win, '');
	}
}
// home expand banner script
function expand_table(obj)
{
if(document.getElementById(obj +"1").value == "+")
{
document.getElementById(obj).style.display = '';
document.getElementById(obj +"1").value = "-"
}
else
{
document.getElementById(obj).style.display = 'none';
document.getElementById(obj +"1").value = "+"
}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
