var hp_aktualniBanner = 1;

function hp_zmenaBanneru()
{
  $("#blocks .bannerx").hide();
  $("#blocks .bannerx:nth-child(" + hp_aktualniBanner.toString() + ")").show();
  
  setTimeout("hp_dalsiBanner()", 4000);
}

function hp_dalsiBanner()
{
  hp_aktualniBanner++;
  if (hp_aktualniBanner > 3)
    hp_aktualniBanner = 1;
  
  hp_zmenaBanneru();
}


function set(currency){

  if(currency == 'EUR' || currency == 'USD' || currency == 'GBP'){

  var options = { path: '/', expires: (365*34*60*60) };
  $(".kurzovni_listek_homepage tr[class='"+currency+"']").hover(function(){
    $("ul.graph li").css("display","none");
    $("ul.graph li."+currency).css("display","block");
    $("[name=currency] option:contains("+currency+")").attr("selected", true);
    $('#currency').trigger('change');
    $.cookie('currency', currency, options);
  });
  
  }
  
  }
function set2(){
  var currency = $('#aside [name=currency] option:selected').text();
  var options = { path: '/', expires: (365*34*60*60) };
  $("ul.graph li").css("display","none");
  $("ul.graph li."+currency).css("display","block");
  $.cookie('currency', currency, options);
  return false;
}

$(document).ready(function() {

    $("body").addClass("jsok");
  	$("#query").labelify({text: "label",labelledClass: "labelhi"});
  	$("#nick").labelify({text: "label",labelledClass: "labelhi"});
  	$("#pass").labelify({text: "label",labelledClass: "labelhi"});
  	$("#nicknl").labelify({text: "label",labelledClass: "labelhi"});
  	$("#passnl").labelify({text: "label",labelledClass: "labelhi"});
    
    Cufon.replace('#aside h2');
    Cufon.replace('#section  h1:first');
    //Cufon.replace('.article h2');
    Cufon.replace('.home h2');
    Cufon.replace('.home #news h3');
    Cufon.replace('.internet h1');
	
	jQuery.browser.version = jQuery.browser.msie && parseInt(jQuery.browser.version) >= 6 && window["XMLHttpRequest"] ? "7.0" : jQuery.browser.version;
	//alert($.browser.version);
	if (($.browser.msie && $.browser.version > 6) || (!$.browser.msie)) {
		$('select').styledSelect({innerClass:'selectReplace'});    
	}

    $('.internet').hover(function(){$('.internet a').toggleClass('hover')},function(){$('.internet a').toggleClass('hover')});
    $('.internet').click(function(){location.href = $('.internet a').attr('href');});
    

//	 $('.news li:even').addClass('newseven');
//	 $('.news li:odd').addClass('newsodd').after('</ul><ul>');

	$('.submenu').prepend('<img src="/img/shadow.png" class="shadow" width="32" height="239" />');
	$('.shadow').ifixpng();

	// nyroModal
	$.nyroModalSettings({
		processHandler: function(settings) {$("object, embed").css("visibility","hidden");},
		endRemove: function(settings) {$("object, embed").css("visibility","visible");}
	});  
  
	$('#continue').click(function(){
    $.nyroModalRemove();
  });
  
	$("a[href$='jpg'], a[href$='png'], a[href$='gif'], a[href$='bmp']").nyroModal();
	$("a[href$='JPG'], a[href$='PNG'], a[href$='GIF'], a[href$='BMP']").nyroModal();

	
	$("[name=currency]").change(function(){set2();});
	$("[name=vyber_kurz]").click(function(){set2();});	
	set("EUR");set("USD");set("AUD");set("NOK");set("CHF");set("PLN");set("DKK");set("RON");set("RUB");set("GBP");set("SEK");set("HUF");set("JPY");set("CAD");    

	/*$('.home #blocks').flash({
		swf: '/img/citfin-banner5.swf',
		flashvars: {clickthru:'http://citfintestweb.e-apollo.cz/cz/produkty/firemni-ucet.html'},
		height: 120,
		width: 712
	});
*/
	/*$('#homepagebanner').flash({
		swf: '/tinymce-storage/files/citco-analytici-v2009-11.swf',
		params: {wmode: "transparent"},
		flashvars: {},
		height: 115,
		width: 462
	});*/

	/*$('#banner').flash({
		swf: '/tinymce-storage/files/citfin-jiranek.swf',
		params: {wmode: "transparent"},
		flashvars: {},
		height: 346,
		width: 234
	});
  	*/
	var h = $('.sectionimg').height();
  if (h < 164) h = 164;
  $('.sectionlinks').height(h+10);



			$('#buttons li').hover(			
				function(){	$(this).stop().animate({top:0},200);},
				function(){	$(this).stop().animate({top:-7},200);}
			);

			$('#fav, #fav2').click(function() {
				var title = document.title;
				var url = document.location.href;
				if ($.browser.mozilla) {
					// firefox
					window.sidebar.addPanel(title, url, "");
					$.nyroModalRemove();
					return false;
				}
				else if($.browser.opera){ // opera
					$(this).attr('rel','sidebar');
					$.nyroModalRemove();
					return true;
				}
				else if($.browser.msie) {
					// ie
					window.external.AddFavorite(url, title);
					$.nyroModalRemove();
					return false;
				}
			});

			$('#hp, #hp2').click(function(){
				if ($.browser.mozilla) {
					location.href="http://www.citfin.cz/cz/domovska-stranka-firefox.html";
					$.nyroModalRemove();
					return false;
				}
				else if($.browser.opera){ // opera
					location.href="http://www.citfin.cz/cz/domovska-stranka-opera.html"
					$.nyroModalRemove();
					return false;
				}
				else if($.browser.msie) {
					// ie
	    		this.style.behavior='url(#default#homepage)';
					this.setHomePage('http://www.citfin.cz');
					$.nyroModalRemove();
				}
			});


});

function isInteger(s) 
{
  return (s.toString().search(/^-?[0-9]+$/) == 0);
}
