function Content() 
{
	var container = document.getElementById("content");
	var contentLoader = document.getElementById("contentLoader");
	var content = contentObject.data.innerHTML;
	container.innerHTML = content;
}

function Open(title, url)
{
	window.onresize = centerWindow;
	$('#pupTitle').html(title);
	$('#pupContent').load(url, function (){
		Show();
	});
	//updateContent(title, url);
}

function Show()
{
	var offsetTop = $("html").scrollTop();
	$("html").css("overflow","hidden");
	$("#overlay").css("visibility","visible");
	$("#overlay").css("width", $(window).width() + "px");
	$("#overlay").css("height", $(window).height() + offsetTop + "px");
	$("#pup").css("visibility","visible");
	centerWindow();
}

function Close() 
{
	$("#overlay").css("visibility","hidden");
	$("#pup").css("visibility","hidden");
	$("html").css("overflow","auto");
}

//function updateContent(url)
//{
//    document.getElementById("contentLoader").src = url;
//}
	
function opencraigslist() 
{
	window.open('https://post.craigslist.org/c/tul/H/','mywindow', 'scrollbars=yes, resizable=yes');
}

function updateContent(title, url)
{

	if (url.length==0)
	  { 
	  document.getElementById("pupContent").innerHTML="";
	  return;
	  }
	  
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	  
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		var response = xmlhttp.responseText;
		document.getElementById("pupContent").innerHTML=response;
		document.getElementById("pupTitle").innerHTML = title;
		Show();
		}
	  }
	  
	xmlhttp.open("GET",url + '?misc=' + (new Date()).getTime(),true);
	xmlhttp.send();
}

function centerWindow() 
{
	var offsetTop = $("html").scrollTop();
	var pupContent = document.getElementById("pup");
	var overlay = $("#overlay");
	//document.getElementById("pupHeader").style.width = (document.getElementById("pup").offsetWidth-2) + 'px';
	
	overlay.css("width", $(window).width()+'px');
	
	pupContent.style.left = ($(window).width()/2) - (pupContent.offsetWidth/2) + "px";
	pupContent.style.top = ($(window).height()/2) - (pupContent.offsetHeight/2) + offsetTop/2 + "px";
}
