
function gE(e) {
   var obj = null;
   
   if( document.getElementById ) { obj = document.getElementById(e); } 
   else if( document.layers ) { obj = document.layers[e]; }
   else if( document.all ) { obj = document.all[e]; }
   
   return obj;
}


function change(id) {
	gE("reg_1").style.display="none";
	gE("reg_2").style.display="none";
	
	gE("reg1").checked=false;
	gE("reg2").checked=false;

	gE("reg_"+id).style.display="inline";
	gE("reg"+id).checked=true;
}


//var p_normal=1500;
var priv_range = [6,3,2,1];
lasttarif = 1;
//var priv_prices = [1500,2000,3000,4000];


function reCalc () {

	places=gE("mist").value;
	tarif=document.forms["kalkulace"].tarif;
	i=0;
	
	if (tarif[0].checked) t=1; else t=2;
	
	if (places>0) {
		if (t==1) { var price=p_normal; }
		else {			
			while (priv_range[i]!=false) {				
				if (places>=priv_range[i]) {
					var price=priv_prices[i];
					break;
				}
				i++; 				
			}
		}
		gE('price').innerHTML=price*places;
		if (gift==1) { gE('price2').innerHTML=price*places; }
		else {
			
			if (t!=lasttarif) {
				
				if (t==2) { m=-1; } else { m=1; }
				
				if (!isNaN(gE('volno1').innerHTML)) { gE('volno1').innerHTML=parseInt(gE('volno1').innerHTML)+m; }
				if (!isNaN(gE('volno2').innerHTML)) { gE('volno2').innerHTML=parseInt(gE('volno2').innerHTML)+m;}
				if (!isNaN(gE('volno3').innerHTML)) { gE('volno3').innerHTML=parseInt(gE('volno3').innerHTML)+m;}
				
				lasttarif=t;
				
			}
	
		}
		
	}
	
}

function reCalcGift () {
	
	var price=0;

	if (gE("price_0")) { price+=((gE("price_0").innerHTML)*(gE("pocet_0").value)); }
	if (gE("price_1")) { price+=((gE("price_1").innerHTML)*(gE("pocet_1").value)); }
	if (gE("price_2")) { price+=((gE("price_2").innerHTML)*(gE("pocet_2").value)); }
	gE('price').innerHTML=price;
	gE('price2').innerHTML=price;
		
}
function ShowAll () {

	if (gE('stejne').checked) {
		gE("dalsi_adresa").style.display="none";	
	} else {
		gE("dalsi_adresa").style.display="block";
	}


}



var chck=1; var kliknuto;
function check(theForm)
{
if(chck==1){
 if (theForm.jm.value=="")
  { alert("Vyplňte Vaše jméno.");
    theForm.jm.focus();
    return (false);
  }
}
  return (true);
}

function limitznaku(){
if(document.comment.text.value.length > 3000){
document.comment.text.value = document.comment.text.value.substring(0,3000);
alert("Text je poíliš dlouhý, bude zkrácen.");
}
}

function vlozit(co){

document.comment.text.value+=co;
skryjinfo();
}

function nochck(){
chck=0;
}


function ukazinfo(ev){

if(document.getElementById){
               
obj=gE('info');
if (document.all && !window.opera){
x = event.clientX + document.body.scrollLeft+5;
y = event.clientY + document.body.scrollTop+5;  
                  
}  
else{
x=ev.pageX+5;
y=ev.pageY+5; 
  
}
if (document.all && !window.opera) {
obj.style.pixelLeft=x;
obj.style.pixelTop=y;
}
else{
obj.style.left=x+"px";
obj.style.top=y+"px";
}

obj.style.display="block";
}
}

function skryjinfo(){
if(gE("info")){
obj=gE("info")
obj.style.display="none";
}
}

function element (id){
var view = gE(id);
return view;
}


function showIt(){

if(!kliknuto){
	var co = element('key');
	if (window.opera)
		co.style.display = 'table-row';
	else if (navigator.appName!='Microsoft Internet Explorer')
		co.style.display = 'table-row';
	else
		co.style.display = 'block';
		kliknuto=1;
}
else{
	var co = element('key');
	co.style.display = 'none';
	kliknuto=0;
}
}

function Re(id,nick){

gE("status").innerHTML="Odpovidate na/reply to: "+nick;
document.comment.odpovedet.value = id;
}

function openWin (showfile,title,width,height) {
	var newWindow = window.open(showfile,title,'toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,resizable=yes,status=no,width='+width+',height='+height);
	newWindow.focus();
	
}

function submitForm () {
  document.dateSet.submit();
}