              var xhr = false;
              var sort=new Array();
				
	      function ToggleCats(catid,subcatid){
		   for(id=4;id<=subcatid;id++){
	             if($('cat_hide'+catid+'_'+id).style.display=="none"){
	              $('cat_hide'+catid+'_'+id).style.display="block";
	              $(catid).innerHTML="View less";
	             }
                     else{
	               $('cat_hide'+catid+'_'+id).style.display="none";
	               $(catid).innerHTML="View more";
	              }
	            }
	        }

		
	       function makeRequest(url,id) {
	       //onclick text decoration
		var id_array=new Array("header_tab1","header_tab2","header_tab3","header_tab4");
		  for(x=0;x<id_array.length;x++){
		    if(id==id_array[x])
		      $(id_array[x]).style.textDecoration = "underline";
		    else
		      $(id_array[x]).style.textDecoration = "none";
		    }
		       sort=url.split("?");
		     getpage(url)
		   }
		function getpage(url){
		      
			if (window.XMLHttpRequest) {
				xhr = new XMLHttpRequest();
			}
			else if (window.ActiveXObject) {
				try {
			           xhr = new ActiveXObject("Microsoft.XMLHTTP");
			           if(!xhr)
			           xhr= new ActiveXobject("Msxml2.XMLHTTP");
			            }
				catch (e) { }
			      }
			if (xhr) {
				xhr.onreadystatechange = showContents;
				xhr.open("GET", url, true);
				xhr.send(null);
			}
			else {
				document.getElementById("updateArea").innerHTML = "Your browser does not support all the features of this application";
			}
			
		   
		}
		 
		 
   		function showContents() {
		    if (xhr.readyState == 4) {
			if (xhr.status == 200) {
		          var outMsg =xhr.responseText;
		 	}
			else {
		          var outMsg = "There was a problem communicating with the server program";
			}
		     document.getElementById("updateArea").innerHTML = outMsg;
		    }
		   else{
		    $("updateArea").innerHTML="<div style='text-align:center;position:relative;top:100px;height:500px;'><img src='./images/loading2.gif'/></div>";
		    }
		}
		
		function page_submit(obj,letter,alpha,page_name){
		 
		   var id_array=new Array("header_tab1","header_tab2","header_tab3","header_tab4");
		    for(x=0;x<id_array.length;x++){
		      if($(id_array[x]).style.textDecoration =="none")
		           continue;
		      else
		            break;
		      }
		    //checking for undefined sort variable
		    if(x>0)
		       getstr = "?"+sort[1]+"&search";
		     else
		      getstr="?search";
		    for (i=0; i<obj.childNodes.length; i++) {
		      if (obj.childNodes[i].tagName == "INPUT") {
		        if (obj.childNodes[i].type == "text") {
		           if(obj.childNodes[i].value=='search...'||obj.childNodes[i].value==''){
		              getstr=""; 
		            }
		           else
		              getstr += "=" + obj.childNodes[i].value;
		         }
		       }  
		    }//--->end for
		     
		     
		    if(getstr!=""){
		       if($(id_array[2]).style.textDecoration !="none"){
		         if(letter!="")
		          getstr +="&letter="+letter;
		         if(alpha!="")
		           getstr +="&alpha="+alpha;
		       }
		          getpage(page_name+getstr);
		     }
		     else
                     alert("please enter text");
		 }//--->end function
		
