/*
 * Vymena obrazku s udanim jen jeho jmena s preload
 * format obrazku OVER: name.ext, OUT: nameo.ext
 * $Id: functions.js,v 1.7 2004/09/29 08:08:46 pavel Exp $
 */
 

function Del() {
	return confirm("Chcete data opravdu smazat?");
	}

function DelAll() {
	q=confirm("POZOR! \nBudou nenavratne smazana data!");
	if(q) q=Del();
	return q;
	}
	
function test_and_openWIN(url,target,x,y) {	
	if(!window.openedWin || !window.openedWin.name) {
		window.openedWin = window.open(url,target,'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width='+x+',height='+y+',left=30,top=30');
	}
	window.openedWin.focus();
}

function openWIN(target,x,y) {
	popWin=window.open('',target,'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width='+x+',height='+y+',left=30,top=30');
	popWin.focus();
}

function openIFrame(target, w, h) {
	obj = new getObj(target);
	if (obj!='undefined') {
		var inhtml = '';
		inhtml = '<iframe name="' + target + '" src="" ';
		inhtml = inhtml + 'width="' + w + '" height="' + h + '" ';
		inhtml = inhtml + 'frameborer="1" ';
		inhtml = inhtml + '>' + '<' + '/iframe>';
		obj.innerHTML = inhtml;
	}
}

function openWinURL(target,url,x,y) {
	popWin=window.open(url,target,'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width='+x+',height='+y+',left=10,top=10');
	popWin.focus();
}

// ----- Otevreni noveho okna ve stredu obrazovky -----
function openWINcenter(page,target,dx,dy){
	x=(screen.width-dx)/2;
	y=(screen.height-dy)/2;
	openWINxy(page,target,dx,dy,x,y);
}

// ----- Otevreni noveho okna na pozici [x,y] -----
function openWINxy(page,target,dx,dy,x,y){
	popWin=window.open(page,target,'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width='+dx+',height='+dy+',left='+x+',top='+y);
	popWin.focus();
}


function Activate() {
	return confirm("Povolit?");
}

function DeActivate() {
	return confirm("Zakazat?");
}

function getObj(name)
{
 if (document.getElementById) {
   return document.getElementById(name);
 } else
		if (document.all) {
			return document.all[name];
		} else
			if (document.layers) {
				return document.layers[name];
			} else return false;
}

function swapMenu( menu ) {
	mo = new getObj( menu );
	if ( mo != 'undefined' ) {
		if ( mo.style.display == 'none' ) {
			mo.style.display = 'block';
		} else {
			mo.style.display = 'none';
		}
		return true;
	}
	return false;
}

function searchit( field, min ) {
	
	try {
		if (field.value.length > min) {
			return true;
		}
	}
	catch (err) {
		alert(err);
	}
	
	alert('Zadaný výraz je příliš krátky. Zadávejte ' + min + ' a více znaků.');
	return false;

}