jQuery(document).ready(function(){ 
jQuery.noConflict(); 

/******* START Chase's jQuery Hover/Preload automater *******/
// How to use:
// 1. Produce two images. One for the default view and one for the hover effect.
// 2. Name the default image whatever you like. Ie. file.png
// 3. For the hover image use the same filename as default, however add _h before the extension. Ie. file_h.png
// 4. Add class="btn" to your image you want to enable a hover effect for.
// 5. Add this code block to your  jQuery(document).ready(function(){ **THE CODE BELOW GOES HERE** });
//used for hover effects. 
// Hover Preloader by Chase
jQuery('.dropdown').hide();
//var cache = [];
jQuery('#sectionSpacer').bind("mouseover", function()
{
jQuery('.dropdown').hide();
});
jQuery('.kjo-link').text('');
/*
jQuery('.btn').each(function(){
	// preload all of the hover images for images with class="btn"
	currentsrc = jQuery(this).attr('src');
	ext = currentsrc.substring(currentsrc.length - 3, currentsrc.length);		
	baseName = currentsrc.substring(0, currentsrc.length - 4);
	newsrc = currentsrc.substring(0, currentsrc.length - 4) + '_h.' + ext;
	var cacheImage = document.createElement('img');
	cacheImage.src = newsrc;
	cache.push(cacheImage);
});
*/


jQuery("#moviePlayImg").bind("click", function()
{
	jQuery("#moviePlay").load('/video.html');
	
});
// start adjust font size
if($.cookie('font') == '14px')
{
	jQuery('.entry p,.entry li').css('font-size','14px');
		jQuery('.oneFourth p, .oneHalf p').css('font-size','16px');
}
jQuery("#fontSmallBtn").bind("click", function()
{
	jQuery('.entry p,.entry li').css('font-size','12px');
		jQuery('.oneFourth p, .oneHalf p').css('font-size','14px');
	$.cookie('font', '12px');
});
jQuery("#fontBigBtn").bind("click", function()
{
	jQuery('.entry p,.entry li').css('font-size','14px');
	jQuery('.oneFourth p, .oneHalf p').css('font-size','16px');
	$.cookie('font', '14px');
});


// end adjust font size
jQuery(".day-with-date, .weekend, .day-with-event").bind("click", function()
{
 jQuery(".day-with-date span, .weekend span, .day-with-event span").css('font-weight','normal');
 jQuery("span",this).css('font-weight','bold');
});
jQuery(".btn").bind("mouseover", function()
{
//bug add another check for mouse out to make sure it has _h
	currentsrc = jQuery(this).attr('src');
	ext = currentsrc.substring(currentsrc.length - 3, currentsrc.length);
	baseName = currentsrc.substring(0, currentsrc.length - 4);
	//Check if the browser messed up
	if(baseName.substring(baseName.length -2 ,baseName.length) != '_h')
	{
		newsrc = currentsrc.substring(0, currentsrc.length - 4) + '_h.' + ext;
	}
	else newsrc = currentsrc.substring(0, currentsrc.length - 4) + '.' + ext;
	//newsrc = currentsrc.substring(0, currentsrc.length - 4) + '_h.'+ ext;
	jQuery(this).attr('src', newsrc);
});
jQuery(".btn").bind("mouseout", function()
{
	currentsrc = jQuery(this).attr('src');
	ext = currentsrc.substring(currentsrc.length - 3, currentsrc.length);
	baseName = currentsrc.substring(currentsrc.length - 6, currentsrc.length - 4);
	//Check if the browser messed up
	if(baseName == '_h')
	{
		newsrc = currentsrc.substring(0, currentsrc.length - 6) + '.' + ext;
	}
	else newsrc = currentsrc.substring(0, currentsrc.length - 4) + '.' + ext;
	
	
	newsrc = currentsrc.substring(0, currentsrc.length - 6) + '.' + ext;
	//alert(newsrc);
	jQuery(this).attr('src', newsrc);
});
/******* END Chase's jQuery Hover/Preload automater *******/

//todo - if one pic disable slide switch
numOfSlides = jQuery("#slideshow > img").size();

if(numOfSlides  > 1)
{
	setInterval( "slideSwitch()", 5000 );
}
jQuery("#ddAboutx").bind("mouseover", function()
{
	jQuery(".dropdown").hide();
	jQuery("#ddAbout").show();
});
jQuery("#ddLifeEnrichmentx").bind("mouseover", function()
{
	jQuery(".dropdown").hide();
	jQuery("#ddLifeEnrichment").show();
});
jQuery("#ddCulinaryProgramsx").bind("mouseover", function()
{
	jQuery(".dropdown").hide();
	jQuery("#ddCulinaryProgram").show();
});
jQuery("#ddCareersx").bind("mouseover", function()
{
	jQuery(".dropdown").hide();
	jQuery("#ddCareers").show();
});

jQuery("#ddAbout").bind("mouseleave", function()
{
	jQuery(".dropdown").hide();
	jQuery("#ddAbout").hide();
});
jQuery("#ddLifeEnrichment").bind("mouseleave", function()
{
	jQuery(".dropdown").hide();
	jQuery("#ddLifeEnrichment").hide();
});
jQuery("#ddCulinaryProgram").bind("mouseleave", function()
{
	jQuery(".dropdown").hide();
	jQuery("#ddCulinaryProgram").hide();
});
jQuery("#ddCareers").bind("mouseleave", function()
{
	jQuery(".dropdown").hide();
	jQuery("#ddCareers").hide();
});
jQuery("#loginBox").bind("mouseleave", function(){jQuery('#loginBox').hide()});
jQuery("#about").bind("mouseover", function(){jQuery(this).attr('src','images/nav_about_h.jpg');});
jQuery("#about").bind("mouseout", function(){jQuery(this).attr('src','images/nav_about.jpg');});
});
function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
function activateHover(myID)
{
	//alert(myID);
	currentsrc = jQuery("#" + myID).attr('src');
	//alert(currentsrc);
	ext = currentsrc.substring(currentsrc.length - 3, currentsrc.length);
	baseName = currentsrc.substring(0, currentsrc.length - 4);
	//Check if the browser messed up
	if(baseName.substring(baseName.length -2 ,baseName.length) != '_h')
	{
		newsrc = currentsrc.substring(0, currentsrc.length - 4) + '_h.' + ext;
	}
	else newsrc = currentsrc.substring(0, currentsrc.length - 4) + '.' + ext;
	//newsrc = currentsrc.substring(0, currentsrc.length - 4) + '_h.'+ ext;
	jQuery('#' + myID).attr('src', newsrc);
}

