﻿/// <reference path="jquery-1.6.2.js" />

/*
*	Code Dependencies:
*	- "jquery-1.7.1.js"
*	- "dc.global.js"
*	- "jquery.cycle.lite.min.js"
*	- "jquery.lecynkarModal-2.0.js"
*/

$(document).ready(function () {
	dc.home.OnDocReady();
});

// This is a Self-Executing Anonymous Function
// "dc" is the namespace for all of our code
// There should be no global "window" variables,
// they should all be created under the "dc" namespace. 
(function (dc, $, undefined) {
	// Hook jQuery Selector Caching Function to "$$"
	var $$ = dc.$$;

	// Create the "dc.home" namespace if it does not exist
	dc.home = (function (home) {
		
		home.OnDocReady = function () {
			$$('#VirtualTour').cycle({
				fx: 'fade',
				speed: 5000,
				timeout: 3000
			});
		}
		
		// Learn more about the Corporate Program link in the right Side Bar
		$$('#CorporateProgramSideBarLink').click(function (event) {
			event.preventDefault();
			$$('div.NavColumn ul li a', '#MainContent').eq(2).click();
		});
		
		// MODAL - Learn more about how Daryl Christopher supports the Jimmy Fund link in the right Side Bar
		$$('#TheJimmyFundModal').lecynkarModal({
			$openModalLinks: $$('#TheJimmyFundSideBarLink'),
			$closeModalLinks: $$('#TheJimmyFundModal div.CloseModalLinkContainer a'),
			overlayCss: { 'z-index' : '2600' },
			beforeOpen: _lecynkarModalBeforeOpen,
			afterClose: _lecynkarModalAfterClose
		});

		function _lecynkarModalBeforeOpen() {
			// If browser is IE 7 or below, hide these elements when showing the modal
			if ( $.browser.msie && parseInt($.browser.version.charAt(0)) < 8) {
				$$('#FooterContainer').hide();
			}
		}

		function _lecynkarModalAfterClose() {
			// If browser is IE 7 or below, hide these elements when showing the modal
			if ( $.browser.msie && parseInt($.browser.version.charAt(0)) < 8) {
				$$('#FooterContainer').show();
			}
		}

		// Return this instance of home
		return home;
	})(window.dc.home = window.dc.home || {});

})(window.dc = window.dc || {}, jQuery);
