//Simple window popup function that works on virtual roots and websites
//Sample call: javascript:showPopUp('/PopUps/AboutGeoLocation.aspx',200,300,'/DotNetNuke')

//Virtual parameter is optional
//If height is null it will default to the height of the current window
//If width is null it will default to the width of the current window
function showPopUp(url, height, width, virtual, resizable, scrollbars)
{
	if(height == null)
		height=document.body.clientHeight;

	if(width == null)
		width=document.body.clientWidth;

	if(resizable == null)
		resizable = 'no';

	if(scrollbars == null)
		scrollbars = 'no';

	//make sure that a / immediately follows the virtual, since we could be in a subdomain
	if(virtual!= null && location.pathname.indexOf(virtual + '/')>=0)
	{
		//we're running in the virtual root, so prepend it to the url
		url=virtual+url;
	}

    //use a timestamped window name so the popup window isn't reused in other popup links
	var d = new Date();
	windowName = 'popup'+d.getTime();

	// Center the window
    var screenheight = window.screen.availHeight;
    var screenwidth = window.screen.availWidth;
    var left_point = parseInt(screenwidth / 2) - parseInt(width / 2);
    var top_point = parseInt(screenheight/2) - parseInt(height / 2);

	window.open(url, '', 'toolbar=no,directories=no,menubar=no,resizable=' + resizable + ',scrollbars=' + scrollbars + ',status=no,height=' + height + ',width=' + width + ',top=' + top_point + ',left=' + left_point);
}

/*
Use this method for displaying demo.
*/
function showDemo(demoSrc, height, width, title)
{
	var demoUrl = '/PopUps/FlashDemo.aspx?src=' + escape(demoSrc) + '&height=' + escape(height) + '&width=' + escape(width)
	if (typeof title != 'undefined')
	{
		demoUrl += '&title=' + escape(title);
	}
	showPopUp(demoUrl, height + 30, width + 30, '/Essure');
}
