﻿function GetXmlHttpObject(){
	var xmlHttp=null;
	try{xmlHttp=new XMLHttpRequest();}
	catch (e){
 		try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
 		catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
	return xmlHttp;}
function validateemail(email){
    r_email=/^[a-zA-Z0-9\_\-\']+(\.[a-zA-Z0-9\_\-\']+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,3})$/g;
    div = document.getElementById('divemail')
    if (email.match(r_email)){
        div.innerHTML="<img src=http://propertypanga.com/Images/good.gif >"
        //div.className = "valid"
        return true}
    else{
        div.innerHTML="<img src=http://propertypanga.com/Images/bad.gif >"
        //div.className = "invalid" 
        return false}}
function disablechar(){
    var box = document.getElementById('ctl00_ContentPlaceHolder1_txtPhone')
    re=/^[a-zA-Z\_]*$/;
	if(!re.exec(box.value)){
	    alert("Invalid Entry:\nOnly Alphabetic characters or Underscore allowed!");
	    box.focus();
        return;}//end name if
}
function NumHandler(e){
    keyCode = e.keyCode | e.charCode
    if (keyCode<48 || keyCode>57) return false
    else return true}
function displayCharLeft(txtId,divId,max){
    tb=document.getElementById('ctl00_ContentPlaceHolder1_'+txtId)
    if (tb.value.length>max) { 
        tb.value = document.tb.value.substring(0,max)}
    document.getElementById(divId).className = "Error"
    document.getElementById(divId).innerHTML = "Characters Left: " + (max - tb.value.length).toString()}