// obecny kod
var isDOM = (document.getElementById); 
var isIE4 = (document.all && !isDOM);
var isNS4 = (document.layers);
var isDyn = (isDOM || isIE4 || isNS4);


function getRef(id) {
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}

function ResizeWindow(Id, Id_item, a) 
{
	var i;
	if (navigator.appName == 'Netscape') i=10;
  
	Obr=new Image(); 
	Obr.src="images/img/ID_"+Id_item+".jpg";
	imgHeight=500;
	imgWidth=500;
	
	var height = screen.height;
	var width = screen.width;
	var leftpos = width / 2 - imgWidth / 2;
	var toppos = height / 2 - imgHeight / 2; 
  
	getRef(Id).src = js_pref_url+'/popup_image.php?pID='+Id_item;
	getRef(Id).style.position='absolute';
	getRef(Id).style.top=availW-toppos+'px';
	getRef(Id).style.left=leftpos+'px';
	getRef(Id).style.width=imgWidth+'px';
	getRef(Id).style.heigh=imgHeight+'px';
}



function popupWindow(url) 
{
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function location_window(url)
{
	window.location(url);
}

function noveOknoAdministr(soubor)
{
	window.open(soubor,'editace','toolbar=no,fullscreen=no,status=no,menubar=no,scrollbars=no,resiziable=no,width=100px,height=100px');
}

function noveOkno(soubor)
{
	window.open(soubor,'editace','toolbar=no,fullscreen=no,status=no,menubar=no,scrollbars=yes,resiziable=no,width=610,height=455');
}

function kontrola()
{
	var vysledek = true;
	var language = "cz";
	if ((document.formular.souhlas.checked=="") || (document.formular.jmeno_doruceni.value=="") || (document.formular.psc.value=="") || (document.formular.ulice.value=="") || (document.formular.mail.value==""))
	{
	vysledek=false;
	if (language == "cz") {alert("Pro pokračování je třeba vyplnit potřebné všechny údaje.");}
	if (language == "en") {alert("It's necessary to accept shopping terms to continue.");}
	if (language == "de") {alert("Es ist unvermeidlich mit den Einkaufzustand zu beistimmen.");}
	};
	return vysledek;
}

function validate(formular)
{

	if (formular.us_jmen.value=="")
    {
        alert("Prosím zadejte Vaše jméno!");
        formular.jmeno_kontakt.focus();
        return false;
    }
    else if (formular.us_log.value=="")
    {
        alert("Prosím vyberte si login!");
        formular.mail.focus();
        return false;
    }
    else if (formular.mail.value=="")
    {
        alert("Prosím zadejte adresu elektronické pošty!");
        formular.mail.focus();
        return false;
    }
	else if (formular.zprava_kontakt.value=="")
    {
        alert("Prosím napište text zprávy!");
        formular.zprava_kontakt.focus();
        return false;
    }
    else if (window.RegExp)
    {
        re = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");
        if (!re.test(formular.mail.value))
        {
            alert("Zadaná adresa není správnou adresou elektronické pošty!");
            formular.mail.focus();
            return false;
        }
    }
    else{return true;}
}

function ValidBook(id)
{

	if (getRef(id).b_cena.value=="")
    {
   		if(!confirm("Nejsou vyplněny všechny údaje!\npokračovat?"))
		{return false;}
    }
    else if (formular.b_autor.value=="")
    {
        if(!confirm("Není vyplněný autor položky!"))
		{return false;}
    }
    else if (getRef(id).b_name.value=="")
    {
        if(!confirm("Není vyplněný jmeno položky!"))
		{return false;}
    }
	else if (getRef(id).b_popis.value=="")
    {
        if(!confirm("Není vyplněný popis polozky!"))
		{return false;}
    }
    else{return true;}
}


function SearchCheckedForm(action)
{
	if(action=="id"){
		getRef("sl2_seach_form").vyhl_autor.checked=false;
		getRef("sl2_seach_form").vyhl_nazev.checked=false;
		getRef("sl2_seach_form").vyhl_popis.checked=false;
	}
	else{getRef("sl2_seach_form").vyhl_id.checked=false;}
}



