function toggle_check($tval)
{
    for(i=0; i<document.search_form.elements.length; i++) {

           if(document.search_form.elements[i].name.substr(0,4)=="mark"){
               if(document.search_form.elements[i].type=="checkbox")
                   document.search_form.elements[i].checked=$tval;
           }
    }
}

function clear_search_form()
{
    for(i=0; i<document.search_form.elements.length; i++) {
           if(document.search_form.elements[i].name=="page")
                document.search_form.elements[i].value='';

           if(document.search_form.elements[i].name.substr(0,7)=="search_"){

               if(document.search_form.elements[i].type=="checkbox")
                   document.search_form.elements[i].checked=false;

               if(document.search_form.elements[i].type=="text")
                   document.search_form.elements[i].value='';

               if(document.search_form.elements[i].type=="select-one")
                   document.search_form.elements[i].value='';
           }
    }
}

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';
}

function toggle_search( whichLayer )
{
  var elem,elem2,vis,vis2;

  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( document.getElementById ) // this is the way the standards work
    elem2 = document.getElementById( "search_status" );
  else if( document.all ) // this is the way old msie versions work
      elem2 = document.all["search_status"];
  else if( document.layers ) // this is the way nn4 works
    elem2 = document.layers["search_status"];
  vis2 = elem2.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';

  if (vis.display=='none'){
       elem2.innerHTML="<a href=\"javascript:toggle_search('search_form');\">+Show Search</a>";
  } else {
       elem2.innerHTML="<a href=\"javascript:toggle_search('search_form');\">-Hide Search</a>";
  }

}
