// Site Variable
var site = "wholesale";

// 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 WHY TTT
function whyttt (dotdotpath, section)	{
	var width = 690;
	var height = 600;
	var screenX = screen.width
	var screenY = screen.height

	var x = (screenX - width)/2;
	var y = (screenY - height)/2;

	var whyttt = window.open(dotdotpath + "whyttt/?section=" + section + "&site=" + site,"whyttt","width=" + width + ",height=" + height + ", top=" + y + ", left=" + x + ",resizable=no, scrollbars=no");
	whyttt.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();
}
// LAUNCHES TTT CAREERS
function career() {
var screenleft
var screentop

  screenleft = (window.screen.width - 720) / 2;
  screentop = (window.screen.height - 540) / 2;

    window.open("http://www.ttt.co.uk/pages/jobshome.html","career","height=540,width=720,fullscreen=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,status=no,directories=no,channelmode=no,top=" + screentop + ",left=" + screenleft + "");

}
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');
}
// KESSING
function Login()
{
	LoginForm.screenwidth.value = screen.width;
	LoginForm.screenheight.value = screen.height;
	LoginForm.submit();
}