var posX;
var posY;

var isIE = document.all?true:false;
document.onmousemove = getMousePosition;
function getMousePosition(e) {
var _x;
var _y;
if (!isIE) {
_x = e.pageX;
_y = e.pageY;
}
if (isIE) {
_x = event.clientX + document.body.scrollLeft;
_y = event.clientY + document.body.scrollTop;
}

posX=_x;
posY=_y;

return true;
}


function getScrollWidth()
{
   var w = window.pageXOffset ||
           document.body.scrollLeft ||
           document.documentElement.scrollLeft;
           
   return w ? w : 0;
} 

function getScrollHeight()
{
   var h = window.pageYOffset ||
           document.body.scrollTop ||
           document.documentElement.scrollTop;
           
   return h ? h : 0;
}


//function to get a handle on xmlHttpRequest object

var xmlHttp = null

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;
}

//display the map
function showDiv(id, status, map) {

	var xmlHttp=null;
	
	//var width = screen.width;
	//var height = screen.height;
	
	var width = screen.width+getScrollWidth();
	//var height = 1021;
	var height = screen.height+getScrollHeight()+250;

		
	xmlHttp = getXmlHttpObject();
	
	if (xmlHttp == null) {
		alert("AJAX not supported");
		return;
	}
	
	if (status == '0') {
		
		var url = "http://www.houstonfinedining.net/recordClick.php?id="+id+"&click=map";
		xmlHttp.open("GET", url, true);
		xmlHttp.send(null);
	}
	
	document.getElementById("dyna").innerHTML = "<div style='position:absolute; filter:alpha(opacity=50);-moz-opacity:.50;opacity:.50; left:10px; top:10px; width:"+width+" px; height:"+height+" px; z-index:40'><img src='images/bk.png', width="+width+" height="+height+" ></div><table style='position:absolute; left:150px; top:"+posY+"px; width:600 px; height:450 px; z-index:41'><tr><td class='dyna'><a class='links-ul' href='javascript:closeDiv();'>Close Map </a></td></tr><tr><td><iframe width='600' height='450' src="+map+" scrolling='no' frameborder='0'></iframe></td></tr></table>";				
}

function closeDiv() {	
	document.getElementById("dyna").innerHTML = "";		
}

//display the website
function showWebsite(id, status, url) {	
	var xmlHttp=null;
	xmlHttp = getXmlHttpObject();
	
	if (xmlHttp == null) {
		alert("AJAX not supported");
		return;
	}
	
	if (status == '0') {
		
		var click_url = "http://www.houstonfinedining.net/recordClick.php?id="+id+"&click=site";
		xmlHttp.open("GET", click_url, true);
		xmlHttp.send(null);
	}
	
	//if(status == '0') {
	//	alert("Sorry, website is not displayed for free listings");
	//}
	//else {
		window.open(url, resizable="yes");
	//}	
}

