// Adds window-resize handle for all that stupid browsers, who still don't support "minwidth" CSS property
function makelimit(){
	document.getElementsByTagName('body')[0].style.width=((document.documentElement.clientWidth<1000)?'1000px': '100%');
	}

// This var stores if stupid browser is detected
var scuko=(navigator.appName=='Microsoft Internet Explorer') && document.documentElement.clientWidth;
if(scuko){
	window.onresize=makelimit;
	window.onload=makelimit;
	}

function thehack(){
	var d=document.getElementsByTagName('body')[0];
	d.style.display='none';
	d.style.display='block';
	}

// Function to show / hide sublevels in the brands list
function catmenu_toggle(obj){
	var ul=obj.parentNode.getElementsByTagName('ul')[0];
	ul.style.display=(ul.style.display=='block')?'none':'block';
	obj.title=(ul.style.display=='block')?'Свернуть':'Раскрыть';
	// stupid browser seems not to refresh the page when blocks' content dynamically changes, so we use the hack
	if(scuko) thehack();
	}

function full_pic(url, name, desc){
	win=window.open('', 'gallery', 'width=590,height=750,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
	win.document.open();
	win.document.writeln(
"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1-strict.dtd'>\n"+
"<html lang='ru'>\n"+
"<head>\n"+
"	<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />\n"+
"	<title>TRIA International, Ltd / Фотогалерея / "+name+"</title>\n"+
"	<link rel='stylesheet' href='/gallery.css' type='text/css' media='screen' />\n"+
"</head>\n"+
"<body>\n"+
"<h1><span class='rfloat'><a href='javascript:window.close()' class='pink'>Закрыть</a></span>"+name+"</h1>\n"+
"<img src='"+url+"' alt='"+name+"' />\n"+
(desc ? "<div>"+desc+"</div>\n" : "" )+
"</body>\n"+
"</html>");
	win.document.close();
	win.focus();
	}

function show_submenu(link){
	if ( !( bb = document.getElementById('brandsubmenu') ) ) return true;
	if (bb.style.display == 'none') bb.style.display = 'block';
	else bb.style.display = 'none'
	return false;
}