function trim(strText) { 
 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 


function search()
{
  var brdgNum = new Array;  
  
  if (isNav6)
     {  parent.ScriptFrame.document.searchform.County.options[0].selected = "None";
        parent.ScriptFrame.document.searchform.Township.options[0].selected = "None";
        county = parent.ScriptFrame.document.searchform.County.options[0].value; 
     }
  else
     {  parent.ScriptFrame.document.searchform.County.options.value = "0";
        parent.ScriptFrame.document.searchform.Township.options.value = "None";
        county = parent.ScriptFrame.document.searchform.County.options.value; 
	township =  parent.ScriptFrame.document.searchform.Township.options.value;
     }
     
  key = trim(parent.ScriptFrame.document.searchform.Keyword.value);
  //alert(key.length);
  
  if (key.length==0 & county==0 & township=="None")
    {  alert("Please enter a Keyword to search on.");   }
  else
    {  parent.QueryFrame.location.href = "/sab_report1.php?county="+county+"&key="+key;   }
   
}
 

 function clearSearch()
 {  
   //alert("CLEAR SEARCH");
   theSelection = ""; 
   
     if (isNav6)
        {  parent.ScriptFrame.document.searchform.County.options[0].selected = "None";
           parent.ScriptFrame.document.searchform.Township.options[0].selected = "None";            
        }
     else
        {  parent.ScriptFrame.document.searchform.County.options.value = "0";
           parent.ScriptFrame.document.searchform.Township.options.value = "None";
        }
   
   parent.ScriptFrame.document.searchform.Keyword.value = "";
   
   refresh();
   parent.QueryFrame.location.href = "/blank.html";
   // fullview(); 
   
 }




function createReport()
{

    bridgenumber = parent.QueryFrame.document.bridgeform.bridgenum.value;    
    bmsnumber = parent.QueryFrame.document.bridgeform.bmsnum.value;     
    mapimg_path = parent.MapFrame.document.mapserv.mapimg1.value; 

    printWin = window.open( "", "printwin", "width=700,height=535,scrollbars,resizable,screenX=20,screenY=40,left=10,top=0");
    printWin.location="/sab_report.php?bmsnumber1="+bmsnumber+"&bridgenumber1="+bridgenumber+"&mapimg_path1="+mapimg_path;
   
}



function panMove(e) 
{
	getImageXY(e);
}


function panMoveURL(e)
{

  if (insideMap)
  {
	tempCheck = new Array;
	 
	getMapXY(mouseX,mouseY);
	queryX = mapX.toString();
	queryY = mapY.toString();
	
	URLString = new String;
	URLString = "/cgi-bin/mapserv.exe?map="+escape(parent.MapFrame.document.mapserv.map.value); 
	
	parseImgExt();
	URLString += "&imgext="
	for (i=0; i<newext.length; i++)
	{
	    URLString += newext[i];
	    if (i<newext.length-1) URLString += "+";
	}	
	
	URLString += "&imgxy="+mouseX+"+"+mouseY;
	URLString += "&zoomdir=0";
	URLString += "&zoomsize=" + zoomsize;

	if (theSelection != "")
	{	    
	      URLString += "&mode=itemnquery";
	      URLString += "&qlayer=bridge&map_querymap_size=" + imgxy + "&map_bridge_header=demo.html&map_bridge_template=zoomto.html&map_web_error=../zoomaway.html&map_bridge_filter=" + theSelection;
	 	 
	 }
	 else
	 { 
	     URLString += "&mode=browse";
         }  
	

	//alert(URLString);
	
	parent.MapFrame.location.href = URLString;
   
   }

}

 