/*** VYSOUVACI BOX ***/
$(document).ready(function() {
	$('#trigger1').click(function() {
		if ($('#slider1').is(':hidden')) {
			if ($('#slider2').is(':visible')) {
				$('#slider2').slideUp('slow');
			}
			$('#slider1').slideDown('slow');
		} else if ($('#slider1').is(':visible')) {
			$('#slider1').slideUp('slow');
		}
		
		return false;
	});
	
	$('#trigger2').click(function() {
		if ($('#slider2').is(':hidden')) {
			if ($('#slider1').is(':visible')) {
				$('#slider1').slideUp('slow');
			}
			$('#slider2').slideDown('slow');
		} else if ($('#slider2').is(':visible')) {
			$('#slider2').slideUp('slow');
		}
		
		return false;
	});
});
/*** END ***/


/*** GALERIE ***/
$(document).ready(function(){
	$("span")
	$(".thumbs a").click(function(){
		// Az se obrazek naloaduje, teprve se zobrazi img+popisek
		$("#largeImg").load(function() {    
        		$("#largeImg").css('display', 'block');
			$("span").css('display', 'block'); 
        	});
		// Dokud se obrazek nenaloaduje, tak je img+popisek skryty
		$("#largeImg").css('display', 'none');
		$("span").css('display', 'none');
	
		var largePath = $(this).attr("href");
		var largeAlt = $(this).attr("title");
		
		$("#largeImg").attr({ src: largePath, alt: largeAlt });
		
		$("span").html("" + largeAlt + ""); return false;
	});
});
/*** END ***/


/*** VYRTUALNI PROHLIDKA - MENICI SE OBSAH TAGU ***/
$(document).ready(function() {
	$("#virtual1").click(function() {
		$("#box1").show();
		$("#box2").hide();
	});

	$("#virtual2").click(function() {
		$("#box2").show();
		$("#box1").hide();
	return false;
	})
});
/*** END ***/


/*** MENICI SE BOX ***/
$(function () {
	var tabContainers = $('div.curriculum > div');
	$('div.curriculum ul.tabNavigation a').click(function () {
	tabContainers.hide().filter(this.hash).show();
	
	$('div.curriculum ul.tabNavigation a').removeClass('selected');
	$(this).addClass('selected');
	
	return false;
	}).filter(':first').click();
});
/*** END ***/


/*** ZMENA CLASY PO KLINUTI NA OBJEKT ***/
$(document).ready(function() {    
	$('.img1').click(function () { 
		$('.img1').addClass('on1');
		$('.img2').removeClass('on2');
	});

	$('.img2').click(function () { 
		$('.img2').addClass('on2');
		$('.img1').removeClass('on1');
	});
});
/*** END ***/


/*** SROLL BOX ***/
$(document).ready(function() {
	jQuery('#mycarousel').jcarousel({
		vertical: true,
		scroll: 4
	});
});
/*** END ***/


/*** IFRAME - AUTO HEIGHT ***/
function doIframe(){
	o = document.getElementsByTagName('iframe');
	for(i=0;i<o.length;i++){
		if (/\bautoHeight\b/.test(o[i].className)){
			setHeight(o[i]);
			addEvent(o[i],'load', doIframe);
		}
	}
}

function setHeight(e){
	if(e.contentDocument){
		e.height = e.contentDocument.body.offsetHeight + 35;
	} else {
		e.height = e.contentWindow.document.body.scrollHeight;
	}
}

function addEvent(obj, evType, fn){
	if(obj.addEventListener)
	{
	obj.addEventListener(evType, fn,false);
	return true;
	} else if (obj.attachEvent){
	var r = obj.attachEvent("on"+evType, fn);
	return r;
	} else {
	return false;
	}
}

if (document.getElementById && document.createTextNode){
 addEvent(window,'load', doIframe);	
}
/*** END ***/

