if (top.length != self.length) top.location.href = self.location.href;
if (!document.getElementById && document.all) document.getElementById = document.all;



var jeVidet = false;
var jeVidet2 = false;

// IE je prase!!
function prm(d,e,f,g)
{
document.getElementById(d).style.display = 'block';
document.getElementById(e).style.display = 'none';	
document.getElementById(f).style.display = 'none';
document.getElementById(g).style.display = 'none';
}


function prn(d)
{
document.getElementById(d).style.display = (jeVidet ? 'none' : 'block');
  jeVidet = (jeVidet ? false : true);
}

function prn2(d)
{
document.getElementById(d).style.display = (jeVidet2 ? 'none' : 'block');
  jeVidet2 = (jeVidet2 ? false : true);
}

function prn3(d)
{
  if(document.getElementById(d).style.display =='none')
  {
  document.getElementById(d).style.display = 'block';
  document.getElementById('zv').value = 'Skrýt vysvětlivky >>';
  }
  else
  {
  document.getElementById(d).style.display = 'none';
  document.getElementById('zv').value = 'Zobrazit vysvětlivky >>';
  }

}


function open_new(w,h) 
{
Okno=window.open("","JSL",'toolbar=0,location=0,scrollbars=0,width='+w+',height='+h+',resizable=0,top=50,left=50');
Okno.focus();
}


function checkoff(p)
{
for(i = 1; i <= p; i++)	
	{
		document.getElementById('n'+i).checked = false;	
	}

}
/* 
counter functions by Michal Soukup
Modified by Robert Hlobilek 2006
*/
var str;
var maxChars = 1000;

function counted(str) {
  var orginal = str.length;
  return  maxChars - orginal;
}

function progresbar (str) {
  var len = str.length;
  var maxWidths = document.getElementById('progres_main').style.width;
  maxWidth =  maxWidths.substr(0,maxWidths.length -2)-2;
  var pBar = document.getElementById('progres_bar');
  
  var newWidth = maxWidth/maxChars*len;
  var procento = Math.round((len/maxChars*100)-0.4)+'%';
  pBar.style.width = newWidth+'px';
  document.getElementById('progres_val').innerHTML=procento;
}

function countChars(){

   var theForm = document.getElementById('np');
   theForm.counter.value = counted(theForm.text.value);
   progresbar (theForm.text.value);
   
   if ( theForm.counter.value < 1) {
     alert('NELZE VLOŽIT VÍCE NEŽ '+ maxChars +' ZNAKŮ');
     theForm.text.value=theForm.text.value.substr(0,maxChars);
   } else if (theForm.counter.value > 750) {
      theForm.counter.style.color = 'black';
   } else if (theForm.counter.value > 400) {
      theForm.counter.style.color = 'ThreedDarkShadow';
   } else if (theForm.counter.value > 200) {
      theForm.counter.style.color = 'gray';
   } else if (theForm.counter.value > 100) {
      theForm.counter.style.color = '#FF8000';
   } else if (theForm.counter.value > 50) {
      theForm.counter.style.color = 'red';
   } else {
      theForm.counter.style.color = 'red';
   }
}

function CheckIt(i)
{
	if(document.getElementById(i).checked == false)
	{
document.getElementById(i).checked = true;
	}
	if(document.getElementById(i).checked == true)
	{
document.getElementById(i).checked = false;
	}
}


function validate_1()
{
if(document.getElementById('vase_jmeno').value == "")
	{
         alert('Nevyplnili jste jméno');
         document.getElementById('vase_jmeno').focus();
         return false;
        }
else if(document.getElementById('kontaktni_telefon').value == "")
	{
         alert('Nevyplnili jste telefon');
         document.getElementById('kontaktni_telefon').focus();
         return false;
        }
else if(document.getElementById('emailova_adresa').value == "")
	{
         alert('Nevyplnili jste emailovou adresu');
         document.getElementById('emailova_adresa').focus();
         return false;
        } 
else if(document.getElementById('text_dotazu').value == "")
	{
         alert('Nevyplnili jste text dotazu');
         document.getElementById('text_dotazu').focus();
         return false;
        }
else if (window.RegExp)

    {

        re = new RegExp("^[^@]+@[^.]+\..+$");

        if (!re.test(document.getElementById('emailova_adresa').value))

        {

            alert("Zadaná adresa není správnou adresou elektronické pošty!");
            document.getElementById('emailova_adresa').focus();
            return false;

        }

    }
else 
{
return true;
}
}


function validate_2()
{
if(document.getElementById('prihlaseni_uz_jm').value == "")
	{
         alert('Nevyplnili jste uživatelské jméno');
         document.getElementById('prihlaseni_uz_jm').focus();
         return false;
        }
else if(document.getElementById('prihlaseni_heslo').value == "")
	{
         alert('Nevyplnili jste heslo');
         document.getElementById('prihlaseni_heslo').focus();
         return false;
        }
else 
{
return true;
}
}

function odeslat(adresa,idf)
   {
       if (adresa)
       {
           var e = document.getElementById(idf);
           e.submit(adresa);
           
       }
   }
   
 
 

function kontrola()
{
	
//alert('test');	
if(document.krok2.typ_reg[0].checked==false && document.krok2.typ_reg[1].checked==false)
	{
         alert('Nevybrali jste typ registrace');
         return false;
    }
	else 
	{
	//return true;
	var e = document.getElementById('krok2');
    var adresa;
    
    if(document.krok2.typ_reg[0].checked==true)
    {
	adresa = '/registrace.html';	
	}
	else
	{
	adresa = '/bez-registrace.html';
	}
    
    
    
    e.setAttribute('action', adresa);
    e.submit(adresa);

	
	}
}  


function kontrola2()
{
	
var zatrzeno = false;
for(var i = 0; i < document.pokladna_1.doprava.length; i++)
{
  if(document.pokladna_1.doprava[i].checked) 
  zatrzeno = true;
}

if(zatrzeno!=true)
{
 window.alert("Nevybrali jste způsob dopravy");
return false;
}
else 
	{
	return true;

	}
}    


PositionX = 100;
PositionY = 100;

defaultWidth  = 500;
defaultHeight = 500;
 
var AutoClose = true;
 
if (parseInt(navigator.appVersion.charAt(0))>=4)
{
  var isNN=(navigator.appName=="Netscape")?1:0;
  var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;

  if(navigator.appName=="Opera")
  {
   var isNN=1;
  }
}


var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;


function popImage(imageURL,imageTitle){
  if (isNN){imgWin=window.open('','U',optNN);}
  if (isIE){imgWin=window.open('','U',optIE);}

  
  imgWin.focus();
  with (imgWin.document){
    writeln('<html><head><title>Loading...</title><style>body{margin:0px; text-align: center;}</style>');writeln('<sc'+'ript>');
    writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
    writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
    writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
    writeln('width=100-(document.body.clientWidth-document.images[0].width);');
    writeln('height=100-(document.body.clientHeight-document.images[0].height);');
    writeln('window.resizeTo(width+150,height);}');writeln('if (isNN){');
    writeln('window.innerWidth=document.images["image"].width;');writeln('window.innerHeight=document.images["image"].height;}}');
    writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');

    if (!AutoClose)
      writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
    else
		  writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onclick="self.close()">');

		writeln('<img name="image" src='+imageURL+' style="display:block"></body></html>');
		close();
  }

}

