
// Kontrola zadání přihlašovacíh údajů
	function Check_Login()
	{
	   if (document.login_form.username.value == '')
	   {
	      document.login_form.username.focus();
	      alert ('Nebylo zadáno přihlašovací jméno.');
	      return false;
	   }
	   if (document.login_form.password.value == '')
	   {
	      document.login_form.password.focus();
	      alert ('Nebylo zadáno heslo.');
	      return false;
	   }
	}

// Kontrola zadání výrazu pro vyhledávání
	function Check_Search()
	{
	   if (document.search_form.search.value == '')
	   {
	      document.search_form.search.focus();
	      alert ('Nebyl zadán výraz pro vyhledávání.');
	      return false;
	   }
	}
	
// Kontrola zadání výrazu pro vyhledávání
	function Check_add_file_Search()
	{
	   if (document.add_file_search_form.add_file_search.value == '')
	   {
	      document.add_file_search_form.add_file_search.focus();
	      alert ('Nebyl zadán výraz pro vyhledávání.');
	      return false;
	   }
	}


// Kontrola emailu
function check_email(email) {

  var re = /^[_a-zA-Z0-9\.\-]+@[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}$/;
  if (!re.test(email))
  {
    alert('E-mailová adresa je ve špatném formátu.');
	document.forgot_pass_form.forgot_pass_mail.value="";
  }
}
	
	
// Aktivace, deaktivace způsobu platby
    function checkpayment()
    {
    ((document.getElementById("payment_hotove").disabled) = (document.getElementById("transport_prepravni_sluzba").checked));
    ((document.getElementById("payment_dobirka").disabled) = (document.getElementById("transport_osobni_odber").checked));
    }
	
	
// Popis objektu
function movein(which,html){
which.style.background='#B0B0B0'; //D0D0D0
description.innerHTML=html;
}

function moveout(which){
which.style.background='#F0F0F0';
description.innerHTML='&nbsp;';
}


// Detail obrázku
function DetailWindow(theURL,winName,features) 
{
  newWindow =window.open(theURL,winName,features);    
  //newWindow.moveTo(x,y);
  //newWindow.resizeTo((x),(y));
  newWindow.focus();
}  
	
//Potvrzení pro vymazání 
var confirmMsg  = 'Skutečně chcete'; //Opravdu si přejete
function confirmLink(theLink, theSqlQuery)
{
    // Confirmation is not required in the configuration file
    if (confirmMsg == '') {
        return true;
    }

    var is_confirmed = confirm(confirmMsg + ' ' + theSqlQuery);
    if (is_confirmed) {
        theLink.href += '&is_js_confirmed=1';
    }

    return is_confirmed;
} // end of the 'confirmLink()' function  


//Potvrzení pro vymazání 
var confirmMsg  = 'Skutečně chcete'; //Opravdu si přejete
function confirmForm(theForm, theSqlQuery)
{
    // Confirmation is not required in the configuration file
    if (confirmMsg == '') {
        return true;
    }

    var is_confirmed = confirm(confirmMsg + ' ' + theSqlQuery);
    if (is_confirmed) {
        document.formular.action += '&is_js_confirmed=1';
    } else {
	return false;
    }
        return is_confirmed;
} // end of the 'confirmForm()' function  


function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) {
        if (theAction == 'out') {
            newColor = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor = (thePointerColor != '')
                     ? thePointerColor
                     : theDefaultColor;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function


// eForm - Stormware
var eFormWnd = null;
function eFormClose() // po 1 sec. se nové okno zavře
{
	if (eFormWnd)
		eFormWnd.close();
}

function eFormImport()
{
	var sURL = new String();
	sURL = "" + document.URL;

	// nesmí být z internetu
	idx = sURL.indexOf("http://");
	if (idx == 0)
	{
		alert("Pred importem uložte soubor na disk.");
		return;
	}

	var sFile, sSpace;
	var sAppName = navigator.appName;
	var sAgent = navigator.userAgent;

	//Mozilla, NN
	if(sAppName == "Netscape")
	{
		sFile = "file:///";
	}
	else if(sAppName == "Microsoft Internet Explorer")
	{
		sFile = "file://";
	}
	else
	{
		alert("Import z Vašeho prohlížeče není podporován.");
	}

	// odríznutí protokolu file:
	idx = sURL.indexOf(sFile);
	if (idx == 0)
		sURL = sURL.substr(sFile.length);

	// prekódování mezer URL
	sSpace = "%20";
	var aURL = sURL.split(sSpace);
	sURL = aURL.join(" ");

	// otevrení tohoto HTML souboru protokolem eform:
	eFormWnd = window.open("eform:" + sURL);
	window.setTimeout("eFormClose()", 1000);
}

