jQuery(document).ready(function() {
//searchForm start
  var $searchform = jQuery('#srchfm'),
      $sbtn = jQuery('#srch .srch');
  $sbtn.hover(function() {
    if(jQuery($searchform).attr('class') != 'act') {
      $searchform.addClass('act').animate( {width:'162px'}, 500,
        function() {
        //Form was opened.
        $sbtn.css({'background-position' : '0 -29px', 'z-index' : '100', 'cursor' : 'pointer'});
        et_search_bar($searchform);
        return false;
      })
    }
    return false;
  })
  //Close the form
  jQuery(document).click(function(e) {
    if (!jQuery(e.target).parents().andSelf().is('#srch') && jQuery($searchform).attr('class') == 'act') {
      $sbtn.css({'background-position' : '0 0', 'z-index' : '0', 'cursor' : 'default'});
      jQuery($searchform).animate( {width : 0}, 500, function() {
        // Form was closed.
        jQuery(this).hide().removeClass('act');
        return false;
      })
    }
  })
//searchForm stop
});
function et_search_bar($searchform) {
   var $searchinput = $searchform.find("input#schipt"),
       searchvalue = $searchinput.val();
   $searchinput.focus(function() {
      if (jQuery(this).val() === searchvalue) jQuery(this).val("");
   }).blur(function() {
      if (jQuery(this).val() === "") jQuery(this).val(searchvalue);
   });
}

