function confirmSubmit(mess)
{
var agree=confirm(mess);
if (agree)
	return true ;
else
	return false ;
}
 function check_form(items){
	 	var myform_array=items.split(",");
		var ok = true;
		for ( keyVar in myform_array ) {
			check_item = document.getElementById(myform_array[keyVar]);
			if (check_item.value == ""){
				ok = false;
				check_item.style.backgroundColor="#FFA8A8";
			}else{
				check_item.style.backgroundColor="#FFFFFF";
			}
		}
		if (ok == false){
			alert("There is a problem with your submission. Please review");
			return false;
		}else{
			return true;
		}
	}
function change_img(){
	if (document.getElementById('align').value == "left"){
		document.getElementById('img_align').src = "gfx/left_img.jpg";
	}else{
		document.getElementById('img_align').src = "gfx/right_img.jpg";
	}
}
/**
SAL - Simple Ajax Lib. 23-Sep-2005
by Nigel Liefrink
Email: leafrink@hotmail.com
*/

var debug = false;
/**
<summary>
Browser Compatability function.
Returns the correct XMLHttpRequest 
  depending on the current browser.
</summary>
*/
function GetXmlHttp() {
  var xmlhttp = false;
  if (window.XMLHttpRequest)
  {
    xmlhttp = new XMLHttpRequest()
  }
  else if (window.ActiveXObject)// code for IE
  {
    try
    {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP")
    } catch (e) {
      try
      {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
      } catch (E) {
        xmlhttp=false
      }
    }
  }
  return xmlhttp;
}


/**
<summary>
Gets the response stream from the passed url, and then calls
   the callbackFuntion passing the response and the div_ids.
</summary>
<param name="url">The url to make the request
            to get the response data.</param>
<param name="callbackFunction">The function to call after 
the response has been recieved.
The response <b>must</b> always 
be the first argument to the function.</param>
<param name="params"> (optional) Any other parameters 
you want to pass to the functions.
(Note: only constants/strings/globals can be passed
       as params, most variables will be out of scope.)
</param>
<example>
    <code>
PassAjaxResponseToFunction('?getsomehtml=1', 
              'FunctionToHandleTheResponse', 
              "\'div1\',\'div2\',\'div3\'');

function FunctionToHandleTheResponse(response, d1, d2, d3){
    var data = response.split(';');
    document.getElementById(d1).innerHTML = data[0];
    document.getElementById(d2).innerHTML = data[1];
    document.getElementById(d3).innerHTML = data[2];
}
    </code>
</example>
*/
function PassAjaxResponseToFunction(url, callbackFunction, params)
{
  var xmlhttp = new GetXmlHttp();
  //now we got the XmlHttpRequest object, send the request.
  if (xmlhttp)
  {
    xmlhttp.onreadystatechange = 
            function ()
            {
              if (xmlhttp && xmlhttp.readyState==4)
              {//we got something back..
                if (xmlhttp.status==200)
                {
                  var response = xmlhttp.responseText;
                  var functionToCall = callbackFunction + 
                                 '(response,'+params+')';
                  if(debug)
                  {
                    alert(response);
                    alert(functionToCall);
                  }
                  eval(functionToCall);
                } else if(debug){
                  document.write(xmlhttp.responseText);
                }
              }
            }
	isq = url.indexOf('?');
	if (isq > 0){
		url = url+"&burst="&randomString();
	}else{
		url+"?burst="&randomString();
	}
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
  }
}


/**
<summary>
Sets the innerHTML property of obj_id with the response from the passed url.
</summary>
<param name="url">The url to make the request 
to get the response data.</param>
<param name="obj_id">The object or the id of 
the object to set the innerHTML for.</param>
*/
function SetInnerHTMLFromAjaxResponse(url, obj_id)
{
  var xmlhttp = new GetXmlHttp();
  //now we got the XmlHttpRequest object, send the request.
  if (xmlhttp)
  {
    xmlhttp.onreadystatechange = 
            function ()
            {
              if (xmlhttp && xmlhttp.readyState==4)
              {//we got something back..
                if (xmlhttp.status==200)
                {
                                  if(debug)
                                  {
                    alert(xmlhttp.responseText);
                  }
                  if(typeof obj_id == 'object')
                  {
                    obj_id.innerHTML = xmlhttp.responseText;
                  } else {
                    document.getElementById(obj_id).innerHTML = 
                                          xmlhttp.responseText;
                  }
                } else if(debug){
                  document.Write(xmlhttp.responseText);
                }
				if (xmlhttp.status==500 || xmlhttp.status==404 )
                {
					document.getElementById(obj_id).innerHTML = "<center><span class=\"errloading\">Load Failed<br><strong>Error:</strong><br>" + xmlhttp.responseText + "</span></center>";
				}
              }
            }
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
  }
}
function preload(url, obj_id){
	pic1= new Image(37,37); 
	pic1.src="gfx/loading_animation.gif";
	document.getElementById(obj_id).innerHTML = "<center><span class=\"loading\"><img src=\"gfx/loading_animation.gif\"><br>Loading, Please Wait</span></center>";
	SetInnerHTMLFromAjaxResponse(url, obj_id);
}
var map = null;
var geocoder = null;
function load() {
	if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(51.4612,-0.9259), 1);
		PassAjaxResponseToFunction("online.asp", "add_data", "1");
    }
}
function add_data(responsetext,ok){
	var pos_array=responsetext.split("|");
	var i = 0;
	var l = pos_array.length;
	var x=0;
	while(x < l){
		if (pos_array[x].length > 0){
			var eachitem=pos_array[x].split(",");
			var point = new GLatLng(eachitem[0],eachitem[1]);
			map.addOverlay(new GMarker(point));
		}
		x++;
	}
}
function randomString() {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var string_length = 20;
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	document.randform.randomfield.value = randomstring;
}