function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=549,height=550,left = 740,top = 425');");
}

function PTIPLogin()
	{
	var d = document.getElementById('Username');
	if (d.value.length > 0)
		{
			var d = document.getElementById('Password');
			if (d.value.length > 0)
				{
					var d = document.getElementById('PTIPLogin');
					d.submit()
				}
				else
				{
				alert("Please enter your password")
				}
		}
		else
		{
		alert('Please enter your username')
		}
	}
function PTIPRegister()
	{
	var d = document.getElementById('Email');
	if (d.value.length > 0)
		{
			var d = document.getElementById('FullName');
			if (d.value.length > 0)
				{
				var d = document.getElementById('CompanyName');
				if (d.value.length > 0)
					{
					var d = document.getElementById('PTIPLogin');
					d.submit()
					}
				else
				{
				alert("Please enter your company name")
				}}
				else
				{
				alert("Please enter your full name")
				}
		}
		else
		{
		alert('Please enter your email address')
		}
	}
function PTIPForgotPassword()
	{
	var d = document.getElementById('Email');
	if (d.value.length > 0)
		{
			var d = document.getElementById('PTIPLogin');
			d.action = "PTIPForgotP.asp";
			d.submit();
		}
		else
		{
		alert('Please enter your email address')
		}
	}

var bType;
var bleft;
var bleft2;
var bleft3;
var bleft4;
var bleft5;
var btop;
var blnMenuOn = false;
var top;
top = '';
function browserType ()
{
if (navigator.userAgent.indexOf('Opera')!=-1 && document.getElementById)
return 'OP'; // Opera
if (document.all)
return 'IE'; // Internet Explorer
if (document.layers)
return 'NN'; //Netscape 4
if (!document.all && document.getElementById)
return 'MO'; // Mozilla (Netscape 6+, etc)
}
function setLayerVisibility (pstrID, pstrVisibility)
{
if (bType == "IE")
eval("document.all." + pstrID + ".style.visibility='" + pstrVisibility + "'");
if (bType == "NN")
eval("document." + pstrID + ".visibility='" + pstrVisibility + "'"); 
if (bType == "MO" || bType == "OP") 
eval("document.getElementById('" + pstrID + "').style.visibility='" + pstrVisibility + "'"); 
}
function setPosition (pstrID, pstrPOS)
{
if (bType == "IE")
	{
	eval("document.all." + pstrID + ".style.left='" + pstrPOS + "'"); 
	}
if (bType == "NN")
	{
eval("document." + pstrID + ".left='" + pstrPOS + "'");
	}
if (bType == "MO" || bType == "OP")
	{
	eval("document.getElementById('" + pstrID + "').style.left='" + pstrPOS + "'");
	}
}

function setLayerDisplay (pstrID, pstrVisibility)
{
if (bType == "IE")
eval("document.all." + pstrID + ".style.display='" + pstrVisibility + "'"); 
if (bType == "NN")
eval("document." + pstrID + ".display='" + pstrVisibility + "'"); 
if (bType == "MO" || bType == "OP") 
eval("document.getElementById('" + pstrID + "').style.display='" + pstrVisibility + "'"); 
}


var aryImages = new Array(2);

  aryImages[0] = "../img/bullet2.gif";

  for (i=0; i < aryImages.length; i++) {
    var preload = new Image();
    preload.src = aryImages[i];
  }

function swap(imgMain)
	{
	eval("document.all." + imgMain + ".src = aryImages[0]");
	}


var a;
a = '';
var b;
b = '';
var c;
c = '';
function doMenuOn (pstrSubID)
	{
	if (document.getElementById(pstrSubID))
		{
		if(a.length > 1)
			{
			setLayerVisibility(a, 'hidden');
			}
		if(b.length > 1)
			{
			setLayerVisibility(b, 'hidden');
			}
		if(c.length > 1)
			{
			setLayerVisibility(c, 'hidden');
			}
		a = pstrSubID;
		setPosition(a, bleft3);
		setLayerVisibility(pstrSubID, 'visible');
		}
	}

function doMenuOnB (pstrSubID)
	{
	if (document.getElementById(pstrSubID))
		{
		if(b.length > 1)
			{
			setLayerVisibility(b, 'hidden');
			}
		if(c.length > 1)
			{
			setLayerVisibility(c, 'hidden');
			}
		b = pstrSubID;
		setPosition(b, bleft4);
		setLayerVisibility(pstrSubID, 'visible');
		}
	}

function doMenuOnC (pstrSubID)
	{
	if (document.getElementById(pstrSubID))
		{
		if(c.length > 1)
			{
			setLayerVisibility(c, 'hidden');
			}
		c = pstrSubID;
		setPosition(c, bleft5);
		setLayerVisibility(pstrSubID, 'visible');
		}
	}

function offLayer (pstrLayer)
{
if (pstrLayer == 'Layer1')
{
if(a.length > 1)
{
setLayerVisibility(a, 'hidden');
}
if(b.length > 1)
{
setLayerVisibility(b, 'hidden');
}
if(c.length > 1)
{
setLayerVisibility(c, 'hidden');
}
}
}

	function SendEmail()
	{
		frm.command.value = "RequestEmail";
		frm.submit();
	}

var z;
z = '';

var x;
x = '100';

var y;
y = '';

function closeInfo(pstrID)
	{
	if(z.length > 0)
	{
	setLayerDisplay('c' + z, 'none');
	setLayerDisplay ('s' + z, 'none');
	setLayerDisplay ('o' + z, 'block');
	}
	}

function openInfo(pstrID)
	{
	if(z.length > 0)
	{
	setLayerDisplay ('c' + z, 'none');
	setLayerDisplay ('s' + z, 'none');
	setLayerDisplay ('o' + z, 'block');
	}
	z = pstrID;
	setLayerDisplay ('o' + z, 'none');
	setLayerDisplay ('c' + z, 'block');
	setLayerDisplay ('s' + z, 'block');
	}


function ApplyNow(pstrID, pstrEmail)
	{
	frm.action = "Register.asp"
	frm.JobReference.value = pstrID;
	frm.JobEmail.value = pstrEmail;
	frm.submit();
	}
function ArrangeViewing(pstrID)
	{
	frmP.action = "Arrange_viewings_54.asp"
	frmP.command.value = "AddEng"
	frmP.PropReference.value = pstrID;
	alert(pstrID);
	frmP.submit();
	}
function PaymentSchedule()
	{
	if (frmit.resort.value == "DesertSprings") {
		frmit.action = "AlmanzoraPS_112_1.asp"
	}
	if (frmit.resort.value == "HarbourLights") {
		frmit.action = "AlmanzoraPS_112_1.asp"
	}
	if (frmit.resort.value == "PlayaMarques") {
		frmit.action = "AlmanzoraPS_112_1.asp"
	}
	if (frmit.resort.value == "Hills_Gardens_Villas") {
		frmit.action = "MajesticPS_113_1.asp"
	}
	if (frmit.resort.value == "Village") {
		frmit.action = "MajesticPS_113_1.asp"
	}
	if (frmit.resort.value == "ValleDelEste") {
		frmit.action = "RealPS_114_1.asp"
	}
	if (frmit.resort.value == "ValleDelSol") {
		frmit.action = "RealPS_114_1.asp"
	}
	if (frmit.resort.value == "MosaTrajectum") {
		frmit.action = "KeyPS_115_1.asp"
	}
	if (frmit.resort.value == "AlmanzoraCountryClub") {
		frmit.action = "WorldwidePS_116_1.asp"
	}
	if (frmit.resort.value == "ElValle") {
		frmit.action = "PolarisPS_117_1.asp"
	}
	if (frmit.resort.value == "LaTorre") {
		frmit.action = "PolarisPS_117_1.asp"
	}
	if (frmit.resort.value == "MarMenor") {
		frmit.action = "PolarisPS_117_1.asp"
	}
	frmit.submit();
	}
function ViewInspection()
	{
	if (frmit.resort.value == "DesertSprings") {
		frmit.action = "AlmanzoraIT_124_1.asp"
	}
	if (frmit.resort.value == "HarbourLights") {
		frmit.action = "AlmanzoraIT_124_1.asp"
	}
	if (frmit.resort.value == "PlayaMarques") {
		frmit.action = "AlmanzoraPS_124_1.asp"
	}
	if (frmit.resort.value == "Hills_Gardens_Villas") {
		frmit.action = "MajesticIT_125_1.asp"
	}
	if (frmit.resort.value == "Village") {
		frmit.action = "MajesticIT_125_1.asp"
	}
	if (frmit.resort.value == "ValleDelEste") {
		frmit.action = "Real_Villa_GolfIT_126_1.asp"
	}
	if (frmit.resort.value == "ValleDelSol") {
		frmit.action = "Real_Villa_GolfIT_126_1.asp"
	}
	if (frmit.resort.value == "MosaTrajectum") {
		frmit.action = "Key_ResortsIT_127_1.asp"
	}
	if (frmit.resort.value == "AlmanzoraCountryClub") {
		frmit.action = "WorldwideIT_128_1.asp"
	}
	if (frmit.resort.value == "ElValle") {
		frmit.action = "Polaris_WorldIT_129_1.asp"
	}
	if (frmit.resort.value == "LaTorre") {
		frmit.action = "Polaris_WorldIT_129_1.asp"
	}
	if (frmit.resort.value == "MarMenor") {
		frmit.action = "Polaris_WorldIT_129_1.asp"
	}
	frmit.submit();
	}
function PropertyInfo()
	{
	if (frmit.resort.value == "DesertSprings") {
		frmit.action = "D1_118_1.asp"
	}
	if (frmit.resort.value == "HarbourLights") {
		frmit.action = "D1_118_1.asp"
	}
	if (frmit.resort.value == "PlayaMarques") {
		frmit.action = "D1_118_1.asp"
	}
	if (frmit.resort.value == "Hills_Gardens_Villas") {
		frmit.action = "D2_119_1.asp"
	}
	if (frmit.resort.value == "Village") {
		frmit.action = "D2_119_1.asp"
	}
	if (frmit.resort.value == "ValleDelEste") {
		frmit.action = "D2_120_1.asp"
	}
	if (frmit.resort.value == "ValleDelSol") {
		frmit.action = "D2_120_1.asp"
	}
	if (frmit.resort.value == "MosaTrajectum") {
		frmit.action = "D2_121_1.asp"
	}
	if (frmit.resort.value == "AlmanzoraCountryClub") {
		frmit.action = "D2_122_1.asp"
	}
	if (frmit.resort.value == "ElValle") {
		frmit.action = "D2_123_1.asp"
	}
	if (frmit.resort.value == "LaTorre") {
		frmit.action = "D2_123_1.asp"
	}
	if (frmit.resort.value == "MarMenor") {
		frmit.action = "D2_123_1.asp"
	}
	frmit.submit();
	}
function Calculate()
	{
	  	frm.command.value = "Calculator";
		frm.submit();
	}
function checkNumeric(objName,minval, maxval,comma,period,hyphen)
{
	var numberfield = objName;
	if (chkNumeric(objName,minval,maxval,comma,period,hyphen) == false)
	{
		numberfield.select();
		numberfield.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function chkNumeric(objName,minval,maxval,comma,period,hyphen)
{
// only allow 0-9 be entered, plus any values passed
// (can be in any order, and don't have to be comma, period, or hyphen)
// if all numbers allow commas, periods, hyphens or whatever,
// just hard code it here and take out the passed parameters
var checkOK = "0123456789" + comma + period + hyphen;
var checkStr = objName;
var allValid = true;
var decPoints = 2;
var allNum = "";

for (i = 0;  i < checkStr.value.length;  i++)
{
ch = checkStr.value.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{	
alertsay = "Please enter only these values \""
alertsay = alertsay + checkOK + "\" in the \"" + checkStr.name + "\" field."
alert(alertsay);
return (false);
}

// set the minimum and maximum
var chkVal = allNum;
var prsVal = parseInt(allNum);
if (chkVal != "" && !(prsVal >= minval && prsVal <= maxval))
{
alertsay = "Please enter a value greater than or "
alertsay = alertsay + "equal to \"" + minval + "\" and less than or "
alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + checkStr.name + "\" field."
alert(alertsay);
return (false);
}
}
function ChangeSacrifice()
	{
	if(x.length > 0)
	{
	setLayerDisplay ('Sacrifice_Option_' + x, 'none');
	}
	x = hiddenXML.Commission_Style.value;
	setLayerDisplay ('Sacrifice_Option_' + x, 'block');
	}
function ChangeValue()
	{
	setLayerDisplay ('Value_' + y, 'none');
	var tt = document.getElementById("Sacrifice_Option_" + x)
	y = tt.value;
	setLayerDisplay ('Value_' + y, 'block');
	hiddenXML.Sacrifice_Value.focus();
	}
function CheckTermForm()
	{
	var str = hiddenXML.Sacrifice_Value.value
	if (str.length > 0){
		hiddenXML.Sacrifice_Value.value = str.replace(/£/,"")
		hiddenXML.Sacrifice_Value.value = str.replace(/</,"")
		hiddenXML.Sacrifice_Value.value = str.replace(/>/,"")
	}
	var str = hiddenXML.Gross_Interest_Rate.value
	if (str.length > 0){
		hiddenXML.Gross_Interest_Rate.value = str.replace(/£/,"")
		hiddenXML.Gross_Interest_Rate.value = str.replace(/</,"")
		hiddenXML.Gross_Interest_Rate.value = str.replace(/>/,"")
	}
	var str = hiddenXML.Cover_Interest_Rate.value
	if (str.length > 0){
		hiddenXML.Cover_Interest_Rate.value = str.replace(/£/,"")
		hiddenXML.Cover_Interest_Rate.value = str.replace(/</,"")
		hiddenXML.Cover_Interest_Rate.value = str.replace(/>/,"")
	}


	alert(hiddenXML.Sacrifice_Value.value)
}
function checkValueValid (){
	var tt = document.getElementById("Sacrifice_Option_" + x)
	y = tt.value;
	if (y == "") {
		checkNumeric (myElement,0,0,',','.','-')
	}
	if (y == "112") {
		checkNumeric (myElement,0,200,',','.','-')
	}
	if (y == "113") {
		checkNumeric (myElement,0,99.99,',','.','-')
	}
	if (y == "115") {
		checkNumeric (myElement,0.01,25,',','.','-')
	}
	if (y == "198") {
		checkNumeric (myElement,0,0,',','.','-')
	}
	if (y == "114") {
		checkNumeric (myElement,0,100000,',','.','-')
	}
}
var myElement
myElement = ''
function SaveID (obj){
	myElement = obj;
}
function DownloadIDD (Branch) {
	var tt = document.getElementById("iddcheck");
	tt.disabled = false;
	open( Branch + 'IDD.pdf', "IDD");
}
function DownloadIDD2 (Branch) {
	var tt = document.getElementById("iddcheck");
	tt.disabled = false;
	open( 'http://www.personaltouchfs.org.uk/templatebuilder/' + Branch + '/IDD.pdf', "IDD");
}
function IDDCheck () {
	var tt = document.getElementById("iddcheck");
	if (tt.checked) {
		var tt = document.getElementById("iddcontinue");
		tt.disabled = false;
	}
}
function SubmitIDD () {
	var tt = document.getElementById("IDD");
	if (bType == "IE")
	tt.style.display='none'; 
	if (bType == "NN")
	eval("document." + pstrID + ".display='none'"); 
	if (bType == "MO" || bType == "OP") 
	eval("document.getElementById('" + pstrID + "').style.display='none'"); 
	var tt = document.getElementById("XMLDATA");
	tt.submit();
}
function GetQuoteIDD () {
	var tt = document.getElementById("IDD");
	if (bType == "IE")
		tt.style.top='235';
		tt.style.width='500';
		bleft = document.body.clientWidth;
		if (bleft <= 762)
			{
			bleft = 762;
			}
		bleft = bleft / 2 - 160;
		tt.style.left = bleft;
		tt.style.display='inline';
	if (bType == "NN")
	eval("document." + pstrID + ".display='inline'"); 
	if (bType == "MO" || bType == "OP") 
	eval("document.getElementById('" + pstrID + "').style.display='inline'"); 
}
function CancelIDD () {
	var tt = document.getElementById("IDD");
	if (bType == "IE")
	tt.style.display='none'; 
	if (bType == "NN")
	eval("document." + pstrID + ".display='none'"); 
	if (bType == "MO" || bType == "OP") 
	eval("document.getElementById('" + pstrID + "').style.display='none'"); 
}
function windowchange()
{
	var tt = document.getElementById("IDD");
	if (length.tt > 0) {
	if (bType == "IE")
		tt.style.top='300';
		tt.style.width='500';
		bleft = document.body.clientWidth;
		if (bleft <= 762)
			{
			bleft = 762;
			}
		bleft = bleft / 2 - 160;
		tt.style.left = bleft;
	if (bType == "NN")
	eval("document." + pstrID + ".display='inline'"); 
	if (bType == "MO" || bType == "OP") 
	eval("document.getElementById('" + pstrID + "').style.display='inline'"); 
}
}
function loadcontent()
{
document.getElementById("newcontent").innerHTML = document.getElementById("content").innerHTML;
document.getElementById("content").innerHTML = ""
}
var newwindow;
function poptastic(url)
{
	newwindow=window.open(url,'name','height=275,width=400');
	if (window.focus) {newwindow.focus()}
}