// js test
function test()
{
  alert('It works now')
}

// colors
function ov(vt)
{
  document.getElementById(vt).style.backgroundColor='#ffff00';
}
                                                           
function re(vt)
{
  document.getElementById(vt).style.backgroundColor='#eeeeee';
}

// radios
function cbb(idecko){
 el=document.getElementById(idecko); 
 el.checked=(el.checked == true)?false:true;
}


function mwzoom(zp,zt,imw,imh)
      {
      
      MWImage = window.open('','_blank','width='+(imw)+',height='+(imh)+',menu=0,navigate=0,status=0,top='+(screen.height/2-imh/2)+',left='+(screen.width/2-imw/2)+'');

      with (MWImage.document)
      {
      open();
       writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
       writeln('<html>');
       writeln('<head>');
       writeln('<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />');
       writeln('<meta http-equiv="Content-Language" content="cs" /> ');
       writeln('<title>'+zt+'</title>');  
       writeln('<style type="text/css"> ');
       writeln('body {margin-top: 0px;font-family: Verdana, \'Geneva CE\', lucida, sans-serif; margin: 0;padding: 0;color: #333333;background-color : #ffffff;text-align: center;}');
       writeln('h1 {padding:0px;margin:5px;font-weight:bold;font-size:8pt;color:#000000;}');
       writeln('.bt {font-size : 8pt;font-weight: bold;color:#ffffff;border-top: solid 1px #aaaaaa;border-bottom: solid 1px #666666;border-left: solid 1px #aaaaaa;border-right: solid 1px #666666;background: #888888;text-align: center;}');
       writeln('</style>');
       writeln('</head>');
       writeln('<body>');
       writeln('<h1>'+zt+'</h1>');
       writeln('<img src="'+zp+'" alt="" style="cursor:pointer;" title="Kliknutím zavřete okno s obrázkem" onclick="window.close();" />');
       writeln('<p style="text-align:center;">&nbsp;</p>');  
       writeln('</body>\n</html>');
      close();
      }
      MWImage.focus();     
}

function txtzoom(zp,imw,imh)
      {
       MWtext = window.open('_js/djs.php?de='+zp+'','_blank','width='+(imw)+',height='+(imh)+',menu=0,navigate=0,statusbar=0,top='+(screen.height/2-imh/2)+',left='+(screen.width/2-imw/2)+'');
       MWtext.focus();     
      }

function zs(idecko){
		el=document.getElementById(idecko).style; 
		el.display=(el.display == 'block')?'none':'block';
	    }

function val()
{
 
  // Loop from zero to the one minus the number of radio button selections
  for (counter = 0; counter < document.getElementById('objform').doruceni.length; counter++)
      {
      // If a radio button has been selected it will return true
      // (If not it will return false)
        if (document.getElementById('objform').doruceni[counter].checked)
        {
        
        return true
        }
      }
  alert('Chyba, objednávku nelze odeslat!\n\nVyberte způsob doručení a zkuste objednávku odeslat znovu');     
 return false
 
}
 
function getkey(e)
{
  var code;
  if (!e)
    var e = window.event; //  IE
  if (e.keyCode)
    code = e.keyCode; // IE a Gecko
  else
    if (e.which)
      code = e.which; // NN4
  return code;
}

function numeric(eX)
{
   test=getkey(eX);
   cisla = (test<45 || test>57);
   
   delka = document.getElementById('advokat').value.length;  
  
  if(cisla || delka>4)
  {
   return false;
  }

}


function nums()
{
 if (window.RegExp) { 
		re = new RegExp("^[0-9]$"); 
		if (!re.test(document.getElementById("advokat").value)) { 
			alert('Chyba');
      return false; 
		}
  }   
}

function alfanumeric(eX,diacritic)
{
  test=getkey(eX);
  set1=(test>32 && test<48);
  set2=(test>57 && test<65);
  set3=(test>90 && test<97);
  if (diacritic == 1)
    set4=(test>122 && test<127);
  else
    set4=(test>122)
  if (set1 || set2 || set3 || set4)
    return false;
}

function safechars(eX)
{
  test=getkey(eX);
  if (test==34 || test==39)
    return false;
}  
  

