function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01 
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { 
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p); } 
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; 
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
if(!x && d.getElementById) x=d.getElementById(n); return x; 
}
function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following text fields must be completed:\n'+errors);
  document.MM_returnValue = (errors == '');
}

String.prototype.fullTrim = function(){
  theString = this.replace(/\s+/g," ");
  theString = theString.replace(/^\s*([\S\s]*\S+)\s*$/,"$1");
  return (theString==" ")?"":theString;
}

function ClearEmailBox(txt,defaulttxt) {
	if (txt.value == defaulttxt)
	txt.value="";
  }

function B1_onclick()
 {
	var temp;
	temp=document.subscribe.email.value;
	
		if(!(validate(temp)))
		{
		//alert(temp)
		 document.subscribe.email.focus();
		 return false;	
		}
		else
		{
		  if(document.subscribe.email.value=='')
			{
			alert("Please enter email")
			document.subscribe.email.focus();
			}
			else
			document.subscribe.submit()
		}	
}

function validate(emailad) {

var exclude=/[^@\-\.\w]|^[@\.\-]|[\.\-]{2}|[@\.]{2}|(@)[^@]*\1/;
var check=/@[\w\-]+\./;
var checkend=/\.[a-zA-Z]{2,3}$/;
	if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){
		alert("Please enter valid email address");
		document.subscribe.email.focus();
		return false;
	}
return true;
}

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@")
dotpos=value.lastIndexOf(".")
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false}
else {return true}
}
}

function FormDL_Validator(Form)
{
// check to see if the field is blank
	
if (Form.Name.value == "")
	{
	alert("Please enter your name");
	Form.Name.focus();
	return (false);
	}


with (Form)
{
if ((Form.Email.value==null)||(Form.Email.value=="")){
		alert("Please Enter Your Email Address")
		Form.Email.focus()
		return false
	}
if (validate_email(Email,"Your Email Address is Not Valid!")==false)
  {Form.Email.focus();return false}
}

if (Form.find_us.value == "")
	{
	alert("Please tell how did you find us.");
	Form.find_us.focus();
	return (false);
	}

}

function FormQ_Validator(Form)
{
// check to see if the field is blank
	
if (Form.Name.value == "")
	{
	alert("Please enter your name");
	Form.Name.focus();
	return (false);
	}

with (Form)
{
if ((Email.value==null)||(Email.value=="")){
		alert("Please Enter Your Email Address")
		Form.Email.focus()
		return false
	}
if (validate_email(Email,"Your Email Address is Not Valid!")==false)
  {Form.Email.focus();return false}
}


if (Form.question.value == "")
	{
	alert("Please enter your question.");
	Form.question.focus();
	return (false);
	}

}

function FormEnq_Validator(Form)
{
// check to see if the field is blank
	
if (Form.Name.value == "")
	{
	alert("Please enter your name");
	Form.Name.focus();
	return (false);
	}

with (Form)
{
if ((Email.value==null)||(Email.value=="")){
		alert("Please Enter Your Email Address")
		Form.Email.focus()
		return false
	}
if (validate_email(Email,"Your Email Address is Not Valid!")==false)
  {Form.Email.focus();return false}
}


if (Form.Message.value == "")
	{
	alert("Please enter your message.");
	Form.Message.focus();
	return (false);
	}
	
if (Form.password.value == "")
	{
	alert("Please enter Display Code.");
	Form.password.focus();
	return (false);
	}

}

function FormQuote_Validator(Form)
{
// check to see if the field is blank
	
if ( (Form.Name.value == "") || (Form.Name.value == "Full Name"))
	{
	alert("Please Enter Your Name");
	Form.Name.focus();
	return (false);
	}


with (Form)
{
if ((Form.Email.value==null)||(Form.Email.value=="") || (Form.Email.value=="E-mail Address")){
		alert("Please Enter Your Email Address")
		Form.Email.focus()
		return false
	}
if (validate_email(Email,"Your Email Address is Not Valid!")==false)
  {Form.Email.focus();return false}
}

if (Form.password.value == "")
	{
	alert("Please enter Display Code.");
	Form.password.focus();
	return (false);
	}

}


function FormRegister_Validator(Form)
{
// check to see if the field is blank
	
if ( Form.user.value == "")
	{
	alert("Please Enter Your Username");
	Form.user.focus();
	return (false);
	}

with (Form)
{
if ((Form.email.value==null)||(Form.email.value=="") ){
		alert("Please Enter Your Email Address")
		Form.email.focus()
		return false
	}
if (validate_email(email,"Your Email Address is Not Valid!")==false)
  {Form.email.focus();return false}
}

if (Form.email2.value == "")
	{
	alert("Please Re-enter Your Email Address.");
	Form.email2.focus();
	return (false);
	}
	
if (Form.email.value != Form.email2.value)
	{
	alert("Your Email Addresses do not match!");
	Form.email2.focus();
	return (false);
	}

if (Form.pass.value == "")
	{
	alert("Please Enter Your Password.");
	Form.pass.focus();
	return (false);
	}
	
if (Form.password2.value == "")
	{
	alert("Please Re-enter Your Password.");
	Form.password2.focus();
	return (false);
	}
	
if (Form.pass.value != Form.password2.value)
	{
	alert("Your Passwords do not match!");
	Form.password2.focus();
	return (false);
	}
	
}

function FormPassword_Validator(Form)
{
// check to see if the field is blank
	
if ( Form.curpass.value == "")
	{
	alert("Please Enter Your Current Password.");
	Form.curpass.focus();
	return (false);
	}

if (Form.newpass.value == "")
	{
	alert("Please Enter Your New Password.");
	Form.newpass.focus();
	return (false);
	}
}

function FormLogin_Validator(Form)
{
// check to see if the field is blank
	
if ( Form.user.value == "")
	{
	alert("Please Enter Your Username");
	Form.user.focus();
	return (false);
	}

if (Form.pass.value == "")
	{
	alert("Please Enter Your Password.");
	Form.pass.focus();
	return (false);
	}
}

function FormAdvice_Validator(Form)
{
// check to see if the field is blank
	
if (Form.Title.value == "")
	{
	alert("Please Select Your Title");
	Form.Title.focus();
	return (false);
	}

if (Form.Name.value == "")
	{
	alert("Please enter your name");
	Form.Name.focus();
	return (false);
	}
	
if (Form.Phone.value == "")
	{
	alert("Please enter your telephone number.");
	Form.Phone.focus();
	return (false);
	}
	
if (Form.DOB.value == "" || Form.DOB.value == "dd/mm/yyyy")
	{
	alert("Please enter your date of birth.");
	Form.DOB.focus();
	return (false);
	}

with (Form)
{
if ((Email.value==null)||(Email.value=="")){
		alert("Please Enter Your Email Address")
		Form.Email.focus()
		return false
	}
if (validate_email(Email,"Your Email Address is Not Valid!")==false)
  {Form.Email.focus();return false}
}


if (Form.mortgage_type.value == "")
	{
	alert("Please Select Your Buyer Type.");
	Form.mortgage_type.focus();
	return (false);
	}
	
if (Form.property_price.value == "")
	{
	alert("Please enter property price.");
	Form.property_price.focus();
	return (false);
	}
	
if (Form.amount_borrow.value == "")
	{
	alert("Please enter amount to borrow.");
	Form.amount_borrow.focus();
	return (false);
	}

}

function FormAdvice2_Validator(Form)
{
// check to see if the field is blank
	
if (Form.Title.value == "")
	{
	alert("Please Select Your Title");
	Form.Title.focus();
	return (false);
	}

if (Form.Name.value == "")
	{
	alert("Please enter your name");
	Form.Name.focus();
	return (false);
	}
	
if (Form.Phone.value == "")
	{
	alert("Please enter your telephone number.");
	Form.Phone.focus();
	return (false);
	}
	
if (Form.DOB.value == "" || Form.DOB.value == "dd/mm/yyyy")
	{
	alert("Please enter your date of birth.");
	Form.DOB.focus();
	return (false);
	}

with (Form)
{
if ((Email.value==null)||(Email.value=="")){
		alert("Please Enter Your Email Address")
		Form.Email.focus()
		return false
	}
if (validate_email(Email,"Your Email Address is Not Valid!")==false)
  {Form.Email.focus();return false}
}


}