// screen resolution to cookie
function screenResolution(){
  var winHscreen = parseInt($(window).height()-30);
  var winWscreen = parseInt($(window).width()-30);
  $.cookie('screenResolution', winWscreen+'x'+winHscreen, {path: '/'});
}

$(document).ready(function(){
  screenResolution();  
  $(window).bind('resize', function() {
    screenResolution();
  }); 
});

// carousel
$(function(){
	$('#carousel').infiniteCarousel({
		displayTime: 6000,
		textholderHeight : .15,
		displayThumbnailBackground: 0,
		thumbnailWidth: '15px',
		thumbnailHeight: '15px',
		thumbnailFontSize: '.7em',
		colorCurrentNum: '#009872'
	});
});

// append class externalLink to news
$(document).ready(function() {
  $('.aktualityContent a').addClass('linkExternal');   
});

// externí odkazy
$(document).ready(function(){
  $('a[href^="http:"], a.linkExternal').click(function(){
    window.open(this.href);
    return false;
  });
}); 


// externí odkazy img
$(document).ready(function(){
  $('a.linkExternalImg').click(function(){
    window.open(this.href);
    return false;
  });
});

// colorbox
// minWidth:300, minHeight:200
$(document).ready(function(){
  var winHcolorbox = parseInt($(window).height()-30);
  var winWcolorbox = parseInt($(window).width()-30);
  //
  if(lang == 'cz'){
    var cInfoText = 'položka {current} z {total}';
  }
  else{
    var cInfoText = 'item {current} of {total}';  
  }
  //  
  $('.colorbox').colorbox({transition:'elastic', speed:350, current: cInfoText, opacity: 0.7, maxWidth: winWcolorbox+'px', maxHeight: winHcolorbox+'px', minWidth: 400});
});

// colorbox outer HTML     
$(document).ready(function(){
  var winHcolorbox = parseInt($(window).height()-30);
  $('.colorboxHTML').colorbox({transition:'elastic', speed:350, opacity: 0.7, width:'960px', maxHeight: winHcolorbox+'px'});
});

// flv player close
function closeFLVplayer(){
  $.fn.colorbox.close();
}

// flv player next element
function nextFLVplayer(){
  $.fn.colorbox.next(); 
}

// overlay banner 
var fadeOutVal = 1000;
function fadeOutOB(){
  $("#containerOB").animate({"opacity": 0}, fadeOutVal);
  var intFadeOut=setInterval(hideOB,fadeOutVal);  
}

function viewOB(){    
  $("#containerOB").css({'display' : 'block'});         
} 
    
function hideOB(){  
  $("#containerOB").css({'display' : 'none'});
  $.cookie('cookieOB', 'hidden', {path: '/'});
}

jQuery().ready(function(){
  var overlayVal = 0.3;
  $("#overlayOB").css('opacity', overlayVal);
  
  if(!$.cookie('cookieOB')){    
    $.cookie('cookieOB', 'visible', {path: '/'});
    viewOB();
  }
  if($.cookie('cookieOB')=='hidden'){ 
    hideOB();  
  }
  else{
    viewOB();
  }
  $("#OBclose").click(function(){
    $.cookie('cookieOB', 'hidden', {path: '/'}); 
    fadeOutOB();   
  });
});

/* jSubmit */

$(document).ready(function(){
  $("#jSubmit").css({'background-position' : 'left'}); 
  
  $("#jSubmit").hover(
    function(){
      $(this).css({'background-position' : 'right'});  
    },
    function(){
      $(this).css({'background-position' : 'left'});  
    }
  );
});

// none 
function none(){};

// jquery amail - anispam
$(document).ready(function(){  
  $('.mail').amail('||','|','AQU');
});







