$(document).ready(function () {

        //Examples of how to assign the ColorBox event to elements
	$("a[rel='example1']").colorbox();
	$("a[rel='example2']").colorbox({transition:"fade"});
	$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
	$("a[rel='example4']").colorbox({slideshow:true});
	$(".single").colorbox({}, function(){
		alert('Howdy, this is an example callback.');
	});
	$(".colorbox").colorbox();
	$(".youtube").colorbox({iframe:true, width:650, height:550});
	$(".iframe").colorbox({width:"80%", height:"80%", iframe:true});
	$(".inline").colorbox({width:"50%", inline:true, href:"#inline_example1"});

	//Example of preserving a JavaScript event for inline calls.
	$("#click").click(function(){
		$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
		return false;
	});


		//transitions
		//for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
		var style = 'easeOutCubic';

		//Retrieve the selected item position and width
		var default_left = Math.round($('#lava li.selected').offset().left - $('#lava').offset().left);
		var default_width = $('#lava li.selected').width();

		//Set the floating bar position and width
		$('#box').css({left: default_left});
		$('#box .head').css({width: default_width});

		//if mouseover the menu item
		$('#lava li').hover(function () {

			//Get the position and width of the menu item
			left = Math.round($(this).offset().left - $('#lava').offset().left);
			width = $(this).width();
		$('#debug').html(left);
			//Set the floating bar position, width and transition
			$('#box').stop(false, true).animate({left: left},{duration:500, easing: style});
			$('#box .head').stop(false, true).animate({width:width},{duration:500, easing: style});

		//if user click on the menu
		}).click(function () {

			//reset the selected item
			$('#lava li').removeClass('selected');

			//select the current item
			$(this).addClass('selected');

		});

		//If the mouse leave the menu, reset the floating bar to the selected item
		$('#lava').mouseleave(function () {

			//Retrieve the selected item position and width
			default_left = Math.round($('#lava li.selected').offset().left - $('#lava').offset().left);
			default_width = $('#lava li.selected').width();

			//Set the floating bar position, width and transition
			$('#box').stop(false, true).animate({left: default_left},{duration:500, easing: style});
			$('#box .head').stop(false, true).animate({width:default_width},{duration:500, easing: style});

		});

	});

$(function() {
    $('#featured_items').cycle({
        fx:     'scrollHorz',
		easing: 'easeInQuart',
        timeout: 8000,
        pager:  '.content_nav',
        cleartypeNoBg:  true,
        pagerAnchorBuilder: function(idx, slide) {
            return '.content_nav li:eq(' + (idx) + ') a';
        }
    });
});

$(function() {
    $('#latest_content_items').cycle({
        fx:     'scrollHorz',
		easing: 'easeInQuart',
        timeout: 0,
        pager:  '.content_nav1',
        cleartypeNoBg:  true,
        pagerAnchorBuilder: function(idx, slide) {
            return '.content_nav1 li:eq(' + (idx) + ') a';
        }
    });
});

$(function() {
    $('#popular_content_items').cycle({
        fx:     'scrollHorz',
		easing: 'easeInQuart',
        timeout: 0,
        pager:  '.content_nav2',
        cleartypeNoBg:  true,
        pagerAnchorBuilder: function(idx, slide) {
            return '.content_nav2 li:eq(' + (idx) + ') a';
        }
    });
});

$(function() {
    $('#tab_slider').cycle({
        fx:     'fade',
        speed:  'fast',
        timeout: 0,
        pager:  '#main_content_slider',
        cleartypeNoBg:  true,
        pagerAnchorBuilder: function(idx, slide) {
            return '#main_content_slider li:eq(' + (idx) + ') a';
        }
    });
});

$(function () {
    $('.htl-links').hide();
    $('div#lava').addClass("lava-off");
    $('li#Header1_LIDefault').toggle( function (){
        $('.htl-links').fadeIn("slow");
        $('div#lava').removeClass("lava-off");
        $('div#lava').addClass("lava-on");
    },
    function(){
        $('.htl-links').fadeOut("slow");

        $('div#lava').removeClass("lava-on");
        $('div#lava').addClass("lava-off");
    });
});