var DH = 0;var an = 0;var al = 0;var ai = 0;if (document.getElementById) {ai = 1; DH = 1;}else {if (document.all) {al = 1; DH = 1;} else { browserVersion = parseInt(navigator.appVersion); if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {an = 1; DH = 1;}}} function fd(oi, wS) {if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); if (al) return wS ? document.all[oi].style: document.all[oi]; if (an) return document.layers[oi];}
function pw() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;}
function mouseX(evt) {if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return null;}
function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;}
function popUp(evt,oi) {if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; ds.visibility = "visible";}}}



function productPopup(url) {
	var width = 525;
	var height = 350;
	var left = (screen.width-width)/2;
	var top = (screen.height*0.8-height)/2;
		
	newWin = window.open(url, "popup", "width="+width+",height="+height+",toolbar=no,location=no,directories=no,resizable=no,status=no,menubar=no,screenX=100,screenY=100, left="+left+", top="+top);
}


function surfto(form) {
	var myindex = form.select1.selectedIndex;
	
	if (form.select1.options[myindex].value != "0") {
		location = form.select1.options[myindex].value;
	}
}

function productPopup(url) {
	var width = 525;
	var height = 350;
	var left = (screen.width-width)/2;
	var top = (screen.height*0.8-height)/2;
		
	newWin = window.open(url, "popup", "width="+width+",height="+height+",toolbar=no,location=no,directories=no,resizable=no,status=no,menubar=no,screenX=100,screenY=100, left="+left+", top="+top);
}


function productPopupbig(url) {
	var width = 625;
	var height = 630;
	var left = (screen.width-width)/2;
	var top = (screen.height*0.8-height)/2;
		
	newWin = window.open(url, "popup", "width="+width+",height="+height+",toolbar=no,location=no,directories=no,resizable=no,status=no,menubar=no,screenX=100,screenY=100, left="+left+", top="+top);
}



//Dedicated servers sign up popup

function dedicatedPopup() {
	var width = 460;
	var height = 550;
	var left = (screen.width-width)/2;
	var top = (screen.height*0.8-height)/2;
		
	newWin = window.open("https://signup.fasthosts.co.uk/dedicated/signup.exe?choose=2", "dedicatedsignup", "width="+width+",height="+height+",scrollbars=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,status=yes,menubar=yes,screenX=100,screenY=100, left="+left+", top="+top);
}


//Hosting account sign up popup

function hostingSignup (url) {
	var width = 800;
	var height = 600;
	var left = (screen.width-width)/2;
	var top = (screen.height*0.8-height)/2;
		
	newWin = window.open(url, "hostingsignup", "width="+width+",height="+height+",scrollbars=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,status=yes,menubar=yes,screenX=100,screenY=100, left="+left+", top="+top);
}


//Screenshot popup

function screenShot (url) {
	var width = 500;
	var height = 400;
	var left = (screen.width-width)/2;
	var top = (screen.height*0.8-height)/2;
		
	newWin = window.open(url, "screenshot", "width="+width+",height="+height+",scrollbars=no,toolbar=no,location=no,directories=no,resizable=no,status=no,menubar=no,screenX=100,screenY=100, left="+left+", top="+top);
}


// Animates a button when clicked.
// To call, use onClick="startAnim(this);"

var objClickedBtn = '';
var i = 0;
var bolAnimating = false;

function startAnim(btn) {
	if (!bolAnimating) {
		objClickedBtn = btn;
		objClickedBtn.style.backgroundColor = '#999999';
		objClickedBtn.value = 'Please wait   ';
		bolAnimating = true;
		btnanim = setInterval('moretext()', 250);
	}
}
 
function moretext() {
	if (i == 0) {
		objClickedBtn.value = 'Please wait.  ';
	}
	else if (i == 1) {
		objClickedBtn.value = 'Please wait.. ';
	}
	else if (i == 2) {
		objClickedBtn.value = 'Please wait...';
	}
	else if (i == 3) {
		objClickedBtn.value = 'Please wait   ';
		i = -1;
	}
	i++;
}

//Opens a new popup window based on the URL provided

function popupWindow(url) {
	var width = 500;
	var height = 450;
	var left = (screen.width-width)/2;
	var top = (screen.height*0.8-height)/2;
	
	newWin = window.open(url, "FHDetails", "width="+width+", height="+height+", status=no, scrollbars, resizable=no, screenX=20, screenY=40, left="+left+", top="+top);
}

function newWindowResize(url, width, height, name) {
	var left = (screen.width-width)/2;
	var top = (screen.height*0.8-height)/2;
	
	newWin = window.open(url, name, "width="+width+", height="+height+", status=yes, scrollbars, resizable=yes, location=yes, toolbar=yes, menubar=yes, screenX=20, screenY=40, left="+left+", top="+top);
	newWin.focus();
}

/* Countdown */

function format(num) {
	if(num < 10) {
		return "0" + num;
	}
	else {
		return num;
	}
}

function updateCountdown(countdownDate) {
	var now = new Date();
	var event = new Date(countdownDate);
	
	if((event-now) > 0)	{
		var seconds = (event - now) / 1000;
		var minutes = seconds / 60;
		var hours = minutes / 60;
		var days = hours / 24;
								
		days = Math.floor(days);
		hours = Math.floor(hours - (days * 24)); 
		minutes = Math.floor(minutes - ((days * 1440) + (hours * 60)));
		seconds = Math.floor(seconds - (((days * 1440)*60) + ((hours * 60)*60) + (minutes * 60)));

		document.getElementById('countdown').innerHTML = days + " days " + hours + "h " + minutes + "m " + format(seconds) + "s";
		bob = window.setTimeout("updateCountdown('" + countdownDate + "')", 1000);
	}
}


function openURL(url, target, closewindow)	{
	if(!target)
		window.location = url;
	else
		window.open(url, target);
		
	if(closewindow)
		window.close(); 

	return false;
}

function openInParent(url, closewindow) {
	window.opener.location.href = url;
	
	if(closewindow)
		window.close(); 
		
	return false;
}