﻿var Lhf = {

	init: function()
	{
	
		$('.image-gallery-slides').cycle({ 
			fx: 'fade', 
			speed: 'fast', 
			timeout: 0, 
			next: '#nextSlide', 
			prev: '#prevSlide',
			pager: '#galleryNav'
		});
		
		$('.image-flash-gallery-slides').cycle({ 
			fx: 'fade', 
			speed: 'fast', 
			timeout: 10000, 
			pager: '#galleryNav'
		});
		
		
		
		$('.lunch-cycle').cycle({ 
			fx: 'fade', 
			timeout: 4000
		});
		
		$('#QuoteContainer').cycle({ 
			fx: 'fade', 
			timeout: 6000
		});
		
		

//		$("table").tablesorter();

		
		
		// remove border bottom for submenu items
		$("ul#nav li ul").each(function(i, item)
		{
		    $("li:last a", this).css({borderBottom: 0});
		});

        if (document.all) {
            $("#nav li").hoverClass("sfHover");
        }
        
        // Init tabs
        if ($(".tabbed-container"))
        {
			$(".tabbed-container > ul").tabs();
        }
        
  
//  // Init tabs
//        if ($("#lunchtabs"))
//        {
//			 $("#lunchtabs > ul").tabs();
//        }
  
        
        // $(".accordion").accordion();
//        $(".accordion").accordion({
//			header: 'a.accordion-title'
//        });
        
        
        	
        $(".cycle")
			//.after('<div id="pager"></div>')
			.cycle({
				pager: "#pager",
				pagerEvent: 'click',
				timeout: 5000,
				pause: 1,
				next: "#nextslide",
				after: function()
				{
					var next = $(this).next();
				
					if (next.length == 0)
						next = $(this.parentNode).children().eq(0);
				
				$("#nextslide").html($("h2", next).text());
				     
				}
		});
        
        
        $('a.lightbox').lightBox(); // Select all links that contains lightbox in the attribute rel
        
	}
};


$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
};   

/**
* OnDomContentReady functions
*/
$(document).ready(function() {
	
	// Append class to body if IE < 7
    // Do this so we don't need conditional comments
    if($.browser.msie === true && parseInt($.browser.version) <= 6)
    {
        // Add png8 to body... 
        $("body").addClass("png8");
        document.execCommand('BackgroundImageCache', false, true);
    }
    
	if ($.browser.msie === true)
	{
		$("#nav li ul").mouseout(function() {
			// console.log(this);
			$(this).css("left", "-999em");
		});
		
		$("#nav li").mouseover(function() {
			$("#nav li ul").css("left", "-999em");
			$("ul", this).css("left", "auto");
		});	
	}
    
    Lhf.init();

    //sfHover();	
});