var set=0;
var th;
var temp=1000;
var temph=0

function elm (id)
{
	return document.getElementById (id);
}

function move2 ()
{
	setm = setInterval (move,1);
}
	
function move()
{			
	th = document.getElementById("avia");			
	th.style.left = temp+"px";
	th.style.top = temph+"px";
	temp-=2;
	temph+=0.33;
	if (temph>78)
	{
		clearInterval (setm);					
		time_set_top = setInterval (time_move_top, 5000)
	}
}

function time_move_top ()
{
	th.style.display="none";
	th = document.getElementById ("avia_top");
	th.style.display="block";
	set_top = setInterval (move_top, 1);
	clearInterval (time_set_top);
}

function move_top()
{				
	th.style.left = temp+"px";
	th.style.top = temph+"px";
	temp-=2;
	temph-=0.23;
	if (temph<-20)
	{					
		clearInterval (set_top);
		time_set_bottom = setInterval (time_move_bottom, 5000)	
	}
}

function time_move_bottom ()
{			
	th.style.display="none";
	th.style.top="78px";
	th.style.left="520px";
	th = document.getElementById("avia");
	th.style.top="-250px";
	th.style.left="1200px";			
	th.style.display="block";			
	temp=1000;
	temph=0;
	setm = setInterval (move, 1);
	clearInterval (time_set_bottom);
}

var hideInt;
var flagsvitok = 0;
$(".svitok").ready(function() {;
	$('.svitok').mouseover(function(){flagsvitok = 1});
	$('.svitok').bind('mouseleave', function()
		{
			flagsvitok = 0;
			$('.svitok').hide();
	})
})

function show (a)
{
	clearTimeout (hideInt);
	$('.svitok').hide();
	$(a).show();
}

function hide()
{
	hideInt = setTimeout (function()
		{
			if (flagsvitok==0) 
			{
				$('.svitok').hide();
			}
		}, 500);
}

function blink ()
{
	$("#avia_blink").hide();
	setTimeout(function(){$("#avia_blink").show();setTimeout(blink,1000)},500);
}
$("#avia_blink").ready(blink());

function blink_class ()
{
	$(".blink").hide();
	setTimeout(function(){$(".blink").show();setTimeout(blink_class,1000)},500);
}
$(".blink").ready(blink_class());
