// JavaScript Document
var xmlhttp = false;
//Check if we are using IE.
try {
//If the Javascript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
//alert ("You are using Microsoft Internet Explorer.");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using Internet Explorer.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
//alert ("You are using Microsoft Internet Explorer");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp = false;
}
}
//If we are using a non-IE browser, create a javascript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
//alert ("You are not using Microsoft Internet Explorer");
}

function setStatus (theStatus, obj){
	if (obj){

		obj.innerHTML = theStatus + "</b>";
	}
}

function makerequest(serverPage, objID) 
{
	
	var obj = document.getElementById(objID);
	setStatus("Loading...",obj);
	xmlhttp.open("GET", serverPage);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}
function load_content(Page, Content) 
{
	var obj = document.getElementById(Content);
	xmlhttp.open("GET", Page);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
			makerequest("view_property.php?title=All+On+Listing+Properties","body_content");
			makerequest("show_random_property.php","random_display_property_content");
		}
	}
	xmlhttp.send(null);
	
		
}






function popUp(num,page)
{
var oPopup = window.createPopup();
var oPopBody = oPopup.document.body;
if (num<0)
       oPopup.show(event.clientX + document.body.scrollLeft, event.clientY + 

document.body.scrollTop, 0, 0, document.body);

else
{

    oPopBody.style.backgroundColor = "aliceblue";
    oPopBody.style.border = "solid blue 1px";
    oPopBody.innerHTML = "<div id='content'><a onclick='popUp(-1,0)'>close</a></div>";
	
 // oPopup.show(px right, px down, width, height, document.body);              
       oPopup.show(event.clientX + document.body.scrollLeft, event.clientY + 

document.body.scrollTop, 500, 500, document.body);
 // oPopup.show(500, 500, 500, 25, document.body);

}
}

function popup(num)
{
  if (num < 0)
    document.getElementById('divA').style.display = 'none';
  else
  {
  divContent = '<table bgcolor="yellow" border="3"><tr><td>'
  divContent += num;
  divContent += '</td></tr></table>';

  document.getElementById('divA').innerHTML = divContent
	
document.getElementById('divA').style.left=event.clientX + document.body.scrollLeft-200;
document.getElementById('divA').style.top=event.clientY + document.body.scrollTop-50;
  document.getElementById('divA').style.display = 'block';
  }
}
