/*
Description:  	Popup Window Handler
Auther:		Bruce Loughmiller
Date Created:	17 Aug 2005

*/

var win;
var imageWin;

function popupAvailability() {
	popup('650', '600',"http://www.rentors.org/calendar.aspx?propertyid=84888");
}

function popup(width,height,url) {
	var x = 0;
	var y = 0;

	closePopup();
	
	if (document.all)
	{
		x = top.window.screenLeft + 100;
		y = top.window.screenTop;
	}
	else
	{
		x = top.window.screenX  + 100;
		y = top.window.screenY;
	}

	var winProperties = "width=" + width + ",height=" + height + ",resizable,scrollbars,top=" + y + ",left=" + x;
	
	win = window.open(url,"HappyPlace",winProperties);
	win.focus();
}


// Display the passed image in a popup window
function popupImage(imageSrc) {
	var x = 0;
	var y = 0;

	if (imageWin != null) {
		imageWin.close();
	}	
	
	if (document.all)
	{
		x = top.window.screenLeft + 100;
		y = top.window.screenTop;
	}
	else
	{
		x = top.window.screenX  + 100;
		y = top.window.screenY;
	}	
	var width=630;
	var height=500;
	var winProperties = "width=" + width + ",height=" + height + ",resizable,scrollbars,top=" + y + ",left=" + x;
	
	imageWin = window.open("","HappyPlace",winProperties);
	if (imageWin.opener == null) {
		imageWin.opener = window;
	}
	imageWin.document.write("<html><head><title>Our Happy Place - Photo Display</title>");
	imageWin.document.write("<link rel='stylesheet' type='text/css' href='css/global.css'></head>");
	imageWin.document.write("<body topmargin='0' leftmargin='0' marginheight='0' marginwidth='0'>");
	imageWin.document.write("<table width='100%' height='100%' cellspacing='0' cellpadding='0' border='0' align='center'>");
	imageWin.document.write("<tr><td class='contentContainer' align='center'><img src='" + imageSrc + "' border='0'><br>");
	imageWin.document.write("<a href='javascript:window.close()'>Close</a>");
	imageWin.document.write("</td></tr></table></body></html>");
	imageWin.document.close();
	imageWin.focus();

}

// Close the popup window, if one is open 
function closePopup() {
	if (win != null) {
		win.close();
	}
}
