function tmt_showhideAll(c){	// modified
	var v = (document.layers) ? ".visibility" : ".style.visibility";
	var arr = (document.layers) ? document.layers : (document.all) ? document.all.tags("DIV") : document.getElementsByTagName("DIV");
	for(var i=0;i<arr.length;i++){
		if (eval("arr["+i+"].id.substr(0,6)") == 'lyrnav') {
			eval("arr["+i+"]"+v+"='"+c+"'");
		}
	}
}

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_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 MM_findObj(n, d) { //v3.0
  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); 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 tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}

function MM_showHideLayers() { //v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility
  var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;}} else{
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }}
}

var lyrTO = setTimeout('cleanUp()',600);
clearTimeout(lyrTO);

function menuClear() {
	lyrTO = setTimeout('cleanUp()',600);
}
function menuHold() {
	clearTimeout(lyrTO);
}

function cleanUp() {
	tmt_showhideAll('hidden');	
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function confirmLink(message) {
	var agree=confirm(message);
	if (agree)
		return true ;
	else
		return false ;
}
// returns an element by its ID
function getElement(elementId) {
	var element = null;
	
	if (document.getElementById) {
		// this is the way the standards work
		element = document.getElementById(elementId);
	} else if (document.all) {
		// this is the way old msie versions work
		element = document.all[elementId];
	} else if (document.layers) {
		// this is the way nn4 works
		element = document.layers[elementId];
	}
	
	return element;
	
}
function confirmLinkButton(url,message) {
	var agree=confirm(message);
	if (agree)
		window.location = url;
	else
		return false ;
}
function find_consult(){
	cityID='';
	if(getElement("citySelect")){
		cityID = getElement("citySelect")[getElement("citySelect").selectedIndex].value;
	}
	regionID = getElement("regionList")[getElement("regionList").selectedIndex].value;
	serviceID = getElement("serviceList")[getElement("serviceList").selectedIndex].value;
	
	if(cityID!='' && cityID!='-1' && serviceID!=''){
		window.location = "search_results.php?s=cboth&id="+cityID+"&idS="+serviceID;
	}else if(cityID!='' && cityID!='-1'){
		window.location = "search_results.php?s=c&id="+cityID;
	}else if(regionID!='' && serviceID!=''){
		window.location = "search_results.php?s=both&id="+regionID+"&idS="+serviceID;
	}else if(regionID!=''){
		window.location = "search_results.php?s=region&id="+regionID;
	}else if(serviceID!=''){
		window.location = "search_results.php?s=service&id="+serviceID;
	}else{
		alert('You must search by a region, service, or both.');
	}
}
function getCities(regionID){
	url = "../../_media/php/getCities.php?id="+regionID;
	var request = loadext(url);
	request.onreadystatechange=function() {
		if (request.readyState==4) {		
			var result = request.responseText;
			
			if (result.error) {
				
			} else{
				var myObject = eval('(' + result + ')');				
				createCityList(myObject);												
			}
		}
	}
	request.open('GET', url, true); 
	request.send('');	
}
function loadext() {
	var page_request = false;
	if (window.XMLHttpRequest) { // if Mozilla, Safari etc
		page_request = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
			}
		}
	} else {
		return false;
	}
	
	return page_request;
}
function createCityList(cityList){	
	content = '';
	if(cityList.length>0){
		content += '&nbsp;&nbsp;&nbsp;and/or<select style="font: normal 11px Verdana, Arial, Helvetica, sans-serif; color: #666666;border: 1px solid #999999; margin-left: 10px;" id="citySelect">';
		content += '<option value="-1">-- residing in (City) --</option>';
		for(i=0; i<cityList.length; i++){
			content += '<option value="'+cityList[i]+'">'+cityList[i]+'</option>';
		}
		content += '</select>';
	}
	
	getElement('cityList').innerHTML = content;
}



//Arrays below are declared/populated in equipment_rental.php



function addSelect()
{
	var esel = document.createElement("select");
	esel.options[0] = new Option('Select an address on file...', '-1');
	for(i=0;i<addresses_id.length;i++)
	{
		optText = addresses_street1[i]+' ('+addresses_city[i]+', '+addresses_state[i]+')';
		esel.options[i+1] = new Option(optText, addresses_id[i]);	
	}
	esel.options[i+1] = new Option('', '-1');
	esel.options[i+2] = new Option('Add New Address...', '-999');
	//esel.onchange = updateAddress;
	par = document.getElementById('Selection');
	par.appendChild(esel);
	
}


function disableAddress()
{
	
}


function enableAddress()
{
	
}

function updateAddress()
{
		
}