// JavaScript Document
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function popupWindow(fileName, id, width, height, resizable)
{
	window.open(fileName, ((id) ? id : ''), "width=" + ((width) ? width : 500) + ", height=" + ((height) ? height : 350) + ", status=no, toolbar=no, menubar=no, location=no, scrollbars=yes" + ((resizable) ? " resizable=yes" : ""));
//	window.open(fileName, ((id) ? id : ''), "width=" + ((width) ? width : 500) + ", height=" + ((height) ? height : 350) + ", status=no, toolbar=no, menubar=no, location=no" + ((resizable) ? " resizable=yes" : "")) + ((scrollbar) ? " scrollbar=yes" : "")));
}


function openOnlineApplication()
{
	var pageURL = "/enquiry/step-1.php";
	window.location = pageURL;
}

function openCallMeBackForm()
{
	var pageURL = "/enquiry/step-4.php?callme=1";
	window.location = pageURL;
}


function hide(id)
{
	var div = returnElementById(id);
	if (div){
		div.style.display = 'none';
	}
	else
	{
		alert("failed to hide");
	}
}


function show(id)
{
	var div = returnElementById(id);
	if (div){
		div.style.display = 'block';
	}
}

function returnElementById(id)
{
	if(document.getElementById){
//			alert("document.getElementById(id)");
			return document.getElementById(id);
	  }
	  else if (document.all){
//			alert("document.all[id]");
			return document.all[id];
	  }
	  else {
		   alert("Warning: Your browser needs upgrading to work with this site");
		   return false;
	  }
}

	function formatBritishCurrency(num) 
	{
		alert("num: "+num);
		num = num.toString().replace(/\£|\,/g,'');
		if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
		cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
		num.substring(num.length-(4*i+3));
		alert("returning: "+(((sign)?'':'-') + '£' + num + '.' + cents));
		return (((sign)?'':'-') + '£' + num + '.' + cents);
	} 
//-->
