function killAutofill(){
  is = document.getElementsByTagName("INPUT");
  for(i=0;i<is.length;i++)
    is[i].style.backgroundColor = "";
  ss = document.getElementsByTagName("SELECT");
  for(i=0;i<ss.length;i++)
    ss[i].style.backgroundColor = "";
}
window.onload=killAutofill;

function focusName(element) {
  if (element.value == " name...") {
    element.value = "";
  }
}

function blurName(element) {
  if (element.value == "") {
    element.value = " name...";
  }
}

function focusEmail(element) {
  if (element.value == " email...") {
    element.value = "";
  }
}

function blurEmail(element) {
  if (element.value == "") {
    element.value = " email...";
  }
}

function checkName(str)
{
        var vname = str
		if (vname == " name...")
             return false;
        if (vname == "")
             return false;
        return true;
}
function checkEmail(str)
{
        var apos = str.indexOf("@");
        var dpos = str.indexOf(".");
        var epos = str.indexOf("]");
        var fpos = str.indexOf("[");     
        if (apos<=0 || dpos<=0 || epos>0 || fpos>0 )
             return false;
        if (dpos+1>=str.length)
             return false;
        return true;
}
function ValidateForm()
{
        if (!checkName(document.theForm.name.value)){
                alert("Please enter your first name.");
                return false;
        }
		if (!checkEmail(document.theForm.email.value)){
                alert("Please enter a valid email address.");
                return false;
        }
	return true;
}

//no spam email address
var user;
var domain;
var suffix;
function nospam(user,domain,suffix) {
	document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + user + '@' + domain + '.' + suffix + '</a>');
}

function nospamsml(user,domain,suffix) {
	document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '" class="lnkNBlack10UL">' + user + '@' + domain + '.' + suffix + '</a>');
}

//netscape css fix

function WM_netscapeCssFix() {
   if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}

function WM_netscapeCssFixCheckIn() {
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
      document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.WM_netscapeCssFix = new Object;
      document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
      document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = WM_netscapeCssFix;
  }
}

WM_netscapeCssFixCheckIn()

//prevents window from capture in frames

if (top.location != self.location) {
        top.location = self.location
}

//popup windows for references

function popupWindow(referenceHTML, w, h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	windowProperties = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable'
	reference = window.open(referenceHTML, 'refName', windowProperties)
	if (parseInt(navigator.appVersion) >= 4) { reference.window.focus(); }
	}

//popup windows for calculators

function popupCalculator(mypage,myname,w,h,scroll) {
	var wi = screen.width - 100;
	var he = screen.height - 100;
	var winl = (screen.width - wi) / 2;
	var wint = ((screen.height - he) / 2) - 20;
	winprops = 'height='+he+',width='+wi+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function PrintThisPage() 
{ 
	var w = 700;
	var h = 450;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	var sOption = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable'
   	var sWinHTML = document.getElementById('contentarea').innerHTML; 
   	var winprint=window.open("","",sOption);
       winprint.document.open(); 
       winprint.document.write('<html><head><title>Real Choice Mortgages - Home Loans, Investment Loans, Finance - Real Choice Mortgages, Croydon, Melbourne, Australia</title>'); 
       winprint.document.write('<link rel="stylesheet" href="http://www.tonychartres.com.au/inc/artlandishprint.css" type="text/css">'); 
       winprint.document.write('</head>'); 
       winprint.document.write('<body><a name="top"></a>'); 
       winprint.document.write('<table width="100%" "cellpadding="0" cellspacing="0"><tr><td align="left" class="txtNBlue11"><b>Real Choice Mortgages - 1300 555 645</b><br>');
	   winprint.document.write('<a href="mailto:enquiries@tonychartres.com.au" class="lnkNBlue11HL">enquiries@tonychartres.com.au</a><br><br></td>');
	   winprint.document.write('<td align="right"><span class="txtNBlack10">[<a href="javascript:window.close()" class="lnkNBlack10HL">close window</a>]</span></td></tr></table>'); 
       winprint.document.write(sWinHTML);          
       winprint.document.write('</body></html>'); 
       winprint.document.close(); 
       winprint.focus(); 
}
