function showBox(id) {
  
  /*document.getElementById(id).style.height='290px';
  document.getElementById(id).style.backgroundImage="url('img/11/box_1.png')";
  document.getElementById(id).style.position='absolute';*/
  //var x=0;
  //if (x==0){
  var bg=id.substring(0,5);
  var design=id.substring(12,14);
  var aktual=parseInt(id.substring(4,5));
  
  var okraj=243;//*aktual;
  var posun=243*(aktual-1);
  var next=aktual+1;
  
  //x=1;
  //document.write(left);
  document.getElementById(id).style.position='static';
  document.getElementById('podbox_'+aktual+'_small_'+design).style.position='absolute';
  
  if (aktual==1){document.getElementById('podbox_'+aktual+'_small_'+design).style.left='10px';}
  if (aktual==2){document.getElementById('podbox_'+aktual+'_small_'+design).style.left='250px';}
  if (aktual==3){document.getElementById('podbox_'+aktual+'_small_'+design).style.left='490px';}
  if (aktual==4){document.getElementById('podbox_'+aktual+'_small_'+design).style.left='730px';}
  //document.getElementById('podbox_'+aktual+'_small_'+design).style.top='absolute';
  
  //document.getElementById(id).style.height='285px';
  
  //document.getElementById(id).style.position='absolute';
  
  //document.getElementById(id).style.background="url('img/"+design+"/"+bg+".png')";
  //document.getElementById(id).style.backgroundColor="#ff0000";
  
  //document.getElementById(id).style.left=posun+'px';
  
  //document.getElementById('podbox_'+aktual+'_small_'+design).style.top='-40px';
  
  
  //document.getElementById('podbox_'+aktual+'_small_'+design).style.left='243px';
  //if(aktual!=4){
  //document.getElementById('box_'+next+'_small_'+design).style.margin='0 3px 0 '+okraj+'px';
  //}


  }

function hideBox(id) {
  var bg=id.substring(0,5);
  var design=id.substring(12,14);
  var aktual=parseInt(id.substring(4,5));
//  var okraj=243*aktual;
  var next=aktual+1;
  document.getElementById('podbox_'+aktual+'_small_'+design).style.position='static';
  
  //document.getElementById(id).style.backgroundImage="url('img/"+design+"/"+bg+"_small.png')";
  document.getElementById(id).style.position='static';
  
  
  
  }
  //document.write("url('img/"+design+"/"+bg+".png')");
  //document.getElementById(id).className='box beshop';
  
  
//}

function viewport() {
var viewportwidth;
 var viewportheight;
  
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
  
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
  
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
 
 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
  
 // older versions of IE
  
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
document.cookie="width="+viewportwidth+";expires=Wed, 11 Jan 2023 22:26:41 UTC";
document.cookie="height="+viewportheight+";expires=Wed, 11 Jan 2023 22:26:41 UTC";
}

function totalbg() {

//rozliseni=viewport().split("x",2);

rozsekaneCookies=document.cookie.split("; ")
poleCookies= new Array;
for(i in rozsekaneCookies){
poleCookies[(rozsekaneCookies[i].split("=")[0])] = rozsekaneCookies[i].split("=")[1];
}

if (poleCookies["width"]){
document.getElementById('totalbg').style.width=poleCookies["width"]+'px'; 
document.getElementById('totalbg').style.height=parseInt(poleCookies["height"])+150+'px';}
else {
viewport();
rozsekaneCookies=document.cookie.split("; ")
poleCookies= new Array;
for(i in rozsekaneCookies){
poleCookies[(rozsekaneCookies[i].split("=")[0])] = rozsekaneCookies[i].split("=")[1];
}
document.getElementById('totalbg').style.width=poleCookies["width"]+'px'; 
document.getElementById('totalbg').style.height=parseInt(poleCookies["height"])+150+'px';
}
//viewport();



//old:
//var sirka=document.body.clientWidth;
//var vyska=window.innerHeight+150;

}


function vypsatHlasku(vypsat,value) {
if (vypsat==true) {
document.getElementById("hlaska").innerHTML="<div class='zavrit'>Kliknutím zavřete</div>"+value;
document.getElementById("hlaska").style.visibility="visible";
setTimeout('document.getElementById("hlaska").style.visibility="hidden"',2500);
}
else {document.getElementById("hlaska").style.visibility="hidden";}
}

function checkPrazdny(value,nazev) {
if (value=="" || value==null || value==undefined || value==false) {return "Pole <b>"+nazev+"</b> nesmí být prázdné!";}
else {return false;}
}

function checkMailNotEmpty(value,nazev) {
var i=0;
var prazdny=checkPrazdny(value,nazev);

if (prazdny!=false) {return prazdny;i++;}
else if (value.indexOf(".")==-1 || value.indexOf("@")==-1) {i++;}
else {var pole=value.split("@");
if (pole[0].length<1 || pole[0].indexOf("@")!=-1) {i++;}
else if (pole[1].indexOf(".")==-1) {i++;}
else if (pole[1].split(".")[1].length<2) {i++;}
}
if (i>0) {return "Pole <b>"+nazev+"</b> musí mít formát e-mailové adresy";}
else {return false;}
}





function handleID(id){
if (document.getElementById(id).style.display=='block'){document.getElementById(id).style.display='none';}
else {document.getElementById(id).style.display='block';}
}

function checkSdilet() {
var i=0;              
var string="<br />";
var check;

check=checkPrazdny(document.getElementById("sdilet_jmeno").value,"jméno");
if (check!=false) {string=string+check+"<br />";i++;}

check=checkMailNotEmpty(document.getElementById("sdilet_from").value,"vaše e-mailová adresa");
if (check!=false) {string=string+check+"<br />";i++;}

check=checkMailNotEmpty(document.getElementById("sdilet_to").value,"e-mailová adresa příjemce");
if (check!=false) {string=string+check+"<br />";i++;}

check=checkPrazdny(document.getElementById("sdilet_vzkaz").value,"vzkaz");
if (check!=false) {string=string+check+"<br />";i++;}

if (i>0) {
vypsatHlasku(true,string);
return false;
}
else {return true;}
}
