
/////////////////////////////////////////////////////////////////
//            MapMagic JavaScript interface                    //  
//                                                             //
//                                                             //
//                         25 July 2002                        //
//                                                             //
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////


var MapScript, MapPath, MapGifImagesFolder, MapWidth, MapHeight, PagePath;
var ScriptPath= "/scripts/map.dll"; //This is the path to where the map dll is hosted
var MapPath = "/maps/StellenboschIGIS/StellenboschIGIS.map";            //This is the path to the map on the same server as the map dll in the wwwroot folder
MapGifImagesFolder = "mapmeblue/"; 				  //This is the path to the mapgif folder to be used for buttons around map
PagePath = "/";	   	 									  //This is the path to where the page is hosted, used when reload with key from the map.

MapWidth = 400;   										  //This is the width of the map image that is displayed
MapHeight = 267;   										  //This is the height of the map image that is displayed

var ZoomSTaValue = 4000;      //The default zoom levels to where the street etc buttons zoom ie. 1:5000
var ZoomSTbValue =8000;       //The default zoom levels to where the street etc buttons zoom ie. 1:5000
var ZoomSTcValue = 20000;     //The default zoom levels to where the street etc buttons zoom ie. 1:5000
var ZoomSTdValue = 41000;     //The default zoom levels to where the street etc buttons zoom ie. 1:5000
var ZoomSTeValue = 80000;     //The default zoom levels to where the street etc buttons zoom ie. 1:5000
var ZoomSTfValue = 160000;    //The default zoom levels to where the street etc buttons zoom ie. 1:5000
var ZoomSTgValue = 350000;    //The default zoom levels to where the street etc buttons zoom ie. 1:5000
var ZoomSThValue = 5000000;   //The default zoom levels to where the street etc buttons zoom ie. 1:5000


var Scale = "ZoomSTd";  //Can be "ZoomSTa", "ZoomSTb", "ZoomSTc", "ZoomSTd", "ZoomSTe", "ZoomSTf" or "ZoomSTg"
var MaxZoomLevel = 23000000;
var MinZoomLevel = 1000;

var MapClickState = "ZoominX2";     //The map click state that is activated the first time the map is opened


var MapBorder = 0;	
var CurrentMapTab;	 				// This store the current tab number if tabs is on the map
var DefaultViewTab = "Tab1";
var LaunchedWin;

function SetPageName(PageNameText){
	//alert(PageNameText);
	PageName = PageNameText;
	}	


function DoTheClearTagsCustom(){
		 //Use to clear form etc..
		 }
	
	
function SetInfoHTML(){
	var AphabeticText="ABCDEFGHIJKLMNOPQSTUVWXYZ";
	var ClientKey = getCookie("CLIENT_KEY");
	//alert("ClientKey="+ClientKey);
	QueryTagkey = ClientKey;
	var pk = ClientKey.substr(0,4); //pk - parks key a validation to check for the prifix TREE
	var pkWP = ClientKey.substr(0,2); //WP - CSIR water points prefeix
	var pBAT = ClientKey.substr(0,3); //BAT - BAterigester properties
	var pSub = ClientKey.substr(0,3); //Sub - suburb  prefeix
	//alert("pkWP="+pkWP);
	if  (QueryTagkey.length == 21)
	  {
	   	if (PageName =="FireEmergencymap"){
	     	document.STForm.Tagkey.value = QueryTagkey;
		}
	   	else {	   
	   		document.location=PageName+".asp?Tagkey="+QueryTagkey+"&TempView="+CurrentMapTab;
	     };
	   }
	else if (pk == "Tree"){
	    document.location=PageName+".asp?Tempkey="+QueryTagkey+"&TempView="+CurrentMapTab;
    	}
	else if (pSub == "Sub"){
	    document.location=PageName+".asp?SubKey="+QueryTagkey+"&TempView="+CurrentMapTab;
    	}
	else if (pkWP == "WP"){
		WaterPointNumber = ClientKey.substr(2,(ClientKey.length - 2));
		//document.all.WPURL.innerHTML = "<a href='WaterPoints.asp?ID=" + ClientKey.substr(2,(ClientKey.length - 2)) + "'>Get More CSIR info for point "+ClientKey.substr(2,(ClientKey.length - 2))+"</a>";
		document.all.WPURL.innerHTML = "<INPUT TYPE='button' class='ElecWaterbutton' value='Get More CSIR info for point " + ClientKey.substr(2,(ClientKey.length - 2)) + "' onclick='CSIR();'>";
		//document.location=PageName+".asp?Tagkey="+QueryTagkey+"&TempView="+CurrentMapTab+"&WPKey="+ClientKey;
    	}
	else if (pBAT == "BAT"){
		//WaterPointNumber = ClientKey.substr(2,(ClientKey.length - 2));
		//document.all.WPURL.innerHTML = "<a href='WaterPoints.asp?ID=" + ClientKey.substr(2,(ClientKey.length - 2)) + "'>Get More CSIR info for point "+ClientKey.substr(2,(ClientKey.length - 2))+"</a>";
		//document.all.WPURL.innerHTML = "<INPUT TYPE='button' class='ElecWaterbutton' value='Get More CSIR info for point " + ClientKey.substr(2,(ClientKey.length - 2)) + "' onclick='CSIR();'>";
		document.location=PageName+".asp?Tagkey="+QueryTagkey+"&TempView="+CurrentMapTab+"&WPKey="+ClientKey;
    	}
	else{
	document.location=PageName+".asp?TempView="+CurrentMapTab;
	}
 }	

function SetInfoHTML_Sample(){
	var ClientKeyToUse = "";
	var ClientKey = getCookie("CLIENT_KEY");
	re = new RegExp("^bcgolfguide");	
	if(re.test(ClientKey)){	   
	   for (var i=11; i < ClientKey.length; i++) {			 
			 ClientKeyToUse = ClientKeyToUse + ClientKey.charAt(i);
			 } 			 
       if (is.ie6|| is.ns6){
		 	  document.getElementById("golflist").value = ClientKeyToUse;
			  document.getElementById("RAPButtons").style.display = "";
			}
			else if(is.ie5|| is.ie55|| is.ie4) {
				    document.resultsForm.golflist.value = ClientKeyToUse;
	   	   			document.all.RAPButtons.style.display = "";
				 	} 
				 else if(is.ns4) {
					 document.resultsForm.golflist.value = ClientKeyToUse;
					  };	
	   }
	else{	   
     if (is.ie6|| is.ns6){
		 	  document.getElementById("RAPButtons").style.display = "none";
			}
			else if(is.ie5|| is.ie55|| is.ie4) {
				    document.all.RAPButtons.style.display = "none"; 
				 	} 
				 else if(is.ns4) {
					 document.resultsForm.golflist.value = "";
					  };	
 
	   };   
    }	
	
	
	
		