  function substituteBlankSpace(queryString) {
        queryString = queryString.replace(/\ /g,"%20");
        return queryString;
    }   

    function popUp(URL, width, height) {
        day = new Date();
        id = day.getTime();
        eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+width+',height='+height+',left=100,top=100');");
    }
    function closePopup() {
        window.close();
    }
    function isBlank(formName, fieldName) {
        var fld  = "";
        eval("fld = document."+formName+ "." +fieldName+".value");
        if(fld == "") {
            var alrt = "Please Enter "+fieldName;
	    alert(alrt);
	    eval("document."+formName+"."+fieldName+".focus()");
	    return false;
	} else {
	    return true;
	}
    }
    function isFieldOK(formName, fieldName,alertMsg) {
        var fld  = "";
        eval("fld = document."+formName+ "." +fieldName+".value");
        if(fld == "") {
	    alert(alertMsg);
	    eval("document."+formName+"."+fieldName+".focus()");
	    return false;
	} else {
	    return true;
	}
    }
    function checkIsBlank(formName, fieldName) {
        var fld  = "";
        eval("fld = document."+formName+ "." +fieldName+".value");
        if(fld == "") {
	    return false;
	} else {
	    return true;
	}
    }
function isNumber(formName, fieldName) {
    var t1 = "";
    eval("t1 = document."+formName+ "." +fieldName+".value");
    if ((t1 != "") && (parseFloat(t1) > 0) && !(isNaN(t1))) {
	return true;
    } else {
	alert("Please enter " + fieldName + " as integer number.");
	eval("document."+ formName +"."+fieldName+".focus()");
	return false;
    }
 }
    function isEmailOk(formName, fldName) {
	var email = "";
	eval("email = document."+formName+ "." + fldName + ".value");
	if (email == "") {
		alert ('Please enter E-mail address.');
		eval("document."+formName+ "." + fldName + ".focus()");
		eval("document."+formName+ "." + fldName + ".select()");
		return false;
	}
	if((email.indexOf("@")==-1) ||(email.indexOf(".")==-1)) {
		alert ('Enter a valid E-mail address!');
		eval("document."+formName+ "." + fldName + ".focus()");
		eval("document."+formName+ "." + fldName + ".select()");
		return false;
	}
	if (email.length < 8) {
		alert("Check E-mail Address!");
		eval("document."+formName+ "." + fldName + ".focus()");
		eval("document."+formName+ "." + fldName + ".select()");
		return false;
        }
	if ((email.indexOf(" ") > 1)) {
		alert("Check E-mail Address!");
		eval("document."+formName+ "." + fldName + ".focus()");
		eval("document."+formName+ "." + fldName + ".select()");
		return false;
        }
	return true;
    } 
    function isEmail(formName, fldName) {
	var email = "";
	eval("email = document."+formName+ "." + fldName + ".value");
	if (email == "") {
		alert ('Please enter E-mail address.');
		return false;
	}
	if((email.indexOf("@")==-1) ||(email.indexOf(".")==-1)) {
		alert ('Enter a valid E-mail address!');
		return false;
	}
	if (email.length < 8) {
		alert("Check E-mail Address!");
		return false;
        }
	if ((email.indexOf(" ") > 1)) {
		alert("Check E-mail Address!");
		return false;
        }
	return true;
    } 
    
	function isPasswordOk(formName, fieldName1, fieldName2) {
	    eval("str = document."+formName+ "." +fieldName1+".value");
	    eval("str1 = document."+formName+ "." +fieldName2+".value");

	    str = trim(str);
	    str1 = trim(str1);
	    if (str == "") {
		alert("Enter Your Password.");
		eval("document."+formName+"."+fieldName1+".value=str");
		eval("document."+formName+"."+fieldName1+".select()");
		eval("document."+formName+"."+fieldName1+".focus()");
		return false;
	    }
	    if(str.length <6) 	{
		alert("Your Password Should be at least 6 Characters.");
		eval("document."+formName+"."+fieldName1+".select()");
		eval("document."+formName+"."+fieldName1+".focus()");
		return false;		
	    }
	    if (str1 == "") {
		alert("Please Confirm Your Password.");
		eval("document."+formName+"."+fieldName1+".value=str1");
		eval("document."+formName+"."+fieldName2+".select()");
		eval("document."+formName+"."+fieldName2+".focus()");
		return false;
	    }
	    if (str == str1) { 
	    } else {
		alert("Confirm Your Password Again.");    	 
		eval("document."+formName+"."+fieldName2+".value=\"\"");
		eval("document."+formName+"."+fieldName2+".select()");
		eval("document."+formName+"."+fieldName2+".focus()");
		return false;
	    }
	    return true;
	}   

    function isPhoneNumber(formName,phoneNumber,ph1,ph2,ph3) {
	str1 = eval("document."+ formName +"."+ph1+".value");
	str2 = eval("document."+ formName +"."+ph2+".value");
	str3 = eval("document."+ formName +"."+ph3+".value");
	
	if (str1 == "") {
	    alert("Please enter area code in phone number.");
	    eval("document."+ formName +"."+ph1+".focus()");
	    eval("document."+ formName +"."+ph1+".select()");
	    return false;
	}
	if (str2 == "") {
	    alert("Please check the phone number.");
	    eval("document."+ formName +"."+ph2+".focus()");
	    eval("document."+ formName +"."+ph2+".select()");
	    return false;
	}
	if (str3 == "") {
	    alert("Please check the phone number.");
	    eval("document."+ formName +"."+ph3+".focus()");
	    eval("document."+ formName +"."+ph3+".select()");
	    return false;
	}
	
	var str = str1 + str2 + str3;
	for (var i = 0; i < str.length; i++) {
	    var ch = str.substring(i, i + 1);
	    if (ch < "0" || "9" < ch) {
		alert('Phone number should be numeric.');
		eval("document."+ formName +"."+ph3+".focus()");
	    	eval("document."+ formName +"."+ph3+".select()");
		return false;
	    }
	}
	if (str.length != 10) {
	    alert("The phone number should have 10 digits.");
	    eval("document."+ formName +"."+ph3+".focus()");
	    eval("document."+ formName +"."+ph3+".select()");
	    return false;
	}
	eval("document."+ formName +"."+phoneNumber+".value="+str);
//    alert("document."+ formName +"."+phoneNumber+".value="+str);
	return true;
    }
    
   function isZip(formName, fieldName) {
        var t1 = "";
        eval("t1 = document."+formName+ "." +fieldName+".value");
        t2 = parseInt(t1.length);
        if ((parseInt(t1) > 0) && (t2 == 5 )) {
	    return true;
	} else {
	    alert("Please check " + fieldName + " code.");
	    eval("document."+ formName +"."+fieldName+".focus()");
	    eval("document."+ formName +"."+fieldName+".select()");
	    return false;
	}
    }  
    
    function checkDateAndFill(formName, myDate, myMonth, myYear, targetFld) {
        if (isDateOk(formName,myDate,myMonth,myYear)) {
	    var d=0;
	    var m=0;
	    var y=0;
	    d = eval("document." + formName + "." + myDate  + ".value");
	    m = eval("document." + formName + "." + myMonth + ".value");
	    y = eval("document." + formName + "." + myYear  + ".value");
	//    eval("document."+formName+"."+targetFld+".value='"+m+"/"+d+"/"+y+"'");
	    eval("document."+formName+"."+targetFld+".value='"+y+"/"+m+"/"+d+"'");
            
            var enteredDt = new Date();
            enteredDt.setYear(parseInt(y));
            enteredDt.setMonth(parseInt(m)-1);
            enteredDt.setDate(parseInt(d));
    
            var fromDt = new Date();
            fromDt.setYear(1900);
            fromDt.setMonth(0);
            fromDt.setDate(1);
            
            var toDt = new Date();
            toDt.setYear(2079);
            toDt.setMonth(5);
            toDt.setDate(6);

            if ((enteredDt >= fromDt) && (enteredDt <= toDt)) {
                return true;
            } else {
                alert("Please Enter Correct Date");
//		eval("document." + formName + "." + myYear + ".selectedIndex = "+m);
		eval("document." + formName + "." + myYear + ".focus()");
		eval("document." + formName + "." + myYear + ".select()");
                return false;
            }

        } else {
            return false;
	}        
    }
function isDateOk(formName,myDate,myMonth,myYear) {
    var dd=0;
    var mm=0;
    var yy=0;
    var lp=0;
    dd = eval("document." + formName + "." + myDate  + ".value");
    mm = eval("document." + formName + "." + myMonth + ".value");
    yy = eval("document." + formName + "." + myYear  + ".value");
    if (dd==0 || mm==0 || yy==0) {
        return false;
    }
    if (isNaN(yy)) {
	alert("Please enter " + myYear + " as integer number.");
	eval("document."+ formName +"."+myYear+".select()");
        return false;
    }
    if (yy.length != 4) {
	    alert("Year should be in YYYY format.");
	    eval("document."+ formName +"."+myYear+".select()");
	    return false;
    }
    lp = yy % 4;
    if ( lp==0 && mm==2) {
	if (dd > 29) {
	    alert("Invalid Date. Please check.");
            eval("document." + formName + "." + myDate + ".options[0].selected = true");
	    eval("document." + formName + "." + myDate + ".focus()");
  	    return false;
	}
    } else {
        if (mm==2) {
  	    if (dd>28) {
	 	alert("Invalid Date!!");
		eval("document." + formName + "." + myDate + ".options[0].selected = true");
		eval("document." + formName + "." + myDate + ".focus()");
		return false;
	    }
	} else if ((mm==4) || (mm==6) || (mm==9) || (mm==11)) {
	    if (dd>30) {
		alert("Invalid Date!!");
		eval("document." + formName + "." + myDate + ".options[0].selected = true");
		eval("document." + formName + "." + myDate + ".focus()");
		return false;
	    }
	}
    }
    
    return true;
}
function isNumber(formName, fieldName) {
    var t1 = "";
    eval("t1 = document."+formName+ "." +fieldName+".value");
    if ((t1 != "") && (parseFloat(t1) > 0) && !(isNaN(t1))) {
	return true;
    } else {
	alert("Please enter " + fieldName + " as integer number.");
	eval("document."+ formName +"."+fieldName+".focus()");
	eval("document."+ formName +"."+fieldName+".select()");
	return false;
    }
 }
    
    function goBack() {
       history.back();
    }
/*
    function getPropertyType() {
        var propertyType = document.searchForm.propertyType.value;
        alert(propertyType);
    }
*/

     function clickHereToPrint() {
         var dispSetting="toolbar=yes,location=no,directories=yes,menubar=yes,";
             dispSetting+="scrollbars=yes,width=900, height=720, left=100, top=25";
         var contentValue = document.getElementById("printContent").innerHTML;
         var docprint=window.open("","",dispSetting);
         docprint.document.open();
         docprint.document.write('<html><head><title>Pacesetter.com - Details Page</title></head><center>');
         docprint.document.write('<link href="http://awata10:8080/pacesetter/styles/pacesetter.css" rel="stylesheet" type="text/css">');
         docprint.document.write('<div class="divPrintContent">')
         docprint.document.write(contentValue);
         docprint.document.write('</div>')
         docprint.document.write('</center></body></html>');
         docprint.document.close();
         docprint.focus();
     }

 function isPasswordOk(formName, fieldName1, fieldName2) {
     eval("str = document."+formName+ "." +fieldName1+".value");
     eval("str1 = document."+formName+ "." +fieldName2+".value");
 
     str = trim(str);
     str1 = trim(str1);
     if (str == "") {
         alert("Enter Your Password.");
         eval("document."+formName+"."+fieldName1+".value=str");
         eval("document."+formName+"."+fieldName1+".select()");
         eval("document."+formName+"."+fieldName1+".focus()");
         return false;
     }
     if(str.length <6) 	{
         alert("Your Password Should be at least 6 Characters.");
         eval("document."+formName+"."+fieldName1+".select()");
         eval("document."+formName+"."+fieldName1+".focus()");
         return false;		
     }
     if (str1 == "") {
         alert("Please Confirm Your Password.");
         eval("document."+formName+"."+fieldName1+".value=str1");
         eval("document."+formName+"."+fieldName2+".select()");
         eval("document."+formName+"."+fieldName2+".focus()");
         return false;
     }
     if (str == str1) { 
     } else {
         alert("Confirm Your Password Again.");    	 
         eval("document."+formName+"."+fieldName2+".value=\"\"");
         eval("document."+formName+"."+fieldName2+".select()");
         eval("document."+formName+"."+fieldName2+".focus()");
         return false;
     }
     return true;
 }   
function isEmailConfirmOk(formName, fieldName1, fieldName2) {
    var email = "";
    var email1 = "";
    eval("email = document."+formName+ "." + fieldName1 + ".value");
    eval("email1 = document."+formName+ "." + fieldName2 + ".value");
    try {
        email = trim(email);
    } catch(e) {}
    try {
        email1 = trim(email1);
    } catch(e) {}
    if (email == "") {
        alert ('Please enter E-mail address.');
        eval("document."+formName+ "." + fieldName1 + ".focus()");
	eval("document."+formName+ "." + fieldName1 + ".select()");
	return false;
    }
    if((email.indexOf("@")==-1) ||(email.indexOf(".")==-1)) {
	alert ('Enter a valid E-mail address!');
	eval("document."+formName+ "." + fieldName1 + ".focus()");
	eval("document."+formName+ "." + fieldName1 + ".select()");
	return false;
    }
    if (email.length < 8 || email.indexOf(" ") > 0) {
        alert("Check E-mail Address!");
	eval("document."+formName+ "." + fieldName1 + ".focus()");
	eval("document."+formName+ "." + fieldName1 + ".select()");
	return false;
    }
    if (email1 == "") {
        alert("Please Confirm Your Email Address.");
        eval("document."+formName+"."+fieldName1+".value=email");
        eval("document."+formName+"."+fieldName2+".select()");
        eval("document."+formName+"."+fieldName2+".focus()");
        return false;
    }
    if (email == email1) {
    } else {
        alert("Confirm Your Email Address Again.");
        eval("document."+formName+"."+fieldName2+".value=\"\"");
        eval("document."+formName+"."+fieldName2+".select()");
        eval("document."+formName+"."+fieldName2+".focus()");
        return false;
    }
    return true;
}
function showMyMenu(divName) {
    try {
        document.getElementById(divName).style.display = "block";
    } catch(e) {}
    try {
        document.getElementById("virtualMap").style.zIndex = "1";
    } catch(e) {}
    try {
        document.getElementById(divName).style.zIndex = "10000";
    } catch(e) {}
}
function hideMyMenu(divName) {
    try {
        document.getElementById(divName).style.display = "none";
    } catch(e) {}
}


function isRadioCheck(formName, fieldName) {
    var fld  = "";
    var fldCnt = 0;
    eval("var obj = document."+formName+ "." +fieldName);
    for(var i=0; i<obj.length; i++) {
        eval("var fld = document."+formName+"."+fieldName+"["+i+"]" +".checked");
        if(fld) {
            fldCnt++;
        }
    }
    if (fldCnt > 0) {
        return true;
    } else {
        alert("Please Choose "+fieldName);
        return false;
    }
    
}
function isCheck(formName, fieldName) {
    var fld  = "";
    eval("fld = document."+formName+ "." +fieldName+".checked");
    if (fld == false) { 
       var alrt = "Please agree to the buyer's agent agreement";
       alert(alrt);
       return false;
    } else {
        return true;
    }  
}

function isBlankAlert(formName, fieldName,alertMsg) {
    var fld  = "";
    eval("fld = document."+formName+ "." +fieldName+".value");
    var clsName = document.getElementById(fieldName).className;
    try {
        if(clsName =="clsHighlights") {
            document.getElementById(fieldName).className = "";
        }
    } catch(e) {}
    fld = trim(fld);
    if (fld == "") {
        alert(alertMsg);
        try {
            eval("document."+formName+"."+fieldName+".focus()");
        } catch(e) {}
        try {
            document.getElementById(fieldName).className = "clsHighlights";
        } catch(e) {}
        return false;
    } else {
        return true;
    }
}
function isCheckAlert(formName, fieldName, alertMsg) {
    var fld  = "";
    eval("fld = document."+formName+ "." +fieldName+".checked");
    if (fld == false) { 
       alert(alertMsg);
       return false;
    } else {
        return true;
    }  
}

function isRadioCheckAlert(formName, fieldName,alertMsg) {
    var fld  = "";
    var fldCnt = 0;
    eval("var obj = document."+formName+ "." +fieldName);
    for(var i=0; i<obj.length; i++) {
        eval("var fld = document."+formName+"."+fieldName+"["+i+"]" +".checked");
        if(fld) {
            fldCnt++;
        }
    }
    if (fldCnt > 0) {
        return true;
    } else {
        alert(alertMsg);
        return false;
    }
    
}

   function isZipAlert(formName, fieldName,alertMsg) {
        var t1 = "";
        eval("t1 = document."+formName+ "." +fieldName+".value");
        t2 = parseInt(t1.length);
        if ((parseInt(t1) > 0) && (t2 == 5 )) {
	    return true;
	} else {
	    alert(alertMsg);
	    eval("document."+ formName +"."+fieldName+".focus()");
	    eval("document."+ formName +"."+fieldName+".select()");
	    return false;
	}
    }  


function displayMessage(msg, wdth) {
    var opStr = "<div class=\"alertMsgDiv\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">"+
                 "<tr>"+
                 "<td style=\"padding:0px;\"><img src=\"images/curve_left.gif\")></td>"+
                 "<td style=\"padding:0px;\" class=\"alertMsg\" width=\""+wdth +"\">"+ msg + "</td>"+
                 "<td style=\"padding:0px;\"><img src=\"images/curve_right.gif\")></td>"+
                 "</tr>"+
                 "</table></div>";
    return opStr;                
}

