function externalLinks() {  
 if (!document.getElementsByTagName) return;  
 var anchors = document.getElementsByTagName("a");  
 for (var i=0; i<anchors.length; i++) {  
   var anchor = anchors[i];  
   if (anchor.getAttribute("href") &&  
       anchor.getAttribute("rel") == "external")  
     anchor.target = "_blank";  
 }  
}  
window.onload = externalLinks;

jQuery(function($){
  $('.sf-menu').superfish({
    autoArrows: false,
    dropShadows: false
  });
  
  $('form#constant-contact-signup input:text').each(function(i){
    var labelData = $(this).parent().prev('label').text();
    $(this).val(labelData);
  });
  $('form#constant-contact-signup input:text').focus(function(){
    var value = $(this).val();
    var labelData = $(this).parent().prev('label').text();
    if(value === labelData) {
      $(this).val('');
    }
  }).blur(function(){
    var value = $(this).val();
    var labelData = $(this).parent().prev('label').text();
    if(value === ''){
      $(this).val(labelData);
    }
  });

  $('form#constant-contact-signup input.submit').val('');
  
  $('.shopp-orderby-menu').easySelectBox({speed:100});
  $('.easy-select-box ul li a').click(function() {
    if($(this).attr('rel') != '') {
      var protocol = location.protocol;
      var hostname = location.hostname;
      var pathname = location.pathname;
      var query = $(this).attr('rel');
      location.replace(protocol+'//'+hostname+'/'+pathname+'/?shopp_orderby='+query);
  }
  });
});
