// mjt popup
var xmlHttp;
var theProperty;
var theType;

function loadVT(url) {
document.getElementById('realVTs').innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  id="realVT" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="620" height="464"><param name="movie" id="theVT2" value="' + url + '.swf" /><param name="quality" value="high" /><param name="WMODE" value="transparent" /> <embed id="theVT" src="' + url + '.swf" width="620" height="464" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed></object>';
}


function loadImage(url) {
document.getElementById('theRealImg').src = url;	
}


function getScrollY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfY;
}



function mjtPopup (property, pgLink, propId, absDir, pgType, maxImgs, maxVts) {
	
	
	
	xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request");
 return;
 }


//URL where we will be getting our data from.
var url="/popup.asp?prop=" + property + "&pglink=" + pgLink + "&propid=" + propId + "&absDir=" + absDir + "&pgType=" + pgType + "&maxImgs=" + maxImgs + "&maxVts=" + maxVts;
theProperty = absDir.split("/");
theType = pgType;
//document.getElementById('mjtPop').style.top = getScrollY() + "px";
//go for it
xmlHttp.onreadystatechange=stateChanged ;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
	
	
	
	
}



function stateChanged() 
{ 
//have we got the data? yezzir. time to handle it.
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 
 document.getElementById('mjtPop').style.display = "block";
 //document.getElementById('mjtPop').style.top = getScrollY() + "px";
 document.getElementById('mjtPop').innerHTML = xmlHttp.responseText;
 $(document.getElementById('mjtPop')).draggable();
document.getElementById('mjtPop').style.marginLeft="-500px";
  document.getElementById('mjtPop').style.left="50%";
 document.getElementById('mjtPop').style.top="50%";
  document.getElementById('mjtPop').style.marginTop="-282px";
  
pageTracker._trackPageview("/popup/" + theProperty[1] + "/"  + theType + "/"); 
 // document.getElementById('mjtPop').style.top="50%";
  //document.getElementById('mjtPop').style.marginTop="";
 //document.getElementById('mjtPop').style.top = (($(window).height() - 564) / 2) + $(window).scrollTop() + "px"; 
  
// $(document.getElementById('mjtPop')).center();
 

}
}

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 closePopup() {
	$(document.getElementById('mjtPop')).fadeOut("fast");

/* document.getElementById('mjtPop').style.display = "none";
  document.getElementById('mjtPop').style.innerHTML = "";*/
	
}



