jQuery(document).ready(function () {
    jQuery(".ImageGallery").carousel({
        itemWidth: 95,
        itemHeight: 95,
        scrollVisible: 3,
        circular: true,
        scrollNum: 3,
        scrollNext: '.next',
        scrollPrev: '.prev',
        scrollSpeed: 1200
    });
	jQuery(".TopGallery").carousel({
		itemWidth : 200,
		itemHeight : 185,
		scrollVisible : 4,
		circular : true,
		scrollNum : 4,
		scrollNext : '.next',
		scrollPrev : '.prev',
		scrollSpeed : 1200
	});
	jQuery(".TopGallery1").carousel({
        itemWidth: 140,
        itemHeight: 120,
        scrollVisible: 4,
        circular: true,
        scrollNum: 4,
        scrollNext: '.next1',
        scrollPrev: '.prev1',
        scrollSpeed: 1200
    });
	jQuery(".TopGallery05").carousel({
		itemWidth : 200,
		itemHeight : 185,
		scrollVisible : 3,
		circular : true,
		scrollNum : 3,
		scrollNext : '.next',
		scrollPrev : '.prev',
		scrollSpeed : 1200
	});
	jQuery(".TopGallery6").carousel({
		itemWidth : 185,
		itemHeight : 150,
		scrollVisible : 3,
		circular : true,
		scrollNum : 3,
		scrollNext : '.next',
		scrollPrev : '.prev',
		scrollSpeed : 1200
	});
	jQuery(".TopGallery2").carousel({
		itemWidth : 180,
		itemHeight : 185,
		scrollVisible : 3,
		circular : true,
		scrollNum : 4,
		scrollNext : '.next',
		scrollPrev : '.prev',
		scrollSpeed : 1200
    });
    jQuery(".TopGalleryAlt").carousel({
		itemWidth : 200,
		itemHeight : 185,
		scrollVisible : 4,
		circular : true,
		scrollNum : 4,
		scrollNext : '.next',
		scrollPrev : '.prev',
		scrollSpeed : 1200
	});
	jQuery(".galleryCarousel").carousel({
		itemWidth : 200,
		itemHeight : 185,
		scrollVisible : 4,
		circular : true,
		scrollNum : 4,
		scrollNext : '.next',
		scrollPrev : '.prev',
		scrollSpeed : 1200
	});
	jQuery(".specialCarouselPane").carousel({
		itemWidth : 200,
		itemHeight : 185,
		scrollVisible : 1,
		circular : true,
		scrollNum : 1,
		scrollNext : '.specialNext',
		scrollPrev : '.specialPrev',
		scrollSpeed : 1200
	});
	
	jQuery(".tvCarouselPane").carousel({
		itemWidth : 200,
		itemHeight : 185,
		scrollVisible : 1,
		circular : true,
		scrollNum : 1,
		scrollNext : '.tvNext',
		scrollPrev : '.tvPrev',
		scrollSpeed : 1200
	});

    jQuery(".galleryMovie").carousel({
        itemWidth: 125,
        itemHeight: 160,
        scrollVisible: 5,
        circular: true,
        scrollNum: 5,
        scrollNext: '.next',
        scrollPrev: '.prev',
        scrollSpeed: 1200
    });

    jQuery(".galleryMovie02").carousel({
        itemWidth: 125,
        itemHeight: 160,
        scrollVisible: 5,
        circular: true,
        scrollNum: 5,
        scrollNext: '.next02',
        scrollPrev: '.prev02',
        scrollSpeed: 1200
    });

    jQuery(".galleryMovie03").carousel({
        itemWidth: 125,
        itemHeight: 160,
        scrollVisible: 5,
        circular: true,
        scrollNum: 5,
        scrollNext: '.next03',
        scrollPrev: '.prev03',
        scrollSpeed: 1200
    });

    jQuery(".galleryMovie04").carousel({
        itemWidth: 125,
        itemHeight: 160,
        scrollVisible: 5,
        circular: true,
        scrollNum: 5,
        scrollNext: '.next04',
        scrollPrev: '.prev04',
        scrollSpeed: 1200
    });
	
		jQuery(".scrollTravel").carousel({
		itemWidth : 143,
		itemHeight : 180,
		scrollVisible : 4,
		circular : true,
		scrollNum : 4,
		scrollNext : '.next',
		scrollPrev : '.prev',
		scrollSpeed : 1200
	});
	
	addTabs();
	addDropDown();
	if ($(".galleryCarousel").length > 0)
	{
		addGalleryControls();
	}
});

function addGalleryControls()
{
	$(".galleryCarousel .carouselItem a").click(function(){
		var imgPath = $(this).attr("href");
		var caption = $(this).children("img").attr("longdesc");
		$(".galleryBox img").attr("src",imgPath);
		$(".galleryBox .caption").html(caption);
		return false;
	});
}

function addTabs()
{
	$(".newsList .tabs li:eq(0)").addClass("active");
	$(".business .tabs li:eq(0)").addClass("active");
	$(".weatherNews .tabs li:eq(0)").addClass("active");
	$(".newsList .tabContent:eq(0)").css("display","block");
	$(".business .tabContent:eq(0)").css("display","block");
	$(".weatherNews .tabContent:eq(0)").css("display","block");
	$(".tabs li").click(function(){
		$(this).siblings().removeClass("active");
		$(this).addClass("active");
		tabIndex = $(this).parent().children().index(this);
		$(this).parent(".tabs").siblings(".tabContent").css("display","none");
		$(this).parent(".tabs").siblings(".tabContent:eq("+tabIndex+")").css("display","block");
		return false;
	});
}

function addDropDown()
{
	$(".dropDown > ul").each(function(){
		$(this).children("li:eq(0)").children("a").css("background","url(img/programBtn.jpg) no-repeat");
	});
	$(".dropDown ul li").mouseover(function(){
		$(this).parent("ul").css("overflow","visible");
	});
	$(".dropDown ul li").mouseout(function(){
		$(this).parent("ul").css("overflow","hidden");
	});
}
