self.focus()

//MAPS
function MakeMap(lat,lon,number,facility,mapwidth,selectlayer,selectkey) {
	myRemote = window.open("http://www.gov.pe.ca/mapguide/mapwindow.php3?lat=" + URLEncoder(lat) + "&lon=" + URLEncoder(lon) + "&infonumber=" + URLEncoder(number) + "&facility=" + URLEncoder(facility) + "&radius=" + URLEncoder(mapwidth) + "&selectlayer=" + URLEncoder(selectlayer) + "&selectkey=" + URLEncoder(selectkey),"myReport","height=480,width=640,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=0,status=1,titlebar=1,toolbar=0,z-lock=0","myReport");
}

function MakeBusinessMap(lat,lon,number,facility,mapwidth,selectlayer,selectkey) {
	
	myRemote = window.open("http://www.gov.pe.ca/mapguide/business/mapwindow.php3?lat=" + URLEncoder(lat) + "&lon=" + URLEncoder(lon) + "&infonumber=" + URLEncoder(number) + "&facility=" + URLEncoder(facility) + "&radius=" + URLEncoder(mapwidth) + "&selectlayer=" + URLEncoder(selectlayer) + "&selectkey=" + URLEncoder(selectkey),"myReport","height=480,width=640,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable=1,scrollbars=0,status=1,titlebar=1,toolbar=0,z-lock=0","myReport");
}


function MakeCatMap(parentCat,parentTitle) {
	myRemote = window.open("http://www.gov.pe.ca/mapguide/mapwindow.php3?parentCat=" + URLEncoder(parentCat) + "&parentTitle=" + URLEncoder(parentTitle),"myReport","height=440,width=620,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=0,z-lock=0","myReport");
}

function MakeCatBusinessMap(parentCat,parentTitle) {
	myRemote = window.open("http://www.gov.pe.ca/mapguide/business/mapwindow.php3?parentCat=" + URLEncoder(parentCat) + "&parentTitle=" + URLEncoder(parentTitle),"myReport","height=440,width=620,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=0,z-lock=0","myReport");
}

function WhatMaps() {
	myRemote = window.open("/mapguide/index.php3","whatMaps","height=480,width=640,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=1,menubar=1,resizable=1,scrollbars=1,status=1,titlebar=1,toolbar=1,z-lock=0","whatMaps");
}

//URL ENCODER
function URLEncoder(urlToEncode){
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = urlToEncode;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for
	return encoded;
};


