﻿jQuery(document).ready(function(){

//begin
$zastava= $('<div id="zastava" style="z-index:10; background-color: #1F1C17; width:100%; height:100%; position:absolute; top:0; left:0; text-align:center; cursor:not-allowed;">'+
'<img id="shtrih" style="display:block; z-index:11; width:444px;" src="/antares/static/shtrih.png" />'+
'<img id="oreol" style="display:block; z-index:12; width:248px;" src="/antares/static/oreol.png" />'+
'<img id="star" style="display:block; z-index:13;  width:87px;" src="/antares/static/star.png" />'+
'<img id="uzor1" style="display:block; z-index:15; width:300px;" src="/antares/static/uzor1.png" />'+
'<img id="uzor2" style="display:block; z-index:15; width:300px;" src="/antares/static/uzor2.png" />'+
'<img id="uzor3" style="display:block; z-index:15; width:300px;" src="/antares/static/uzor3.png" />'+
'<img id="uzor4" style="display:block; z-index:15; width:300px;" src="/antares/static/uzor4.png" />'+
'<img id="bukva" style="display:block; z-index:24; width:165px;" src="/antares/static/bukva.png" />'+
'<img id="enter" style="display:block; z-index:25; width:92px;" src="/antares/static/enter.jpg" />'+
'</div>').appendTo(document.body);

var y0=320;
var W=$zastava.width();

$zastava.children().hide().css({position:'absolute'}).each(centerize);
setTimeout(start, 500);

function start(){
$('#shtrih').css({top:y0-2})
  .show('blindup',{direction: 'right', easing:'easeInCubic'}, 2800);
setTimeout(ozarenie, 2800+700);
}
function centerize(){
//top:y0-$(this).height(),
$(this).css({ left:(W-$(this).width())/2});
return this;
}
function ozarenie(){
$('#star').css({top:y0-57})//$('#star').height()-14})
 .show('blindup',{direction: 'up'}, 1000)
// , function(){
$('#oreol').css({top:y0-$('#oreol').height()}).fadeIn(1500, 'easeInCubic');
//});
setTimeout(uzory, 2400);

}

function uzory(){
var hUzor=60;
var wUzor=300;
var nPad=6;
var v=2000;
var xLev=$('#oreol').position().left - wUzor +87;
var xPra=$('#oreol').position().left + $('#oreol').width() - 80;
var yVerh=y0-hUzor-nPad;
var yNiz=y0+nPad+4;
//op={direction: 'horizontal'};
opL={direction: 'left'};
opR={direction: 'right'};
$('#uzor1').css({left:xLev, top:yVerh})
  .show('blindup',opR, v);
$('#uzor2').css({left:xPra, top:yVerh})
  .show('blindup',opL, v);
$('#uzor3').css({left:xPra, top:yNiz})
  .show('blindup',opL, v);
$('#uzor4').css({left:xLev, top:yNiz})
  .show('blindup',opR, v);


setTimeout(bukva, v+300);
}

function bukva(){
$('#bukva').css({top:y0-18})
//  .fadeIn(1500,'easeOutBounce', function(){
  .show('fade',{direction:'down'},function(){
setTimeout(goup, 700);
});
}
function goup(){
$('#enter').css({top:y0+80, cursor:'pointer'})
  .show('bounce',{direction:'down'}).click(zastafinish);
tFinish=setTimeout(zastafinish, 15000);
}
function zastafinish(){
//$('#left-sidebar').show('slide',{direction: 'up'})
clearTimeout(tFinish)
$zastava.fadeOut('slow');
bReady=true;
}

});
