$(document).ready(function(){
//nastaveni nahodneho citatu na uvod
var position = ['0px','-90px','-180px','-270px','-360px','-450px','-540px'];
//swap(position);
//zmena_obrazku();
$('.vice').click(function(event) {
event.preventDefault();
$idcko=$(this).attr('id');
$('#'+$idcko+'_div').slideToggle('slow', function(){
var $link = $('#'+$idcko+'_odkaz');
if($(this).is(":visible")){
$link.text("Skr�t");
//$('html,body').animate({scrollTop: $('#'+$idcko+'_skrol').offset().top});
}else{
$link.text("Zobrazit");
}
});
});
//Harvester sber emailu
$(".harvester-button").click(function(event){
event.preventDefault();
email=$('#email').val();
email=encodeURIComponent(email);
$('#okno #okno-msg').empty();
$("#okno").show();
$('#okno #okno-msg').html('loading...');
$.ajax({
url: "include/ajax-email-ulozit.php?email="+email,
async: true,
}).done(function( data_msg ){
data=data_msg.split('|');
var vysledek='';
//console.log(data_msg);
if(data[0]=="1"){
vysledek=data[1];
$('#email').val('');
}else if(data[0]=="2"){
vysledek=data[1];
}else if(data[0]=="3"){
vysledek=data[1];
}else{
vysledek="Do�lo k nezn�m� chyb�, email nemohl b�t vlo�en";
}
$('#okno #okno-msg').empty().html(vysledek+".");
}).fail(function() {
}).always(function() {
});
});
$("#okno .cancel").click(function(event){
$("#okno").hide();
});
/*
* Replace all SVG images with inline SVG
*/
$('img.svg').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
jQuery.get(imgURL, function(data) {
// Get the SVG tag, ignore the rest
var $svg = jQuery(data).find('svg');
// Add replaced image's ID to the new SVG
if(typeof imgID !== 'undefined') {
$svg = $svg.attr('id', imgID);
}
// Add replaced image's classes to the new SVG
if(typeof imgClass !== 'undefined') {
$svg = $svg.attr('class', imgClass+' replaced-svg');
}
// Remove any invalid XML tags as per http://validator.w3.org
$svg = $svg.removeAttr('xmlns:a');
// Replace image with new SVG
$img.replaceWith($svg);
}, 'xml');
});
});
function swap(position) {
var i = Math.floor(Math.random()*position.length);
$('.zahlavi span').css('background-position', '0 ' + position[i]);
}
//po x vterinach zmenit obrazek
function zmena_obrazku(){
setTimeout(function() {
$pozice=$('.zahlavi span').css('background-position').split(' ');
$shora=parseFloat($pozice[1].replace('px'));
$nova_shora=$shora-90;
if($nova_shora<-540){
$nova_shora=0;
}
$('.zahlavi span').css('background-position', '0 ' + $nova_shora+'px');
zmena_obrazku();
}, 7000);
}