
$(document).ready(function(){
  
  //Change safari search input button
  if($.browser.safari) {
    $("#btn-search-submit").attr("type", "submit").css({ margin: "0 0 0 10px" });
    $("#txt-search").attr({ type: "search", results: "5" });
    $("#lbl-search").hide();
  }
  
  //IE drop down fix
  if (document.all) {
    $("#nav > li").hoverClass ("sfHover");
  }
  
  //home page voices rotation
  //-------------------------------------------------
  var numVoices = $(".rotate-voices").size();
    $("#voices .next").click(function(){
    if(document.all) { $("#voices").css({ padding: "0 0 10px 0" }); }
    $(".cur-voice").fadeOut(500, function(){
      if($(".cur-voice").attr("rel") <= numVoices - 1 ) {
        x = $(".cur-voice").next();
      } else {
        x = $(".rotate-voices[@rel=1]");
      }
      $(".cur-voice").removeClass("cur-voice");
      x.fadeIn(500).addClass("cur-voice");
    });
    return false;
  });
  
  $("#voices .prev").click(function(){
    $(".cur-voice").fadeOut(500, function(){
      if($(".cur-voice").attr("rel") == 1 ) {
        x = $(".rotate-voices[_40rel="+numVoices+"]");
      } else {
        x = $(".cur-voice").prev();
      }
      $(".cur-voice").removeClass("cur-voice");
      x.fadeIn(500).addClass("cur-voice");
    });
    return false;
  }); 
  //end voices rotation
  
  
  // POPUPS
  $(".popup").click(function(){        
    window.open($(this).attr("href"), "popup1","width=550, height=500, toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes"); 
    return false;     
  });
  $(".popupMini").click(function(){        
      window.open($(this).attr("href"), "popup2","width=400, height=200, toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes"); 
      return false;     
  });
  
  
  
});

$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
};
