	// JavaScript Document
	function getmapdata(dbname,recordid)
	{

		ajaxSpecificDiv('_customelements/_actions/presentmapdata.php?strDatabase='+dbname+"&nRecordID="+recordid,'mapdata');
	}

	function createRefreshObj(name)
	{
		d=document.getElementById(name);
		refreshing(d);
	}

	function refreshing(obj)
	{
		tblHeight = obj.offsetHeight;
		obj.innerHTML = "<table height=\""+tblHeight+"\" width=\"100%\"><tr height=\"100%\"><td height=\""+tblHeight+"\" style=\"background-color:#fff;\"><div align=\"center\"><img src='images/loading.gif' border='0'></div></td></tr></table>";
	}

	function ajaxResSorter(sortby, url, numheaders, id)
	{
		// set all to off
		//alert("calling:"+url);

		// we need the next line because on fileupload we refersh the ajax.
		window.document.saveparts.lastsort.value = sortby;
		window.document.saveparts.lastpage.value = 1;

		for (var i = 1; i <= numheaders; i++) {
				setClass("header_"+i,"");
		  }
		setClass("header_"+id,"active");

		for (var i = 1; i <= window.document.saveparts.numpages.value; i++) {
				setClass("pagerlink_"+i,"");
		  }
		setClass("pagerlink_1","active");

		if (window.document.forms['resourcesearch'].searchFilter.value)
		{
			url = "resource_ajaxsearch.php?";
		}
		ajaxWizardRun('tableholder', url+"pagenum=1&sortby="+sortby+"&strFilter="+window.document.forms['resourcesearch'].searchFilter.value);
	}

	function toggleShow(nameobj)
	{
			var elem, vis;
			if( document.getElementById ) // this is the way the standards work    
			{
				elem = document.getElementById( nameobj );
			} 
			else if( document.all ) // this is the way old msie versions work
			{
				elem = document.all[nameobj];  
			} 
			else if( document.layers ) // this is the way nn4 works    
			{
				elem = document.layers[nameobj];  
				// if the style.display value is blank we try to figure it out here
			}

			if(elem != null)
			{
				elem.className = (elem.className=="off")? "on":"off";
			}
	}

	function ajaxSpecificDiv(url,divName)
	{
		ajaxWizardRun(divName, url);
	}

	function ajaxNoSpinner(url,param1)
	{
			d=document.getElementById(param1);
			var opt = {
				method: 'post',
				on404: function(t) {
					alert('Error 404: location "' + t.statusText + '" was not found.');
				},
				onFailure: function(t) {
					alert('Error ' + t.status + ' -- ' + t.statusText);
				}
			}
		
		new Ajax.Updater(param1,url, opt);
		
	}
	

	function ajaxNoResponse(url)
	{
			var opt = {
				method: 'post',
				on404: function(t) {
					alert('Error 404: location "' + t.statusText + '" was not found.');
				},
				onFailure: function(t) {
					alert('Error ' + t.status + ' -- ' + t.statusText);
				}
			}
		
			new Ajax.Request(url, opt);
		
	}

	function ajaxWizardRun(param1, url)
	{
			d=document.getElementById(param1);
			refreshing(d);
			var opt = {
				method: 'post',
				on404: function(t) {
					alert('Error 404: location "' + t.statusText + '" was not found.');
				},
				onFailure: function(t) {
					alert('Error ' + t.status + ' -- ' + t.statusText);
				}
			}
		
		new Ajax.Updater(param1,url, opt);
	}

	function ajaxWizardRunJS(param1, url)
	{
			d=document.getElementById(param1);
			refreshing(d);
			var opt = {
				method: 'post',
				onComplete: function(t){ 
					if(t.getResponseHeader("Content-Type")=="text/javascript;")
					{
						//it knows if header coming back is javascript, and runs it as javascript AUTOMATICALLY
								//eval(t.responseText);
						//and then set div to blank, rather than displaying javascript code
						window.document.getElementById('captcha').innerHTML = "<div align=\"center\"><img src='../../../abendago/images/loading.gif' border='0'></div>";
					}
				},
				on404: function(t,json) {
					alert('Error 404: location "' + t.statusText + '" was not found.');
				},
				onFailure: function(t,json) {
					alert('Error ' + t.status + ' -- ' + t.statusText);
				}
			}
		
		new Ajax.Updater(param1,url, opt);
		
	}

function setClass(whichLayer, newClassName){  

	var elem, vis;  
	if( document.getElementById ) // this is the way the standards work    
	{
		elem = document.getElementById( whichLayer );
	} else if( document.all ) // this is the way old msie versions work
	{
		elem = document.all[whichLayer];  
	} else if( document.layers ) // this is the way nn4 works    
	{
		elem = document.layers[whichLayer];  
		// if the style.display value is blank we try to figure it out here
	}

	if(elem != null)
	{
		elem.className=newClassName;
	}
}


	function ajaxRequestForm(url,divName)
	{
		url=url+"?strName="+document.getElementById( "strName" ).value;
		url=url+"&strEmail="+document.getElementById( "strEmail" ).value;
		url=url+"&strComments="+document.getElementById( "strComments" ).value;
		
		url=url+"&id="+document.getElementById( "varID" ).value;
		ajaxWizardRun(divName, url);
	}
