function gebi(id){
	return document.getElementById(id);
}

paf = "img/buts/";
function preload(nejm){
	for(i=1;i<=10;i++){
		src = paf+nejm+i+'.gif';
		document.write('<img src="'+src+'">');
	}
}

/*
function light(but){
	eval(but+"lock=1");
	eval(but+"=10");
	el = gebi(but+'1');
	//alert(el.lang);
	//sp = el.getAttribute('lang');
	//sp = el.lang;
	//if(sp==null) sp = '';
	sp2 = '';
	if(but=='mod') sp2 = 'spec';
	nu = 'url("'+paf+'butl'+sp2+eval(but)+'.gif")';
	el.style.backgroundImage = nu;
	el = gebi(but+'2');
	nu = 'url("'+paf+'butc'+eval(but)+'.gif")';
	el.style.backgroundImage = nu;
	el = gebi(but+'3');
	//sp = el.lang;
	sp2 = '';
	if(but=='hom') sp2 = 'spec';
	nu = 'url("'+paf+'butr'+sp2+eval(but)+'.gif")';
	el.style.backgroundImage = nu;
}*/

function light(but){
	eval(but+"lock=1");
	eval(but+"=10");
	el = gebi(but+'1');
	jsp2 = el.getAttribute('lang');
	if(jsp2==null) jsp2 = '';
	nu = 'url("'+paf+'butl'+jsp2+eval(but)+'.gif")';
	el.style.backgroundImage = nu;
	el = gebi(but+'2');
	nu = 'url("'+paf+'butc'+eval(but)+'.gif")';
	el.style.backgroundImage = nu;
	el = gebi(but+'3');
	jsp2 = el.getAttribute('lang');
	if(jsp2==null) jsp2 = '';
	nu = 'url("'+paf+'butr'+jsp2+eval(but)+'.gif")';
	el.style.backgroundImage = nu;
}

function hide(but){
	hides(but,0);
}

function hides(but,seuf){
	if(seuf==0) eval(but+"lock=0");
	if(eval(but)>0 && eval(but+"lock")==0){
		eval(but+"--");
		el = gebi(but+'1');
		jsp2 = el.getAttribute('lang');
		if(jsp2==null) jsp2 = '';
		nu = 'url("'+paf+'butl'+jsp2+eval(but)+'.gif")';
		el.style.backgroundImage = nu;
		el = gebi(but+'2');
		nu = 'url("'+paf+'butc'+eval(but)+'.gif")';
		el.style.backgroundImage = nu;
		el = gebi(but+'3');
		jsp2 = el.getAttribute('spec');
		if(jsp2==null) jsp2 = '';
		nu = 'url("'+paf+'butr'+jsp2+eval(but)+'.gif")';
		el.style.backgroundImage = nu;
		setTimeout('hides("'+but+'",1)',80);
	}
}

function swapit(row,num){
	bfot = gebi('r'+row+'big');
	mfot = gebi('r'+row+'mini'+num);
	tname = bfot.name;
	bfot.src = 'img/px.gif';
	bfot.name = mfot.name;
	bfot.src = 'res.php?d=u&f='+mfot.name+'&w=224&h=168';
	mfot.name = tname;
	mfot.src = 'res.php?d=u&f='+tname+'&w=50&h=37';
}

function zoomwindow(url){
	window.open(url,'zoom','width=100, height=100, location=no, menubar=no, toolbar=no, resizable=yes, scrollbars=yes, status=yes');
}

function zoomit(row){
	bfot = gebi('r'+row+'big');
	zoomwindow('zoom.php?d=u&f='+bfot.name);
}

function zoomnu(el){
	zoomwindow('zoom.php?d=n&f='+el.name);
	//window.open(,'zoom','width=100, height=100, location=no, menubar=no, toolbar=no, resizable=yes, scrollbars=yes, status=yes');
}
function zoomimp(el){
	zoomwindow('zoom.php?d=g&f='+el.name);
}

function decome(el){
	el.style.textDecoration = 'underline';
	el.parentNode.parentNode.style.backgroundImage = 'url("img/ubebatr.gif")';
}

function undecome(el){
	el.style.textDecoration = 'none';
	el.parentNode.parentNode.style.backgroundImage = 'url("img/ubebat.gif")';
}

function decome2(el){
	el.style.textDecoration = 'underline';
	el.parentNode.parentNode.style.backgroundImage = 'url("img/akcesbatr.gif")';
}

function undecome2(el){
	el.style.textDecoration = 'none';
	el.parentNode.parentNode.style.backgroundImage = 'url("img/akcesbat.gif")';
}

function tapmask(id){
	el = gebi('resdiv'+id);
	el.style.display = 'block';
}

function taphide(id){
	el = gebi('resdiv'+id);
	el.style.display = 'none';
}

function zoomtap(hash){
	zoomwindow('zoom.php?d=h&f='+hash);
	//window.open(,'zoom','width=100, height=100, location=no, menubar=no, toolbar=no, resizable=yes, scrollbars=yes, status=yes');
}

function zoomsal(id){
	zoomwindow('zoom.php?d=g&f=salon_'+id+'.jpg');
	//window.open(,'zoom','width=100, height=100, location=no, menubar=no, toolbar=no, resizable=yes, scrollbars=yes, status=yes');
}

function zoomkon(fn){
	zoomwindow('zoom.php?d=k&f='+fn);
	//window.open(,'zoom','width=100, height=100, location=no, menubar=no, toolbar=no, resizable=yes, scrollbars=yes, status=yes');
}

function checkform(){
	inpz = document.getElementsByTagName('input');
	for(i=0;i<inpz.length;i++){
		if(inpz[i].className == 'checkme'){
			if( (inpz[i].type == 'text' && !inpz[i].value) || (inpz[i].type == 'checkbox' && !inpz[i].checked) ){
				gebi('formzwar').style.color = '#ff0000';
				//gebi('formzwar').style.textDecoration = 'blink';
				gebi('formzerr').style.display = 'inline';
				return false;
			}
		}
	}
}