// JavaScript Document
$(document).ready(function(){
		// When a link is clicked
	$('.slideshow').cycle({
		fx: 'fade',
		speed: 3000,
		timeout: 8000,
		pause: 300 // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
//	change_option();

//  $("#series option").click(function(e){
     // get id
	 // search db for all criteria
	 // update other select options accordingly: style, size, depth, width, height
//	 var options ='';
//	 var ser = $("select#series option:selected").html();
	
 //    e.preventDefault();
     // send request
   //  $.post("load_content.php", {series: ser}, function(xml) {
 
//	   if($("status",xml).text()==1){alert("HERE");}
//	   show = $("content", xml).text();
//	   $("select#size option").remove();
//	   $("select#size option").html( 
//	   $("content", xml).text() 
//	   ); 

//alert(show);
 //   });
 //  });
  

		$("span.tab").click(function () {
			
			// switch all tabs off
			$(".tab_active").removeClass("tab_active");
			
			// switch this tab on
			$(this).addClass("tab_active");
			
			// slide all content up
			$(".tab_content").slideUp();
			
			// slide this content up
			var content_show = $(this).attr("title");
			$("#"+content_show).slideDown();

		  
		});
		$("input.add-to-cart-button").mousedown(function () {
				var src = "includes/templates/freetemplate2/images/add_to_cart_down.png";
				$(this).attr("src", src);		
		});
	$(".scroll").click(function(event){
		
				
			// switch all tabs off
			$(".tab_active").removeClass("tab_active");
			
			// switch this tab on
			$(".tab_video").addClass("tab_active");
			
			// slide all content up
			$(".tab_content").slideUp();
			
			// slide this content up
			$("#content_2").slideDown();

		  
		//prevent the default action for the click event
		event.preventDefault();

		//get the full url - like mysitecom/index.htm#home
		var full_url = this.href;

		//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
		var parts = full_url.split("#");
		var trgt = parts[1];

		//get the top offset of the target anchor
		var target_offset = $("#"+trgt).offset();
		var target_top = target_offset.top;

		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 500);
	});
});

