var url="http://multivarka.ru/";

function openImage(image,title) {
	window.open(image+"?title="+title, "popupimage", "scrollbars=0, resizable=1, width=520, height=450").focus();
}
 
function Preload() {
	b=Preload.arguments; 
	preload_images = new Array();
	for(i=0; i<b.length; i++) {
		preload_image = new Image;
		preload_image.src=b[i];
		preload_images[i]=preload_image;
	}
}


function MenuAct(obj,act,activated) {
	if (activated) return;
	if (act==1) {
		obj.className='menubox1';
	} else {
		obj.className='menubox';
	}
}

function focusWindowSearch(query) {
	if (!query) query = '';
	left=screen.width/2-457;
	opt="scrollbars=0, resizable=0, width=850, height=600, left="+Math.ceil(left)+", top=10";
	window.open('/base/search/'+query,"multivarka_search",opt).focus();
}

function focusWindowBase(dir) {
	if (!dir) dir = '';
	left=screen.width/2-457;
	height=screen.height-100;
	//920
	opt="scrollbars=1, resizable=0, width=915, height="+height+", left="+Math.ceil(left)+", top=10";
	window.open('/base'+dir,"multivarka_ibase",opt).focus();
}

function focusWindow(dir,add) {
	opt = '';
	if (dir!='base') {
		left=screen.width/2-457;
		height=screen.height-100;
		//920
		opt="scrollbars=1, resizable=0, width=915, height="+height+", left="+Math.ceil(left)+", top=10";
	}
	if (add) {
		var obj=window.open(url+dir+add,"multivarka_"+dir,opt);
		obj.focus();
		return;
	} else {
		var obj=window.open("","multivarka_"+dir,opt);
	}
	href=obj.location.href;
	//for opera 9.0
	if (href==window.location.href) href="";
	if (dir=='base') {
		s = href.indexOf(url+dir);
		if (s<0) s = href.indexOf(url);
	} else {
		s = href.indexOf(url+dir);
	}
	if (s>=0) {
		obj.focus();
		return;
	}
	window.open(url+dir,"multivarka_"+dir,opt).focus();
}

function ImgSrc(obj,area,src) {
	tbl=obj.parentNode.parentNode.parentNode;
	all=tbl.getElementsByTagName('td');
	for (i=0;i<all.length;i++) {
		td=all[i];
		if (td.className) {
			col=td.getElementsByTagName('IMG');
			col[0].src='/home/'+area+'/dot.gif';
			td.className='submenu3';
		}
	}
	obj.className='submenu31';
	col=obj.getElementsByTagName('IMG');
	col[0].src='/home/'+area+'/dot1.gif';
	document.getElementById('dishimg').src=src;
}

function ImgSrcm(obj,area,src) {
	tbl=obj.parentNode.parentNode.parentNode;
	all=tbl.getElementsByTagName('td');
	for (i=0;i<all.length;i++) {
		td=all[i];
		if (td.className) {
			col=td.getElementsByTagName('IMG');
			col[0].src='/home/'+area+'/dotm.gif';
			td.className='submenu3m';
		}
	}
	obj.className='submenu3m1';
	col=obj.getElementsByTagName('IMG');
	col[0].src='/home/'+area+'/dotm1.gif';
	document.getElementById('dishimg').src=src;
}

function ResetCriterion() {
	inputs=document.getElementById('criterionbox').getElementsByTagName('INPUT');
	for (i=0;i<inputs.length ;i++ ) {
		inputs[i].checked=false;
	}
}

function ResetShowAll() {
	document.getElementById('resetcheckbox').checked=false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function DisplayMenu(obj,act) {
	obj=document.getElementById(obj);
	if (act) {
		obj.style.visibility='visible';
	} else {
		obj.style.visibility='hidden';
	}
}

function MenuAct2(obj,act,activated) {
	if (activated) return;
	if (act==1) {
		obj.parentNode.parentNode.cells[0].childNodes[0].childNodes[0].src='/home/arrow1.jpg';
		obj.parentNode.parentNode.cells[2].className='submenu41';
	} else {
		obj.parentNode.parentNode.cells[0].childNodes[0].childNodes[0].src='/home/arrow.jpg';
		obj.parentNode.parentNode.cells[2].className='submenu4';
	}
}

function showmenu(height) {
	if (!height) return;
	document.getElementById('pos').style.top=(height-document.getElementById('pos').clientHeight)/2;
	document.getElementById('pos').style.visibility='visible';
}
