			var hash = document.location.hash;
			hash = hash.replace("#", "");

			function theRotator() {
				//Set the opacity of all images to 0
				$('div#rotator ul li').css({opacity: 0.0});
				
				//Get the first image and display it (gets set to full opacity)
				$('div#rotator ul li:first').css({opacity: 1.0});
					
				//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
				setInterval('rotate()',4000);
				
			}

			function rotate() {	
				//Get the first image
				var current = ($('div#rotator ul li.show')?  $('div#rotator ul li.show') : $('div#rotator ul li:first'));

				//Get next image, when it reaches the end, rotate it back to the first image
				var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first'));	
				
				//Set the fade in effect for the next image, the show class has higher z-index
				next.css({opacity: 0.0})
				.addClass('show')
				.animate({opacity: 1.0}, 1000);

				//Hide the current image
				current.animate({opacity: 0.0}, 1000)
				.removeClass('show');
				
			};
			
			
(function($){

			$(document).ready(function(){
                            
                                   $.fn.hideOptionGroup = function() {
            $(this).hide();
            $(this).children().each(function(){
                $(this).attr("disabled", "disabled").removeAttr("selected");
            });
            $(this).appendTo($(this).parent());

        }

        $.fn.showOptionGroup = function() {
            $(this).show();    
            $(this).children().each(function(){
                $(this).removeAttr("disabled" );
            });
            $(this).prependTo($(this).parent());
            $(this).parent().animate({
                scrollTop:0
            },0);
        }
                        
                                $("#us_states").showOptionGroup();
                                $("#canada_prov").hideOptionGroup();
                                
                                
				//this is for dropdown menus
				$('ul.sf-menu').superfish();	
				
				$("#gallerySelect").change(function(){
				var opVal = $(this).val();
				document.location.href="/"+opVal;
				});
				
				
				//this is for the rotating image banner
				theRotator();
				
				
				
				//the following stuff is for gallery images 
				$('.gallery ul li img').click(function(){
						var newSource = $(this).attr("src").replace('_resampled/SetHeight60-','').replace('_resampled/SetWidth60-','');
						$(this).parent().parent().siblings('.gallery-image').attr("src", newSource);
						var myHTML = $(this).siblings('span').html();
						$('.gallery-description').text(myHTML);
						$(this).parent().siblings().removeClass("current");
						$(this).parent().addClass("current");
						
						
				});
				
				
				//the following stuff is for gallery images 
				$('.jCarouselLite ul li img').click(function(){
						var newSource = $(this).attr("src").replace('_resampled/SetHeight60-','').replace('_resampled/SetWidth60-','');
						$(this).parent().parent().parent().parent().siblings('.gallery-image').attr("src", newSource);
						$(this).parent().siblings().removeClass("current");
						$(this).parent().addClass("current");
				});
				
				$('.viewphotosclick').click(function(){
					$(this).parent().siblings().children('.myPhotoContainer').children('.galleryItem').children().trigger('click');
				});
				
				$('.gallery .nextbtn').click(function(){
						$('.gallery ul li.current img').parent().next().children().trigger('click');
						//$('.default .next').trigger('click');
				});
				$('.gallery .prevbtn').click(function(){
						$('.gallery ul li.current img').parent().prev().children().trigger('click');
						//$('.default .prev').trigger('click');
				});
	
				//$('.jCarouselLite li:first-child').addClass('current');
				//$('.gallery li:first-child').addClass('current');
				
				
				$('.overlay').css("height",$(document).height());
				
				$('.viewphotos').click(function(){
					$("body").css("overflow", "hidden");
					if (jQuery.browser.msie && (parseInt(jQuery.browser.version) == 7)) {
					$("html").css("overflow", "hidden");
					$('html').scrollTop(100);
					}

					$('.gallery').hide();
					$(this).parent().siblings('.gallery.photo').show();
					$('.overlay').show();
					$(".default .jCarouselLite ul li").css("height", 40);
					$(".default .jCarouselLite ul li").css("width", 60);
					$(".default .jCarouselLite ul li img").css("height", 40);
					$(".default .jCarouselLite ul li img").css("width", 60);
					$(".default .jCarouselLite").jCarouselLite({
							btnNext: ".default .next",
							btnPrev: ".default .prev",
							circular: false,
							visible: 10
					});
					$('.gallery li').removeClass('current');
					$(this).parent().siblings('.gallery.photo').children().children('.jCarouselLite').children('ul').children('li:first-child').addClass('current');
					
				});
				$('.closephotos').click(function(){
					$('.overlay').hide();
					$(this).parent('.gallery.photo').hide();
					var $myplayerparent = $(this).parent('.gallery.photo');
					var $videoplayer = $(this).parent('.myVideoContainer .gallery.photo').children('.myvideo').clone();
					$(this).parent('.myVideoContainer .gallery.photo').children('.myvideo').remove();
					$videoplayer.appendTo($myplayerparent);
					$("body").css("overflow", "auto");
					
					if (jQuery.browser.msie && (parseInt(jQuery.browser.version) == 7)) {
					$("html").css("overflow", "auto");
					}
					$('.gallery-description').text('');
				});

				$('.viewfloorplans').click(function(){
					$(this).parent().siblings('.gallery.floorplan').show();
					$('.overlay').show();
					$("body").css("overflow", "hidden");
				});
				$('.closefloorplans').click(function(){
					$(this).parent('.gallery.floorplan').hide();
					$('.overlay').hide();
					$("body").css("overflow", "auto");
				});
				
				
				$('.hiddendescription').hide();
				$('.showmore').click(function(){
					$(this).siblings('.hiddendescription').toggle(500, function(){	
						if(jQuery.browser.msie)
						this.style.removeAttribute('filter');
					});
					if($(this).text() == "Show More"){
					$(this).text("Hide Content");
					}else{
					$(this).text("Show More");
					}
				});
			
	
		$("#signupEmail").focus(function(){
				if ($(this).val() == "" || $(this).val() == "ENTER EMAIL HERE")
				{
					$(this).val("");
				}
				$("#emailSignupDropdown").fadeIn();
			});
			$("#signupEmail").blur(function(){
				if ($(this).val() == "" || $(this).val() == "ENTER EMAIL HERE")
				{
					$(this).val("ENTER EMAIL HERE");
				}
			});
			
			$("#signupEmail").focus(function(){
				if ($(this).val() == "" || $(this).val() == "ENTER EMAIL HERE")
				{
					$(this).val("");
				}
				$("#emailSignupDropdown").fadeIn();
			});
			$("#signupEmail").blur(function(){
				if ($(this).val() == "" || $(this).val() == "ENTER EMAIL HERE")
				{
					$(this).val("ENTER EMAIL HERE");
				}
			});		
			$(".emailCloseBtn").click(function(e){
				$(this).parent().fadeOut();
			});
					

			$("#emailSignupForm").submit(function() {
				$("#emailSignupDropdown").hide();
				$("#emailSignupDropdownThankYou").fadeIn();
				setTimeout('$("#emailSignupDropdownThankYou").fadeOut();', 5000);
				$.ajax(
				{
					type: "POST",
					url: "/subscribe.php?SendUpdate=1",
					data: $(this).serialize(),
					success: function(response)
					{
					   $("#emailSignupForm")[0].reset();

					}
				})

				return false;
			});
			
			
			$("#formNewsLetterForm").submit(function() {
				$("#formNewsLetterForm").hide();
				$("#formThankYou").fadeIn();				
				$.ajax(
				{
					type: "POST",
					url: "/subscribe.php?SendUpdate=1",
					data: $(this).serialize(),
					success: function(response)
					{
					   $("#formNewsLetterForm")[0].reset();
					   $("#formNewsLetterForm").hide();
						$("#formThankYou").fadeIn();

					}
				
				})

				return false;
			});
			
			//for concert sign up
                        $("#form_country").change(function(){
	
                                    if ($(this).val() != "UNITED STATES") { 
                                        $("#state").removeClass("required error");
                                        $("#state").next().hide();
                                        $("#state").attr('disabled', 'disabled');
                                    }
                                    if ($(this).val() != "CANADA") { 
                                        $("#state").removeClass("required error");
                                        $("#state").next().hide();
                                        $("#state").attr('disabled', 'disabled');
                                    }
                                    if ($(this).val() == "UNITED STATES") {
                                        $("#state").addClass("required");
                                        $("#state").attr('disabled', '');
                                        $("#us_states").showOptionGroup();
                                        $("#canada_prov").hideOptionGroup();
                                    }
                                    if ($(this).val() == "CANADA") {
                                        $("#state").addClass("required");
                                        $("#state").attr('disabled', '');
                                        $("#canada_prov").showOptionGroup();
                                        $("#us_states").hideOptionGroup();
                                    }
     
                                }); 
                                
                                if ($("#ticketRequestForm").validate){
					$("#ticketRequestForm").validate({
					 
					    
					    rules: {
						 form_postal_code: {
							required: true,
							digits: true
							},
						 form_email: {
							required: true,
							email: true
							},
						 form_phone: {
							required: true,
							digits: true
							}
						 },
						submitHandler:function(event){form_submit(event)}
										
									 
					});
				}
				
				function form_submit(event){
					$(".module").hide();
					$("#ticketRequestForm").hide();
					$("#formThankYou").fadeIn();
					$("#space_clear").hide();
					//event.preventDefault();
					
					//var data = $(this).serialize();
					//alert(data);
					
					var data = $("#ticketRequestForm").serialize();
					
					$.ajax(
						{
						type: "POST",
						url: "/club-m-ticket-request/",
						data: data,
						success: function(response)						
						{
						   //$("#formNewsLetterForm")[0].reset();
						   //alert(data);
						   //$("#ticketRequestForm").hide();
						   //$("#formThankYou").fadeIn();
						   //$("#space_clear").hide();
						}
					});

					return false;
				}
				/*
				$("#ticketRequestForm").submit(function(event) {
					return false;
					$("#ticketRequestForm").hide();
					$("#formThankYou").fadeIn();
					$("#space_clear").hide();
					event.preventDefault();
					
					var data = $(this).serialize();
					$.ajax(
						{
						type: "POST",
						url: "/club-m-ticket-request/",
						data: data,
						success: function(response)						
						{
						   //$("#formNewsLetterForm")[0].reset();
						   //alert(response);
						   //$("#ticketRequestForm").hide();
						   //$("#formThankYou").fadeIn();
						   //$("#space_clear").hide();
						}
					});

					return false;
				});
				*/			
			
				//homepage tab area
						
				//$('.featuredTabs .tab').css('opacity', 0.33);
				//$('.featuredTabs .tab1').css('opacity', 1);
				$('.featuredTabs .tab').click( function(){
					var tabNumber = $(this).attr('class').replace('tab tab','');
					$('.banner').hide();
					$('.banner.number'+tabNumber).show();
					//$('.featuredTabs .tab').css('opacity', 0.33);
					//$(this).css('opacity', 1);
					//ie7 fix
					$('#sideBanners').css('margin-left', '30');
				});
				
			});
			

})(jQuery)


function Validate( theForm ){
	if ( theForm.Prefix.value == "" ){
		alert( 'Please provide your prefix.' );
		return false;
		}
	if ( theForm.FirstName.value == "" || theForm.LastName.value == "" ){
		alert( 'Please enter your full name.' );
		return false;
		}
	if ( theForm.BrideGroomWeddingParty.value == "" ){
		alert( 'Please provide the Bride/Groom Wedding Party.' );
		return false;
		}
	if ( theForm.Address1.value == "" ){
		alert( 'Please enter your address.' );
		return false;
		}
	if ( theForm.City.value == "" ){
		alert( 'Please enter your city.' );
		return false;
		}
	if ( theForm.Country.selectedIndex == 0 ){
		alert( 'Please select your country.' );
		return false;
		}
	if ( theForm.Country.selectedIndex == 1 && theForm.State.selectedIndex == 0 ){
		alert( 'Please select your state.' );
		return false;
		}
	if ( theForm.Zip.value == "" ){
		alert( 'Please enter your zip code.' );
		return false;
		}
	if ( theForm.Phone.value == "" ){
		alert( 'Please enter your phone number.' );
		return false;
		}
	if ( theForm.Email.value == "" ){
		alert( 'Please enter your email address.' );
		return false;
		}
	if ( theForm.Email.value != theForm.ConfirmEmail.value ){
		alert( 'Please make sure the email and confirm email fields match.' );
		return false;
		}
	if ( theForm.NumCeremonyGuests.value == "" ){
		alert( 'Please enter the number of Ceremony guests.' );
		return false;
		}
	if ( theForm.NumReceptionGuests.value == "" ){
		alert( 'Please enter the number of Reception guests.' );
		return false;
		}
	return true;
}


function Validate2( theForm ){
/*	if ( theForm.Prefix.value == "" ){
		alert( 'Please provide your prefix.' );
		return false;
		}
	if ( theForm.FirstName.value == "" || theForm.LastName.value == "" ){
		alert( 'Please enter your full name.' );
		return false;
		}
	if ( theForm.City.value == "" ){
		alert( 'Please enter your city.' );
		return false;
		}
	if ( theForm.Country.selectedIndex == 0 ){
		alert( 'Please select your country.' );
		return false;
		}
	if ( theForm.Country.selectedIndex == 1 && theForm.State.selectedIndex == 0 ){
		alert( 'Please select your state.' );
		return false;
		}
	if ( theForm.Zip.value == "" ){
		alert( 'Please enter your zip code.' );
		return false;
		}
	if ( theForm.Email.value == "" ){
		alert( 'Please enter your email address.' );
		return false;
		}
	return true;
*/
	if ( theForm.Address1.value != "" ){
		if ( theForm.City.value == "" ){
			alert( 'Please enter your city.' );
			return false;
			}
		 if ( theForm.Country.selectedIndex == 0 ){
			alert( 'Please select your country.' );
			return false;
			}
		if ( theForm.Country.selectedIndex == 1 && theForm.State.selectedIndex == 0 ){
			alert( 'Please select your state.' );
			return false;
			}
		if ( theForm.Zip.value == "" ){
			alert( 'Please enter your zip code.' );
			return false;
			}
		}
	if ( theForm.Email.value == "" ){
		alert( 'Please enter your email address.' );
		return false;
		}
	if ( theForm.Email.value != theForm.ConfirmEmail.value ){
		alert( 'Please make sure the email and confirm email fields match.' );
		return false;
		}
}

/* Always open PDF links in a new window. */
$(document).ready(function() {
   $('a[href$=".pdf"]').attr('target', '_blank');
});

