
<!--
document.onclick = showID;
window.onerror=handlerFunction;  
var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-18013226-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  
function handlerFunction(description, page, line) {
	error = "Caught error... \n\nDescription : "+description+" \nPage : "+page+" \nLine : "+line;
	//alert(error);
	return true;
}
function showID(){
//	if(!document.all){blur();}
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function returnArrtib(element, attrib){
	for (i=0;i<element.attributes.length;i++) {
		if(element.attributes[i].name == attrib){return element.attributes[i].value; break;}
	}
}
function checkInput(element, type){
	var defaultvalue=''
	if (element.defaultValue) {
	 defaultvalue=element.defaultValue;
	}
	if ("blur"==type) {
		if(element.value == "") {element.value = defaultvalue;}
	} else if ("focus"==type) {
		if (element.value==defaultvalue) { element.value = ""; }
	}
}

function clearMissedFields(theForm){
	//This function checks all fields for initial values and removes them before submitting.
	for(x=0;x<theForm.elements.length;x++){
		if(theForm.elements[x].value == returnArrtib(theForm.elements[x], "initialvalue")){
			theForm.elements[x].value = "";
		}
	}
}


function formHandler(theForm){
	//The form object is passed this function (called theForm)
	//set error status variable
	formError = false;
	//loop through form elements array
	for(x=0;x<theForm.elements.length;x++){
		//check if field is mandatory
		attribs = "";
		if(theForm.elements[x].style.mandatory == "true"){
			//switch to detect form object type
			switch(theForm.elements[x].type){
				//any text object
				case 'text':
					//if value is blank
					if(theForm.elements[x].value == "" || theForm.elements[x].value == theForm.elements[x].style.initialvalue){
						alert("Please complete the "+theForm.elements[x].style.fullname+" field.");
						//set form error to prevent form submit
						formError = theForm.elements[x];
						break;
					}
					//if type = email run email check function
					if(theForm.elements[x].style.fieldtype == "email" && !varifyEmail(theForm.elements[x].value)){
						alert("The email address does not appear to be valid.");
						//set form error to prevent form submit
						formError = theForm.elements[x];
						break;
					}
					//if type = number run numeric regualr expression function
					if(theForm.elements[x].style.fieldtype == "number" && !varifyNumber(theForm.elements[x].value)){
						alert("The "+theForm.elements[x].fullName+" field must only contain numbers and spaces.");
						//set form error to prevent form submit
						formError = theForm.elements[x];
						break;
					}
				break;
				//any text-area
				case "textarea":
					if(theForm.elements[x].value == ""  || theForm.elements[x].value == theForm.elements[x].style.initialvalue){
						alert("Please complete the "+theForm.elements[x].style.fullname+" field.");
						//set form error to prevent form submit
						formError = theForm.elements[x];
						break;
					}
				break;
				//any select drop-down
				case "select-one":
					if(theForm.elements[x].options[theForm.elements[x].selectedIndex].value == ""){
						alert("Please select an option from the "+theForm.elements[x].style.fullname+" menu.");
						//set form error to prevent form submit
						formError = theForm.elements[x];
						break;
					}
				break;
			}
		//if form error, break the from loop
		if(formError){break}
		}
	}
	//if no errors, submit
	if(!formError){
		clearMissedFields(theForm);
		theForm.submit();
	}else{
		formError.focus();
	}
}

function varifyEmail(string){
	//set error status variable.
	varified = false;
	//check string for @ sign after 1 character
	if(string.indexOf("@") >= 1){
		//if found, split string into array using the @ sign
		emailArray = string.split("@");
		//check 2nd array index for full-stop after 1 character, and set varified var as true (varified!)
		if(emailArray[1].indexOf(".") >= 1 && emailArray[1].indexOf(".") < emailArray[1].length-1){varified = true;}
	}
	return varified;
}

function varifyNumber(string){
	//set regular expression - 0 to9 and space
	numericExp = RegExp("[0-9 ]");
	//loop through each character of the string
	for(x=0;x<string.length;x++){
		//if a char is found that is not in the regular expression, return false (stops function at this point)
		if(!numericExp.test(string.substr(x,1))){
			return(false);
			break;
		}
	}
	//if no errors, returns true
	return(true);
}

function formElementFocus(formID, elementID){
	//document.getElementById(elementID).focus();
	//theForm = MM_findObj(formID);
	//theElement = eval("theForm."+elementID);
	//theElement.focus();
}

function showHilite(img){
	MM_findObj("mapboroughoverlay").src = "images/cityMap-"+img+".gif";
}
/*
var map, bounds;

function showMap(latAv, longAv, latArray, longArray, typeArray, markerInfo, zoom) {
		if (GBrowserIsCompatible()) {
			var map = new GMap2(MM_findObj("googleMapDiv"));
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			// ==== It is necessary to make a setCenter call of some description before adding markers ====
			// ==== At this point we dont know the real values ====
			iconArray = new Array();
			iconArray["FixedDigital"] = new GIcon(G_DEFAULT_ICON, "/images/iconCameraFixedDigital.png");
			iconArray["Red-light"] = new GIcon(G_DEFAULT_ICON, "/images/iconCameraRedLight.png");
			iconArray["Combined Speed-Red light camera"] = new GIcon(G_DEFAULT_ICON, "/images/iconCameraCombined.png");
			iconArray["Fixed"] = new GIcon(G_DEFAULT_ICON, "/images/iconCameraFixed.png");
			iconArray["FixedSpeed"] = new GIcon(G_DEFAULT_ICON, "/images/iconCameraFixed.png");
			map.setCenter(new GLatLng(0,0),0);
			marker = new Array();
			var bounds = new GLatLngBounds();
			for(x=0;x<latArray.length;x++){
				point = new GLatLng(latArray[x], longArray[x]);
				marker[x] = new GMarker(point, iconArray[typeArray[x]]);
				marker[x].label = '<div style="width: 210px; padding-right: 10px">'+markerInfo[x]+'<\/div>';
				marker[x].lat = latArray[x];
				marker[x].long = longArray[x];
				map.addOverlay(marker[x]);
				bounds.extend(point);
				GEvent.addListener(marker[x], "click", function() {	map.setCenter(new GLatLng(this.lat,this.long)); map.zoomIn();});
}
			if(zoom == 0){
				map.setZoom(map.getBoundsZoomLevel(bounds));
				map.setCenter(bounds.getCenter());
			}else{
				map.setCenter(new GLatLng(latAv, longAv), 16);
			}
		}
}
*/
var map, bounds;
function showMap(latAv, longAv, ids, latArray, longArray, typeArray, markerInfo, zoom) {
		if (GBrowserIsCompatible()) {
			var map = new GMap2(MM_findObj("googleMapDiv"));
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			// ==== It is necessary to make a setCenter call of some description before adding markers ====
			// ==== At this point we dont know the real values ====
			iconArray = new Array();
			iconArray["Fixed Digital"] = new GIcon(G_DEFAULT_ICON, "images/iconCameraFixedDigital.png");
			iconArray["Red-light"] = new GIcon(G_DEFAULT_ICON, "images/iconCameraRedLight.png");
			iconArray["Combined Speed-Red light camera"] = new GIcon(G_DEFAULT_ICON, "images/iconCameraCombinedSpeed-Redlightcamera.png");
			iconArray["Fixed"] = new GIcon(G_DEFAULT_ICON, "images/iconCameraFixed.png");
			iconArray["Fixed Speed"] = new GIcon(G_DEFAULT_ICON, "images/iconCameraFixed.png");
			map.setCenter(new GLatLng(0,0),0);
			marker = new Array();
			var bounds = new GLatLngBounds();
			for(x=0;x<latArray.length;x++){
				point = new GLatLng(latArray[x], longArray[x]);
				marker[x] = new GMarker(point, iconArray[typeArray[x]]);
				marker[x].label = '<div style="width: 210px; padding-right: 10px">'+markerInfo[x]+'<\/div>';
				marker[x].lat = latArray[x];
				marker[x].long = longArray[x];
				marker[x].id = ids[x];
				map.addOverlay(marker[x]);
				bounds.extend(point);
				GEvent.addListener(marker[x], "click", function() { 
															window.location.href='cameras1.php?cameraID='+ this.id; 
														}
									);
			}
			if(zoom == 0){
				map.setZoom(map.getBoundsZoomLevel(bounds));
				map.setCenter(bounds.getCenter());
			}else{
				map.setCenter(new GLatLng(latArray, longArray), 16);
			}
		}
}

function showHideFromArray(arr, showID){
	for(x=0;x<arr.length;x++){
		if(arr[x] != showID){MM_findObj(arr[x]).style.display = "none";}
	}
	if(MM_findObj(showID).style.display == "block"){
		MM_findObj(showID).style.display = "none";
	}else{
		MM_findObj(showID).style.display = "block";
	}
}
//AJAX xml object for use in conjunction with ajax.js
function checkOpened(id, URL){
	if(MM_findObj(id).style.display == "block"){
		getData(URL);
	}
}
function getData(URL){
	response = "";
	new Ajax.Request(URL,
	{method:'get',
		 onSuccess: function(transport){
			var response = transport.responseText || "no response text";
		 },
		  onFailure: function(){
			a = null;
		 }
	});
}
-->
