// Site Variable
var site = "retail";

// 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();
}

// 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 TOOLS
function tools (dotdotpath, section)	{
	var width = 742;
	var height = 410;
	var screenX = screen.width
	var screenY = screen.height

	var x = (screenX - width)/2;
	var y = (screenY - height)/2;

	var tools = window.open(dotdotpath + "tools/?section=" + section + "&site=" + site,"tools","width=" + width + ",height=" + height + ", top=" + y + ", left=" + x + ",resizable=yes, scrollbars=yes");
	tools.focus();
}

// 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();
}

function terms(dotdotpath) {
	popup(dotdotpath + 'privacy.cfm','newwin','510','500','scrollbars=yes');
}

function legals(dotdotpath) {
	popup(dotdotpath + 'legal.cfm','newwin','510','500','scrollbars=yes');
}