// ---------Browser determination-----------
dom = (document.getElementById);
IE4x = (document.all && !dom);
NN4x = (document.layers);
br4x = (IE4x || NN4x);
IE5x = (IE4x && navigator.appVersion.indexOf("5.") >= 0);

function createPictureWindow(_file,Width,Height)
{
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+(Width*p)+(Height*q);
	WinFeatures = "top="+(screen.height-Height)/2+",left="+(screen.width-Width)/2+",width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no";
	w = window.open(_file,windowName,WinFeatures);
}

function createDescriptionWindow(URL,Width,Height)
{
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+(Width*p)+(Height*q);
	this.window.name='pw';
	WinFeatures = "top="+(screen.height-Height)/2+",left="+(screen.width-Width)/2+",width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=yes";
	t = window.open(URL,windowName,WinFeatures);

}


function ExpandNode(num,url){
	if(IE4x){
		objName=document.all['submenu'+num].style;
		objName.display=((objName.display=="block")?"none":"block");
	}

	if(NN4x){
		location.href=url;
	}

	if(dom){
		objName=document.getElementById('submenu'+num).style;
		objName.display=((objName.display=="block")?"none":"block");
	}

}

function checkOrder(form)
{
	_name = document.forms[form].elements['name'].value;
	_phone= document.forms[form].elements['telephone'].value;
	_address = document.forms[form].elements['delivery_address'].value;

	if (_name == "")
	{
		alert('Введите Ваши фамилию, имя и отчество!');
		document.forms[form].elements['name'].focus();
		return false;
	}
 	else if (_phone == "")
	{
		alert('Введите номер контактного телефона!');
		document.forms[form].elements['telephone'].focus();
		return false;
	}
	else if (_address == "")
	{
		alert('Введите адрес доставки!');
		document.forms[form].elements['delivery_address'].focus();
		return false;
	}
	else return true;
}

// ---------Layer visibility-----------

function hideLayer(layer) {
	if (NN4x) document.layers[layer].visibility = "hide";
	if (IE4x || dom) document.all[layer].style.visibility = "hidden";}

function showLayer(layer) {
	if (NN4x) document.layers[layer].visibility = "show";
	if (IE4x || dom) document.all[layer].style.visibility = "visible";}




