// JavaScript Document


/* ////////////////////  Drop-Down Menu ////////////////////// */
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

/*
* runs once the page is loaded
*/
$(document).ready(function()
{  
     $('#jsddm > li').bind('mouseover', jsddm_open)
     $('#jsddm > li').bind('mouseout',  jsddm_timer)
});

document.onclick = jsddm_close;
/* ////////////////////  Drop-Down Menu ////////////////////// */



function fmSearchForm( xform ){

     xform.submit();

}

function fmHSearch(){

     var xform = document.getElementById('pform');
     
     if(xform.q && xform.q.value=='Product Search') xform.q.value='';
     //var sfield = document.getElementById('search_field');
     //alert('here');
     xform.method='get';
     xform.action='/search.php';
     xform.submit();

}


function clickclear(thisfield) {
     if (thisfield.value == 'Product Search') {
          thisfield.value = "";
     }
}

function clickrecall(thisfield) {
     if (thisfield.value == "") {
          thisfield.value = 'Product Search';
     }
}

function checkEnter(event, xform)
{     

    var code = 0;
    
    if (NS4)
        code = event.which;
    else
        code = event.keyCode;
        
     alert(code);
        
    if (code==13){
     
        //fmHSearch();
        
     }
}

/**
 * web safe email mailto: link
 */ 
function semail(name, domain){

     var email_address = name+'@'+domain;
     document.write( '<a href="mailto:'+email_address+'">'+email_address+'</a>' );
}


