function loadPhotoGallery(xml)
{
    var path = "";
    if(location.href.indexOf('/localhost/') > 0 )
    {
        path = "http://localhost/ampcapital/apps/";        
    } 
    else if(location.href.indexOf('/staging1.freestylemedia.com.au/') > 0 )
    {
        path = "http://staging1.freestylemedia.com.au/ampcapital/apps/";
    }
    else if(location.href.indexOf('www.retireaustralia.com.au') > 0)
    {
        path = "http://www.retireaustralia.com.au/apps/";
    }
	else 
	{
		path = "http://retireaustralia.com.au/apps/";
	}
    
    var fullpath = path + "Gallery.swf?xmlPath=" + xml;
    var so = new SWFObject(fullpath, "Gallery", "496", "740", "9", "#fff1d7");
	so.addParam("allowScriptAccess", "sameDomain");
	so.addParam("allowFullScreen","false");
	so.addParam("quality", "high");
	so.addParam("wmode", "transparent");
	so.useExpressInstall(path+'expressinstall.swf');
	so.write("flashPhotoGallery");

}

function loadMap()
{
    var path = "";
	var xmlPath = "";
	var cssPath = "";
    if(location.href.indexOf('/localhost/') > 0 )
    {
        path = "http://localhost/ampcapital/apps/";        
		xmlPath = "http://www.retireaustralia.com.au/feed/villagesmap.xml";
		cssPath = "http://www.retireaustralia.com.au/apps/flash.css";
    } 
    else if(location.href.indexOf('/staging1.freestylemedia.com.au/') > 0 )
    {
        path = "http://staging1.freestylemedia.com.au/ampcapital/apps/";
		xmlPath = "http://staging1.freestylemedia.com.au/ampcapital/feed/villagesmap.xml";
		cssPath = "http://staging1.freestylemedia.com.au/ampcapital/apps/flash.css";
    }
    else if(location.href.indexOf('www.retireaustralia.com.au') > 0)
    {
        path = "http://www.retireaustralia.com.au/apps/";
		xmlPath = "http://www.retireaustralia.com.au/feed/villagesmap.xml";
		cssPath = "http://www.retireaustralia.com.au/apps/flash.css";
    }
	else 
	{
		path = "http://retireaustralia.com.au/apps/";
		xmlPath = "http://retireaustralia.com.au/feed/villagesmap.xml";
		cssPath = "http://retireaustralia.com.au/apps/flash.css";
	}
    
    var fullpath = path + "VillagesMap.swf";
    var so = new SWFObject(fullpath, "Map", "510", "450", "9", "#ffffff");
	so.addParam("allowScriptAccess", "sameDomain");
	so.addParam("allowFullScreen","false");
	so.addParam("quality", "high");
	//so.addVariable("key","ABQIAAAAdJS_f4B9FQQvN8NYSBtCchQoaZLoEDPr8xbkbZ9wuzJrVxwylhRlQHWBuu8TTn8vCRXNETtslpulag"); //staging1 key
	so.addVariable("key","ABQIAAAAADWTM0yYFcrurhPyxzGVWxRQNIMSnH4urCL-3lgI9T9Z3V4GkhSKU2H2NN8zzqBZONrKZzftAI7p7Q"); //live key
	so.addVariable("xmlPath",xmlPath);
	so.addVariable("cssPath",cssPath);
	so.useExpressInstall(path+'expressinstall.swf');
	so.write("flashMap");

}

function changeTextSize(size)
{
	var body = document.body;
	if (size == "large")
		body.style.fontSize = "0.85em";
	else if (size == "xlarge")
		body.style.fontSize = "0.95em";
	else
		body.style.fontSize = "0.7em";
}



/* Making the text size drop down work for IE */

function dropDownForIE()
{
    if (document.all && document.getElementById)
	{
		var navRoot = document.getElementById("accessibility");
		navRoot.onmouseover=function()
		{
			this.className += "over";
		}
		navRoot.onmouseout=function()
		{
			this.className = this.className.replace("over", "");
		}
	}
}


/* input box text toggle */

function inputBoxTextToggleInit()
{
	if (document.getElementById && document.getElementById("txtName") && document.getElementById("txtEmail"))
	{
		var txtName = document.getElementById("txtName");
		var txtEmail = document.getElementById("txtEmail");
		inputBoxTextToggle(txtName, "Enter name here");
		inputBoxTextToggle(txtEmail, "Enter email address");
	}
}

function inputBoxTextToggle(txtElem, text)
{
	txtElem.onfocus = function()
	{
		if (txtElem.value == text)
			txtElem.value = "";
	}

	txtElem.onblur = function()
	{
		if (txtElem.value == "")
			txtElem.value = text;
	}
}



/* Onload */

init = function()
{
    // drop down menu for IE
    dropDownForIE();	

	// input box toggling
	inputBoxTextToggleInit();

}

window.onload = init
function map_onRollover(myId) {
    //alert(myId);
    thisMovie("Map").nav_Rollover(myId);
}

//finds flash movie plugin consistently across browsers
function thisMovie(movieName) {
    return document.getElementById(movieName);
}

RegisterShowAllButton = function()
{
    if($(".showAll").length != 0)
    {
	var height = $("#popupFacilitiesWrapper").height() + 15;
	var position = $(".showAll").position().top;
	var top = position - height;
    $(".showAll").toggle(function() {        	
        $("#popupFacilitiesWrapper").css("top",top);
	$("#popupFacilitiesWrapper").show('slow'); $(".showAll").text("Hide All");
   },function(){
     $("#popupFacilitiesWrapper").hide('slow'); $(".showAll").text("Show All");
    });
    }
}
            
$( RegisterShowAllButton );
