var app = $.noop();

app = {
	init: function(){
		app.listHotels();
		
		
		$("#offer_1 a, #offer_2 a, #offer_3 a, #offer_4 a").colorbox({
			href: function(){
				var index = $(this).index();
				var href = $(this).attr("href");		
				return href;
			}, 
			title: function(){
				var title = $(this).find('span:eq(0)').html();
				return title;
			},
			close: "X",
			width: 763,
			height: 700,
			overlayClose: true,
			onLoad: function() {
				var href = $(this).attr("href");				
				pageTrack(href);
			}
			},
			function() {
				 //$("#tabs").tabs();
				// app.buildHotelTable();
				
				var tabContainers = $('div.tabs > div');

						    $('div.tabs ul.tabNavigation a').click(function () {
						        tabContainers.hide().filter(this.hash).show();

						        $('div.tabs ul.tabNavigation a').removeClass('selected');
						        $(this).addClass('selected');
						        return false;
						    }).filter(':first').click();
			}

		);	
		$("#sticker").click(function(){
			location.href = "http://www.visitphilly.com";
		});

	},
	listHotels: function(){
		var hotel, rate, link, phone, rsvp_type, contact;
		$(hotels).each(function(){			
			hotel = $(this).attr('name');
			rate = $(this).attr('start_rate');
			link = $(this).attr('res_url');
			phone = $(this).attr('res_number');
			if (link === undefined) {
				rsvp_type = "phone";
				contact = phone;
			}
			else {
				rsvp_type = "link";
				contact = link;
			};
		})		
	},
	buildHotelTable: function (hotel, rate) {
		var table = $("table#hotels");
		// $("#wrapper").prepend(html);
	}
}

$(document).ready(function(){
	app.init();
	$(document).bind('cbox_complete', function(){
			trackOutbound("#cboxWrapper");
	});		
})
