function validate() {
	var email=document.contactUsForm.txtEmail.value;
	var surname=document.contactUsForm.txtSurname.value;

	if (email=="")
	{
		alert("- Please fill in all required fields.");
		return false;
	}
	else if (surname=="")
	{
		alert("- Please fill in all required fields.");
		return false;
	}
	else if (document.contactUsForm.txtFirstname.value=="")
	{
		alert("- Please fill in all required fields.");
		return false;
	}
	else if (document.contactUsForm.txtComments.value=="")
	{
		alern("- Please fill in all required fields.");
		return false;
	}
	else if (email.indexOf("@")==-1)
	{
		alert("- Invalid email address.");
		return false;
	}
	else
	{
		return true;
	}
}

function FlashRefinance() {
    var liveURL = "http://www.maximlending.com.au/";
    var devURL = "http://staging1.freestylemedia.com.au/maxim";
    var flashPath = "flash/";
    var flashName = "Promotion05.swf?Rate=7.47";
    var completeFlashPath = flashPath + flashName + "&domain="+liveURL;

    if(location.href.indexOf('staging1') > 0 ) 
    {
        completeFlashPath = flashPath + flashName + "&domain="+devURL;
    }
    // <![CDATA[	
							
		var fo = new FlashObject(completeFlashPath, "flashRefinance", "177", "180", "8", "#FFFFFF");
		fo.write("flashRefinance");
     // ]]>     
}

function FlashSubRefinance() {
    var liveURL = "http://www.maximlending.com.au/";
    var devURL = "http://staging1.freestylemedia.com.au/maxim/";
    var flashPath = "flash/";
    var flashName = "SubPromotion05.swf?Rate=7.47";
    var completeFlashPath = liveURL + flashPath + flashName + "&domain=" + liveURL;

    if(location.href.indexOf('staging1') > 0 ) 
    {
        completeFlashPath = devURL + flashPath + flashName + "&domain="+devURL;
    }
    // <![CDATA[	
							
		var fo = new FlashObject(completeFlashPath, "flashSubRefinance", "177", "121", "8", "#FFFFFF");
		fo.write("flashSubRefinance");
     // ]]>     
}

function FlashNews() {
    var liveURL = "http://www.maximlending.com.au/";
    var devURL = "http://staging1.freestylemedia.com.au/maxim";
    var flashPath = "flash/";
    var flashName = "homeHeader_02.swf";
    var completeFlashPath = flashPath + flashName + "?domain=" + liveURL;

    if(location.href.indexOf('staging1') > 0 ) 
    {
        completeFlashPath = flashPath + flashName + "?domain="+devURL;
    }
    // <![CDATA[	
							
		var fo = new FlashObject(completeFlashPath, "flashNews", "420", "17", "8", "#FFFFFF");
		fo.write("newsflash");
     // ]]>     
}        

function popup(id) {
        identity = document.getElementById(id);
        
	if (id == "banner01") {
            document.getElementById("banner02").style.visibility = "hidden";
            document.getElementById("banner03").style.visibility = "hidden";
            document.getElementById("banner04").style.visibility = "hidden";
            identity.style.visibility = "visible";
        }
        else if (id == "banner02") {
            document.getElementById("banner01").style.visibility = "hidden";
            document.getElementById("banner03").style.visibility = "hidden";
            document.getElementById("banner04").style.visibility = "hidden";
            identity.style.visibility = "visible";
        }
        else if (id == "banner03") {
            document.getElementById("banner01").style.visibility = "hidden";
            document.getElementById("banner02").style.visibility = "hidden";
            document.getElementById("banner04").style.visibility = "hidden";
            document.getElementById("banner03").style.visibility = "visible";
        }
        else if (id == "banner04") {
            document.getElementById("banner01").style.visibility = "hidden";
            document.getElementById("banner02").style.visibility = "hidden";
            document.getElementById("banner03").style.visibility = "hidden";
            document.getElementById("banner04").style.visibility = "visible";
        }   
}

function open_win(url_add)
{
   window.open(url_add,'calculator','width=640,height=350,menubar=no,status=no,location=no,toolbar=no,scrollbars=no');
}

function hoverEffect(id) {
    if (id == "firstHomeBuyer") {
        document.getElementById("firstHomeBuyer").style.backgroundImage = "url(images/home/bg-first-home-buyers-over.gif)";
    }
    else if (id == "investingInProperty") {
        document.getElementById("investingInProperty").style.backgroundImage = "url(images/home/bg-investing-over.gif)";
    }
    else if (id == "movingHouses") {
        document.getElementById("movingHouses").style.backgroundImage = "url(images/home/bg-refinancing-over.gif)";
    }
    else if (id == "selfEmployed") {
        document.getElementById("selfEmployed").style.backgroundImage = "url(images/home/bg-self-employed-over.gif)";
    }
}

function rollOut(id) {
    if (id == "firstHomeBuyer") {
        document.getElementById("firstHomeBuyer").style.backgroundImage = "url(images/home/bg-first-home-buyers.gif)";
    }
    else if (id == "investingInProperty") {
        document.getElementById("investingInProperty").style.backgroundImage = "url(images/home/bg-investing.gif)";
    }
    else if (id == "movingHouses") {
        document.getElementById("movingHouses").style.backgroundImage= "url(images/home/bg-refinancing.gif)";
    }
    else if (id == "selfEmployed") {
        document.getElementById("selfEmployed").style.backgroundImage= "url(images/home/bg-self-employed.gif)";
    }
}
