clearBasic_cookie = "OPACclearBasic";

inputSearch_cookie = "OPACinputSearch";
inputSelect_cookie = "OPACinputSelect";

function helpLookup(event){  
  tempX = event.clientX;
  tempY = event.clientY;  
  windowW = 550;    
  if((screen.width - tempX) < windowW)
    tempX = screen.width - windowW - 100;    
  else
    tempX = tempX + 10;
  windowH = 350;    
  if((screen.height - tempY) < windowH)
    tempY = screen.height - windowH - 80;
  else      
    tempY = tempY;  
  
  TB_LEFTPOS = tempX;
  TB_TOPPOS = tempY;
  
  TB_init_url_opPos('quickSearchCatHelp.jsp?KeepThis=true&TB_iframe=true&height=' + windowH + '&width=' + windowW, ' ');  
}

/// load / submit doc /////////
function loadDoc(){	
    document.search_form.inputSearch.value = GetCookie(inputSearch_cookie); 
    document.search_form.inputSelect.selectedIndex = GetCookie(inputSelect_cookie); 
    var elOrder = "";
    var elName = "";
    				
    if(GetCookie(clearBasic_cookie) == 'YES'){
        document.search_form.inputSearch.value = "";
        document.search_form.inputSelect.selectedIndex = 0;
    }//default
    
    SetCookie(clearBasic_cookie, 'NO');	
}

function AllInputs(form) {
    
    
    if (document.search_form.inputSearch.value == "" ||
      document.search_form.inputSearch.value == '*'){                
        validatePrompt("Please enter some search terms")
        
        return (false);
    }else {	          
        if (document.search_form.inputSearch.value.substr(0,1) == '*'){        
          validatePrompt("'*' not allowed as first character in PrefixQuery")        
          return (false);
        }
      
        return (true);	  
    }
}
function validatePrompt(PromptStr) {  
    alert(PromptStr)
    return false;  
}
function resetStartRecord(){  
    if(document.search_form.startRecord)
        document.search_form.startRecord.value = 1;		  
}
function setValues(){			
    SetCookie(inputSearch_cookie, document.search_form.inputSearch.value);
    SetCookie(inputSelect_cookie, document.search_form.inputSelect.selectedIndex);  
    
    var elOrder = "";
    var elName = "";
    
    var element; //object
    
}
function runSubmit(form){
    if (!AllInputs(form)){ 
        document.search_form.inputSearch.focus();
        return (false);
    }
    else{
        setValues();		
        document.search_form.customValue_1.value = document.search_form.inputSearch.value;        
        document.search_form.customMatch_1.value = document.search_form.inputSelect.value;
        
        return (true);			  		
    }   
}
function execSubmit(form){
    if(runSubmit(form)){    
        
        document.search_form.submit();  		  
    }
}
function newSearch(){ 			
    document.search_form.reset();	
}
function getAdvancedForm(file){   
    var location = parent.location + "";
    
    if(location.indexOf("welcome.jsp") > 0)
        parent.location = file + '';
    else
        window.location = file + '';
}

function document_onkeypress(){ 
    if (window.event.keyCode == 13){	
        event.cancelBubble; 
    }
}
if(IE) document.onkeypress = document_onkeypress;   
function getKeycode(e){  
    var NN4key = e.which
    if (NN4key == 13){			    
    }  
}
if(Nav) document.onkeydown = getKeycode;

function displayMess(refine){    
  if("on" == refine)
    alert('Search produced too many results(1000+), please refine your search ');    
}

