 
//   *** Functions for County Search   ****    

/**
  * Zooms to the county selected in the County dropdown list and displays
  *  the report for the county.
  * This function requires that at least one program (IDP, OGP, PIDA) is selected
  */
function zoomToCounty()
 { 
    var cboCounty = parent.ScriptFrame.document.getElementById('cboCounty');
    var cboTownship = parent.ScriptFrame.document.getElementById('cboTownship');
    var cboMetroArea = parent.ScriptFrame.document.getElementById('cboMetroArea');
    var cboSchoolDistrict = parent.ScriptFrame.document.getElementById('cboSchoolDistrict');
       	   
    if (isNav6)
       {    
           i = cboCounty.selectedIndex;
	   county = cboCounty.value; 
	   
	   cboTownship.options[0].selected = "0";
	   cboMetroArea.options[0].selected = "0";
	   cboSchoolDistrict.options[0].selected = "0";
	   
           //i = parent.ScriptFrame.document.searchform.County.selectedIndex;
	   //county = parent.ScriptFrame.document.searchform.County.options[i].value; 
	   //parent.ScriptFrame.document.searchform.Township.options[0].selected = "0";
	   //parent.ScriptFrame.document.searchform.Metroarea.options[0].selected = "0"; 
	   //parent.ScriptFrame.document.searchform.Schooldistrict.options[0].selected = "0";
       } 
    else 
       {
       	   var county = cboCounty.options.value; 
       	   
       	   cboTownship.options.value = "0";
       	   cboMetroArea.options.value = "0";
	   cboSchoolDistrict.options.value = "0";
	   
           //county = parent.ScriptFrame.document.searchform.County.options.value;  
 	   //parent.ScriptFrame.document.searchform.Township.options.value = "0";	
 	   //parent.ScriptFrame.document.searchform.Metroarea.options.value = "0";
 	   //parent.ScriptFrame.document.searchform.Schooldistrict.options.value = "0";

       }
   
    parent.ButtonFrame.document.Buttonform.Keyword.value = " ";	
   
   for (i=0; i<parent.LayerFrame.document.layerForm.layer.length;i++) 
   {   if (parent.LayerFrame.document.layerForm.layer[i].value == "pida")
       {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
             {  progcode3 = 1;     }
          else {  progcode3 = 0;     }   
       }
       if (parent.LayerFrame.document.layerForm.layer[i].value == "ogp")
       {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
             {  progcode2 = 1;    }
          else {  progcode2 = 0;     }
       }
       if (parent.LayerFrame.document.layerForm.layer[i].value == "idp")
       {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
             {  progcode1 = 1;    }
          else {  progcode1 = 0;     }
       }
   }
   
   metroareaquery = 0;
   schooldistrictquery = 0;
   projectquery = 0;
   
   if ( (progcode1 == 0) && (progcode2 == 0) && (progcode3 == 0) )
      {  alert('Please select at least one DCED program type from the list: IDP, OGP, PIDA.')     
      	      if (isNav6)
      	      {
      	      	      cboCounty.options.selectedIndex = 0;
      	      	      //parent.ScriptFrame.document.searchform.County.options.selectedIndex = 0;
      	      }
      	      else
      	      {
      	      	      cboCounty.options.value = 0;
      	      	      //parent.ScriptFrame.document.searchform.County.options.value = 0;
      	      }    
      }
   else  
      {  
         parent.QueryFrame.location.href = "/reports/GotoCounty.php?county="+county+"&progcode1="+progcode1+"&progcode2="+progcode2+"&progcode3="+progcode3+"&year="+getDataSetYear();
         setLastQuery(zoomToCounty);
      }
  
 }
 
 
 function zoomToSelectedCounty()
  {  
     var i =0;  
     if (parent.QueryFrame.document.Qform.Bnum.length == 2)
     {            
        //theSelection = " ";	    
 	urlOptions = "&mapext=" + parent.QueryFrame.document.Qform.Extval.value;
 	parent.MapFrame.document.mapserv.mapext.value=parent.QueryFrame.document.Qform.Extval.value;      
     }       
     else 
        if (parent.QueryFrame.document.Qform.Bnum.length == 3)  
           {   // theSelection =  "%2F" + parent.QueryFrame.document.Qform.Bnum[i].value + "%2F";               
                urlOptions = "&mapext=" + parent.QueryFrame.document.Qform.Extval.value;
                parent.MapFrame.document.mapserv.mapext.value = parent.QueryFrame.document.Qform.Extval.value;
           }
        else 
         {    
  	   // theSelection = "%2F";       
  	  //  while (i < parent.QueryFrame.document.Qform.Bnum.length - 3)
  	  //  { 	       
  	  //    theSelection = theSelection + parent.QueryFrame.document.Qform.Bnum[i].value +"%7C";
  	  //    i = i + 1;
  	  //  } 
  	  //  theSelection = theSelection + parent.QueryFrame.document.Qform.Bnum[i].value + "%2F";	    
  	    urlOptions = "&mapext=" + parent.QueryFrame.document.Qform.Extval.value;
  	    parent.MapFrame.document.mapserv.mapext.value=parent.QueryFrame.document.Qform.Extval.value;
  	 } 
     
     for (i=0; i<parent.LayerFrame.document.layerForm.layer.length;i++) 
     {    
         if ( progcode3 == 1 )
         {  if (parent.LayerFrame.document.layerForm.layer[i].value == "pida")
            {   parent.LayerFrame.document.layerForm.layer[i].checked = true;    }
         }
         if ( progcode2 == 1 )
         {  if (parent.LayerFrame.document.layerForm.layer[i].value == "ogp")
            {   parent.LayerFrame.document.layerForm.layer[i].checked = true;    }
         }
         if ( progcode1 == 1 )
         {  if (parent.LayerFrame.document.layerForm.layer[i].value == "idp")
            {   parent.LayerFrame.document.layerForm.layer[i].checked = true;    }
         }
         
         if (metroareaquery == 1)
	 { if (parent.LayerFrame.document.layerForm.layer[i].value == "metroarea")
            {   parent.LayerFrame.document.layerForm.layer[i].checked = true;  }
         }
         if (schooldistrictquery == 1)
         {
         	 if (parent.LayerFrame.document.layerForm.layer[i].value == "schooldistricts")
         	 	 {	parent.LayerFrame.document.layerForm.layer[i].checked = true; }
         }
     }
     
     
    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 += "+";
    }
        
    for (i=0; i<parent.LayerFrame.document.layerForm.layer.length;i++) 
     {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
	   { URLString += "&layer="+parent.LayerFrame.document.layerForm.layer[i].value; }
     }    
    
  //  queryLayerCheck();
  //  URLString += "&layer="+layer;
    
    
    URLString += "&imgxy="+mouseX+"+"+mouseY; 
    mode = "browse";    
    URLString += "&mode=browse";
    URLString += urlOptions;    
    URLString += "&map_web_error=../zoomaway.html&map_querymap_size="+imgxy;  
    URLString += "&map_size="+imgxy;   
    URLString += "&qlayer="+qlayer; 
    URLString += "&map_"+qlayer+"_header=demo.html";
    URLString += "&map_"+qlayer+"_template=zoomto.html";
    URLString += "&map_"+qlayer+"_filter=" + theSelection; 
   
    parent.MapFrame.location.href = URLString;   
   
   } // zoomToSelectedCounty()
 
 
 function zoomToSelectedProjectid(i)
  {   
    programnum = parent.QueryFrame.document.Qform.Bnum[i].value;
    projectquery = 1;
    
     theSelection =  "%2F" + programnum + "%2F";
     urlOptions = "&mapext=" + parent.QueryFrame.document.Qform.Ext_val[i].value;
     parent.MapFrame.document.mapserv.mapext.value = parent.QueryFrame.document.Qform.Ext_val[i].value;
      
    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 += "+";
    }
    
    for (i=0; i<parent.LayerFrame.document.layerForm.layer.length;i++) 
     {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
    	   { URLString += "&layer="+parent.LayerFrame.document.layerForm.layer[i].value; }
     } 
  
    qlayer = qlayerCheck();
    
    URLString += "&imgxy="+mouseX+"+"+mouseY;   
    mode = "itemnquery";
    
    URLString += urlOptions;
    URLString += "&mode=itemnquery";
    URLString += "&map_web_error=../zoomaway.html";
    URLString += "&map_querymap_size="+imgxy;  
     
    URLString += "&qlayer="+qlayer; 
    URLString += "&map_"+qlayer+"_header=demo.html";
    URLString += "&map_"+qlayer+"_template=zoomto.html";
    URLString += "&map_"+qlayer+"_filter=" + theSelection; 
    parent.MapFrame.location.href = URLString;          
 }  // End of ZoomToSelectedProjectid

 function zoomToKeyword()
 {  
    var i =0;  
    
    if (parent.QueryFrame.document.Qform.Bnum.length == 2)
       {  return ;  }       
    else 
       if (parent.QueryFrame.document.Qform.Bnum.length == 3)  
          {    theSelection =  "%2F" + parent.QueryFrame.document.Qform.Bnum[i].value + "%2F";               
               urlOptions = "&mapext=" + parent.QueryFrame.document.Qform.Ext_val[i].value;
               parent.MapFrame.document.mapserv.mapext.value = parent.QueryFrame.document.Qform.Ext_val[i].value;
          }
       else 
         {  
            theSelection = "%2F";  
	    limit = parent.QueryFrame.document.Qform.Bnum.length - 3;
	    
	    if (limit >= 210)
	    	{ limit = 210;  }	         
	    	       
	    while (i < limit)	         
	    {   	         
	    	theSelection = theSelection + parent.QueryFrame.document.Qform.Bnum[i].value +"%7C";
	    	i = i + 1;
	    } 
 
 	    theSelection = theSelection + parent.QueryFrame.document.Qform.Bnum[i].value + "%2F";	    
 	    urlOptions = "&mapext=shapes";
 	    
 	    parent.MapFrame.document.mapserv.mapext.value=mapext;

 	}  
  
	for (i=0; i<parent.LayerFrame.document.layerForm.layer.length;i++) 
	 {  
	    if (parent.LayerFrame.document.layerForm.layer[i].value == "pida")
		{   parent.LayerFrame.document.layerForm.layer[i].checked = true;    }
	    if (parent.LayerFrame.document.layerForm.layer[i].value == "ogp")
		{   parent.LayerFrame.document.layerForm.layer[i].checked = true;    }
	    if (parent.LayerFrame.document.layerForm.layer[i].value == "idp")
		{   parent.LayerFrame.document.layerForm.layer[i].checked = true;    }
	 }      
	 
   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 += "+";
   }
  
   var year = getDataSetYear();
   URLString += "&imgxy="+mouseX+"+"+mouseY; 
   mode = "itemnquery";    
   URLString += "&mode=itemnquery";
   URLString += urlOptions;  
   URLString += "&qlayer=program";
   URLString += "&map_querymap_size=" + imgxy; 
   URLString += "&map_program_header=demo.html";
   URLString += "&map_program_template=zoomto.html"
   URLString += "&map_program_filter=" + theSelection;
   
   //alert(URLString);
   parent.MapFrame.location.href = URLString;     
  
  } // zoomToSelected()
 
  
 //   *** Functions for Township search ****    
  
  function zoomToTownship()
   { 
      var cboCounty = parent.ScriptFrame.document.getElementById('cboCounty');
      var cboTownship = parent.ScriptFrame.document.getElementById('cboTownship');
      var cboMetroArea = parent.ScriptFrame.document.getElementById('cboMetroArea');
      var cboSchoolDistrict = parent.ScriptFrame.document.getElementById('cboSchoolDistrict');
      
      if (isNav6)
      { 
      
      	i = cboTownship.selectedIndex; 
      	Township = cboTownship.options[i].value; 
      	
      	cboCounty.options[0].selected = "0";
      	cboMetroArea.options[0].selected = "0";
      	cboSchoolDistrict.options[0].selected = "0";
      	
	//i = parent.ScriptFrame.document.searchform.Township.selectedIndex;        	    
	//Township = parent.ScriptFrame.document.searchform.Township.options[i].value; 
	//parent.ScriptFrame.document.searchform.County.options[0].selected = "0";
	//parent.ScriptFrame.document.searchform.Metroarea.options[0].selected = "0"; 
	//parent.ScriptFrame.document.searchform.Schooldistrict.options[0].selected = "0";
      } 
      else 
      {
      
        var Township = cboTownship.options.value; 
            	
        cboCounty.options.value = "0";
        cboMetroArea.options.value = "0";
      	cboSchoolDistrict.options.value = "0";
      
      	//Township = parent.ScriptFrame.document.searchform.Township.options.value; 
	//parent.ScriptFrame.document.searchform.County.options.value = "0";	
	//parent.ScriptFrame.document.searchform.Metroarea.options.value = "0";
	//parent.ScriptFrame.document.searchform.Schooldistrict.options.value = "0";

       }
     
      parent.ButtonFrame.document.Buttonform.Keyword.value = " ";	
      
     for (i=0; i<parent.LayerFrame.document.layerForm.layer.length;i++) 
     {   if (parent.LayerFrame.document.layerForm.layer[i].value == "pida")
         {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
               {  progcode3 = 1;     }
            else {  progcode3 = 0;     }   
         }
         if (parent.LayerFrame.document.layerForm.layer[i].value == "ogp")
         {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
               {  progcode2 = 1;    }
            else {  progcode2 = 0;     }
         }
         if (parent.LayerFrame.document.layerForm.layer[i].value == "idp")
         {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
               {  progcode1 = 1;    }
            else {  progcode1 = 0;     }
         }
     }
     
     metroareaquery = 0;
     projectquery = 0;
     
     if ( (progcode1 == 0) && (progcode2 == 0) && (progcode3 == 0) )
        {  alert('Please select at least one DCED program type from the list: IDP, OGP, PIDA.')             
      	      if (isNav6)
      	      {
      	              cboTownship.options.selectedIndex = 0;
      	      	      //parent.ScriptFrame.document.searchform.Township.options.selectedIndex = 0;
      	      }
      	      else
      	      {
      	              cboTownship.options.value = 0;
      	      	      //parent.ScriptFrame.document.searchform.Township.options.value = 0;
      	      }    
        }
     else  
        {  
           parent.QueryFrame.location.href = "/reports/GotoTownship.php?Township="+Township+"&progcode1="+progcode1+"&progcode2="+progcode2+"&progcode3="+progcode3+"&year="+getDataSetYear();
           setLastQuery(zoomToTownship);
        }
    
 }
 


//   *** Functions for Metro Area search ****   
  
  function zoomToMetroArea()
   { 
   
      var cboCounty = parent.ScriptFrame.document.getElementById('cboCounty');
      var cboTownship = parent.ScriptFrame.document.getElementById('cboTownship');
      var cboMetroArea = parent.ScriptFrame.document.getElementById('cboMetroArea');
      var cboSchoolDistrict = parent.ScriptFrame.document.getElementById('cboSchoolDistrict');
      
      if (isNav6)
      {     
        i = cboMetroArea.selectedIndex;
        Metroarea = cboMetroArea.options[i].value; 
        
	cboCounty.options[0].selected = "0";
	cboTownship.options[0].selected = "0";
	cboSchoolDistrict.options[0].selected = "0";
      
	//i = parent.ScriptFrame.document.searchform.Metroarea.selectedIndex;        	    
	//Metroarea = parent.ScriptFrame.document.searchform.Metroarea.options[i].value; 
	//parent.ScriptFrame.document.searchform.County.options[0].selected = "0";
	//parent.ScriptFrame.document.searchform.Township.options[0].selected = "0";
	//parent.ScriptFrame.document.searchform.Schooldistrict.options[0].selected = "0";
      } 
      else 
      {
      	var Metroarea = cboMetroArea.value; 
      	
      	cboCounty.options.value = "0";
      	cboTownship.options.value = "0";
      	cboSchoolDistrict.options.value = "0";

	//Metroarea = parent.ScriptFrame.document.searchform.Metroarea.options.value; 
	//parent.ScriptFrame.document.searchform.County.options.value = "0";
	//parent.ScriptFrame.document.searchform.Township.options.value = "0";
	//parent.ScriptFrame.document.searchform.Schooldistrict.options.value = "0";
       }
     
     parent.ButtonFrame.document.Buttonform.Keyword.value = " ";		
     
     for (i=0; i<parent.LayerFrame.document.layerForm.layer.length;i++) 
     {   if (parent.LayerFrame.document.layerForm.layer[i].value == "pida")
         {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
               {  progcode3 = 1;     }
            else {  progcode3 = 0;     }   
         }
         if (parent.LayerFrame.document.layerForm.layer[i].value == "ogp")
         {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
               {  progcode2 = 1;    }
            else {  progcode2 = 0;     }
         }
         if (parent.LayerFrame.document.layerForm.layer[i].value == "idp")
         {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
               {  progcode1 = 1;    }
            else {  progcode1 = 0;     }
         }
     }
     
     projectquery = 0;
     
     if ( (progcode1 == 0) && (progcode2 == 0) && (progcode3 == 0) )
        {  alert('Please select at least one DCED program type from the list: IDP, OGP, PIDA.')              
      	      if (isNav6)
      	      {
      	      	      cboMetroArea.options.selectedIndex = 0;
      	      	      //parent.ScriptFrame.document.searchform.Metroarea.options.selectedIndex = 0;
      	      }
      	      else
      	      {
      	      	      cboMetroArea.options.value = 0;
      	      	      //parent.ScriptFrame.document.searchform.Metroarea.options.value = 0;
      	      }    
        }
     else  
        {  metroareaquery = 1;
           parent.QueryFrame.location.href = "/reports/GotoMetroArea.php?Metroarea="+Metroarea+"&progcode1="+progcode1+"&progcode2="+progcode2+"&progcode3="+progcode3+"&year="+getDataSetYear();
           setLastQuery(zoomToMetroArea);
        }
    
 }
 
 
  function zoomToSchoolDistrict()
   { 
      var cboCounty = parent.ScriptFrame.document.getElementById('cboCounty');
      var cboTownship = parent.ScriptFrame.document.getElementById('cboTownship');
      var cboMetroArea = parent.ScriptFrame.document.getElementById('cboMetroArea');
      var cboSchoolDistrict = parent.ScriptFrame.document.getElementById('cboSchoolDistrict');
      
      if (isNav6)
      {       
      	i = cboSchoolDistrict.selectedIndex;        	    
      	Schooldistrict = cboSchoolDistrict.options[i].value; 
      	
      	cboCounty.options[0].selected = "0";
      	cboTownship.options[0].selected = "0";
	cboMetroArea.options[0].selected = "0";
	
	//i = parent.ScriptFrame.document.searchform.Schooldistrict.selectedIndex;        	    
	//Schooldistrict = parent.ScriptFrame.document.searchform.Schooldistrict.options[i].value; 
	//parent.ScriptFrame.document.searchform.County.options[0].selected = "0";
	//parent.ScriptFrame.document.searchform.Township.options[0].selected = "0";
	//parent.ScriptFrame.document.searchform.Metroarea.options[0].selected = "0";
      } 
      else 
      {
      	var Schooldistrict = cboSchoolDistrict.options.value; 
      	
      	cboCounty.options.value = "0";
      	cboTownship.options.value = "0";
      	cboMetroArea.options.value = "0";

	//Schooldistrict = parent.ScriptFrame.document.searchform.Schooldistrict.options.value; 
	//parent.ScriptFrame.document.searchform.County.options.value = "0";
	//parent.ScriptFrame.document.searchform.Township.options.value = "0";
	//parent.ScriptFrame.document.searchform.Metroarea.options.value = "0";
       }
     
     parent.ButtonFrame.document.Buttonform.Keyword.value = " ";		
     
     for (i=0; i<parent.LayerFrame.document.layerForm.layer.length;i++) 
     {   if (parent.LayerFrame.document.layerForm.layer[i].value == "pida")
         {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
               {  progcode3 = 1;     }
            else {  progcode3 = 0;     }   
         }
         if (parent.LayerFrame.document.layerForm.layer[i].value == "ogp")
         {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
               {  progcode2 = 1;    }
            else {  progcode2 = 0;     }
         }
         if (parent.LayerFrame.document.layerForm.layer[i].value == "idp")
         {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
               {  progcode1 = 1;    }
            else {  progcode1 = 0;     }
         }
     }
     
     projectquery = 0;
     
     if ( (progcode1 == 0) && (progcode2 == 0) && (progcode3 == 0) )
        {  alert('Please select at least one DCED program type from the list: IDP, OGP, PIDA.')              
       	      if (isNav6)
      	      {
      	              cboSchoolDistrict.options.selectedIndex = 0;
      	      	      //parent.ScriptFrame.document.searchform.Schooldistrict.options.selectedIndex = 0;
      	      }
      	      else
      	      {
      	              cboSchoolDistrict.options.value = 0;
      	      	      //parent.ScriptFrame.document.searchform.Schooldistrict.options.value = 0;
      	      }    
        }
     else  
        {  schooldistrictquery = 1;
           parent.QueryFrame.location.href = "/reports/GotoSchoolDistrict.php?SchoolDistrict="+Schooldistrict+"&progcode1="+progcode1+"&progcode2="+progcode2+"&progcode3="+progcode3+"&year="+getDataSetYear();
           setLastQuery(zoomToSchoolDistrict);
        }
    
 }
 
 function zoomToSelectedSchoolDistrict()
  {  
     var i =0;  
     
     // alert(parent.QueryFrame.document.Qform.Extval.value);  
     
     if (parent.QueryFrame.document.Qform.Bnum.length == 2)
     {            
        //theSelection = " ";	    
 	urlOptions = "&mapext=" + parent.QueryFrame.document.Qform.Extval.value;
 	parent.MapFrame.document.mapserv.mapext.value=parent.QueryFrame.document.Qform.Extval.value;      
     }       
     else 
        if (parent.QueryFrame.document.Qform.Bnum.length == 3)  
           {    //theSelection =  "%2F" + parent.QueryFrame.document.Qform.Bnum[i].value + "%2F";               
                urlOptions = "&mapext=" + parent.QueryFrame.document.Qform.Extval.value;
                parent.MapFrame.document.mapserv.mapext.value = parent.QueryFrame.document.Qform.Extval.value;
           }
        else 
         {    
  	   // theSelection = "%2F";       
  	  //  while (i < parent.QueryFrame.document.Qform.Bnum.length - 3)
  	  //  { 	       
  	  //    theSelection = theSelection + parent.QueryFrame.document.Qform.Bnum[i].value +"%7C";
  	  //    i = i + 1;
  	  //  } 
  	  //  theSelection = theSelection + parent.QueryFrame.document.Qform.Bnum[i].value + "%2F";	    
  	    urlOptions = "&mapext=" + parent.QueryFrame.document.Qform.Extval.value;
  	    parent.MapFrame.document.mapserv.mapext.value=parent.QueryFrame.document.Qform.Extval.value;
  	 } 
     
     for (i=0; i<parent.LayerFrame.document.layerForm.layer.length;i++) 
     {    
         if ( progcode3 == 1 )
         {  if (parent.LayerFrame.document.layerForm.layer[i].value == "pida")
            {   parent.LayerFrame.document.layerForm.layer[i].checked = true;    }
         }
         if ( progcode2 == 1 )
         {  if (parent.LayerFrame.document.layerForm.layer[i].value == "ogp")
            {   parent.LayerFrame.document.layerForm.layer[i].checked = true;    }
         }
         if ( progcode1 == 1 )
         {  if (parent.LayerFrame.document.layerForm.layer[i].value == "idp")
            {   parent.LayerFrame.document.layerForm.layer[i].checked = true;    }
         }
         
         if (schooldistrictquery == 1)
	 {  
	    if (parent.LayerFrame.document.layerForm.layer[i].value == "schooldistricts")
            {   parent.LayerFrame.document.layerForm.layer[i].checked = true;  }
         }
     }
     
     
    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 += "+";
    }
        
    for (i=0; i<parent.LayerFrame.document.layerForm.layer.length;i++) 
     {  if (parent.LayerFrame.document.layerForm.layer[i].checked)
	   { URLString += "&layer="+parent.LayerFrame.document.layerForm.layer[i].value; }
     }    
    
  //  queryLayerCheck();
  //  URLString += "&layer="+layer;
    
    
    URLString += "&imgxy="+mouseX+"+"+mouseY; 
    mode = "browse";    
    URLString += "&mode=browse";
    URLString += urlOptions;  
       
  //  URLString += "&map_web_error=../zoomaway.html&map_querymap_size="+imgxy;
      URLString += "&map_size="+imgxy;
  //  URLString += "&qlayer="+qlayer; 
  //  URLString += "&map_"+qlayer+"_header=demo.html";
  //  URLString += "&map_"+qlayer+"_template=zoomto.html";
  //  URLString += "&map_"+qlayer+"_filter=" + theSelection;
   
    //alert(URLString);
    parent.MapFrame.location.href = URLString;   
   
   } // zoomToSelectedCounty()


