var menu = "";
var more = "";

$(function() {
	
	$('#pause').click( function(ev) {
		ev.preventDefault();
		$('.slideshow').cycle('pause');
	});
	
	$("#play").click(function(ev) {
		ev.preventDefault();
		$('.slideshow').cycle('resume');
	});
	
		// $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)  

		   $("ul.topnav li").click(function() { //When trigger is clicked...  
		     
		           //Following events are applied to the subnav itself (moving subnav up and down)  
		           $(this).find("div").slideDown('slow').show(); //Drop down the subnav on click  
		     
		           $(this).hover(function() {  
		           }, function(){  
		               $(this).find("div").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up  
		           });  
		     
		       });  
		
//	$("ul.topnav li").click(function() { //When trigger is clicked...
//		
//		if (menu) {
//			$("#"+menu).find("div").slideUp('slow');
//		}
//		if (menu!=$(this).attr("id")) {
//			//Following events are applied to the subnav itself (moving subnav up and down)
//				$(this).find("div").slideDown('slow');
//				menu = $(this).attr("id");
//		} else {
//			menu="";
//		}
//		
//	});
	
	// 
	$(".link").click(function() {
		more = $(this).attr("id")+'_div';
		if($(this).html()=='&gt; Read all'){
			$("#"+more).show();
			$(this).html('&gt; Read less');
		} else {
			$("#"+more).hide();
			$(this).html('&gt; Read all');
		}
	});
	
	$("div.features-button").css("cursor","pointer").css("cursor","hand");
	$("div.specifications-button").css("cursor","pointer").css("cursor","hand");
	$("div.accessories-button").css("cursor","pointer").css("cursor","hand");
	
	$("#images-button").click(function() {
		$("#gallery").show();
		$(this).css('backgroundPosition', 'bottom center');
		$("#video").hide();
		$("#video-button").css('backgroundPosition', 'top center');
		$("#reviews").hide();
		$("#reviews-button").css('backgroundPosition', 'top center');
	});

	$("#video-button").click(function() {
		$("#video").show();
		$(this).css('backgroundPosition', 'bottom center');
		$("#gallery").hide();
		$("#images-button").css('backgroundPosition', 'top center');
		$("#reviews").hide();
		$("#reviews-button").css('backgroundPosition', 'top center');
	});

	$("#reviews-button").click(function() {
		$("#reviews").show();
		$(this).css('backgroundPosition', 'bottom center');
		$("#gallery").hide();
		$("#images-button").css('backgroundPosition', 'top center');
		$("#video").hide();
		$("#video-button").css('backgroundPosition', 'top center');
	});

	$(".features-button").click(function() {
		$("#features").show();
		$(this).css('backgroundPosition', 'bottom center');
		$("#specifications").hide();
		$("div.specifications-button").css('backgroundPosition', 'top center');
		$("#accessories").hide();
		$("div.accessories-button").css('backgroundPosition', 'top center');
	});

	$(".specifications-button").click(function() {
		$("#specifications").show();
		$(this).css('backgroundPosition', 'bottom center');		
		$("#features").hide();
		$("div.features-button").css('backgroundPosition', 'top center');
		$("#accessories").hide();
		$("div.accessories-button").css('backgroundPosition', 'top center');
	});

	$(".accessories-button").click(function() {
		$("#accessories").show();
		$(this).css('backgroundPosition', 'bottom center');
		$("#features").hide();
		$("div.features-button").css('backgroundPosition', 'top center');
		$("#specifications").hide();
		$("div.specifications-button").css('backgroundPosition', 'top center');
	});
	
	$("#source").change(function() {
		if ($(this).val() == "Press") {
			$("#publication").show();
			$("#pub-label").show();
		}
		else {
			$("#publication").hide();
			$("#pub-label").hide();
		}
	});
});

