$(document).ready(function(){
		   
  // Open external links in new tab/window
  $("a[href*='http://']:not([href*='"+location.hostname+"'])").click(function(){
    this.target = "_blank";
  });
    
  // Return inputs to default value on blur.
  $('input[alt]').focus(function(){
    if ($(this).attr("value") === $(this).attr("defaultValue")) {
      $(this).attr("value", "");
    }
  }).blur(function(){
    if ($(this).attr("value") === "") {
     $(this).attr("value", $(this).attr("defaultValue"));
    }
  });


	//email replacement
	$('.safemail').each(function(){
		var emaillink = $(this).text().
		      replace(/\sat\s/g, "@").
		      replace(/\sdot\s/g, ".");

    if ($(this).attr('title')) {
 			emaillink += "?subject=" + $(this).attr('title').replace(/\s/g,"%20");
	  }
	
		$(this).replaceWith("<a href=\"mailto:" + emaillink + "\">" + emaillink.split("?")[0] + "</a>");
	});
	
	
	//Typekit
	$("#navigation, #slideshow li a, .frames li h3, #filters").addClass("tk-proxima-nova-soft");
	
	// Carousel
	$("#slideshow").cycle({
    speed: 5000,
    next: 'a#next',
    prev: 'a#prev',
    pause: 1,
    speed: 400,
    fx: 'scrollHorz',
    cleartypeNoBg: true
  });
  
  //Rating hide and show
  $(".frames .rating").hide();
  $(".frames li a").live("hover", function(){
    $(this).find(".rating").slideToggle(100);
  });
  
  //  filter dropdown
  $(".dropdown ul li a:last").css('border', 'none'); //remove last border
  $(".dropdown").hide();
  $(".show_dropdown").click(function(){
    $(this).toggleClass("active");
    $(this).next('.dropdown').slideToggle();
    return false;
  });

});


