function zacitNahravani(form){
 var navrat = true;
    if (form.soubor.value == '') {
        form.soubor.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.soubor.style.background = '#FFFFFF'; 
     document.getElementById('progress_bar').innerHTML = "<img src='/images/loading.gif'>";  
    }
       return navrat;  
}  
function konecNahravani(stav, dir){  
   if (stav == 1){  
     document.getElementById('progress_bar').innerHTML = "<div style='background-color: Green; padding: 5px; margin-bottom: 5px; color: White'>Nahravani probehlo uspesne...</div>";  
     document.getElementById('soubory').value = '';  
   } 
   if (stav == 2) {  
     document.getElementById('progress_bar').innerHTML = "<div style='background-color: Red; padding: 5px; margin-bottom: 5px; color: White'>Spatny typ souboru, podporovany pouze JPEG,JPG,GIF,BMP</div>";  
   } 
   if (stav !=1 && stav!=2){  
     document.getElementById('progress_bar').innerHTML = "<div style='background-color: Red; padding: 5px; margin-bottom: 5px; color: White'>Pri nahravani doslo k chybe...</div>";  
   }
   if (dir == 2){
     document.getElementById('druhyform').innerHTML ="<span style='background-color: Gray; font-size: 15px; padding: 5px; color: White;'>&nbsp;KROK 1: VYBER FOTEK&nbsp;</span>&nbsp;<a href='/vlastni-motivy/kalendar/&step=2' style='background-color: #FF6600; font-size: 15px; padding: 5px; color: White;'>&nbsp;KROK 2: Vyber typu kalendare a dokonceni objednavky&gt;&nbsp;</a>";   
     document.getElementById('tretiform').innerHTML ="<input type='submit' value='Pridat do kosiku' name='add_custom' /><input type='submit' value='Objednat' name='send_custom' />";   
   }
   stranka="/calendar.php";
   ajax(stranka,"nahrany");  
   return true;     
}
  
function zobrazit(co)
{
  var obr = document.getElementById(co), krok = 0.05, o = krok;
  for(var i = krok; i <= 1; i += krok)
  {
    setTimeout(krokAnimace, i * 400);
  }
  function krokAnimace()
  {
    var of = Math.round((o) * 100);
    obr.style.cssText = "opacity: " + o + "; filter: alpha(opacity=" + of + "); -moz-opacity: " + o + "; -khtml-opacity: " + o + "; ";
    o += krok;
  }
}

function DeleteStuff(cesta, presmerovani)  {
  smazat = window.confirm("Opravdu chcete smazat tuto polozku "+cesta+"?");
  if (smazat)
  {
     location.href=presmerovani;
  }
}

function CheckShirt(form) {
 var navrat = true;
    if (form.velikost.value == '') {
        form.velikost.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.velikost.style.background = '#FFFFFF';
    }
    if (form.vystrih.value == '') {
        form.vystrih.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.vystrih.style.background = '#FFFFFF';
    }
    if (form.gramaz.value == '') {
        form.gramaz.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.gramaz.style.background = '#FFFFFF';
    }
    if (form.soubor.value == '') {
        form.soubor.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.soubor.style.background = '#FFFFFF';
    }
    if (form.format.value == '') {
        form.format.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.format.style.background = '#FFFFFF';
    }
    if (form.umisteni.value == '') {
        form.umisteni.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.umisteni.style.background = '#FFFFFF';
    }
    if (form.pocet_kusu.value == '') {
        form.pocet_kusu.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.pocet_kusu.style.background = '#FFFFFF';
    }
  if (navrat==false){document.getElementById("vyplnto").style.display = 'block';}
  else{document.getElementById("vyplnto").style.display = 'none';}

    return navrat;
 }
function CheckCalendar(form) {
 var navrat = true;
    if (form.format.value == '') {
        form.format.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.format.style.background = '#FFFFFF';
    }
    if (form.pocet_kusu.value == '') {
        form.pocet_kusu.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.pocet_kusu.style.background = '#FFFFFF';
    }
  if (navrat==false){document.getElementById("vyplnto").style.display = 'block';}
  else{document.getElementById("vyplnto").style.display = 'none';}
    return navrat;
 } 
function CheckPad(form) {
 var navrat = true;
    if (form.soubor.value == '') {
        form.soubor.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.soubor.style.background = '#FFFFFF';
    }
    if (form.format.value == '') {
        form.format.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.format.style.background = '#FFFFFF';
    }
    if (form.pocet_kusu.value == '') {
        form.pocet_kusu.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.pocet_kusu.style.background = '#FFFFFF';
    }
  if (navrat==false){document.getElementById("vyplnto").style.display = 'block';}
  else{document.getElementById("vyplnto").style.display = 'none';}

    return navrat;
 }
function CheckBag(form) {
 var navrat = true;
    if (form.soubor.value == '') {
        form.soubor.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.soubor.style.background = '#FFFFFF';
    }
    if (form.pocet_kusu.value == '') {
        form.pocet_kusu.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.pocet_kusu.style.background = '#FFFFFF';
    }
  if (navrat==false){document.getElementById("vyplnto").style.display = 'block';}
  else{document.getElementById("vyplnto").style.display = 'none';}
    return navrat;
 } 
function CheckCup(form) {
 var navrat = true;
    if (form.soubor.value == '') {
        form.soubor.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.soubor.style.background = '#FFFFFF';
    }
    if (form.umisteni.value == '') {
        form.umisteni.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.umisteni.style.background = '#FFFFFF';
    }
  if (navrat==false){document.getElementById("vyplnto").style.display = 'block';}
  else{document.getElementById("vyplnto").style.display = 'none';}
    if (form.hrnek_klasicky.value == '' && form.hrnek_matovy.value == '' && form.hrnek_ciry.value == '' && form.korbel_tretinka.value == '' && form.korbel_pullitr_zlate_prouzky.value == '' && form.korbel_pullitr_modry_dekor.value == '' && form.hrnek_svlekaci.value == '') {
        document.getElementById("vyplnto2").style.display = 'block';
        navrat = false;
    } else {
        document.getElementById("vyplnto2").style.display = 'none';
    }
    return navrat;
 }
 
 function CheckUser(reform) {
 var form=document.poster;
 var navrat = true;
    if (form.jmeno.value == '') {
        form.jmeno.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.jmeno.style.background = '#FFFFFF';
    }
    if (form.prijmeni.value == '') {
        form.prijmeni.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.prijmeni.style.background = '#FFFFFF';
    }
    if (form.ulice.value == '') {
        form.ulice.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.ulice.style.background = '#FFFFFF';
    }
    if (form.mesto.value == '') {
        form.mesto.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.mesto.style.background = '#FFFFFF';
    }
    if (form.psc.value == '') {
        form.psc.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.psc.style.background = '#FFFFFF';
    }
    if (form.tel.value == '') {
        form.tel.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.tel.style.background = '#FFFFFF';
    }
    if (form.mail.value == '') {
        form.mail.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.mail.style.background = '#FFFFFF';
    }
    return navrat;
 }

 function CheckObch(form) {
 var navrat = true;

    if (form.nadpis.value == '') {
        form.nadpis.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.nadpis.style.background = '#FFFFFF';
    }
    if (form.kraj.value == '') {
        form.kraj.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.kraj.style.background = '#FFFFFF';
    }
    if (form.mesto.value == '') {
        form.mesto.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.mesto.style.background = '#FFFFFF';
    }
    if (form.ulice.value == '') {
        form.ulice.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.ulice.style.background = '#FFFFFF';
    }
    if (form.psc.value == '') {
        form.psc.style.background = '#d1a3a3';
        navrat = false;
    } else {
        form.psc.style.background = '#FFFFFF';
    }
    if (navrat == false) {
    if (document.getElementById){
    document.getElementById('upozorneni').style.display = 'block';
    }}
    return navrat;
 }

function Jump(theSelect){
    selindex = theSelect.selectedIndex
    selvalue = theSelect.options[selindex].value
    window.location.href = selvalue
}
var barvatrika = 1;
function CountPrizeShirt(){
var spoctito="";
var gramaz=0;
var format="";
var druh="";
var text="";
var kusy="";
var spocti="";
var spoctito="";
var selindex = document.getElementById("gramaz").selectedIndex;
    if (selindex == 1) {gramaz=75;}
    if (selindex == 2) {gramaz=85;}
var formatindex = document.getElementById("format").selectedIndex;
    if (barvatrika==2 && formatindex == 1) {format=85;}
    if (barvatrika==2 && formatindex == 2) {format=170;}
    if (barvatrika==1 && formatindex == 1) {format=150;}
    if (barvatrika==1 && formatindex == 2) {format=300;}
var textindex = document.getElementById("text").value;
    if (textindex != "") {text=50;}
var kusindex = document.getElementById("kusy").value;
    if (kusindex != "") {kusy=kusindex;} else {kusy=1;}
    spocti=kusy*(gramaz+format+text);
    spoctito=spocti+" k&#269;";
    document.getElementById("cenovka").value=spocti;
return document.getElementById("cena").innerHTML=spoctito;
}
function ChangeColorShirt(barvaindex){
    if (barvaindex == 1) {
    document.getElementById("triko_barva").innerHTML="<img src='/design/triko_cerne.jpg' />";
    barvatrika=1;}
    if (barvaindex == 2) {
    document.getElementById("triko_barva").innerHTML="<img src='/design/triko_bile.jpg' />"; 
    barvatrika=2;}
    if (barvaindex == 3) {document.getElementById("triko_barva").innerHTML="<img src='/design/triko_royal.jpg' />"; barvatrika=1;}
    if (barvaindex == 4) {document.getElementById("triko_barva").innerHTML="<img src='/design/triko_sky.jpg' />"; barvatrika=1;}
    if (barvaindex == 5) {document.getElementById("triko_barva").innerHTML="<img src='/design/triko_cervene.jpg' />"; barvatrika=1;}
    if (barvaindex == 6) {document.getElementById("triko_barva").innerHTML="<img src='/design/triko_oranzove.jpg' />"; barvatrika=1;}
    if (barvaindex == 7) {document.getElementById("triko_barva").innerHTML="<img src='/design/triko_zlute.jpg' />"; barvatrika=1;}
    if (barvaindex == 8) {document.getElementById("triko_barva").innerHTML="<img src='/design/triko_bezove.jpg' />"; barvatrika=1;}
    if (barvaindex == 9) {document.getElementById("triko_barva").innerHTML="<img src='/design/triko_zelene.jpg' />"; barvatrika=1;}
    if (barvaindex == 10) {document.getElementById("triko_barva").innerHTML="<img src='/design/triko_zelene_tmave.jpg' />"; barvatrika=1;}
    if (barvaindex == 11) {document.getElementById("triko_barva").innerHTML="<img src='/design/triko_fialove.jpg' />"; barvatrika=1;}
return CountPrizeShirt();
}
function CountPrizePad(){
var spoctito="";
var format="";
var kusy="";
var spocti="";
var spoctito="";
var formatindex = document.getElementById("format").selectedIndex;
    if (formatindex == 1) {format=176;}
    if (formatindex == 2) {format=250;}
var kusindex = document.getElementById("kusy").value;
    if (kusindex != "") {kusy=kusindex;} else {kusy=1;}
    spocti=kusy*format;
    spoctito=spocti+" k&#269;";
    document.getElementById("cenovka").value=spocti;
return document.getElementById("cena").innerHTML=spoctito;
}
function CountPrizeBag(toto){
var spoctito="";
var format="";
var kusy="";
var spocti="";
var spoctito="";
var formatindex = document.getElementById("format").selectedIndex;
    if (toto == 1) {
    format=156;
    document.getElementById("triko_barva").innerHTML="<img src='/design/taska_bila.jpg' />";}
    if (toto == 2) {
    format=156;
    document.getElementById("triko_barva").innerHTML="<img src='/design/taska_zluta.jpg' />";}
    if (toto == 3) {
    format=156;
    document.getElementById("triko_barva").innerHTML="<img src='/design/taska_modra.jpg' />";}
    if (toto == 4) {
    format=156;
    document.getElementById("triko_barva").innerHTML="<img src='/design/taska_cervena.jpg' />";}
    if (toto == 5) {
    format=156;
    document.getElementById("triko_barva").innerHTML="<img src='/design/taska_naturalni.jpg' />";}
var kusindex = document.getElementById("kusy").value;
    if (kusindex != "") {kusy=kusindex;} else {kusy=1;}
    spocti=kusy*format;
    spoctito=spocti+" k&#269;";
    document.getElementById("cenovka").value=spocti;
return document.getElementById("cena").innerHTML=spoctito;
}
function CountPrizePuzzle(){
var spoctito="";
var format="";
var kusy="";
var spocti="";
var spoctito="";
var formatindex = document.getElementById("format").selectedIndex;
    if (formatindex == 1) {format=126;}
    if (formatindex == 2) {format=176;}
    if (formatindex == 3) {format=246;}
var kusindex = document.getElementById("kusy").value;
    if (kusindex != "") {kusy=kusindex;} else {kusy=1;}
    spocti=kusy*format;
    spoctito=spocti+" k&#269;";
    document.getElementById("cenovka").value=spocti;
return document.getElementById("cena").innerHTML=spoctito;
}
function CountPrizeCalendar(){
var spoctito="";
var format="";
var kusy="";
var spocti="";
var spoctito="";
var formatindex = document.getElementById("format").selectedIndex;
    if (formatindex == 1) {format=296;}
    if (formatindex == 2) {format=446;}
var kusindex = document.getElementById("kusy").value;
    if (kusindex != "") {kusy=kusindex;} else {kusy=1;}
    spocti=kusy*format;
    spoctito=spocti+" k&#269;";
    document.getElementById("cenovka").value=spocti;
return document.getElementById("cena").innerHTML=spoctito;
}
function CountPrizePolstar(){
var spoctito="";
var format="";
var kusy="";
var spocti="";
var spoctito="";
var formatindex = document.getElementById("format").selectedIndex;
    if (formatindex == 1) {format=246;}
    if (formatindex == 2) {format=246;}
var kusindex = document.getElementById("kusy").value;
    if (kusindex != "") {kusy=kusindex;} else {kusy=1;}
    spocti=kusy*format;
    spoctito=spocti+" k&#269;";
    document.getElementById("cenovka").value=spocti;
return document.getElementById("cena").innerHTML=spoctito;
}
function CountPrizeCup(){
var jedna=0;
var dva=0;
var tri=0;
var ctyri=0;
var pet=0;
var sest=0;
var sedm=0;
var spocti="";
var spoctito="";
var jedna = document.getElementById("1").value;
var dva = document.getElementById("2").value;
var tri = document.getElementById("3").value;
var ctyri = document.getElementById("4").value;
var pet = document.getElementById("5").value;
var sest = document.getElementById("6").value;
var sedm = document.getElementById("7").value;

    spocti=jedna*176+dva*246+tri*246+ctyri*400+pet*450+sest*450+sedm*296 ;
    spoctito=spocti+" k&#269;";
    document.getElementById("cenovka").value=spocti;
return document.getElementById("cena").innerHTML=spoctito;
}

var coukazat2 = "ano";
function ukaz2(cochci2){
if (document.getElementById){
    if(coukazat2=="ano"){
    document.getElementById(cochci2).style.display = "block"; // skryje předchozí polozku
    coukazat2 = cochci2;
    document.getElementById('minise').focus();
    }
    else {
    document.getElementById(cochci2).style.display = "none"; // skryje předchozí polozku
    coukazat2 = "ano";    
    }
    }
    return false;
}
function closethis(todle){
if (document.getElementById){
    document.getElementById(todle).style.display = "none";
    }
}
function pohled(tohle, zastohle, kam, sirka){
if(sirka){dodatekk="width='" + sirka + "'";}
else { dodatekk="";}
if (document.getElementById){
        document.getElementById(kam).innerHTML = "<a href='" + tohle +"' rel='lightbox[backsmall]'><img src='" + zastohle + "' " + dodatekk + " id='nahled'></a>";
        
return zobrazit(kam);    }
}

          var zobrazena = "prvni"; // pomocna promenna, na zacatku nastavena na jmeno zobrazene polozky
          function zobraz(polozka){
               if (document.getElementById){
                    document.getElementById(zobrazena).style.display = "none"; // skryje předchozí polozku
                    document.getElementById(polozka).style.display = "block"; // zobrazi se nakliknuta polozka
                    zobrazena = polozka; // aktualne zobrazena polozka se ulozi do globalni promenne, aby se pozdeji dala skryt
                    return false; // odkaz neproklikne na href
               }
               else {
                    if(document.stylesheets) document.stylesheets["zalozky"].disabled = true; // v nekterych browserech (IE 4) vypne styl nezobrazovani, aby se polozky alespon zobrazily
                    return true; // odkazy budou proklikavat na href
               } 
          }

function ajax(stranka, kam)
{
    var httpRequest;  
    if(typeof window.ActiveXObject != 'undefined')
    {httpRequest = new ActiveXObject("Microsoft.XMLHTTP");}
    else
    {httpRequest = new XMLHttpRequest();}
    httpRequest.open("GET", stranka, true);
    httpRequest.onreadystatechange= function () 
    {processRequest(httpRequest, kam)};
    httpRequest.send(null);
}
function processRequest(httpRequest, kam) 
{    if (httpRequest.readyState == 4)
    {   if(httpRequest.status == 200)
        {
            if (typeof kam == 'string') 
            {document.getElementById(kam).innerHTML = httpRequest.responseText;}
            if (typeof kam == 'function') 
            {kam(httpRequest.responseText);}
        }else{
            alert("Chyba pri nacitani stanky " + httpRequest.status +" : "+ httpRequest.statusText);}
            }else{
            if (typeof kam == 'string' && kam != '') 
              {document.getElementById(kam).innerHTML = "<img src='/image/loading.gif' />";}}
} 

var funkcni="ano";          
var timerID = null;

function stillCard(){
clearTimeout(timerID); 
}
function showCard(){
clearTimeout(timerID); 
    var karta="/card.php";
    var divuj="card";
    document.getElementById("card").style.visibility = "hidden";
    if(funkcni=="ano"){
        ajax(karta,divuj);
        funkcni="ne";
    }
        zobrazit(divuj);
}
function hideCard(){
var skryt;
timerID=setTimeout("document.getElementById('card').style.visibility = 'hidden'", 1000);
}





