function ShowOrder(product_id) {
	dWidth=320;
	dHeight=510;
	leftpos=(screen.width-320)/2;
	toppos=(screen.height-dHeight)/2;
	(navigator.appName == "Microsoft Internet Explorer" ? window.showModalDialog('../order.php?proid='+product_id+'&r='+Math.random(), null, 'dialogWidth:320px;dialogHeight:535px;status:no;scroll:no;resizable: no') : window.open('../order.php?proid='+product_id+'&r='+Math.random(), null, 'width='+dWidth+',height='+dHeight+',top='+toppos+',left='+leftpos+',scrollbars=no,location=no,toolbar=no,resizable=yes'));
}

function ShowReservation(product_id) {
	dWidth=320;
	dHeight=520;
	leftpos=(screen.width-320)/2;
	toppos=(screen.height-dHeight)/2;
	(navigator.appName == "Microsoft Internet Explorer" ? window.showModalDialog('../reserve.php?proid='+product_id+'&r='+Math.random(), null, 'dialogWidth:320px;dialogHeight:535px;status:no;scroll:no;resizable: no') : window.open('../reserve.php?proid='+product_id+'&r='+Math.random(), null, 'width='+dWidth+',height='+dHeight+',top='+toppos+',left='+leftpos+',scrollbars=no,location=no,toolbar=no,resizable=yes'));
/*
	window.showModalDialog('../reserve.php?proid='+product_id, null, 'dialogWidth:320px;dialogHeight:520px;status:no;scroll:no;resizable: no');
	*/
}

function ShowDiv(item, div) {
	var box=document.getElementById(item);							//zjištění checkboxu
	var divname=document.getElementById(div);
//	alert(box.checked+' - '+divname.style.display.value);
	
	if(box.checked==true) {	 //je-li položka vybrána, ok
		divname.style.display="";
	}
	else {
		divname.style.display="none";
	}
}

function ShowHideTab(item) {	//zobrazí / skryje prvek tab1 a zamění img1 +/-
	var divname=document.getElementById('tab'+item);
	var imgname=document.getElementById('img'+item);
	if(divname.style.display=="none") {	 //je-li položka vybrána, ok
		imgname.src='../images/minus.gif';
		divname.style.display="";
	}
	else {
		divname.style.display="none";
		imgname.src='../images/plus.gif';
	}

}

function ShowHideAdmTab(item) {	//zobrazí / skryje prvek tab1 a zamění img1 +/-
	var divname=document.getElementById('tab'+item);
	var imgname=document.getElementById('img'+item);
	if(divname.style.display=="none") {	 //je-li položka vybrána, ok
		imgname.src='images/minus.gif';
		divname.style.display="";
	}
	else {
		divname.style.display="none";
		imgname.src='images/plus.gif';
	}

}

function ShowDivReverse(item, div) {	//opačné chování, při odškrtnutém boxu je zobrazen
	var box=document.getElementById(item);							//zjištění checkboxu
	var divname=document.getElementById(div);
//	alert(box.checked+' - '+divname.style.display.value);
	
	if(box.checked==false) {	 //je-li položka vybrána, ok
		divname.style.display="";
	}
	else {
		divname.style.display="none";
	}
}


function CheckEmail(mail)
{
//	alert(mail);
    reg = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,4}$/;
	return mail.search(reg) == 0;
}

function SubmitFilter(elmt) {
	var frm;
	frm=document.getElementById(elmt);
	if (event.keyCode == 13) {
		frm.submit();
		return true;
	}
	return false;
}

function Change(elmt) {
	var div;
	div=document.getElementById(elmt);

	if(div.className=='over') {
		div.className='out';
		div.style.backgroundImage='url(images/'+elmt+'_cb.jpg)';
	}
	else {
		div.className='over';
		div.style.backgroundImage='url(images/'+elmt+'.jpg)';
	}
	return;

}

var preload;	//aby se nenacitaly porad dokola
preload=(preload>0 ? preload : 0);

function Preload() {
/*	if (preload>0)
	{
		return;
	}*/
	img1= new Image();
	img1.src = "images/publ.jpg";
	img2 = new Image();
	img2.src = "images/sale.jpg";
	img3 = new Image();
	img3.src = "images/rent.jpg";
	img4 = new Image();
	img4.src = "images/info.jpg";
	preload=1;
/*	document.getElementById('rent').style.backgroundImage='url('+img3.src+')';
	document.getElementById('sale').style.backgroundImage='url('+img2.src+')';
	document.getElementById('info').style.backgroundImage='url('+img4.src+')';
	document.getElementById('publ').style.backgroundImage='url('+img1.src+')';
*/
	return;
}

//dotazovací okno na smazání
function ConfirmDel() {
	if (confirm('Opravdu chcete položku smazat ?\nOperace je nevratná!')) {
		return true;
		} 
	else {
		return false;
	}
}

function CheckNumber(numb) {
	_numb=parseInt(numb.value);
	if (_numb.toString() == 'NaN' || numb.value.length<5 || _numb.length<5) {
		numb.style.borderColor='red';
		return false;
	}
	else {
		numb.style.borderColor='';
		return true;
	}
}

function CheckString(str) {	//min. délka řetězce 2znaky
	if(str.value=='' || str.value.length < 2) {
		(alertitem>0 ? 1 : alert('Pole označená * musí být vyplněná!'));
		str.style.borderColor='red';
		alertitem=1;
		return false;
	}
	else {
		str.style.borderColor='';
	}
	return true;
}