// COACHING-BACKING TABS
$(document).ready(function() {
	//Default Action
	$(".cb-content").hide(); //Hide all content
	$("ul.cb-nav li:first").addClass("active").show(); //Activate first tab
	$(".cb-content:first").show(); //Show first tab content	
	//On Click Event
	$("ul.cb-nav li").click(function() {
		$("ul.cb-nav li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".cb-content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(function() {
		     if ($.browser.msie)
		         this.style.removeAttribute('filter');
		});
		return false;
	});
});
// ABOUT TABS
$(document).ready(function() {

	//Default Action
	$(".coach-info").hide(); //Hide all content
	$("ul.coach-nav li:first").addClass("active").show(); //Activate first tab
	$(".coach-info:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.coach-nav li").click(function() {
		$("ul.coach-nav li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".coach-info").hide(); //Hide all tab content
		var activeTab = $(this).find('a').attr('rel'); //Find the rel attribute value to identify the active tab + content
		$('#'+activeTab).fadeIn(); //Fade in the active content
		return false;
	});

});
//STYLISH SELECT
$(document).ready(function(){
	$('#select, #howlong, #weeklygames, #sng_select-hours, #selecthours, #mtt_selecthours').sSelect();
});
//
// RELATED VIDEOS
$(document).ready(function() {
	$("aside h4 a#related-game-link").click(function() {
		$("aside h4 a").removeClass("active"); 
		$(this).addClass("active"); 
		$("aside div").hide();
		//var activeTab = $(this).find("a").attr("rel"); 
		$("#related-game").fadeIn();
		return false;
	});
	$("aside h4 a#related-type-link").click(function() {
		$("aside h4 a").removeClass("active"); 
		$(this).addClass("active"); 
		$("aside div").hide();
		//var activeTab = $(this).find("a").attr("rel"); 
		$("#related-type").fadeIn();
		return false;
	});

});	
// CONTACT FORM VALIDATION
$(document).ready(function() {
  $("#sng_Form").validate({
    rules: {
    name: "required",
    age: "required",
    email: "required",
	location: "required",
	job: "required",
	pokerstars: "required",
	sng_hours: "required",
	howlong: "required",
	weeklygames: "required",
	tableninja: "required",
	sngwiz: "required",
	games: "required",
	goals: "required",
	whyjoin: "required",
	sng_accept: "required",
	mtt_accept: "required"
    },
    messages: {
    name: " *",
    age: " *",
	email: " *",
	location: " *",
	job: " *",
	pokerstars: " *",
	sng_hours: " *",
	howlong: " *",
	weeklygames: " *",
	tableninja: " *",
	sngwiz: " *",
	games: " *",
	goals: " *",
	whyjoin: " *",
	sng_accept: "*",
	mtt_accept: "*"
    },
    submitHandler: function(form) {
			$.post('http://pocarr.com/contact_sng.php', $("#sng_Form").serialize(), function(data) {
				$('#sng_Form').html(data);
				});
		}
  });
});
$(document).ready(function() {
  $("#mtt_Form").validate({
    rules: {
		name: "required",
	    age: "required",
	    email: "required",
		location: "required",
		selecthours: "required",
		PokerStars: "required",
		whyjoin: "required"
    },
    messages: {
		name: " *",
	    age: " *",
		email: " *",
		location: " *",
		selecthours: " *",
		PokerStars: " *",
		whyjoin: " *"

    },
    submitHandler: function(form) {
			// do other stuff for a valid form
			$.post('http://pocarr.com/contact_mtt.php', $("#mtt_Form").serialize(), function(data) {
				$('#mtt_Form').html(data);
				});
		}
  });
  });
