/**
  *	UMass Hotel at the Campus Center
	*	Common Javascript Functions
	*	Author: Michael Williams
	*	Website by Glexia, Inc.
	*/


//	Alternative jQuery call - http://www.artzstudio.com/2009/04/jquery-performance-rules/#defer-to-window-load
//
//	Although jQuery(document).ready is incredibly useful, it occurs during page render while objects are still downloading.
//	Reduce CPU usage during the page-load by binding jQuery functions to the jQuery(window).load event, which occurs after 
//	all objects called by the HTML (including <iframe> content) have downloaded.
$(document).ready(function(){
	
	// Add rel="external to flickr thumbnails
	$('#sidebar_flickr_photos a').attr('rel','external');
	//$('#sidebar_flickr_photos a').attr('rel','lightbox').click(function(){ return false; });
	
	// Open rel="external" links in new window
	$(function(){
		$('a[rel*=external]').click(function(){
			window.open(this.href);
			return false;
		});
	});
	
	// Reservations form calendar
	$('a#choose_date').fade_box({
				height: 200,
				width: 500,
				wrapping_class: 'addon_find_another_trip_thickbox',
				fade_height: 15,
				fade_width:15,
				fade_click_close: false,
				auto_scroll: false,
				show_title: false,
				corners: true
			});
	
	
	$('p.close_box a').bind('click', function(){
		$('#addon_find_another_trip_message_wrap_link').hide_fade();
		return false;
	});
	

	$(function(){
    $('a.new-window').click(function(){
        window.open(this.href);
        return false;
    });
});
});