/* initalize superfish for menus  */
$(document).ready(function(){
	$(".nav")
	.superfish({
		animation : { opacity:"show", height:"show" }
	})
	.find(">li:has(ul)")
		.mouseover(function(){
			$("ul", this).bgIframe({opacity:false});
		})
		.find("a")
			.focus(function(){
				$("ul", $(".nav>li:has(ul)")).bgIframe({opacity:false});
			});
});

// getParams *******************************************************************
function getParams(params) {
   var Params = new Object ();
   if ( ! params ) return Params; // return empty object
   var Pairs = params.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) continue;
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;

}
// end getParams *****************************************************************

function searchFormSubmit(form) {

     if (form.aff.value == 'losbanosenterprise') {
        var encoded_keywords = encodeURIComponent(form.keywords.value);
	form.sf_pubsys_story.value = encoded_keywords;
     }
     else if (form.aff.value == 'web') {
         var encoded_keywords = encodeURIComponent(form.keywords.value);
         var section_num = '111';
         var url_version = 'ysr';
         var params = 'product=Yahoo%2COverture&' +
                      'collection=WEB&' +
                      'live_template=http%3A%2F%2Fpubsys.losbanosenterprise.com%2F' + section_num + '%2Fv-' + url_version + '%2Findex.html&' + 
                      'error_template=http%3A%2F%2Fpubsys.losbanosenterprise.com%2F' + section_num + '%2Fv-yerr%2Findex.html&' +
                      'preview_template=http%3A%2F%2Fpreview.losbanosenterprise.com%2F' + section_num + '%2Fv-' + url_version + '%2Findex.html&' +
                      'results_per_page=10'; 
         window.location = "http://search2.losbanosenterprise.com/search-bin/search.pl.cgi?sf_Keywords=" + encoded_keywords + '&' + params;

         return false;
     }

     return true;
 }
