// Declare Client Variables
var agt = navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
             && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
             && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav6up = (is_nav && (is_major >= 5));

var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie4up = (is_ie && (is_major >= 4));
    
var is_win = ((agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1));
var is_mac = (agt.indexOf("mac")!=-1);

// Determine Client Type - Advanced (adv) or Standard (std)
if (is_nav6up || is_ie4up)
{
	var client = 'adv';
}
else
{
	var client = 'std';
}

// Declare Screen Width & Height
var SW = screen.availWidth;
var SH = screen.availHeight;


// Calculate Horizontal Centrepoint
function xcPCalc(SW,SH)
{
	if (SW / SH > 2) { xcP = (SW/4); }
	else { xcP = SW/2; }
	return xcP;
}


// Declare Horizontal Centrepoint
var xcP = xcPCalc(SW,SH);

// Declare Vertical Centrepoint
var ycP = SH/2;


// Check Horizontal Centrepoint
function xCheck(xOff)
{
	if ((screen) && (client == 'adv')) { var x = xcP+xOff; }
	else { var x = 400+xOff; }
	return x;
}


// Check Horizontal Centrepoint
function yCheck(yOff)
{
	if ((screen) && (client == 'adv')) { var y = ycP+yOff; }
	else { var y = 300+yOff; }
	return y;
}


function spawn(w, h, trgt, scrolling, name)
{

    xOff = ((w+10)/2)*-1;
	yOff = ((h+29)/2)*-1;
	
	if (name == "") name = 'ff';
	
	// Declare Window Co-ordinates
	var x = xCheck(xOff);
	var y = yCheck(yOff);
	
	//alert("x: "+x+"\ny: "+y+"\nxOff: "+xOff+"\nyOff: "+yOff+"\nh: "+h+"\nw: "+w);

	// Launch Window
	eval("pop = window.open(trgt,name,'width='+w+',height='+h+',left='+x+',top='+y+',scrollbars='+scrolling+',toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=no')");
	
	if (pop == null || pop == false)
	{
		alert("Cannot open a pop-up window.\n\nThis site runs in a pop-up window but one cannot be opened.\n\nThis may be becuase you are using some software (such as Norton Internet Security) that disables pop-up windows.\n\nIf you wish to see this site please disable this software.");
	}
	
	pop.focus();
}

function spawnFull(w, h, trgt)
{
	xOff = ((w+10)/2)*-1;
	yOff = ((h+29)/2)*-1;
	
	// Declare Window Co-ordinates
	var x = xCheck(xOff);
	var y = yCheck(yOff);
	
	//alert("x: "+x+"\ny: "+y+"\nxOff: "+xOff+"\nyOff: "+yOff+"\nh: "+h+"\nw: "+w);

	// Launch Window
	eval("pop = window.open(trgt,'fffull','width='+w+',height='+h+',left='+x+',top='+y+',scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes,dependent=no')");
	
	if (pop == null || pop == false)
	{
		alert("Cannot open a pop-up window.\n\nThis site runs in a pop-up window but one cannot be opened.\n\nThis may be becuase you are using some software (such as Norton Internet Security) that disables pop-up windows.\n\nIf you wish to see this site please disable this software.");
	}
	
	pop.focus();
}

function spawnTC()
{
	spawn(400, 550, '../' + country + '/terms.html', 1);
}

function spawnJump(URL)
{
	spawnFull(850, 450, '../' + country + '/jump.html?site=' + URL, 1);
}





