
jQuery(document).ready(function() {   
    // open external link in new tab/window
    // use rel="external" instead of target="_blank"
    $('a[rel="external"]').click( function() {
        this.target = "_blank";
    });

		//clear field
		$(document).pngFix(); 

		 $("#News_Email:text").focus(function() {
	      if( this.value == this.defaultValue ) {
	          this.value = "";
	      }
	   }).blur(function() {
	      if( !this.value.length ) {
	          this.value = this.defaultValue;
	      }
	   })
   

     //email replacement
   	$("span.mailto").each(function(){
   	  exp = $(this).text().search(/\((.*?)\)/) != -1 ? new RegExp(/(.*?) \((.*?)\)/) : new RegExp(/.*/);
   	  match = exp.exec($(this).text());
   	  addr = match[1] ? match[1].replace(/ at /,"@").replace(/ dot /g,".") : match[0].replace(/ at /,"@").replace(/ dot /g,".");
   	  emaillink = match[2] ? match[2] : addr;
   	  subject = $(this).attr('title') ? "?subject="+$(this).attr('title').replace(/ /g,"%20") : "";
       $(this).after('<a href="mailto:'+addr+subject+'">'+ emaillink + '</a>');
   		$(this).remove();
   	});
    
 
    
     $("a#delivery-same").click(function(){
      $("ol.billing input").each(function(){
        var input_name = $(this).attr("id");
        var input_value = $(this).val();
        
        $("ol.delivery input#del_" + input_name).val(input_value);
      });
      
      $("ol.billing select").each(function(){
        var input_name = $(this).attr("id");
        var input_value = $(this).val();
        
        $("ol.delivery select#del_" + input_name).val(input_value);
      });
    });

 	  //slideshow
    //$('#heroshot').cycle({fx: 'fade', timeout: 0, speed: 600});

 		$('#slideshow').cycle({fx: 'fade', timeout: 5000, speed: 2000});

  
   
    $("ul#fashion-gallery li a:eq(0)").addClass('active');
    $("ul#fashion-gallery li a:not(:eq(0))").fadeTo(200, .8);
  
		
		//hover effects
		$("#call_to_action > li > a > img" ).hover(function () {
	    $(this).fadeTo("slow", 0.50);
	    $(this).fadeTo("fast", 0.90);
	  });
	  
    // $("#banner-fashion > a, #banner-bridal > a").fadeTo('fast', 0.6);
	
    // $("#banner-fashion > a").hover(function () {
    //      $(this).fadeTo("slow", 0.50);
    //      $(this).fadeTo("fast", 0.90);
    //    });
	  
		//gallery hide show
    
   
		
		$('div.hidden').hide().eq(0).show();
		$('#fashion-gallery > li > a').click(function() {
			var category = "#" + $(this).attr('rel');
			$('div.hidden').hide();
			$(category).fadeIn("slow");
			return false;
		});
		
    // $('').scrollTo(
    //   '#text', 800
    // );
		$('a.scrollTo').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
    		$.scrollTo( 'div.desc', 800);
    		return false;
    	});
      
    $('form#new_cart_item').addClass('baseform');
	

});