var xmlHttp;
var p=2; 
var rand=0;
var http_request = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            // set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
     
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('canvas').innerHTML = result;           
         } else {
            alert('There was a problem with the request.');
         }
      }
   }

function get(obj) {
      makePOSTRequest('index.php', "");
   }












function add_to_contact(ContentID)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="add_to_contact.php?ContentID="+ContentID;
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedContact
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedContact() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { alert(xmlHttp.responseText);}}

function fov(id,name,type,details)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="add_to_favorite.php?id="+id+"&type="+type+"&name="+name+"&details="+details
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedFov
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedFov() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 if(xmlHttp.responseText==1)
 alert("Offer has been added to your favorite list.");
 if(xmlHttp.responseText==0)
 alert("Offer already exist in your favorite list.");
 if(xmlHttp.responseText==100)
 alert("Please login!");
 
 }  
}





function add_to_contact(ContentID)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="add_to_contact.php?ContentID="+ContentID;
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedContact
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}






function join_group(gid)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="join_group.php?gid="+gid
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedGroup
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedGroup() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 if(xmlHttp.responseText==1)
 alert("You have joined the group successfully.");
 if(xmlHttp.responseText==0)
 alert("You are already member of this group.");
 }  
}




function set_con()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="set_con.php?money="+document.getElementById('cur').value+"&country="+document.getElementById('country1').value+"&state="+document.getElementById('state1').value;
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedCon
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedCon() 
{ 
var s=""; 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 if(xmlHttp.responseText!=0){
 document.getElementById('myCon120').innerHTML=document.getElementById('state1').value+", "+document.getElementById('country1').value+", Currency: "+document.getElementById('cur').value;
 s=s+"<br><br><center>You have selected Country: "+document.getElementById('country1').value+", ";
 s=s+"State: "+document.getElementById('state1').value+", ";
 s=s+"Currency: "+document.getElementById('cur').value+"</center>";
 document.getElementById('cust').innerHTML=s;

 document.getElementById('cons').innerHTML=document.getElementById('state1').value+", "+document.getElementById('country1').value+", Currency: "+document.getElementById('cur').value;
 s=s+"<br><br><center>You have selected Country: "+document.getElementById('country1').value+", ";
 s=s+"State: "+document.getElementById('state1').value+", ";
 s=s+"Currency: "+document.getElementById('cur').value+"</center>";


 
 
 }
  }  
}


function check_cust()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="check_cust.php?"
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedCust
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedCust() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 if(xmlHttp.responseText==0)
 alert("Plesae select Country, State, Currency to customize the site.");
 }  
}


function open_house()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="open_house.php?";
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedOpen
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedOpen() 
{ 
document.getElementById('open_house_list').innerHTML=xmlHttp.responseText;
}



function ask_f(uid)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="ask_f.php?uid="+uid;
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedF
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedF() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
alert(xmlHttp.responseText);
}



function rss_prev()
{ 
var str="";
str="<!-- Start of Real Estate Network Frame -->";
str=str+"<iframe frameborder='0' marginwidth='0' marginheight='0' width='"+document.form10.width.value+"' height='"+document.form10.height.value+"' src='http://www.zoleni.com/offer_list.php?num="+document.form10.num.value+"&section="+document.form10.section.value+"'></iframe>";
str=str+"<!-- End of Real Estate Network Frame -->";
document.getElementById('html').style.display="";
document.getElementById('html').value=str;

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="offer_list.php?s=1&num="+document.form10.num.value+"&type="+document.form10.section.value+"&height="+document.form10.height.value+"&width="+document.form10.width.value;
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedRss
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedRss() 
{ 
document.getElementById('pr').innerHTML=xmlHttp.responseText;
}

function get_preview()
{
window.open("ppp.php","p","height=320px,width=240px,resizable=1");
}



function showProperty(pid,x,y)
{ 
document.getElementById('p1').style.display="none";
document.getElementById('p2').style.display="";
showAddress(x,y);
var str="";
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="offer_list1.php?pid="+pid
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedPo
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedPo() 
{ 
document.getElementById('po').innerHTML=xmlHttp.responseText;
}






function showAgent(pid,x,y)
{ 
document.getElementById('p1').style.display="none";
document.getElementById('p2').style.display="";
showAddress(x,y);
var str="";
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="agent_list1.php?pid="+pid
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedPo
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedPo() 
{ 
document.getElementById('po').innerHTML=xmlHttp.responseText;
}













function find_pro()
{ 
var str="";
str=str+"&city="+document.getElementById('city').value;
str=str+"&address="+document.getElementById('address').value;
str=str+"&ptype="+document.getElementById('ptype').value;
str=str+"&parking="+document.getElementById('parking').value;
str=str+"&from="+document.getElementById('from').value;
str=str+"&to="+document.getElementById('to').value;
str=str+"&bedroom="+document.getElementById('bedroom').value;
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="search_map.php?"+str;
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedfPo
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedfPo() 
{ 
document.getElementById('DHTMLgoodies_thumbs_inner').innerHTML=xmlHttp.responseText;
}




function show_all_property(m,s)
{ 
var str="";
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 
var url="offer_list2.php?pid="+s+"&m="+m
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedPoAll
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedPoAll() 
{ 
document.getElementById('com').innerHTML=xmlHttp.responseText;
}




function save_find(lin,section)
{ 
alert("Link has been saved to your Search History");
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url="save_link.php?link="+lin+"&section="+section;
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedSave
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedSave() 
{ 
}








function re_vc(id)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url="reload_vc.php?";
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedVC
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedVC() 
{ 
document.getElementById('vc').innerHTML=xmlHttp.responseText;
}




function add_article(id)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var str="s=1";
str=str+"&writer_name="+document.register.writer_name.value;
str=str+"&writer_email="+document.register.writer_email.value;
str=str+"&writer_image="+document.register.writer_image.value;
str=str+"&title="+document.register.title.value;
str=str+"&details="+document.register.details.value;
str=str+"&image="+document.register.image.value;

var url="article_details1.php?str";
url=url+"&amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedArticle
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChangedArticle() 
{ 

}







function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 }  
}





function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
function send_to_friend(page)
{
window.open("send_to_friend.php?page="+page,'p','height=400,width=600');
}
function send_message(userid)
{
window.open("send_message.php?userid="+userid,"msg",'height=350,width=650');
}

function IsNumeric(strString)
   //  check for valid numeric strings 
   {
   var strValidChars = "0123456789.";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
