var currentshform = null;

function checkEnter(e){ 

	var characterCode ;
	if(e && e.which){ 
		e = e;
		characterCode = e.which;
	}else{
		e = event;
		characterCode = e.keyCode; 
	}

	if(characterCode == 13){ 
		return true;
	}
	return false;
}





function CheckLogin(TheForm){

	var rv = true;
	var Cellno = TheForm.cell.value;
	var Upin = TheForm.pin.value;

	if ((Cellno == null) || (Cellno == '')){
		alert("Please enter your cell number");
		rv = false;
	}

	if (isNaN(Cellno)){
		alert("Your cell number should contain digits only - no spaces or other characters.");
		rv = false;
	}

	if ((Upin == null) || (Upin == '')){
		alert("Please enter your PIN");
		rv = false;
	}

	if (isNaN(Upin)){
		alert("Your PIN should contain digits only - no spaces or other characters.");
		rv = false;
	}
	return rv;
}


function rungping(pg){

	var SearchPageToGet = "/ping_g.jsp?ADD=" + pg + "&TMST=" + (new Date()).getTime();

	if( document.layers && document.layers['pingg'].load ) {
		document.layers['pingg'].load(SearchPageToGet,0);
	} else if( window.frames && window.frames.length) {
		window.frames['pingg_frame'].window.location.replace(SearchPageToGet);
	} else {
	}

}

function LocationPost (strURL, divid, formid, numparms) {
	
	xmlhttpPost(strURL, divid, formid, numparms);	
	setshform(document.forms[formid]);
}



function instruct(divnm){
	GO(divnm).style.display='block';

}





function setshform(thecurrform){
	currentshform = thecurrform;
}

function setshformfromID(thecurrformname){
	currentshform = document.forms[thecurrformname];
}


function xmlhttpGET(strURL, divid) {
    var xmlHttpReq = false;
    var self = this;
           
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('GET', strURL, true);
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            var respstring = self.xmlHttpReq.responseText;
            GO(divid).innerHTML = respstring;
        }
    }
    self.xmlHttpReq.send(null);
}

function xmlhttpPost(strURL, divid, formid) {
	xmlhttpPost(strURL, divid, formid, 2);
}


function xmlhttpPost(strURL, divid, formid, numparms) {
    var xmlHttpReq = false;
    var self = this;
    
    updatepage('<image border=0px style="padding:10px;" src="/images/loading.gif">', divid);
    
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText, divid);
        }
    }
    self.xmlHttpReq.send(getquerystring(formid, numparms));
}



function getquerystring(formid, numparms) {
	var form = document.forms[formid];
	var propstat = form.VerifyListingStatus.value;
	var thepropid = form.propid.value;
	var prop3 = "";
	if (numparms > 2){
		prop3 = form.var3.value;
	}

    	qstr = 'x=' + escape(thepropid) + '&w=' + escape(propstat);  // NOTE: no '?' before querystring
    	
    	if (numparms > 2){
	    	qstr = qstr + '&y=' + escape(prop3);
	}
    
    return qstr;
}

function updatepage(str, divid){

    GO(divid).innerHTML = str;
}


function GO(obid){
  if (document.getElementById){
	return document.getElementById(obid);
  }else if (document.all){
	return document.all[obid];
  }else if (document.layers){
   	return document.layers[obid];
  }
}



/*
function ShowHousePost(strURL, divid, formid){

    var xmlHttpReq = false;
    var self = this;
    
    updatepage('<image border=0px style="padding:10px;" src="/images/loading.gif">', divid);
    
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText, divid);
        }
    }
    self.xmlHttpReq.send(getshowhousequerystring(formid));
}



function getshowhousequerystring(formid) {

	var form = document.forms[formid];
	
	var propstat = form.VerifyListingStatus.value; 		// suburb
	var thepropid = form.propid.value; 			// propid 
	var prop3 = form.var3.value; 				// road
	
	var ShowDay = form.ShowDay.value; 			
	var ShowTime = form.ShowTime.value;	
	var xcord = form.xcord.value;
	var ycord = form.ycord.value;

    	qstr = 'x=' + escape(thepropid) + '&w=' + escape(propstat) + '&y=' + escape(prop3) + '&ShowDay=' + ShowDay + '&ShowTime=' + ShowTime;
    	qstr = qstr + '&xcord=' + xcord + '&ycord=' + ycord;
    	
    	return qstr;
}

*/



function Textlimiter(TheField, limitto){
	if (TheField.value.length > limitto) {
		TheField.value = TheField.value.substring(0, limitto);
		alert("You cannot enter more than " + limitto + " characters in this field");
	}
}


function NumericOnly(TheField){
	if (isNaN(TheField.value)){
		alert("This field should contain numeric values only - no spaces, commas or other characters.\r\n e.g. \'3\' or \'4.5\' are ok but \'4,5\' is not.");
		TheField.value = 0;
	}
}

function DigitsOnly(TheField){

	if ((isNaN(TheField.value)) || (TheField.value.indexOf(".") >=0) || (TheField.value.indexOf(" ") >=0)){
		alert("This field should contain digits only.\r\n e.g. \'280\' or \'450000\' are ok but \'4,500\' or \'1.5\' are not.");
		TheField.value = "";
	}
}

function CheckAlhphanumeric(TheField){

	var RegxpChkStr = /^[A-Za-z0-9]+$/;

	if((TheField.value != null) && (TheField.value != '') &&(!RegxpChkStr.test(TheField.value))){
		alert("This field should contain digits and letters only.\r\n e.g. \'AD280\' or \'450000\' are ok but \'445,555\' or \'1/500/40\' are not.");
		TheField.value = "";
		return false;
	} 

}

function PhoneDigitsOnly(TheField){

	if ((isNaN(TheField.value)) || (TheField.value.indexOf(".") >=0) || (TheField.value.indexOf(" ") >=0)){
		alert("Phone numbers should contain digits only.\r\n e.g. \'0821234567\' or \'0112345678\' ");
		TheField.value = "";
	}
}


function setsuburbandmap(SuburbSelectList){

	if ((SuburbSelectList != null) && (SuburbSelectList.value != null) && (!isNaN(SuburbSelectList.value))){
		var seltxt = SuburbSelectList.options[SuburbSelectList.selectedIndex].text;
		var subid = SuburbSelectList.value;
		SuburbSelectList.form.VerifyListingStatus.value=seltxt.substring(0, seltxt.indexOf('--'));
		document.forms.listingform.subi.value = subid;
		document.forms.listingform.subn.value = seltxt;
		
		
		
		if (GO("address") != null){
			var GoogleAddress = seltxt.substring(0, seltxt.indexOf('--')) + ", South Africa";
			GO("address").value= GoogleAddress;
			showAddress(GoogleAddress);
		}
		
	}

	
}


function checkaddpropform(theform){

	var es = "";
	var subid = theform.subi.value;
	//var propid = theform.prop_id.value;
	var heading = theform.short_desc.value;
	var desc = theform.long_desc.value;
	var theprice = theform.price.value;
	var proptype = theform.property_type.value;
	
	var propstatus = null;
	if (theform.status != null){propstatus = theform.status.value;}
	else if (theform.VerifyListingStatus != null){propstatus = theform.VerifyListingStatus.value;}
	else{propstatus = null;}
		
	var persname = theform.person_name.value;
	var phoneno = theform.phone.value;
	var persemail = theform.email.value;	
	
	if ((subid == null) || (subid == 0) || (subid == '')){es = es + " - Enter a suburb.\r\n";}
	
	if ((persname == null) || (persname == 0) || (persname == '')){es = es + " - Enter your name.\r\n";}
	if ((phoneno == null) || (phoneno == 0) || (phoneno == '')){es = es + " - Enter a contact telephone number.\r\n";}
	if ((persemail == null) || (persemail == 0) || (persemail == '')){es = es + " - Enter your email address.\r\n";}
	
	//if ((propid == null) || (propid == 0) || (propid == '')){es = es + " - Enter the listing's unique reference number.\r\n";}
	if (((heading == null) || (heading.length < 2)) && ((desc == null) || (desc.length < 2))
	){es = es + " - Enter the heading/short description or alternatively, the full description for the listing as a minimum.\r\n";}
	if ((theprice == null) || (theprice == 0) || (theprice == '')){es = es + " - Enter the price.\r\n";}
	if ((proptype == null) || (proptype == 0) || (proptype == '')){es = es + " - Enter the property type.\r\n";}
	if ((propstatus == null) || (propstatus == 0) || (propstatus == '')){es = es + " - Enter the property status.\r\n";}

	

	if (es.length > 0){
		es = "Please make the following corrections:\r\n" + es;
		alert(es);
		return false;
	}else{
		return true;
	}

}


function checkaddpremform(theform){


	var es = "";
	
	var publication = theform.pub.value;
	var advert =  theform.Ad_Size.value;
	var agentid = theform.agent_id.value;
	
	var propid = null;
	var propstatus = theform.status.value;;
	var subid = theform.subi.value;
	if (theform.prop_id != null){propid = theform.prop_id.value;}
	var heading = theform.short_desc.value;
	var theprice = theform.price.value;
	var thecords = theform.cords.value;
	var proptype = theform.property_type.value;

	if ((publication == null) ||  (publication == '')){es = es + " - Enter the publication.\r\n";}
	if ((advert == null) ||  (advert == '')){es = es + " - Enter the advert size.\r\n";}
	if ((agentid == null) || (agentid == 0) || (agentid == '')){es = es + " - Choose an estate agent.\r\n";}	
	if ((subid == null) || (subid == 0) || (subid == '')){es = es + " - Enter a suburb.\r\n";}
	if (theform.prop_id != null){
		if ((propid == null) || (propid == 0) || (propid == '')){es = es + " - Enter the unique reference number.\r\n";}
	}
	if ((heading == null) || (heading.length < 2) ){es = es + " - Enter the heading.\r\n";}
	if ((theprice == null) || (theprice == 0) || (theprice == '')){es = es + " - Enter the price.\r\n";}
	if ((proptype == null) || (proptype == 0) || (proptype == '')){es = es + " - Enter the property type.\r\n";}	
	if ((propstatus == null) || (propstatus == 0) || (propstatus == '')){es = es + " - Enter the property status.\r\n";}	
	

	
	
	
	



	if (es.length > 0){
		es = "Please make the following corrections:\r\n" + es;
		alert(es);
		return false;
	}else{
		return true;
	}

}


function setshowdate(){
  var dt = GO('datepicker').value;
  var hr = GO('hr').value;
  var mn = GO('mn').value;
  
  if ((dt != null) && (dt != '') && (hr != null) && (hr != '') && (mn != null) && (mn != '')){
  
  	GO('auc_date').value = dt + " " + hr + ":" + mn + ":00";
  }

}


function checkaddpipform(theform){

	var es = "";
	var propid = null;
	var subid = theform.subi.value;
	if (theform.prop_id != null){propid = theform.prop_id.value;}
	var heading = theform.short_desc.value;
	var theprice = theform.price.value;
	var thecords = theform.cords.value;
	var proptype = theform.property_type.value;
	var persemail = theform.email.value;
	var persphone = theform.phone.value;

	var propstatus = null;
	if (theform.PiPStatus != null){propstatus = theform.PiPStatus.value;
	}else if (theform.VerifyListingStatus != null){propstatus = theform.VerifyListingStatus.value;
	}else{propstatus = null;}
	
	if ((subid == null) || (subid == 0) || (subid == '')){es = es + " - Enter a suburb.\r\n";}
	if (theform.prop_id != null){
		if ((propid == null) || (propid == 0) || (propid == '')){es = es + " - Enter the unique reference number.\r\n";}
	}
	
	
	
	if ((heading == null) || (heading.length < 2) ){es = es + " - Enter the address.\r\n";}
	if ((theprice == null) || (theprice == 0) || (theprice == '')){es = es + " - Enter the price.\r\n";}
	if ((propstatus == null) || (propstatus == 0) || (propstatus == '')){es = es + " - Enter the property status.\r\n";}
	//if ((thecords == null) || (thecords == 0) || (thecords == '')){es = es + " - Enter the property's coordinates (click its location on the map).\r\n";}
	if ((proptype == null) || (proptype == 0) || (proptype == '')){es = es + " - Enter the property type.\r\n";}
	if ((persemail != null) && (persemail.length > 0) && ((persemail.length < 5) || (persemail.indexOf("@") < 0))){es = es + " - Please enter a valid email address.\r\n";}
	if ((persphone != null) && (persphone.length > 0) && (persphone.length != 10)){es = es + " - Enter a valid cell number - it must be 10 digits long with no spaces.\r\n";}
		
	if (((persemail != null) && (persemail != '')) && ((persphone == null) || (persphone == ''))){es = es + " - Enter the agent's cell number.\r\n";}
	if (((persemail == null) || (persemail == '')) && ((persphone != null) && (persphone != ''))){es = es + " - Enter the agent's email address.\r\n";}	

	if (es.length > 0){
		es = "Please make the following corrections:\r\n" + es;
		alert(es);
		return false;
	}else{
		return true;
	}

}



function NoPicFound(AnImage){

	AnImage.src = "/bin/na.gif";
	AnImage.width = 70;
	return true;
}


function CheckSize(theimage, picnm){

	return CheckSize(theimage, picnm, 150, 120);
}


function CheckSize(theimage, picnm, maxwidth, maxheight){

	if ((maxheight == null) || (maxheight == 0)) {maxheight = 120;}
	if ((maxwidth == null) || (maxwidth == 0)) {maxwidth = 150;}


	var imagesrc = theimage.src;
	var origimage = new Image;
	origimage.src = imagesrc;

	var imagewidth = origimage.width;
	var imageheight = origimage.height;

	if ((imagewidth > maxwidth)||(imageheight > maxheight)){


		var heightratio = imageheight/maxheight;
		var widthratio = imagewidth/maxwidth;
	
		if (heightratio > widthratio){
			theimage.height = imageheight/heightratio;
			theimage.width =  imagewidth/heightratio;
			theimage.name =  heightratio;

		}else{
			theimage.height = imageheight/widthratio;
			theimage.width =  imagewidth/widthratio;
			theimage.name =  widthratio;
		}

		var finalimagename = theimage.name + ":" + picnm;
		theimage.name = finalimagename;
	
		var divnm = "d" + picnm.substring(1,picnm.length);

		if (document.getElementById) { //Netscape 6 & IE 5

			if ((document.getElementById(divnm) != null) && (document.getElementById(divnm).className != null)){
				document.getElementById(divnm).className = 'govisible';
			}

		}else{ //ie4

			thediv = eval('document.all.' + divnm);
			if (thediv != null){
				thediv.className = 'govisible';
			}
		}
	}else{
		//resize to it's natural size
		theimage.height = imageheight;
		theimage.width =  imagewidth;
	}

	return true;

}


function setMainPic(theimage, mainpicnm){
	if ((theimage != null) && (mainpicnm != null)){
		mainpicnm.src = theimage.src;
	}
}


function ChangeSelPic(theurl, divnm){

	if ((theurl.value != null) && (theurl.value.length > 0) && (GO(divnm) != null)){
		var sURL = theurl.value;
		sURL = sURL.replace(/\\/g, '/');
		sURL = sURL.substring((sURL.indexOf(":/") + 2),(sURL.length));
		var PicInnerHtml = "<img src='file:///" + sURL + "' width='100px' >";
		GO(divnm).innerHTML = PicInnerHtml;
	}

}

function CellPhone(Fieldname){

	if ((isNaN(Fieldname.value)) || (Fieldname.value.indexOf(".") >=0) || (Fieldname.value.indexOf(" ") >=0)){
		alert("The cell number should contain digits only e.g. 0821234567");
		Fieldname.value = '';
	}
}

function checkcells(theform){
var RV = "";
if (!checkonecell(theform.p1.value)){RV = RV + theform.p1.value + " is not a valid cell number";}
if (!checkonecell(theform.p2.value)){RV = RV + theform.p2.value + " is not a valid cell number";}
if (!checkonecell(theform.p3.value)){RV = RV + theform.p3.value + " is not a valid cell number";}
if (!checkonecell(theform.p4.value)){RV = RV + theform.p4.value + " is not a valid cell number";}
if (!checkonecell(theform.p5.value)){RV = RV + theform.p5.value + " is not a valid cell number";}

	if (RV != ""){	alert(RV);	return false;
	}else{	return true;}

}

function checkonecell(cell2check){
var procok = true;
if ((cell2check != null) && (cell2check.length > 0)){
	if (cell2check.length == 10){
		if ((cell2check.indexOf("08") != 0) && (cell2check.indexOf("07") != 0)){
			procok = false;
		}
	
	}else{
		procok = false;
	}
}
return procok;
}




function togglement(elid){
  var elem, vis;
  elem = GO(elid); 
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

var lastlookedupagstr='';
function getag(agentryfld, divtoupdnm){

	// get agency
	if ((agentryfld != null) && (agentryfld.value != null) && (agentryfld.value != '') && (agentryfld.value.length > 2)){

		//check we haven't already checked this string last time
		if (agentryfld.value != lastlookedupagstr){
			GO(divtoupdnm).style.display = 'block';
			lastlookedupagstr = agentryfld.value;
			GO(divtoupdnm).innerHTML = 'Loading...';
			
			var ref = agentryfld.value;
			var repocordsrc = "/frlookup.jsp?";
			if (ref != null){ repocordsrc = repocordsrc + "&ref=" + ref;}		
			repocordsrc = repocordsrc + "&tmstmp" + new Date().getTime();
			xmlhttpGET(repocordsrc, divtoupdnm);
			
		}
		
	}
}


function getagentlistonname(agentryfld, divtoupdnm){

	// get agent
	
	if ((agentryfld != null) && (agentryfld.value != null) && (agentryfld.value != '') && (agentryfld.value.length > 2)){

		//check we haven't already checked this string last time
		if (agentryfld.value != lastlookedupagstr){
			GO(divtoupdnm).style.display = 'block';
			lastlookedupagstr = agentryfld.value;
			GO(divtoupdnm).innerHTML = 'Loading...';
			
			var ref = agentryfld.value;
			var repocordsrc = "/frlookup.jsp?";
			if (ref != null){ repocordsrc = repocordsrc + "&agnm=" + ref;}		
			repocordsrc = repocordsrc + "&tmstmp" + new Date().getTime();
			xmlhttpGET(repocordsrc, divtoupdnm);
			
		}
		
	}
}

function getsbrblistonname(agentryfld, divtoupdnm){

	// get agent
	
	if ((agentryfld != null) && (agentryfld.value != null) && (agentryfld.value != '') && (agentryfld.value.length > 2)){

		//check we haven't already checked this string last time
		if (agentryfld.value != lastlookedupagstr){
			GO(divtoupdnm).style.display = 'block';
			lastlookedupagstr = agentryfld.value;
			GO(divtoupdnm).innerHTML = 'Loading...';
			
			var ref = agentryfld.value;
			var repocordsrc = "/openlookup.jsp?";
			if (ref != null){ repocordsrc = repocordsrc + "&sub=" + ref;}		
			repocordsrc = repocordsrc + "&tmstmp" + new Date().getTime();
			xmlhttpGET(repocordsrc, divtoupdnm);
			
		}
		
	}
}



function changebg(objecttochg, newcolor){

	if ((objecttochg != null) && (newcolor != null)){
		objecttochg.style.background = newcolor;
	}


}


function setagent(agidvalue, agnmval, frid){

	if (GO('pickl4agn') != null){
		GO('pickl4agn').innerHTML = '';
		GO('pickl4agn').style.display = 'none';

	}

	if ((agidvalue != null) && (GO('agent_id') != null)){
		GO('agent_id').value = agidvalue;
	}
	if ((frid != null) && (GO('franid') != null)){
		GO('franid').value = frid;
	}	
	if ((agnmval != null) && (GO('agencypic') != null)){
		GO('agencypic').value = agnmval;
	}

}

function setsuburb(subidvalue, subnm){

	if (GO('picksubrb22') != null){
		GO('picksubrb22').innerHTML = '';
		GO('picksubrb22').style.display = 'none';
	}

	if ((subidvalue != null) && (GO('subi') != null)){
		GO('subi').value = subidvalue;
	}


	if ((subnm != null) && (GO('suburbpic') != null)){
		GO('suburbpic').value = subnm;
	}
	
	if ((subnm != null) && (GO('suburbpick') != null)){
		GO('suburbpick').value = subnm;
	}	

	if ((subnm != null) && (GO('subn') != null)){
		GO('subn').value = subnm;
	}
	
	if (GO("address") != null){
	
		GO('mapholder').style.display = 'block';
		var sSubname = subnm.substring(0, subnm.indexOf(','));
		var sProvince = subnm.substring((subnm.indexOf('(') + 1), subnm.indexOf(')'));
		var GoogleAddress = sSubname + ", " + sProvince + ", South Africa";
		GO("address").value= GoogleAddress;
		showPremAddress(GoogleAddress);
		
	}
	

}

function setfranch(valtoset, idtoset){

if (GO('pickl') != null){
	GO('pickl').innerHTML = '';
	GO('pickl').style.display = 'none';
	
}

if ((valtoset != null) && (GO('franlk') != null)){
	GO('franlk').value = valtoset;
}

if ((idtoset != null) && (GO('franid') != null)){
	GO('franid').value = idtoset;
	getbranch(idtoset, 'branchdiv');
}

if ((idtoset != null) && (GO('franchise_id') != null)){
	GO('franchise_id').value = idtoset;
}




}

function getbranch(frid, divtoupdnm){

	if ((frid != null) && (frid != '') ){

		GO(divtoupdnm).style.display = 'block';
		GO(divtoupdnm).innerHTML = 'Loading...';

		var ref = frid;
		var repocordsrc = "/frlookup.jsp?";
		if (ref != null){ repocordsrc = repocordsrc + "&id=" + ref;}		
		repocordsrc = repocordsrc + "&tmstmp" + new Date().getTime();
		xmlhttpGET(repocordsrc, divtoupdnm);

		
	}
}

function getagentlist(agid, divtoupdnm){

	if ((agid != null) && (agid != '') && (GO(divtoupdnm) != null)){

		GO(divtoupdnm).style.display = 'block';
		GO(divtoupdnm).innerHTML = 'Loading...';

		var ref = agid;
		var repocordsrc = "/frlookup.jsp?";
		if (ref != null){ repocordsrc = repocordsrc + "&agid=" + ref;}		
		repocordsrc = repocordsrc + "&tmstmp" + new Date().getTime();
		xmlhttpGET(repocordsrc, divtoupdnm);
	
		
	}
}

function getspics(TS){

	var propT = GO('pid');
	var divtoupdnm = 'EditPicsDiv';

	if ((propT != null) && (propT.value != null)){
	
		var propid = propT.value;
		
		if ((propid != null) && (propid != '') ){

			GO(divtoupdnm).style.display = 'block';
			GO(divtoupdnm).innerHTML = '<image border=0px style="padding:10px;" src="/images/loading.gif">';

			var repocordsrc = "/openlookup.jsp?";
			repocordsrc = repocordsrc + "&pid=" + propid;	
			if (TS != null){repocordsrc = repocordsrc + "&ts=" + escape(TS);}
			repocordsrc = repocordsrc + "&tmstmp" + new Date().getTime();
			xmlhttpGET(repocordsrc, divtoupdnm);


		}
	}	
}

function GetAdminPrems(status, bank, price, beds){
	GetAdminPrems(status, bank, price, beds, null, 0);
}



function GetPremLeadsDetails(formtouse, div2hit, processingpage, thedetleadid){

	var leadid = thedetleadid;
	GO(div2hit).style.display = 'block';
	GO(('zbut' + leadid)).style.display = 'block';
	DoFormPost(formtouse, div2hit, processingpage, 'lid=' + leadid);
	GO('but' + leadid).style.display = 'none';

}



function DoFormPost(TheFormObj, divid, TheHandlerJSP){

	DoFormPost(TheFormObj, divid, TheHandlerJSP, '');

}



function DoFormPost(TheFormObj, divid, TheHandlerJSP, AddString){

if (TheFormObj != null){

	var qs = "";
	for( i = 0; i< TheFormObj.length; i ++){
		if ((TheFormObj[i].name != null) && (TheFormObj[i].value != null)){
			qs = qs + "&" + escape(TheFormObj[i].name) + "=" + escape(TheFormObj[i].value);
		}
	}
	if (AddString){qs = qs + "&" + AddString;}

    var xmlHttpReq = false;
    var self = this;
    GO(divid).innerHTML = '<image border=0px style="padding:10px;" src="/images/loading.gif">';

    // Mozilla/Safari
    if (window.XMLHttpRequest) {
	self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
	self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', TheHandlerJSP, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
	if (self.xmlHttpReq.readyState == 4) {
	    updatepage(self.xmlHttpReq.responseText, divid);
	}
    }
    self.xmlHttpReq.send(qs);


	

}

}


function osw(theUrl){
	ow(theUrl, 500, 600);
}

function ow(theUrl, WinHeight, WinWidth){
var w_width = 400;
var w_height = 400;
var winnm = "_" + new Date().getTime();

if (WinHeight){w_height = WinHeight;}
if (WinWidth){w_width = WinWidth;}

var openstring= 'width=' + WinWidth + ',height=' + WinHeight + ',location=yes,directories=yes,status=yes,scrollbars=yes';

window.open(theUrl ,winnm,openstring);

}
