jQuery(document).ready(function($) {
    // $() will work as an alias for jQuery() inside of this function
    
     /* slideshows */
    $('.wsMainSlideshow').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		timeout: 7000,
		speed: 2000,
		height: 645,
		width: 977
	});

    /* pop-ups via fancybox */
    /* map fancybox */
	var siteWidth = 920;
	
	$('.wsFancy').fancybox({
	 	'type'		:'iframe',
		'width' 	:siteWidth,
		'height' 	:810,
		'padding' 	:3,
		'scrolling'	: 'auto'			
	});
    
    /* takes out the bottom border divider in the last div */
   $('.left .wrapper .pkgContainer:last-child').css('background-image', 'none');
   $('.right .wrapper .pkgContainer:last-child').css('background-image', 'none');   

      /* Room Overview Vertical Scrolling on hover state */
	    // Override default parameters onload
	$.fn.hoverscroll.params = $.extend($.fn.hoverscroll.params, {
		vertical : true,
		width: 640,
		height: 500,
		arrows: true,
		fixedArrows: true
	});
   
   // Generate hoverscroll with overridden default parameters
   
    $('.wsSliderContainer').hoverscroll();
    
   $('.activityType').addClass('hideActivity');
    
    
    /* Room Overview click change active room */
    
    $('.activityName').click(function(){
    	ws_this = this;
    	//console.log((ws_this).id);
    	ws_activity_id = (ws_this).id;
    	
    	if($('#'+ws_activity_id).hasClass('activeRoom')){
    		
    	}else{
    		$('.activityName').removeClass('currentName');
    		$('.activityType').removeClass('currentActivity');
    		$('#'+ws_activity_id).addClass('currentName');
       		$('.'+ws_activity_id).addClass('currentActivity');
    	}
    });
    
    /* Directions slider */
    $('.dirSlideButton').click(function(){
    	var direct_button = this;
    	//console.log(direct_button);
    	ws_text_container = $(direct_button).prev();
    	$(ws_text_container).slideToggle('fast', function(){
    		$(direct_button).toggleClass('wsButtonOpen');
    	});
    	    	
    	if($(direct_button).hasClass('wsButtonOpen')){
    		//var button_html = $(direct_button).html();
    		$(direct_button).text('+ Show Directions');
    	}else{
    		$(direct_button).text('- Hide Directions');
    	}
    });
    
    $('.directionsText').hide();
    $('.directionsText:first').show();
	$('.expandPhoto').fadeIn();
	$('.expandPhoto').click(function() {
		var htmlStr = $('.expandPhoto').html();
			
    		if(htmlStr == "Show Menu") {
				$('.pageHeader').animate({
					top: 0
					},500, function() {
				});
				
				$('.expandPhoto').html("Expand Photo");
			} else  {
				$('.pageHeader').animate({
					top: -177
					},500, function() {
				});
		
				$('.expandPhoto').html("Show Menu");
			}

	});
	
	
	$('#btn_news').click(function () {
		var emailVar = $('#txt_email').val();
		var emailLink = 'http://www.mynewsletterbuilder.com/tools/subscription.php?username=brampton&action=main&email='+emailVar+'&send_id=&newsletter_id=0';
		window.open(emailLink);
		
	});
	
});
