<!-- Hide script from old browsers
// Make sure file is not hosted in a different frameset
if ( top.location.href != window.location.href )
  { top.location.href=window.location.href }

    function openWindow(url, w, h) {
        var windowprops = "width=" + w + ",height=" + h +",,left=10,top=10,scrollbars=yes,status=no,toolbar=no,location=no,directories=no,resizable=yes";
          popup = window.open(url,'newWin',windowprops);
          popup.focus();
           } 
        
	function openPicture(pic,w,h) {
     
     	var wpro = w + 20;
     	var hpro = h + 50;
		var windowprops = "left=160,top=50,scrollbars=no,status=no,toolbar=no,location=no,directories=no,resizable=no,width=" + wpro + ",height=" + hpro;
          
		picture = window.open('','newPicture',windowprops);
		picture.close();
        picture = window.open('','newPicture',windowprops);  
        picture.focus();
        
		picture.document.write("<html><head><title>Picture<\/title><link href='common\/cstyle.css' type=text\/css rel=stylesheet><\/head><body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'bgcolor='#000000'>")
		picture.document.writeln("<table width='100%' border='0' cellpadding='5'><tr><td align='center' valign='middle'>")
		picture.document.writeln("<img src=" + pic + " width=" + w + " height=" + h + "></td></tr></table>")
		picture.document.write("<center><a href='#' OnClick='window.close();' class='messageLink'>Close</a></center>")
		picture.document.write("<\/body><\/html>")
	}                
 
function showdate()
{
	
		// Determine the current date and display it
   	var today = new Date();
   	var day = today.getDay();
   	var date = today.getDate();
   	var month = today.getMonth();
   	var year = today.getFullYear();
   	
   		//January,February,March,April,May,June,July,August,September,October,November,December
   	if (month == 0) {month='Jan'};
   	if (month == 1) {month='Feb'};
   	if (month == 2) {month='Mar'};
   	if (month == 3) {month='Apr'};
   	if (month == 4) {month='May'};
   	if (month == 5) {month='Jun'};
   	if (month == 6) {month='Jul'};
   	if (month == 7) {month='Aug'};
   	if (month == 8) {month='Sept'};
   	if (month == 9) {month='Oct'};
   	if (month == 10) {month='Nov'};
   	if (month == 11) {month='Dec'};
   
   	if (day == 0) {day='Sunday'};
   	if (day == 1) {day='Monday'};
   	if (day == 2) {day='Tuesday'};
   	if (day == 3) {day='Wednesday'};
   	if (day == 4) {day='Thursday'};
   	if (day == 5) {day='Friday'};
   	if (day == 6) {day='Saturday'};
   
   if ( document.all ) {
		document.write ('<span class="small">&nbsp;&nbsp;' + day + ', ' + month +  ' ' + date + ', ' + year + '</span>');
	} else {
		document.write ('<span class="smallNC">&nbsp;&nbsp;' + day + ', ' + month +  ' ' + date + ', ' + year +  '</span>');
	}
   
   
}

function switchClass(obj,strClassName) {
		obj.className	= strClassName;
	}
	
function gotoURL(strUrl) {
		location = strUrl;
	}

function copyrightYear(startYear)
	{
		d = new Date();
		
		if (startYear != d.getFullYear())
			{
			return startYear + " - " + d.getFullYear();
			}
		else
			{
			return startYear;
			}
	}
	
	// Show current date in format "Nov 15, 2003".		
function nsDate()
{
		// Get today's date.
	var sDate = new Date();
	var sToday = "";
	
		// Array with months.
	var aMonths = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	
		// Get current month.
	var iMonth = sDate.getMonth();
		
		// Get current hour,minute,second.
	var iHours   = sDate.getHours();
	var iMinutes = sDate.getMinutes();
	var iSeconds = sDate.getSeconds();
			
	sToday = "";
		// Get today's date string.
	sToday += aMonths[iMonth] + " ";
	sToday += sDate.getDate() + ", ";
	sToday += sDate.getFullYear() + " ";

		// Display the date on the screen.
	document.write("<b>"+sToday+"</b>");	
}

	// Get the current date in format "Nov 15, 2003  12:53:23 pm".
function today()
{
	var ie4=document.all;
    var ns4=document.layers;
    var ns6=document.getElementById&&!document.all;
    	
		// Get today's date.
	var sDate = new Date();
	var sToday = "";
	
		// Array with months.
	var aMonths = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	
		// Get current month.
	var iMonth = sDate.getMonth();
		
		// Get current hour,minute,second.
	var iHours   = sDate.getHours();
	var iMinutes = sDate.getMinutes();
	var iSeconds = sDate.getSeconds();
	
		// If iHour > 12.
	if(iHours>12)
		iHours = iHours - 12;
	
	if(iMinutes < 10)
		iMinutes = "0" + iMinutes;
		
	if(iSeconds < 10)
		iSeconds = "0" + iSeconds;
	
	sToday = "";
		// Get today's date string.
	sToday += aMonths[iMonth] + " ";
	sToday += sDate.getDate() + ", ";
	sToday += sDate.getFullYear() + " ";
	
	sToday += iHours + ":";
	sToday += iMinutes + ":" ;
	sToday += iSeconds; 

	
		// Set am or pm
	if(sDate.getHours() < 12)
		sToday += " am ";
	else
		sToday += " pm ";
	
		// Display the date on the screen.
	
		// Write the clock to the layer:
	if (ns4) 
	{
		return;
	} 
	else 
		if (ie4) 
		{
			document.getElementById("LiveClock").innerHTML = "<b>"+sToday+"</b>";
		}	 
		else 
			if (ns6)
			{
				document.getElementById("LiveClock").innerHTML = "<b>"+sToday+"</b>";
            }            
	
		setTimeout("today()",1000);
		//window.setInterval(today(),100);
}


// (c) http://insighteye.com
function checkCheckBox(f)
{
	if (f.Name.value == "" )
	{
		alert("Please enter your full name.");
		f.Name.focus();
		return false;
	}
	
	if (f.postcode.value == "" )
	{
		alert("Please enter your postcode.");
		f.postcode.focus();
		return false;
	}
	
	if (f.Email.value == "" )
	{
		alert("Please enter your email address.");
		f.Email.focus();
		return false;
	}
	
	
	
	if (!validEmail(f.Email.value) )
	{
		alert("Please enter a valid email address.");
		f.Email.focus();
		return false;
	}
	
	if (f.agree.checked == false )
	{
		alert("Before continuing, please tick the box to confirm your acceptance of our terms and conditions.");
		return false;
	}
	
	
	
	return true;
}


function validEmail(email)
{
		
	if ((email.length < 3) || (email.length > 50) || 
		(email.charAt(0) == '@') || (email.charAt(email.length-1) == '@') || 
		(email.charAt(0) == '.') || (email.charAt(email.length-1) == '.') || 
		(email.indexOf('.') == -1) || (email.indexOf('@') == -1) ||
		(email.indexOf('@') != email.lastIndexOf('@')) || 
		(email.indexOf(' ') > 0) || (email.indexOf('?') > 0) || (email.indexOf('..') > 0)
		)
	{
		return false;
	}
	else
	{
		return true;
	}
}

function emptyvalidation(entered, alertbox)
{

// Emptyfield Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} document.contactform.Name.focus(); return false;}
else {return true;}
}
} 


//DO NOT REMOVE THIS COPYWRITE INFO!
//Mortgage Refinancing Calculator
//By Daniel C. Peterson
//Web Winder Website Services, 1997-2003  All Rights Reserved.
//Distribution, editing or reselling of this script is strictyly prohibited
//without expressed written permission from Daniel C. Peterson.
//For commercial grade (professional) versions of this and many other
//calculators, visit http://www.webwinder.com.

function computeForm(form) {

    var pmt1 = form.payment.value;

    var prin1 = form.principal.value;

    var intPort1 = 0;

    var prinPort1 = 0;

    var accumInt1 = 0;

    var accumPrin1 = 0;

    var i1 = form.intRate.value;

    if (i1 > 1.0) {

        i1 = i1 / 100.0;

        form.intRate.value = i1;

    }

    var i1  = i1  / 12;

    var i2 = form.intRate2.value;

       if (i2 > 1.0) {

           i2 = i2 / 100.0;

           form.intRate2.value = i2;

       }

       var i2  = i2  / 12;

    var count1 = 0;

    while(prin1 > 0) {

        intPort1 = prin1 * i1;

        prinPort1 = pmt1 - intPort1;

        prin1 = prin1 - prinPort1;

        accumPrin1 = accumPrin1 + prinPort1;

        accumInt1 = accumInt1 + intPort1;

        count1 = count1 + 1;

        if(count1 > 600) {break; } else {continue; }

       }


    var pow = 1;

    for (var j = 0; j < form.nper2.value *12; j++)

        pow = pow * (1 + i2);

    var fpayment2 = (form.principal.value * pow * i2) / (pow - 1);

    form.payment2.value = "£" + parseInt(fpayment2,10) + "." + parseInt(fpayment2 % 1 * 100,10);

   var fmoSave = form.payment.value - fpayment2;

   form.moSave.value = "£" + parseInt(fmoSave,10) + "." + parseInt(fmoSave % 1 *100,10);
		
		var ftotInt2 = (fpayment2 * form.nper2.value *12)
    - form.principal.value;


   var fintSave = accumInt1 - ftotInt2;



    form.closeMo.value = parseInt(form.closingCost.value / fmoSave,10);

   var fnetSave = fintSave - form.closingCost.value;


    form.summary.value = "If you switch from your current " + parseInt(form.intRate.value *100,10) + "." + parseInt(form.intRate.value *100 % 1 *100,10) + "% mortgage to a " + parseInt(form.intRate2.value *100,10) + "." + parseInt(form.intRate2.value *100 % 1 *100,10) + "% mortgage, your monthly payment will drop by " + form.moSave.value + ". However, in order for this remortgaging to produce any savings at all you will need to stay in your current home for at least " + form.closeMo.value + " months.  That's how long it will take for your monthly payment savings to offset the costs involved in arranging your new mortgage.";
		
}



function clearForm(form)

{

    form.principal.value = "";
    form.payment.value = "";
    form.intRate.value = "";
    form.intRate2.value = "";
    form.nper2.value = "";
    form.closingCost.value = "";
    form.payment2.value = "";
    form.moSave.value = "";
    form.closeMo.value = "";
    form.intSave.value = "";
    form.origInt.value = "";
    form.netSave.value = "";
    form.totInt2.value = "";
    form.summary.value = "";

}


// End hiding script from old browsers -->

