﻿$(document).ready(function(){

	var _width = 520;
	var _height = 432;
	var _dimensions = "";

	$("a.popup").click(function(){
		
		_dimensions = $(this).attr("rel").split(",");
		if(_dimensions.length > 1)
		{
			_width = _dimensions[0];
			_height = _dimensions[1];
		}
		openPopUp( $(this).attr("href"), _width, _height);
		return false;
	});	

});

function openPopUp(URL, W, H) {
// opens a new popup window and displays the passed url, and height & width settings
 var thisWidth = W;
 var thisHeight = H;
 var thisURL = URL;
 // set the min width and height if not passed
 if(typeof thisWidth == "undefined"){
 thisWidth = 500;
 }
 if(typeof thisHeight == "undefined"){
 thisHeight = 600;
 }
 //alert("passed W = "+thisWidth+" passed H = "+thisHeight);
 var strOptions = "menubar=no,statusbar=yes,resizable=yes,scrollbars=yes,toolbar=no,height="+thisHeight+",width="+thisWidth;
 var newPopUp = window.open(thisURL, "", strOptions);
 newPopUp.focus();

}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=no,scrollbars=1,location=0,statusbar=0,status=0,menubar=0,resizable=0,width=520,height=432,left = 100,top = 25');");
}


