// CENTRAL POPUP
function popup(url,winname,w,h,feat)
{
	if (!(isNaN(w) || isNaN(h)))
	{
		var adjust = 20;
		var x=parseInt((screen.width-w)/2);
		var y=parseInt(((screen.height-h)/2-adjust));
		if (x<0)	x=0;
		if (y<0)	y=0;
		
		if (feat!=null && feat!="")
		{
			feat=","+feat;
		}
		else
		{
			feat="";
		}
		feat="left="+x+",top="+y+",width="+w+",height="+h+feat;
	}
	var this_win = window.open(url,winname,feat);
	this_win.focus();
}

function disclaimer()
{
	popup(dotdotpath+'legals/disclaimer.htm','popwin1',610,400,'location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
}

function liveprices_redirect()
{
	popup(dotdotpath+'legals/liveprice_disclaimer.htm','popwin1',610,400,'location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
}

function UKdisclaimer()
{
	popup(dotdotpath+'legals/UKRegulatoryNotice.htm','popwin2',610,400,'location=no,status=yes,menubar=no,scrollbars=yes,resizable=no');
}

function live()
{
	window.open("live.htm","","width=507,height=545");
}

function open_demo(dotdotpath)
{
	// code to place the pop up window in the centre of the screen.
	var width = 550;
	var height = 400;
	var screenX = screen.width
	var screenY = screen.height

	var x = (screenX - width)/2;
	var y = (screenY - height)/2;
	
	var win = window.open(dotdotpath + "liveprice/demo_liveprice_player.htm","my_win","width=" + width + ",height=" + height + ", top=" + y + ", left=" + x)
	win.focus();
}

// CHECKS FIELDS ARE FILLED IN BEFORE SUBMITTING FORM FOR CURRENCY CONVERSION
function currency_check() {
	if (document.f.amount.value=="") {
		return false;
	} else if (document.f.convert.value=="") {
		return false;
	} else if (document.f.into.value=="") {
		return false;
	} else {
		return;
	}
}

// LAUNCHES LIGHTMAKER.COM MID-SCREEN
function lightmaker()	{
	var width = 790;
	var height = 520;
	var screenX = screen.width
	var screenY = screen.height

	var x = (screenX - width)/2;
	var y = (screenY - height)/3;

	var lightmaker = window.open("http://www.lightmaker.com","lightmaker","status=yes,scrollbars=yes,resizable=yes,location=yes,toolbar=yes,menubar=yes,width=" + width + ",height=" + height + ", top=" + y + ", left=" + x);
	lightmaker.focus();
}

function Calendar() {
	var width = 248;
	var height = 224;
	var screenX = screen.width
	var screenY = screen.height

	var x = (screenX - width)/2;
	var y = (screenY - height)/2;

	var calendar = window.open("calendar.htm","calendar","width=" + width + ",height=" + height + ", top=" + y + ", left=" + x);
	calendar.focus();
}