﻿$(function() {
	$("#ProgrammesA").click(function() {
	$("#ProgrammesSliderCtl").slideToggle("fast");
		$("#ScheduleSliderCtl").slideUp("fast");
	});

	$("#CloseProgrammes").click(function() {
	$("#ProgrammesSliderCtl").slideUp("fast");
	});

	$("#ScheduleA").click(function() {
		$("#ScheduleSliderCtl").slideToggle("fast");
		$("#ProgrammesSliderCtl").slideUp("fast");
	});

	$("#CloseSchedule").click(function() {
		$("#ScheduleSliderCtl").slideUp("fast");
	});

	})

var KeyCtl_Count;
var KeyCtl_Current = 0;
var KeyCtl_Interval;
function KeyCtl_Select(index, stop) {
	if (stop)
		clearInterval(KeyCtl_Interval);

	var t = $("#KeyCtl > .preview > .item");
	t.eq(KeyCtl_Current).addClass("DisplayNone");
	t.eq(index).removeClass("DisplayNone");

	var q = $("#KeyCtl > .buttons > .thumb");
	q.eq(KeyCtl_Current).removeClass("selected");
	q.eq(index).addClass("selected");

	KeyCtl_Current = index;
	return false;
}
function KeyCtl_Prev(stop) {
	return KeyCtl_Select(KeyCtl_Current == 0 ? KeyCtl_Count : KeyCtl_Current - 1, stop);
}
function KeyCtl_Next(stop) {
	return KeyCtl_Select(KeyCtl_Current == KeyCtl_Count ? 0 : KeyCtl_Current + 1, stop);
}
$(document).ready(function() {
	KeyCtl_Interval = setInterval("KeyCtl_Next(false)", 8000);
});

var VideosCtl_Count;
var VideosCtl_Current = 0;
var VideosCtl_Interval;
function VideosCtl_Select(index, stop) {
	if (stop)	clearInterval(VideosCtl_Interval);

	if (index != VideosCtl_Current) {
		var t = $("#VideosCtl > .video > .item");
		t.eq(VideosCtl_Current).fadeOut("slow");
		t.eq(index).removeClass("DisplayNone");
		t.eq(index).fadeIn("slow");

		var q = $("#VideosCtl > .content > .item");
		q.eq(VideosCtl_Current).removeClass("selected");
		q.eq(index).addClass("selected");
		
		VideosCtl_Current = index;
	}
	return false;
}
function VideosCtl_Prev(stop) {
	return VideosCtl_Select(VideosCtl_Current == 0 ? VideosCtl_Count : VideosCtl_Current - 1, stop);
}
function VideosCtl_Next(stop) {
	return VideosCtl_Select(VideosCtl_Current == VideosCtl_Count ? 0 : VideosCtl_Current + 1, stop);
}
$(document).ready(function() {
	$("#VideosCtl > .video > .NotSelected").fadeOut(0);
});

var TrailerCtl_Current = 0;
function TrailerCtl_Select(index) {
	if (index != TrailerCtl_Current) {
	
		var t = $("#Trailer > .item > .videoContainer");
		t.eq(TrailerCtl_Current).addClass("DisplayNone");
		t.eq(index).removeClass("DisplayNone");

		t = $("#Trailer > .item > .infoContainer");
		t.eq(TrailerCtl_Current).addClass("DisplayNone");
		t.eq(index).removeClass("DisplayNone");
	
		var t = $("#TrailerGallery > .FloatLeft > a > .trailerThumb");
		t.eq(index).addClass("selected");
		t.eq(TrailerCtl_Current).removeClass("selected");
	}
	TrailerCtl_Current = index;
	return false;
}


