function MM_jumpMenuRaw(selObj)
 { //v3.0
   eval("this.location='"+selObj.options[selObj.selectedIndex].value+"'");
 }

function doHelp (HelpUrl)
 {
   MM_openBrWindow(HelpUrl,'Help','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600');
 }


function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_changeProp(objName,theProp,theValue) { //v3.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1) ) eval("obj."+theProp+"='"+theValue+"'")
  else if (obj && ( obj.style) ) eval("obj."+theProp+"='"+theValue+"'");
}

function MM_jumpMenu(selObj)
 { //v3.0
   eval("this.location='"+selObj.options[selObj.selectedIndex].value+"'");
 }

function MM_openBrWindow(theURL,winName,features)
 { //v2.0
    window.open(theURL,winName,features);
 }


function doValidate ( )
 {
   return ( 1 );
 }

function doSubmit2 ( act, formname )
 {
   if ( doValidate () )
    {
      MM_changeProp ( 'Act', 'value', act, 'HIDDEN' );
      var F = MM_findObj ( formname );
      F . submit ();
    }
 }
function doSubmit ( act )
 {
   if ( doValidate () )
    {
      MM_changeProp ( 'Act', 'value', act, 'HIDDEN' );
      var F = MM_findObj ( 'form1' );
      F . submit ();
    }
 }

function toSubmit2 ( act, formname )
 {
   if ( doValidate () )
    {
      MM_changeProp ( 'Act', 'value', act, 'HIDDEN' );
      var F = MM_findObj ( formname );
    }
   return ( 1 );
 }
function toSubmit ( act )
 {
   if ( doValidate () )
    {
      MM_changeProp ( 'Act', 'value', act, 'HIDDEN' );
      var F = MM_findObj ( 'form1' );
    }
   return ( 1 );
 }

function GoToUrl(Url)
 { //v3.0
   eval("this.location='"+Url+"'");
 }


var showMode = 'table-cell';
if (document.all) showMode='block';
//if (document.all) showMode='';

function toggleVis(btn, mainform){
  btn   = document.forms[mainform].elements[btn];
  cells = document.getElementsByName('t'+btn.name);
  mode = btn.checked ? showMode : 'none';
  for(j = 0; j < cells.length; j++) cells[j].style.display = mode;
}

function SetVisibility(elements, on){
  cells = document.getElementsByName(elements);
  mode = on ? '' : 'none';
  //alert ( mode );
  for(j = 0; j < cells.length; j++) {
   //alert ('Prev='+cells[j].style.display);
   cells[j].style.display = mode;
  }
}


function ToggleVisibility(elements){
   var cells;
   var j;
   cells = document.getElementsByName(elements);

   //alert ( mode );
   for(j = 0; j < cells.length; j++) {
    //alert ('Prev='+cells[j].style.display);
    mode = cells[j].style.display=='none' ? '' : 'none';
    cells[j].style.display = mode;
   }
   //document.getElementsByName('VIS_'+lng)[0].value = val;
   return ( mode );
}

function checkp(f) {
  if(f.From.value=="") {
       alert('Prosím, zadejte e-mail');
       return false;
  }
  f.submit();
}

function isNumeric(val){return(parseFloat(val,10)==(val*1));}

function checkobj(f) {
  if(f.Jmeno.value=="") {
       alert('Prosím, zadejte jméno');
       f.Jmeno.focus();
       return false;
  }
  if(f.Email.value=="") {
       alert('Prosím, zadejte e-mail');
       f.Email.focus();
       return false;
  }
  if(!isNumeric(f.Delka.value)) {
       alert('Prosím, zadejte délku videa');
       f.Delka.focus();
       return false;
  }
  f.submit();
}

function zpracuj(f) {
  f.To.value = 'jfk';
  f.To.value += '@' ;
  f.To.value += 'ehosting.cz' ;
}


function MakeKbit(f) {
  f.KBIT.value=parseInt(1*f.MB.value*1024/(1*f.M.value*60+1*f.S.value)*8);
}

function MakeMB(f) {
  f.MB.value=parseInt(1*f.KBIT.value/8*(1*f.M.value*60+1*f.S.value)/1024);
}

function MakeMS(f) {
  sec=1*f.MB.value*1024*8/(1*f.KBIT.value);
  f.M.value=parseInt(sec/60);
  f.S.value=parseInt(sec%60);
}




function mkcore(jmeno, domena, tld){
  var ret=jmeno;
  ret += String.fromCharCode(63+1);
  if(typeof(domena)=="undefined") ret += 'dvideo.cz';
  else if(typeof(tld)=="undefined") ret += domena+'.cz';
  else ret += domena+'.'+tld;
  return (ret);
}

function mke(jmeno, domena, tld) {
  document.write(mkcore(jmeno, domena, tld));
}

function mkm(jmeno, domena, tld) {
  document.write('mai');
  document.write('lto'+String.fromCharCode(58));
  mke(jmeno, domena, tld);
}

function gom(jmeno, domena, tld) {
  var dst='mai';
  dst += 'lto'+String.fromCharCode(58);
  dst += mkcore(jmeno,domena,tld);
  window.open(dst);
}

function mkhref(jmeno, domena, tld, atr) {
  document.write('<a href="javascript:gom(\''+jmeno+'\'');
  if(typeof(domena)!="undefined") {
   document.write(', \''+domena+'\'');
   if(typeof(tld)!="undefined") document.write(', \''+tld+'\'');
  }
  document.write(')"');
  if(typeof(atr)!="undefined") document.write(' '+atr);
  document.write('>');
  document.write(mkcore(jmeno, domena, tld));
  document.write('</a>');
}

function mk_form_to (form_name, jmeno)
 {
   var F = MM_findObj ( form_name );

   F.To.value=mkcore(jmeno);
 }





function rowOverNew(row, color)
{
  if (typeof(color)=='undefined') color='#FFDDAA';
  row.style.backgroundColor=color;
}

function rowOutNew(row)
{
    row.style.backgroundColor='';
}

function rowClick(id)
{
top.horni.location.href = id ;

}


function popupwin(name,height,width){
 win = window.open(name,'popup','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,height=' +height+ ',width=' + width);
}
function popupwinid(name,id,height,width){
 win = window.open(name,id,'toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,height=' +height+ ',width=' + width);
}


function deleteConfirmPopup(adr, height, width) {
 var confDel = adr;
 confDel= confirm('|DeleteConfirmTx|');

 if (confDel== true) popupwin (adr, height, width);
}

function ReloadMain() {
   window.opener.location.reload();
}

function RefreshMain( RefreshUrl ) {
   window.opener.location=RefreshUrl;

}
function CloseThis() {
   window.close();
}

function AdjustVisData(prefix, lng) {
   // if ( document.getElementById(prefix+lng).style.display == '' ) val='1'; else val='';
   // document.getElementById('VIS_'+lng).value = val;
   if ( document.getElementsByName(prefix+lng)[0].style.display == '' ) val='1'; else val='';
   document.getElementsByName('VIS_'+lng)[0].value = val;

}

function ToggleAllLangVisibility( formname, lg ){
   var cells = document.forms[formname].elements;
   ted='';
   for(j2 = 0; j2 < cells.length; j2++) {
     n = cells[j2].name;
     if ( n ) {
       if ( n.substring(0,2) == 'T_' && n.substring(n.length-3) == '_' + lg ) {
         ted = ToggleVisibility( n );
       }
     }
   }
   if ( ted == '' ) val='1'; else val='';
   document.getElementsByName('VIS_'+lg)[0].value = val;
}


function WorkingBox( txt ) {
   document.getElementById('workingbox').innerHTML = txt;
   document.getElementById('workingbox').style.display = '';
}


function NewSetLangVisibility( formname, lg, on ){
   var cells = document.forms[formname].elements;
   for(j2 = 0; j2 < cells.length; j2++) {
     n = cells[j2].name;
     if ( n ) {
       if ( n.substring(0,2) == 'T_' && n.substring(n.length-3) == '_' + lg ) {
         SetVisibility( n, on );
       }
     }
   }
}
function NewSetAllLangVisibility( formname, on ){
   var cells = document.forms[formname].elements;
   for(j2 = 0; j2 < cells.length; j2++) {
     n = cells[j2].name;
     if ( n ) {
       if ( n.substring(0,2) == 'T_' && n.substring(n.length-3,1).substring(0,1) == '_' ) {
         SetVisibility( n, on );
       }
     }
   }
}


function ShowNextLg() {
   NewSetAllLangVisibility( 'form1', false );
   VisibleLang = (VisibleLang+1)%Langs.length;
   NewSetLangVisibility( 'form1', Langs[VisibleLang], true );
   /*

   for (var i=0; i<Langs.length; i++) {
     //NewSetLangVisibility( 'form1', Langs[i], false );
     alert( Langs[i] );
     //NewSetLangVisibility( 'form1', Langs[i], true );
   }
   NewSetAllLangVisibility( 'form1', true );
   */
}


function ToggleVisibilityById( idelement ) {
   x=document.getElementById(idelement);
   if ( x ) {
    if ( x.style.display == 'none' ) x.style.display = '';
    else x.style.display = 'none';
   }
}


//nepouziva se, misto toho se vola primo ToggleVisibility
function HlpTglVisibility( formname ){
   var cells = document.forms[formname].elements;
   for(j2 = 0; j2 < cells.length; j2++) {
     n = cells[j2].name;
     if ( n ) {
       if ( n.substring(0,4) == 'HLP_' ) {
         ToggleVisibility( n );
       }
     }
   }
}


