$(document).ready(function() {

  /* Open External Links in New Window */
	$("a[rel=external]").attr("target","_blank");
	
	/* Sign Up Lightbox */
	$("a.stay-updated").fancybox({
		'type' : 'iframe',
		'overlayColor' : '#fff',
		'padding' : 0,
		'scrolling' : 'no',
		'autoDimensions' : false,
		'autoScale' : false,
		'width' : 640,
		'height' : 800,
		'titleShow' : false
	});
	
	/* Samples Lightbox */
	$("a.samples").fancybox({
		'type' : 'iframe',
		'overlayColor' : '#fff',
		'padding' : 0,
		'scrolling' : 'no',
		'autoDimensions' : false,
		'autoScale' : false,
		'width' : 640,
		'height' : 800,
		'titleShow' : false
	});
	
	/* After Event Lightbox */
	$("a.after-event").fancybox({
		'type' : 'iframe',
		'overlayColor' : '#fff',
		'padding' : 0,
		'scrolling' : 'no',
		'autoDimensions' : false,
		'autoScale' : false,
		'width' : 640,
		'height' : 840,
		'titleShow' : false
	});
	
	/* eBook Lightbox */
	$("a.ebook").fancybox({
		'type' : 'iframe',
		'overlayColor' : '#fff',
		'padding' : 0,
		'scrolling' : 'no',
		'autoDimensions' : false,
		'autoScale' : false,
		'width' : 640,
		'height' : 695,
		'titleShow' : false
	});
	
	/* Order Lightbox */
	$("a.order").fancybox({
		'type' : 'iframe',
		'overlayColor' : '#fff',
		'padding' : 20,
		'scrolling' : 'no',
		'autoDimensions' : false,
		'autoScale' : false,
		'width' : 640,
		'height' : 400,
		'titleShow' : false,
		'showNavArrows' : false
	});
	
	/* YouTube Lightbox */
	$("a.watch").click(function() {
    $.fancybox({
      'padding' : 0,
			'autoScale' : false,
			'transitionIn' : 'none',
			'transitionOut' : 'none',
			'title' : this.title,
			'width' : 680,
			'height' : 495,
			'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type' : 'swf',
			'titleShow' : false,
			'swf' : {
        'wmode' : 'transparent',
				'allowfullscreen' : 'true'
			}
		});
    return false;
  });
  
  /* Vimeo Lightbox */
  $("a.watch-alt").click(function() {
		$.fancybox({
			'padding' : 0,
			'autoScale' : false,
			'transitionIn' : 'none',
			'transitionOut' : 'none',
			'title' : this.title,
			'width' : 680,
			'height' : 495,
			'href' : this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
			'type' : 'swf',
			'titleShow' : false
		});

		return false;
	});
  
  /* Home Products */
  $("#products ul").jcarousel();
	
	/* Quotes Slideshow */
	$("#quotes").cycle({ 
    delay:  1000,
    timeout: 9000
  });
  
  /* Polaroids Slideshow */
	$("#polaroids").cycle({ 
    delay:  1000,
    timeout: 9000
  });
  
  /* FAQ */
  $(".answer").hide();
  $("a.question").click(function() {    
    $(this).parent().next(".answer").toggle();
    return false;
  });
  
});
