

function ucwords(str) {    
    return str.replace(/^(.)|\s(.)/g, function ( $1 ) { return $1.toUpperCase ( ); } );
} 

function search(submit, root) {
     IE = (document.all)
     NC = (document.layers)
     Opera = (document.getElementById)

    
     if(IE){
         eval('text = document.all["txtSearch"]')
          eval('form = document.all["searchForm"]')
     }
     if(NC){
         eval('text = document.layers[txtSearch]')
         eval('form = document.layers[searchForm]')
     }
     if(Opera){
         eval('text = document.getElementById("txtSearch")')
         eval('form = document.getElementById("searchForm")')
     }

 if (text.value == "") {
      text.focus();
    if (submit)
      return false;
      
  } else {
    text_value = ucwords(text.value.toLowerCase());
	
    re = /[^A-Za-z0-9]/g;

    expression = text_value.replace(re, "-");
    
    form.action= root + 'search/' + expression + '/1';
    
    if (submit)
      return true;
  }
}
