//показ картинок и контуров для вставок
function vs(id) 
{
	var fixedBlock = document.getElementById("fixedBlock");
	var req = getXmlHttpRequest();
	req.onreadystatechange = function()
	{
		if (req.readyState != 4) return;		
		document.body.innerHTML = req.responseText;
	}
	req.open("GET", window.location.href + "?set=" + id, true);
	req.send(null);
}

function newW3(path) 
{
	w1 = window.open(path,"wwww","toolbar=0, status=1, width = 390, height = 390, resizable=1, scrollbars=1");
	w1.focus();
}

function newW1() 
{
	w1 = window.open("","wwww","toolbar=0, status=1, width = 700, height = 650, resizable=1, scrollbars=1");
	w1.focus();
}

function newW2() 
{
	w1 = window.open("","wwww","toolbar=0, status=1, width = 600, height = 650, resizable=1, scrollbars=1");
	w1.focus();
}

function cl() 
{ 
	for(var i=1; i<=4; i++) 
	{
		document.getElementById('sub'+i).style.visibility='hidden';
	}
}
function show(num) 
{
	cl();
  	document.getElementById('sub'+num).style.visibility='visible';
} 

/*
function cl() { 
	for(var i=1; i<=4; i++) {
		eval('sub'+i+'.style.visibility="hidden"');
	}
}
function show(num) {
	cl();
  	eval('sub'+num+'.style.visibility="visible"');
} 
*/

function Hide(ttt)
{
	var on = document.getElementById(ttt).style.display;
	if(on == '') {
		document.getElementById(ttt).style.display = 'none';
	} else {
		document.getElementById(ttt).style.display = '';
	}
}

//сперто с яндекса
document.onkeydown = register;
function register(e) 
{
	var nextUrl = document.getElementById("nextUrl");
	var backUrl = document.getElementById("backUrl");

	if (!e) e = window.event;
	var k = e.keyCode;
	
	if (e.ctrlKey) 
	{
		var tagName = (e.target || e.srcElement).tagName;
		if (tagName != 'INPUT' && tagName != 'TEXTAREA') 
		{
			if (k == 37) 
			{
				if(backUrl.value != "") window.location.href = backUrl.value;
			}
			if (k == 39) 
			{
				if(nextUrl.value != "") window.location.href = nextUrl.value;
			}
		}
	}
}