var tiout,texlost,txt2,txt3;
txt3=0;
texlost=0;
function size ()
{
	var bod,tex,txt;
	var x,y,tttt;
	
	// общий синтаксис

		if (self.innerHeight) {
		
		x = self.innerWidth;
		
		y = self.innerHeight;
		
		// IE 6 Strict Mode
		
		} else if (document.documentElement && document.documentElement.clientHeight) {
		
		x = document.documentElement.clientWidth;
		
		y = document.documentElement.clientHeight;
		
		// Остальные версии IE
		
		} else if (document.body) {
		
		x = document.body.clientWidth;
		
		y = document.body.clientHeight;
		}
	
	
	bod = $("#page").height();
	txt = $("#text").height();
	if (txt3==0)
	{txt3 = txt;}
	txt2 = txt;
	tttt = y;
	//$("#keyText").html("y = "+y+" bod = "+bod+" tx="+txt);
	
	//if (y!=texlost)
	//{
		if (txt>y) {
			//tex = y-313;
			//bod=y;
			if (txt3<txt)
			$('#text').height(txt);
			else {txt=txt3;}
			//$("#keyText").html($("#keyText").html()+"1");
		}
		else
		{
				txt=y-305;
				if (txt3<txt)
				{
					$('#text').height(txt);
				}
				else {txt=txt3;}
			//$("#keyText").html($("#keyText").html()+"2");
		}
		if (y<800){
			y=800;
			
			if (y-305>txt2)
			{txt=y-305;}
			else {txt=txt2;}
			
			if (txt3<txt)
			{
				$('#text').height(txt);
			}
			else {txt=txt3;}
		}
		
		
		
		txt+=321;
		$('.leftpol').height(txt);
		$('.ritpol').height(txt);
	//}
	texlost = tttt;	
	//$("#keyText").html($("#keyText").html()+"y = "+y+" bod = "+bod+" tx="+txt);
}

var tr,scher;
function blinks ()
{
	if (scher==0)
	{
		scher=1;
		
	}
	else
	{
		scher=0;
	}
	$('.blinks').animate({opacity: scher}, 600);
}

$(document).ready(function(){
	size ();
	tiout = setInterval("size ()",3000);
	tr = setInterval('blinks ()',800);
});
