// NB Purchase mortgage website URL hardcoded in.

// Faster loading for mouseover images.
function pre_load()
  {
  var d=document;
  if(d.images)
    {
    if(!d.pre_save) d.pre_save=new Array();
    var i,j=d.pre_save.length,a=pre_load.arguments;
    for(i=0; i<a.length; i++)
      {
      if (a[i].indexOf("#")!=0)
        {
        d.pre_save[j]=new Image; d.pre_save[j++].src=a[i];
        }
      }
    }
  }

// Hunt the widget.
function find_obj(n,d)
  {
  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=find_bj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n);
  return x;
 }

// Mouse move.
function img_back()
  {
  var i,x,a=document.img_save;
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  }
function img_swap()
  {
  var i,j=0,x,a=img_swap.arguments;
  document.img_save=new Array;
  for(i=0;i<(a.length-2);i+=3)
  if((x=find_obj(a[i]))!=null)
    {
    document.img_save[j++]=x;
    if(!x.oSrc) x.oSrc=x.src;
    x.src=a[i+2];
    }
 }

/*
// Redirect for purchases.
function am_move(purl,rurl)
  {
  if(document.getElementById("am01").value=="buy")
    {
    window.location=purl
    }
  if(document.getElementById("am01").value=="rent")
    {
    window.location=rurl
    }
  }
*/

// Redirect for purchases.
function mt_move(purl)
  {
  if(document.getElementById("mt01").value=="purchase")
    {
    window.location=purl
    }
  }

// Show the full address.
function show_fa()
  {
  document.getElementById("fa01").style.display='';
  document.getElementById("fa02").style.display='';
  document.getElementById("fa03").style.display='';
  document.getElementById("fa04").style.display='none'
  }

// Look up the address from PAF.
function look_fa()
  {
  	
  pcaFastAddressBegin
      (document.getElementById('postcode').value,

       document.getElementById('building').value,
       'english',
       'simple',
       'mindc11111', 
       'bb17-kw64-mc37-xf99','', ''
      )
	//alert("sadasdas");
  document.getElementById("fa01").style.display='';
  document.getElementById("fa02").style.display='';
  document.getElementById("fa03").style.display='';
  document.getElementById("fa04").style.display='none'
  
  //alert("sadasdas");
  }

// Show the second applicant.
function show_sa()
  {
  document.getElementById("sa01").style.display='';
  document.getElementById("sa02").style.display='';
  document.getElementById("sa03").style.display='';
  document.getElementById("sa04").style.display='';
  }

// Hide the second applicant.
function hide_sa()
  {
  document.getElementById("sa01").style.display='none';
  document.getElementById("sa02").style.display='none';
  document.getElementById("sa03").style.display='none';
  document.getElementById("sa04").style.display='none';
  }

// Show the other loans table.
function show_ol()
  {
  document.getElementById("oloans").style.display='';
  }

// Hide the other loans table.
function hide_ol()
  {
  document.getElementById("oloans").style.display='none';
  }

// Display HTML in a popup.
function PopWindow(w,h,url)
  {
  winl=(screen.width-w)/2;
  wint=(screen.height-h)/2;
  winprops='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes'+',resizable=yes';
  win=window.open(url,'GasAndElectricity',winprops);
  if(parseInt(navigator.appVersion)>=4){win.window.focus();}
  }
