//<script>
//<!--

var fpTextSelect;

function filepick(inputobj, mask, lm) {
  fpTextSelect = inputobj;
  
  FilePickDialog = window.open('../lib/WebFilePick/filepick.asp?mask=' + mask + '&lm=' + lm, 'new_page', 'height=315,resizable=yes,width=500')
  if (FilePickDialog.opener == null) { 
    FilePickDialog.opener = self
  }     
}

function article_open(article_key, height, width) {
  window.open('../public/article.asp?fullscreen=1&key=' + article_key, '', 'height=' + height + ',width=' + width);
}

function sheetAction(strRecordAction, strCopyValue) {
  if (strCopyValue != '') frmSheet.elements(strCopyValue).value = frmSelected.elements(strCopyValue).value;
  frmSheet.RecordAction.value = strRecordAction;
  frmSheet.submit();
}

function Go(sURL){
  window.location.href = sURL;
}

function InvertDisplay(id){
  if (document.all(id).style.display == 'none') {
    document.all(id).style.display='';
  } else {
    document.all(id).style.display='none';
  }
}

function Check_Set(check, value){
  if (check) {
    check.checked = value; // pokud je jen 1 radek
    for (i = 0; i < check.length; i++) 
      check(i).checked = value;
  }
}

function IsValidEmail(email){
  return email.search(/^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$/) == 0;
}

function ErrorAlert(strText) {
  alert(strText);
  return true;
}

function wtcCharCount(string1, string2) {
  intCharCount = 0;
  for (i = 0; i < string1.length; i++) {
    if(string2.indexOf(string1.charAt(i)) > -1)
      intCharCount++;
  }
  return intCharCount;
}

function wtcInStr(string1, string2) {
  blnInStr = true;
  for(i = 0; blnInStr && i < string2.length; i++) {
    blnInStr = false;
    for(j = 0; !blnInStr && j < string1.length; j++) {
      blnInStr = blnInStr || string2.charAt(i) == string1.charAt(j);
    }
  }
  return blnInStr;
}

function wtcRound(numeric_expression, length) {
  tmpNum = Math.round(numeric_expression * 100) / 100;
  tmpStr = '' + tmpNum + '';
  if (tmpStr.indexOf(".", 0) == -1) {
    tmpNum = tmpNum + ".00"
  }
  if (tmpStr.length - (tmpStr.indexOf(".", 0)) == 2) {
    tmpNum = tmpNum + "0"
  }
  return tmpNum;
}

function wtcStringConvert(inputString, convertType){
  var i, inputArray, outputArray, arraySize, inputChar, charPosition, outputString = ''
  switch (convertType) {
    case 'CZ':
      inputArray = 'ÁÄÆÈÏÉÌËÍÅ¼ÑÒÓÖÀØŒŠÚÙÜÝYŽáäæèïéìëíå¾ñòóöàøœšúùüýyŸž';
      outputArray = 'AACCDEEEILLNNOORRSSTUUUYYZZaaccdeeeillnnoorrsstuuuyyzz';
      arraySize = 1;
      break;
    case 'UTF8':
      inputArray = 'ŠŒŽšœžŸ£¥ª¯³¹º¼¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ';
      outputArray = 'Å ÅšÅ¤Å½Å¹Å¡Å›Å¥Å¾ÅºÅÄ„ÅžÅ»Å‚Ä…ÅŸÄ½Ä¾Å¼Å”ÃÃ‚Ä‚Ã„Ä¹Ä†Ã‡ÄŒÃ‰Ä˜Ã‹ÄšÃÃŽÄŽÄÅƒÅ‡Ã“Ã”ÅÃ–Å˜Å®ÃšÅ°ÃœÃÅ¢ÃŸÅ•Ã¡Ã¢ÄƒÃ¤ÄºÄ‡Ã§ÄÃ©Ä™Ã«Ä›Ã­Ã®ÄÄ‘Å„ÅˆÃ³Ã´Å‘Ã¶Å™Å¯ÃºÅ±Ã¼Ã½Å£';
      arraySize = 2;
      break;
  }
  for (i = 0; i < inputString.length; i++) {
    inputChar = inputString.charAt(i);
    charPosition = inputArray.indexOf(inputChar);
    if(charPosition > 0){
      outputString += outputArray.substr(arraySize * charPosition, arraySize);
    } else {
      outputString += inputChar;
    }
  }
  return outputString;
}

function ValidateControl(objControl, strName, strType) {
  var strValue = objControl.value;
  var blnError = false;
  switch (strType) {
    case 'number' :
      if(!(wtcInStr('0123456789', strValue) && wtcCharCount(strValue, ',') <= 1 && wtcCharCount(strValue, '.') <= 1 && (parseInt(strValue) >= 0 && strValue != ''))) {
        blnError = ErrorAlert('Položka mùže obsahovat jen èíslice bez mezer');
      }
      break;
    case 'text' :
      if (strValue.length == 0 || wtcCharCount(strValue, ' ') == strValue.length) {
        blnError = ErrorAlert('Není zadaná položka: ' + strName);
      }
      break;
    case 'email' :
      if (!IsValidEmail(objControl.value)) {
        blnError = ErrorAlert('Chybnì zadaná položka ' + strName);
      }
      break;
  }
  if (blnError) {
    objControl.focus();
    return false;
  } else {
    return true;
  }
}

function ValidateControlSelect(objControl, strName, objItem) {
  if(objControl.selectedIndex < 0) {
    alert('Nebyla vybrána žádná položka v nabídce ' + strName);
    objControl.focus();
    return false;
  }
  if(objItem > -1) {
    if(objItem == objControl.selectedIndex) {
      alert('Nebyla vybrána žádná položka v nabídce ' + strName);
      objControl.focus();
      return false;
    }
  }
  return true;
}

//pridani stranky do oblibenych
function siteToFavorites(){
  if (IE4 && !NS4)
    window.external.AddFavorite("http://www.minolta.cz/","www.minolta.cz");
  else
    alert('Tato služba vyžaduje alespon\n Internet Explorer 5.0');
}

//nastaveni stranky jako homepage
function siteAsHomapage(){
  if (IE4 && !NS4)
    oHomePage.setHomePage('www.minolta.cz');
  else
    alert('Tato služba vyžaduje alespon\n Internet Explorer 5.0');
}

//-->
//</script>
