  var hilitedNovePodaniImg = new Image(); 
  var hilitedStavPodaniImg = new Image();
  var hilitedUvodniStranaImg = new Image();
	
  hilitedNovePodaniImg.src = "/images/main_menu_img_1.gif";
  hilitedStavPodaniImg.src = "/images/main_menu_img_1.gif";
  hilitedUvodniStranaImg.src = "/images/main_menu_img_1.gif";
 
  function DetectBrowser() {
    var isIE = "0";
    
	if(navigator.appVersion.indexOf("MSIE") != -1) { 
       isIE = "1";
    }
    
    try { // m_oErrMessageClientId existuje jen v podani, proto sekce try
        var textboxTypeBrowser = document.getElementById(m_oTypeBrowserClientId);
        textboxTypeBrowser.value = isIE;
    } catch(e) {
    
    }
  }
  function ChangeLinkImage(imageId, spanId) {
    var l_oLinkImg = document.getElementById(imageId);
    var l_oLinkSpan = document.getElementById(spanId);
    var aPath = l_oLinkImg.src;
    var pomString = aPath.substring(aPath.length - 6,aPath.length);
         
    if(pomString == "_2.gif") {
        aPath = aPath.substring(0,aPath.length - 6) + "_1.gif";
        l_oLinkImg.src = aPath;
        l_oLinkSpan.className = "ftMainMenuSpan";
    } else {
        pomString = l_oLinkImg.src.substring(0,aPath.length - 6);
        pomString = pomString + "_2.gif";
        l_oLinkImg.src = pomString;
        l_oLinkSpan.className = "ftMainMenuSpanHover";
    }
  }
  function showForms() {
    newWin=window.open("","oknoForms","resizable,scrollbars,width=365,height=411");
  }
  function SetFocus() {
	var oForm = document.getElementById("form1");

	for(var i = 0; i < oForm.elements.length; i++) {
	    var oEl = oForm.elements[i];
	    if(oEl.tagName == "INPUT") {
		    if (oEl.type == "text") {
			    oEl.focus();
			    oEl.select();
			    break;
		    }
	    } else if (oEl.tagName == "SELECT") {
		    oEl.focus();
		    break;
	    } else if (oEl.tagName == "TEXTAREA") {
		    oEl.focus();
		    break;
	    }
	}
  }
  function setStatus(aString) {
    window.status = aString;
    return true;
  }
  function CheckText(datain){
    var data = datain
    if(data==""){
      alert(m_sNoDataErrText); //alert("No data available")
      return false
    }
    if(data.length > 7000){
      alert(m_sTooMuchDataErrText); //alert("Too much data (max. ~ 7 kb)");
      return false
    }

    return true
  }
  function AskForUpload() {
    var sFile = document.getElementById("m_oPodaniPage_m_oPrilohyFileUpload").value;
		if (sFile != "") {
			event.returnValue = false;
			m_sPridatSouborRequest = xreplace(m_sPridatSouborRequest,"xxxxx",sFile);
			var b = window.confirm(m_sPridatSouborRequest);
			if (b) {
				document.getElementById("m_oPodaniPage_m_oUlozitButton").click();
			}
		} 
	}
	function ShowPrintView() {
	  newWin = window.open('','printPreview','resizeable,scrollbars,menubar,width=770,height=580');
	}

  function xreplace(checkMe,toberep,repwith){
    var temp = checkMe;
    var i = temp.indexOf(toberep);
    
    while(i > -1){
        temp = temp.replace(toberep, repwith);    
        i = temp.indexOf(toberep, i + repwith.length + 1);
    }
    return temp;
  }

function PodaniClick() {
	var button = document.getElementById("m_oPodaniButton");
	button.click();	
}
function StavPodaniClick() {
	var button = document.getElementById("m_oStavPodaniButton");
	button.click();	
}
function MainPageClick() {
	var button = document.getElementById("m_oMainPageButton");
	button.click();	
}
function EmailListClick() {
	var button = document.getElementById("m_oEmailListButton");
	button.click();	
}
function PrilohyCheck(ConfirmText) {
	var sFile = document.getElementById(m_oPrilohyFileUploadClientId).value;
  if(sFile != "") {
    event.returnValue = false;
    if(window.confirm(ConfirmText)) {
      document.getElementById(m_oUlozitButtonClientId).click();
    }
  }
}
function CustomValidatorIxs_ClientValidate(source, args) {
	args.IsValid = (args.Value.length == 12);
}
function showErrMessage() {
	var ErrMessageTextBox;

	try { // m_oErrMessageClientId existuje jen v podani, proto sekce try
	    ErrMessageTextBox = document.getElementById(m_oErrMessageClientId);
	} catch(e) {
	}
	
	if(ErrMessageTextBox != null) {
	    var ErrMessage = ErrMessageTextBox.value;
	    if(ErrMessage != "") {
	        alert(ErrMessage);
	        ErrMessageTextBox.value = "";
	    }
	}
}
function _axPoe()
{ 
    var l_oAx = document.getElementById(_g_obj_el_name);
    return l_oAx;
}
function _axPoe_detect()
{
    try {
        return _axPoe().Hello(42) == 'Hello42';
    }
    catch(e) {
        return false;
    }
}
function TestAxEnabled() {
    var IsAxEnabled = _axPoe_detect();
    if(IsAxEnabled == false) {
        // pokud se nepodari inicializace appletu, zakazu tlacitko Podepsat a oznamim to uzivateli
        var SignButton = document.getElementById(m_oSignButtonClientId);
        SignButton.disabled = "disabled";
        alert(m_sNeuspechInicAxText);
    }
}
function ax_crypto_signStringPoe(text)
{
    try {
        // u appletu predelam jednoduche entery na dvojte
        text = text.replace(/\r/g,"");
        text = text.replace(/\n/g,"\r\n");
        return _axPoe().crypto_signString(text);
    }
    catch(e) {
        window.alert("ax_crypto_signString1 error: " + e.message);
        throw  e;
    }
}
function PodepsatPodani() {
    var SignedText = document.getElementById(m_oSignedTextClientId);
       
    if(SignAll == 1) {
        // novy zpusob - podepisu cely mail
        _ax = _axPoe; // prepisu alikovo ax svym ax
        var aUrl = "WS/WSPrepareEmail.aspx";
        ax_file_saveFromASPXWS(aUrl,OnSucceeded, OnFailed); // ulozeni pripraveneho emailu do souboru 
    } else {
        // stary zpusob - podepisu jen sourn podani
        if(navigator.appName == 'Microsoft Internet Explorer') {
            // vyvolam vbs skript kliknutim na skryte tlacitko
            document.getElementById(m_oSignIEButtonClientId).click();
        } else {
            var SouhrnPodani = document.getElementById(m_oSouhrnPodaniClientId); 
            // provedu podepsani AX appletem
            SignedText.value = ax_crypto_signStringPoe(SouhrnPodani.value);
        }

        if(SignedText.value != "") {
            // odeslu podani
            alert(m_sFormularPodepsanText + " " + m_sOdeslaniPodaniText);
            document.getElementById(m_oSendMailButtonClientId).click();
        }
    }
}
function OnSucceeded(result, userContext, methodName) {
    var filename = result;
    // podepsani souboru
    try {
        var podpis = document.getElementById(m_oSignedTextClientId);
        podpis.value = ax_crypto_sign(filename);
		}	finally {
				ax_file_deleteTemp(filename);
		}

    alert(m_sFormularPodepsanText + " " + m_sOdeslaniPodaniText);
    document.getElementById(m_oSendMailButtonClientId).click();
}
function OnFailed() {
    
}
















