﻿var banners = {
	"index": [
		{
			"img": "/images/banners/index/img-seniors.jpg",
			"text": "Špičková technologie<br/><big>léčení nádorů</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": true
		},
		{
			"img": "/images/banners/index/img-gantry.jpg",
			"text": "Špičková technologie<br/><big>léčení nádorů</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": true
		},
		{
			"img": "/images/banner_flowers.jpg",
			"text": "Špičková technologie<br/><big>léčení nádorů</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": true
		},
		{
			"img": "/images/banners/index/img-klucina.jpg",
			"text": "Přednosti protonové<br/><big>terapie</big>",
			"link": "Chci vědět více",
			"href": "/cs/prednosti-protonove-terapie",
			"isActive": true,
			"isLink": true

		},
		{
			"img": "/images/banners/index/img-pampeliska.jpg",
			"text": "Léčebné<br/><big>indikace</big>",
			"link": "Chci vědět více",
			"href": "/cs/lecebne-indikace",
			"isActive": true,
			"isLink": true

		},
		{
			"img": "/images/banners/index/img-realita.jpg",
			"text": "O nás",
			"link": "Chci vědět více",
			"href": "/cs/o-nas",
			"isActive": true,
			"isLink": true

		}

	],
	"about": [

		{
			"img": "/images/banners/about/img-realita.jpg",
			"text": "Život si zaslouží to<br/><big>nejlepší</big>",
			"link": "Chci vědět více",
			"href": "/cs/o-nas",
			"isActive": true,
			"isLink": true

		},
		{
			"img": "/images/banners/about/img-interier1.jpg",
			"text": "Život si zaslouží to<br/><big>nejlepší</big></big>",
			"link": "Chci vědět více",
			"href": "/cs/o-nas",
			"isActive": true,
			"isLink": true

		},
		{
			"img": "/images/banners/about/img-interier2.jpg",
			"text": "Život si zaslouží to<br/><big>nejlepší</big></big>",
			"link": "Chci vědět více",
			"href": "/cs/o-nas",
			"isActive": true,
			"isLink": true

		},
		{
			"img": "/images/banners/about/img-interier3.jpg",
			"text": "Život si zaslouží to<br/><big>nejlepší</big></big>",
			"link": "Chci vědět více",
			"href": "/cs/o-nas",
			"isActive": true,
			"isLink": true

		},
		{
			"img": "/images/banners/about/img-vizualizace2.jpg",
			"text": "Život si zaslouží to<br/><big>nejlepší</big></big>",
			"link": "Chci vědět více",
			"href": "/cs/o-nas",
			"isActive": true,
			"isLink": true

		}
	],
	"therapy": [
		{
			"img": "/images/banners/therapy/img-klucina.jpg",
			"text": "Špičková technologie<br/><big>léčení nádorů</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": true

		}
	],
	"technology": [
		{
			"img": "/images/banners/technology/img-gantry.jpg",
			"text": "Špičková technologie<br/><big>léčení nádorů</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": true

		},
		{
			"img": "/images/banners/technology/img-control-room.jpg",
			"text": "Špičková technologie<br/><big>léčení nádorů</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": true

		},
		{
			"img": "/images/banners/technology/img-gantry2.jpg",
			"text": "Špičková technologie<br/><big>léčení nádorů</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": true

		}
	],
	"cyklotron": [
		{
			"img": "/images/banners/cyklotron/cyklotron-2.jpg",
			"text": "Špičková technologie<br/><big>cyklotron</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": false

		}
	],
	"transport": [
		{
			"img": "/images/banners/transport/transport-1.jpg",
			"text": "Špičková technologie<br/><big class=\"smallgreen\">transportní systém</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": false

		}
	],
	"prednosti": [
		{
			"img": "/images/banners/prednosti/prednost-1.jpg",
			"text": "Přednosti<br/><big class=\"smallgreen\">protonové terapie</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": false

		},
		{
			"img": "/images/banners/prednosti/prednost-2.jpg",
			"text": "Přednosti<br/><big class=\"smallgreen\">protonové terapie</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": false

		},
		{
			"img": "/images/banners/prednosti/prednost-3.jpg",
			"text": "Přednosti<br/><big class=\"smallgreen\">protonové terapie</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": false

		}
	],
	"ozarovny": [
		{
			"img": "/images/banners/ozarovny/ozarovny-1.jpg",
			"text": "Špičková technologie<br/><big>gantry</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": false
		},
		{
			"img": "/images/banners/ozarovny/ozarovny-2.jpg",
			"text": "Špičková technologie<br/><big>gantry</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": false

		},
		{
			"img": "/images/banners/ozarovny/ozarovny-3.jpg",
			"text": "Špičková technologie<br/><big>ozařování očí</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": false

		},
		{
			"img": "/images/banners/ozarovny/ozarovny-4.jpg",
			"text": "Špičková technologie<br/><big>ozařování očí</big>",
			"link": "Chci vědět více",
			"href": "/cs/technologie-centra",
			"isActive": true,
			"isLink": false

		}
	]
}


var setBanner = "index";
var bannerIndex = 2;

function theRotator() {
	$('div#banner ul li:first').addClass('show');
	$('div#banner ul li').css({opacity: 0.0});
	$('div#banner ul li:first').css({opacity: 1.0});
	setInterval('rotate()', 6000);
}

function rotate() {
	var current = ($('div#banner ul li.show') ? $('div#banner ul li.show') : $('div#banner ul li:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#banner ul li:first') : current.next()) : $('div#banner ul li:first'));
	if (!$.browser.msie) {
		$("#banner .inside h1").animate({opacity: 0.0}, 500);
	}
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	current.animate({opacity: 0.0}, 1000).removeClass('show');
	setTimeout('changeTextOnTheBanner()', 700);
}

function changeBanner(banner) {
	if (!banners[banner]) {
		banner = "index";
	}
	setBanner = banner;
	$("#banner").empty();
	$("#banner").append('<ul></ul>');

	$.each(banners[banner], function(k, v) {
		$("#banner ul").append('<li><img src="' + v.img + '" width="945" height="210" /></li>');
	});
	$("#banner").append('<div class="inside"><h1>' + banners[banner][0].text + '</h1><a href="' + banners[banner][0].href + '">' + banners[banner][0].link + '</a></div>');
	if (banners[setBanner][0].isLink) {
		$("#banner .inside a").show();
	} else {
		$("#banner .inside a").hide();
	}
	if (banners[setBanner].length != 1) { theRotator(); }
}

function changeTextOnTheBanner() {
	if (bannerIndex > banners[setBanner].length) {
		bannerIndex = 1;
	}
	$("#banner .inside h1").html(banners[setBanner][bannerIndex - 1].text);
	$("#banner .inside a").html(banners[setBanner][bannerIndex - 1].link);
	$("#banner .inside a").attr('href', banners[setBanner][bannerIndex - 1].href);
	if (!$.browser.msie) {
		$("#banner .inside h1").animate({opacity: 1.0}, 500);
	}
	if (banners[setBanner][bannerIndex - 1].isLink) {
		$("#banner .inside a").show();
	} else {
		$("#banner .inside a").hide();
	}
	bannerIndex++;
}

