function sall(){
 if(!document.listmsg.Msg) return;
 if(!document.listmsg.Msg.length)
	document.listmsg.Msg.checked = document.listmsg.Msg.checked ? false : true;
 else
	for(var i=0;i<document.listmsg.Msg.length;i++)
		document.listmsg.Msg[i].checked = document.listmsg.Msg[i].checked ? false : true;
}

function chbg(x,id,c)
{
	if(x=='over'){
		document.getElementById(id).style.backgroundColor = '#CECECE';
	}
	else{
		document.getElementById(id).style.backgroundColor = c;
	}
}

function chbd(x,id)
{
	if(x=='over'){
		//document.getElementById(id).style.border = '#000000 1px solid;';
	}
	else{
		//document.getElementById(id).style.border = 0;
	}
}

function open_new(url,w,h) 
{
	w+=25;h+=50;
	//window.open(name_foto+".gif",'foto','top=30, left=30, menubar=0, toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, width=270, height=180');
	myWin = window.open(url ,'open_new','top=0, left=0, menubar=0, toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, width='+w+', height='+h+'');
	var winWidth=w; 
	var winHeight=h;
	//alert(winWidth); 
	myWin.resizeTo(winWidth, winHeight); 
	var winPosX=screen.width/2-winWidth/2; 
	var winPosY=screen.height/2-winHeight/2;  
	myWin.moveTo(winPosX, winPosY); 
	myWin.focus();
	//self.name = 'zrp_admin';
}

//Слои

function move_lay(lay,pad) 
{ 
	if(document.getElementById(lay))
	{ 
		//document.getElementById('sh').style.top = document.body.scrollTop;

		//var width = document.body.clientWidth;
		//if(width < 800){width = 800;}
		//alert(document.body.clientWidth); 
		//document.getElementById(lay).style.left = (width - 800) / 2 + pad; 
		document.getElementById(lay).style.left = pad; 
		document.getElementById(lay).style.top = 115; 
		//document.getElementById('sh').style.display = '';
	} 
}

function allay(){
	
	move_lay('lay113',11);	
	move_lay('lay116',238);	
	//move_lay('lay8',288);	
	//move_lay('lay67',380);	
	//move_lay('lay11',258);	
	//move_lay('lay12',500);	
	
	//move_lay('lay2',27); + 50
	//move_lay('lay3',149);
	//move_lay('lay4',481);
	//move_lay('lay5',509);
	//move_lay('lay6',828);
}


var currLay;
var inte;

function showLay(lay)
{
	if(document.getElementById(lay)){
	document.getElementById(lay).style.display='';
	currLay = lay;
	}

}

function hideLay()
{
	
	if(document.getElementById(currLay)){
	document.getElementById(currLay).style.display='none';
	clearInterval(inte);}
	
}

function strInt()
{
		inte = setInterval(hideLay, 1000);
}

function stoInt()
{
		clearInterval(inte);
}

document.onclick=hideLay;