function MM_openBrWindow(theURL) { //v2.0
  var winName='';
  var features='width=700, height=700, resizable=no, left=200,top=25,menu=no, toolbar=no,resizable=no,scrollbars=yes';
  window.open(theURL,winName,features);
}

function MM_openBrWindow2(theURL, w, h) { //v2.0
  var winName='';
  var features='width='+w+', height='+h+', resizable=no, left=200,top=25,menu=no, toolbar=no,resizable=no,scrollbars=yes';
  window.open(theURL,winName,features);
}

function setFocus(){
 //var form = document.forms[formName];
 var flag=false;
 for(z=0;z<document.forms.length;z++){
  var form = document.forms[z];
  var elements = form.elements;
  for (var i=0;i<elements.length;i++){ 
    var element = elements[i];
    if(element.type == 'text' && 
      !element.readOnly &&
      !element.disabled){
      element.focus();
	  flag=true;
     break;
    }
  }
  if(flag)break;
 }
}


function MapPopUp(query, path)
	{
		WindowObjectReference = window.open(path+"map.php?address="+query,null,"width=800,height=359");
	}
	
	
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function new_freecap()
{
	// loads new freeCap image
	if(document.getElementById)
	{
		// extract image name from image source (i.e. cut off ?randomness)
		thesrc = document.getElementById("freecap").src;
		thesrc = thesrc.substring(0,thesrc.lastIndexOf(".")+4);
		// add ?(random) to prevent browser/isp caching
		document.getElementById("freecap").src = thesrc+"?"+Math.round(Math.random()*100000);
	} else {
		alert("Sorry, cannot autoreload freeCap image\nSubmit the form and a new freeCap will be loaded");
	}
}

function toggleLayer( whichLayer )
{
  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];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}


