function slideSwitch() {
     var $active = $('#slideshow img.active');

     if ( $active.length == 0 ) $active = $('#slideshow img:last');

     var $next =  $active.next().length ? $active.next()
          : $('#slideshow img:first');

     $active.addClass('last-active');

     $next.css({opacity: 0.0})
          .addClass('active')
          .animate({opacity: 1.0}, 2000, function() {
               $active.removeClass('active last-active');
          });
}


function goToByScroll(id){
     	$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}		

jQuery(document).ready(function(){	

$("p#javascriptAlert").remove();

//Subnav Events
$("#navigation ul li.about-us-a").hover(function() {
	$("#subnav-about-us").stop(true, true).slideToggle('medium'); },
	function() {
	$("#subnav-about-us").stop(true, true).slideToggle('medium');
});

$("#subnav-about-us").hover(function() {
$(this).stop(true, true).show(); },
function() {
$(this).stop(true,true).slideUp('medium');

}); 

$("#navigation ul li.ordering-prices-a").hover(function() {
	$("#subnav-ordering-prices").stop(true, true).slideToggle('medium'); },
	function() {
	$("#subnav-ordering-prices").stop(true, true).slideToggle('medium');
});

$("#subnav-ordering-prices").hover(function() {
$(this).stop(true, true).show(); },
function() {
$(this).stop(true,true).slideUp('medium');

}); 

$("#navigation ul li.our-products-a").hover(function() {
	$("#subnav-our-products").stop(true, true).slideToggle('medium'); },
	function() {
	$("#subnav-our-products").stop(true, true).slideToggle('medium');
});

$("#subnav-our-products").hover(function() {
$(this).stop(true, true).show(); },
function() {
$(this).stop(true,true).slideUp('medium');

}); 


	
	$("#boutique-options").hide();
	$("#silhouette-options").hide();
	
	function chooseForm(){
		
		var value = $("#formSelecter").val();
		if(value == "Boutique (Laser cut)"){
			$("#boutique-options").show();
			$("#silhouette-options").hide();
		}
                if(value == "Silhouette (Printed)"){
			$("#silhouette-options").show();	
			$("#boutique-options").hide();
		}
	}
	$("#formSelecter").change(chooseForm);
          chooseForm();


$("label img").live("click", function() {
  $("#" + $(this).parents("label").attr("for")).click();
});

$("table#create-and-make-form-design tr td img, table#sample-order-form-design-boutique tr td img").click(function(){
    $(this).parent().parent().parent().parent().find("td").css("background", "#fff")
    $(this).parent().parent().parent().parent().find("td").css("color", "#4a3e3b")
	$(this).parent().parent().css("background", "url('images/misc/tick-create-and-make-design-form.jpg') right bottom no-repeat #e1a4ab")
	$(this).parent().parent().css("color", "#fff")
});


	$("ul#indexbuckets li a, img.backtotop, ul.bigbuttons li a").hover(function(){
		$(this).css("opacity","0.8");},
	function() {
		$(this).css("opacity","1"); });	
	
	$(function() {
  	   setInterval( "slideSwitch()", 3000 );
		//$(".lightbox").lightbox();
		$("a.fbox").fancybox();
		$("a.press").fancybox();
	});
	

  $("input[name$='Boutique Design']").click(function(){
 
  var radio_value = $(this).val();
 
  if(radio_value=='Gatefold') {
    $(".gatefoldHide").fadeOut();
  }
 	else if(radio_value=='Boutique Border') {
    $(".gatefoldHide").fadeOut();
  }
  else {
   $(".gatefoldHide").fadeIn();
   }
  });


  $("input[name$='Boutique Card Size']").click(function(){
 
  var radio_value = $(this).val();
 
  if(radio_value=='A5 Large') {
    $(".boutiqueCardSizeHide").fadeOut();
  }
  else {
   $(".boutiqueCardSizeHide").fadeIn();
   }
  });

$("#inviteReminder h4").hide();

 $("input[name$='Number Evening Invitations'], input[name$='Number Day Invitations']").focus(function(){
	  $("#inviteReminder h4").stop().fadeIn();
 });
 $("input[name$='Number Evening Invitations'], input[name$='Number Day Invitations']").blur(function(){
	  $("#inviteReminder h4").fadeOut();
 });

												
});
