// JavaScript Document


var resizeTimer = null;
$(window).bind('resize', function(){
  if (resizeTimer) clearTimeout(resizeTimer);
  resizeTimer = setTimeout(doSomething, 1);});








$(function(){

var winWidth = $(window).width();
var winHeight  = $(window).height();
 


$(".draggable").draggable(); 
$('.content').css('left', (winWidth/2)-360 + 'px');
$('#share').css('top', 10 + 'px');
$('#share').css('left', (winWidth)-(winWidth)+5 + 'px');



if (winHeight > 760){
    if (winHeight < 900){$('.content').css('top', (winHeight/2)-390 + 'px'); $('#pozadi').css('top', (winHeight/2)-570 + 'px');}
    else {$('.content').css('top', (winHeight/2)-420 + 'px'); $('#pozadi').css('top', (winHeight/2)-600 + 'px');}}
else {$('.content').css('top', (winHeight/2)-370 + 'px'); $('#pozadi').css('top', (winHeight/2)-540 + 'px');}


$('div#text').height(winHeight);
$('div#text').width(winWidth); 
$('#pozadi_I').css('left', (winWidth/2)-960 + 'px');
$('#pozadi_II').css('left', (winWidth/2)-960 + 'px');
$('#pozadi_I').css('top', (winHeight/2)-600 + 'px');
$('#pozadi_II').css('top', (winHeight/2)-600 + 'px');

$('.listen_button').click(function(){
  vrstva[(vrstva.length)]=(vrstva.length)-1;
  $('.listen').css('z-index', (vrstva.length)-1);  
  $('.listen_r').animate({opacity:1},200).animate({opacity:0},200); 
  return false;});

$('.gig_button').click(function(){
  vrstva[(vrstva.length)]=(vrstva.length)-1;
  $('.gig').css('z-index', (vrstva.length)-1); 
  $('.gig_r').animate({opacity:1},200).animate({opacity:0},200);
  return false;});

$('.see_button').click(function(){
  vrstva[(vrstva.length)]=(vrstva.length)-1;
  $('.see').css('z-index', (vrstva.length)-1); 
  $('.see_r').animate({opacity:1},200).animate({opacity:0},200);
  return false;});

$('.lyrics_button').click(function(){
  vrstva[(vrstva.length)]=(vrstva.length)-1;
  $('.lyrics').css('z-index', (vrstva.length)-1); 
  $('.lyrics_r').animate({opacity:1},200).animate({opacity:0},200);
  return false;});
  
$('.amp_button').click(function(){
  vrstva[(vrstva.length)]=(vrstva.length)-1;
  $('.amp').css('z-index', (vrstva.length)-1); 
  $('.amp_r').animate({opacity:1},200).animate({opacity:0},200);
  return false;});  

$('.bio_button').click(function(){
  vrstva[(vrstva.length)]=(vrstva.length)-1;
  $('.bio').css('z-index', (vrstva.length)-1); 
  $('.bio_r').animate({opacity:1},200).animate({opacity:0},200);
  return false;});

$('.touch_button').click(function(){
  vrstva[(vrstva.length)]=(vrstva.length)-1;
  $('.touch').css('z-index', (vrstva.length)-1); 
  $('.touch_r').animate({opacity:1},200).animate({opacity:0},200);
  return false;});
  
$('.others_button').click(function(){
  vrstva[(vrstva.length)]=(vrstva.length)-1;
  $('.others').css('z-index', (vrstva.length)-1); 
  $('.others_r').animate({opacity:1},200).animate({opacity:0},200);
  return false;});  

});


function doSomething(){

$(function(){
var winWidth = $(window).width();
var winHeight  = $(window).height();
$('.content').css('left', (winWidth/2)-360 + 'px');

if (winHeight > 760){
    if (winHeight < 900){$('.content').css('top', (winHeight/2)-390 + 'px'); $('#pozadi').css('top', (winHeight/2)-570 + 'px');}
    else {$('.content').css('top', (winHeight/2)-420 + 'px'); $('#pozadi').css('top', (winHeight/2)-600 + 'px');}}
else {$('.content').css('top', (winHeight/2)-370 + 'px'); $('#pozadi').css('top', (winHeight/2)-540 + 'px');}

$('#pozadi_I').css('left', (winWidth/2)-960 + 'px');
$('#pozadi_II').css('left', (winWidth/2)-960 + 'px');
$('#pozadi_I').css('top', (winHeight/2)-600 + 'px');
$('#pozadi_II').css('top', (winHeight/2)-600 + 'px');

$('#share').css('top', 10 + 'px');
$('#share').css('left', (winWidth)-(winWidth)+5 + 'px');

$('div#text').height(winHeight);
$('div#text').width(winWidth);});};

function skryj(){$(function(){$('.ram').css('opacity', 0);});

};
