// JavaScript Document

 $(document).ready(function() {
							
							
	//BOXMODULES FUNCTIONALITY
	

	$('#boxmoduleslides').cycle({ 
		fx: 'scrollLeft',
		timeout: 0, 
		speed:   300
	});	
	
	$('.boxmodulenav li#health a').addClass('selected');
							
	$('.boxmodulenav li#health a').click(function(){
		$('#boxmoduleslides').cycle(0);
		$('.boxmodulenav ul li a').each(function() {
			$(this).removeClass('selected');								
		});
			$(this).addClass('selected');
	});
	
	$('.boxmodulenav li#diet a').click(function(){
		$('#boxmoduleslides').cycle(1);
		$('.boxmodulenav ul li a').each(function() {
			$(this).removeClass('selected');								
		});
			$(this).addClass('selected');
	});
	
	$('.boxmodulenav li#cardio a').click(function(){
		$('#boxmoduleslides').cycle(2);
		$('.boxmodulenav ul li a').each(function() {
			$(this).removeClass('selected');								
		});
			$(this).addClass('selected');
	});
	
	$('.boxmodulenav li#weight a').click(function(){
		$('#boxmoduleslides').cycle(3); 
		$('.boxmodulenav ul li a').each(function() {
			$(this).removeClass('selected');								
		});
			$(this).addClass('selected');
	}); 
	

   
	//DEFAULT VALUE FOR INPUT OBX
	$("#input-search").defaultvalue("Search Goldsgym.com");
   	$("#input-zipcode").defaultvalue("Enter Zip or City, State");
	$("#input-gym-finder").defaultvalue("Zip Code");
	//CHANGE BETWEEN MEMBER AND NON MEMBER PAGE
	$("#member").click(function(){
		member();
	});
	 
	$("#nonmember").click(function(){
		nonmember();
        });

	// NAVIGATION MENU)
 
	
	//STORIES FUNCTIONALITY
	

	$('#storiesslider').cycle({
			fx: 'scrollVert',
			speed: 400,
			timeout: 0,
			prev: '.less',
			next: '.more'
		});	

	$('.stories-mod').cycle({ 
		fx: 'scrollLeft',
		timeout: 0, 
		speed:   400
	});

	$(".story a").click(function(){
		var id = $(this).attr("id");
		id = Number(id);
		$('.stories-mod').cycle(id); 
	});
	
	
	$('.iphone-img').cycle({ 
		fx: 'scrollLeft',
		timeout: 0, 
		speed:   400
	});

	$(".iphone-thumbs-wrap a").click(function(){
		var id = $(this).attr("id");
		id = Number(id);
		$('.iphone-img').cycle(id); 
	});	
	
	//SLIDE ARTICLES
	/*
	  $('.fitness-articles-slides').cycle({
                fx: 'scrollLeft',
                timeout: 0,
                speed:   400
        });
	 */
 
                $(".fitness-articles li a").click(function(){
                        var id = $(this).attr("id");
                        $(".fitness-slide").each(function(){
                                $(this).hide();
                        });
                        $("#fitness-" + id).slideDown('slow');  
                });


                $(".diet-articles li a").click(function(){
                        var id = $(this).attr("id");
			$(".diet-slide").each(function(){
				$(this).hide();
			});
			$("#diet-" + id).slideDown('slow');
                });

		
                $(".cardio-articles li a").click(function(){
                        var id = $(this).attr("id");
                        $(".cardio-slide").each(function(){
                                $(this).hide();
                        });
                        $("#cardio-" + id).slideDown('slow');
                });

		 $(".training-articles li a").click(function(){
                        var id = $(this).attr("id");
                        $(".training-slide").each(function(){
                                $(this).hide();
                        });
                        $("#training-" + id).slideDown('slow');
                });

 });

function member()
{
	 //hightlight Member tab at the top
         $("#member-link").addClass("selected");
         $("#nonmember-link").removeClass("selected");

         $(".non-member-section").each(function(){
 	        $(this).css('display', 'none');
         });

         $(".member-section").each(function(){
         	  $(this).css('display', 'block');
         });

         //cookies
         $.cookie("golds-gym-member", "1");
}

function nonmember()
{
	 $("#nonmember-link").addClass("selected");
         $("#member-link").removeClass("selected");
         $(".member-section").each(function(){
   	      $(this).css('display', 'none');
         });

         $(".non-member-section").each(function(){
              $(this).css('display', 'block');
         });

         $.cookie("golds-gym-member", "0");
}


