function fnPrint()
{
    document.getElementById("btnClose").style.visibility = "hidden";
    document.getElementById("btnPrint").style.visibility = "hidden";
    window.print();
    document.getElementById("btnClose").style.visibility = "visible";
    document.getElementById("btnPrint").style.visibility = "visible";                
}
function printFriendly()
{
    window.open("about:blank","PrintWindow","toolbar=no,directories=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes,location=no,width=685");
    document.frmwpaloc.action= window.location + "?print=yes";
    document.frmwpaloc.target = "PrintWindow";
    document.frmwpaloc.submit();
    document.frmwpaloc.action= window.location;
    document.frmwpaloc.target = "";
}
function changePage(opt)
{
    if(opt == "n")
    {
        document.getElementById("temp_page").value = parseInt(document.getElementById("temp_page").value) + 1;
    }
    else
    {
        document.getElementById("temp_page").value = parseInt(document.getElementById("temp_page").value) - 1;
    }
    document.frmwpaloc.submit(); 
}
function fnMapTool(sTool)
{
    document.frmwpaloc.mapTool.value = sTool
	if (document.frmwpaloc.mapTool.value=="in")
	{
		document.getElementById("zoomOut").src="images/zoomOut.gif";
		document.getElementById("reCenter").src="images/reCenter.gif";
		document.getElementById("mapRow").style.cursor = "url(images/curZoomIn.cur),pointer";
		document.getElementById("MapImage").style.cursor = "url(images/curZoomIn.cur),pointer";
	}
	if (document.frmwpaloc.mapTool.value=="out")
	{
		document.getElementById("zoomIn").src="images/zoomIn.gif";
		document.getElementById("reCenter").src="images/reCenter.gif";
		document.getElementById("mapRow").style.cursor = "url(images/curZoomOut.cur),pointer";
		document.getElementById("MapImage").style.cursor = "url(images/curZoomOut.cur),pointer";
	}
	if (document.frmwpaloc.mapTool.value=="reCen")
	{
		document.getElementById("zoomIn").src="images/zoomIn.gif";
		document.getElementById("zoomOut").src="images/zoomOut.gif";
		document.getElementById("mapRow").style.cursor = "url(images/curReCen.cur),pointer";
		document.getElementById("MapImage").style.cursor = "url(images/curReCen.cur),pointer";
	}    
} 
function submitAllMap()
{
    document.frmwpaloc.mapPage.value = "1";
    document.frmwpaloc.submit();
}
function fnSetSuburb()
{
    document.getElementById("txtSuburb").value = "";
}
function fnEnter(e)
{
    var key;
    if(window.event)
        key=window.event.keyCode;
    else
        key=e.which;
    if(key == 13)
    {
        document.getElementById("btSearch").click();
    }
}
function fnSetRegion(e)
{   
    var key;
    if(window.event)
        key=window.event.keyCode;
    else
        key=e.which;
    if(key!=13)
    {
        document.getElementById("sltRegion").value = "";
    }
    else
    {  
        e.returnValue = false;
        e.cancel = true;
        document.getElementById("btSearch").click();
    }
}
function fnSetXY()
{
    var a, arr1;
    a=0;
    while(1)
    {
        if(document.frmwpaloc.multiAdd[a].checked==true)
        {
            arr1=document.frmwpaloc.multiAdd[a].value.split(",");
            document.frmwpaloc.address.value = document.frmwpaloc.multiAdd[a].text
            document.frmwpaloc.addX.value = arr1[0];
            document.frmwpaloc.addY.value = arr1[1];
            document.frmwpaloc.address.value = arr1[2]+ ", " + arr1[3]+ ", " + arr1[4];
            return false;
        }
        a=a+1;
    }                
}

function fnSetImage()
{
    if (document.frmwpaloc.mapTool.value=="in")
    {
        document.getElementById("zoomIn").src="images/zoomIn_hover.gif";
        document.getElementById("mapRow").style.cursor = "url(images/curZoomIn.cur),pointer";
        document.getElementById("MapImage").style.cursor = "url(images/curZoomIn.cur),pointer";
    }
    if (document.frmwpaloc.mapTool.value=="out")
    {
        document.getElementById("zoomOut").src="images/zoomOut_hover.gif";
        document.getElementById("mapRow").style.cursor = "url(images/curZoomOut.cur),pointer";
        document.getElementById("MapImage").style.cursor = "url(images/curZoomOut.cur),pointer";
    }
    if (document.frmwpaloc.mapTool.value=="reCen")
    {
        document.getElementById("reCenter").src="images/reCenter_hover.gif";
        document.getElementById("mapRow").style.cursor = "url(images/curReCen.cur),pointer";
        document.getElementById("MapImage").style.cursor = "url(images/curReCen.cur),pointer";
    }
}
function RestoreNormalImage(n)
{
	if (n==1) 
    {
		if (document.frmwpaloc.mapTool.value!="in")
		{
			document.getElementById("zoomIn").src="images/zoomIn.gif";
		}
    }
    if (n==2) 
    {
		if (document.frmwpaloc.mapTool.value!="out")
		{
			document.getElementById("zoomOut").src="images/zoomOut.gif";
		}
    }
    if (n==3) 
    {
		if (document.frmwpaloc.mapTool.value!="reCen")
		{
			document.getElementById("reCenter").src="images/reCenter.gif";
		}
    }
    if (n==4) 
    {
		document.getElementById("orgMap").src="images/originalMap.gif";
    }
}
function ChangeOverImage(n)
{
	if (n==1) 
    {
		document.getElementById("zoomIn").src="images/zoomIn_hover.gif";
    }
    if (n==2) 
    {
		document.getElementById("zoomOut").src="images/zoomOut_hover.gif";
    }
    if (n==3) 
    {
		document.getElementById("reCenter").src="images/reCenter_hover.gif";
    }
    if (n==4) 
    {
		document.getElementById("orgMap").src="images/originalMap_hover.gif";
    }
}
