function get_credits_line(x) {
	var line = '';
	switch (x) {
		case 0: line = 'Tento web vytvořili'; break;
		case 1: line = 'studenti a absolventi GMK'; break;
		case 2: line = 'Žádná ze zde uvedených postav'; break;
		case 3: line = 'není smyšlená ani fiktivní'; break;
		case 4: line = 'Během přípravy, tvorby ani dokončování webu'; break;
		case 5: line = 'nepřišlo k újmě žádné zvíře'; break;
		case 6: line = ''; break;
		case 7: line = 'POJĎ NA GMK!'; break;
		case 8: line = ''; break;
		case 9: line = '© 2010 Gumová Medová Kočka'; break;
		case 10: line = 'STOP'; break;
	}
	return line;
}

//~ function change_and_show_line(text) {
	//~ $('#credits-line').text(text);
	//~ $('#credits').fadeIn(250);
//~ }

function show_credits(index) {
	var line = get_credits_line(index);
	if (line != 'STOP') {
		setTimeout('show_credits('+(index+1)+')', 3000);
		if (index > 0) {
			$('#credits').fadeOut(250);
			setTimeout('$("#credits-line").text("'+line+'"); $("#credits").fadeIn(250);', 500);
		} else {
			$('#credits-line').text(line);
			$('#credits').fadeIn(250);
		}
	}
}

function get_element_to_hide(x) {
	var to_hide = '';
	switch (x) {
		case 0: to_hide = 'navi-9'; break;
		case 1: to_hide = 'navi-4'; break;
		case 2: to_hide = 'navi-7'; break;
		case 3: to_hide = 'arrows'; break;
		case 4: to_hide = 'navi-2'; break;
		case 5: to_hide = 'navi-8'; break;
		case 6: to_hide = 'navi-5'; break;
		case 7: to_hide = 'section-title'; break;
		case 8: to_hide = 'navi-6'; break;
		case 9: to_hide = 'navi-3'; break;
		case 10: to_hide = 'navi-1'; break;
		case 11: to_hide = 'navi'; break;
		case 12: to_hide = 'text'; break;
		case 13: to_hide = 'content-outer'; break;
		case 14: to_hide = 'footer'; break;
		case 15: to_hide = 'column'; break;
		case 16: to_hide = 'STOP'; break;
	}
	return to_hide;
}

function hide_element(index) {
	var to_hide = get_element_to_hide(index);
	if (to_hide == 'content-outer') {
		$('#column').css('height', '400px');
	}
	if (to_hide != 'STOP') {
		setTimeout('hide_element('+(index+1)+')', 1000);
		$('#'+to_hide).fadeOut(250);
	} else {
		$('body').prepend('<div id="credits"><p id="credits-line"></p></div>');
		show_credits(0);
	}
}

function autodestruct() {
	$("*").unbind('click');
	$("*").click(function() { return false; });
	hide_element(0);
}

var window_width = 0;
var window_height = 0;

function get_dimensions() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  window_width = myWidth;
  window_height = myHeight;
}

