//jQuery.noConflict();

function searchIn(){
	if(jQuery("#searchField").val() == textSearch){
		jQuery("#searchField").val("");
		jQuery("#searchField").addClass("inputTextIn");
		jQuery("#searchField").removeClass("input");
	}
}

function searchOut(){
	if(jQuery("#searchField").val() == ""){
		jQuery("#searchField").addClass("input");
		jQuery("#searchField").removeClass("inputTextIn");
		jQuery("#searchField").val(textSearch);
	}
}

function searchAdvanceShow(){
	if(!showAvSe){
		
		
		jQuery("#sectionAdvencedSearch").slideDown("fast", function(){
			if(jQuery("#searchField").val() != textSearch){
				jQuery("#searchAdvancedField").val( jQuery("#searchField").val() );
			}
		});
		
		showAvSe = true;
	}else{
		jQuery("#sectionAdvencedSearch").slideUp("fast");
		showAvSe = false;
	}
}

function searchSend(){
	var sQueryParam = jQuery("#searchField").val();
	var searchModule = "/search";

   var sEncodingCodeParam = "/" + ciNoEncodType;
   var sCategoryIdParam = "/0";
   var sPageParam = "/"+ciFirstUriPage;
         
   //search/:encoding_code/:query/:category_id/:page
   
   //If no change to default value("Search a Scuup").
	if(sQueryParam == textSearch){
		sQueryParam = "";
	}
   
   if ((sQueryParam == "") || (sQueryParam == " ")){
      sQueryParam = "_";         
   }
   else{                   
      //If search string is not alpha num, need to encode.
      if (!isAlphaNumeric(sQueryParam)){
         //alert("Search string" + convertToHexStr(searchText));
         sEncodingCodeParam = "/" + ciHexStrEncodType;
         sQueryParam = convertToHexStr(sQueryParam)         
      }      
   }
     
   sQueryParam = '/' + sQueryParam; 
   
   this.location.href = csServerUrlRoot + searchModule + sEncodingCodeParam + sQueryParam + 
      sCategoryIdParam + sPageParam;   
}

nn=(document.layers)?true:false;
ie=(document.all)?true:false;

function searchFieldKeyPress(event){
   //var sOutput = "searchFieldKeyPress: Entry: " + event.keyCode ;
   //confirm(sOutput);
   if (event.keyCode == 13){
      //confirm("searchFieldKeyPress: Enter pressed!");
      searchSend();
   }
}
