// JavaScript Document
$(document).ready(function(){
	var hotHeight = $(".hot-more-info").height();
	$(".hot-more-info").hide();
	$(".hot-more").click(function(){
		$(".hot-more").fadeOut("normal");	
		$(".hot-more-info").css('height', (hotHeight));
		$(".hot-more-info").slideDown("slow");
	});
	$(".hot-less").click(function(){
		$(".hot-more").fadeIn("normal");
		$(".hot-more-info").slideUp("slow");
	});
    $(".destination_feature_innerBox > ul").tabs();
	$(".gaming_feature_innerBox > ul").tabs();
	$(".events_feature_innerBox > ul").tabs();
	//$('ul#tab_menu').tabify();
	$("#categories").accordion({
		active: ".current",
		header: "a.head",
		selectedClass: "active",
		navigation: true,
		event: "mouseover",
		autoHeight: false
	});
	$('.slideshow').cycle({ 
		fx:    'fade', 
		timeout:       8000,
		random:  1 
	});

	//$("img.poker_png").pngFix();
	$("#signup").validate( {
		rules: {
			tbEmail: {
				required: function(element){
					if ($('input[name=eclub]:checked').val() == 'Optin' || $('#tbEmail').val() != '') {
						return true;
					}
					return false;
				}
			}
		}
	});
	
	$("input[name=eclub]").blur(function() {
		$("#tbEmail").valid();
	});
	
	
	jQuery.validator.addMethod("age", function(value, element) { 
		/* the minumum age you want to allow in */
		var min_age = 21;
		
		var birthday = value.split('/',3);
		var year = parseInt(birthday[2]);
		var month = parseInt(birthday[0]) - 1;
		var day = parseInt(birthday[1]);
		
		var theirDate = new Date((year + min_age), month, day);
		var today = new Date;
		
		if ( (today.getTime() - theirDate.getTime()) < 0) {
			return this.optional(element); //not of age
		} else {
			return true; //of age
		}
	}, "You must be 21 or older to participate ");	
	
	jQuery.validator.addMethod("newsletter", function(value, element) { 
		if( $('input[name=eclub]:checked').val() == 'Optin' || value!='' ){
			return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
		}
		return true; //no need to validate email address
	}, "Please enter a valid email address.");
	
	
	jQuery.validator.addClassRules({
	  name: {
		required: true,
		minlength: 1
	  },
	  zip: {
		required: true,
		digits: true,
		minlength: 5,
		maxlength: 10
	  }
	});
	
	$('#birthday').datepicker({
		yearRange: '1910:2010'
	});
	
	$('#anniversary').datepicker({
		yearRange: '1910:2010'
	});
	
	$('#Cobirthday').datepicker({
		yearRange: '1910:2010'
	});
	


  });