<!--
var w = window;
var d = document;
// 4. CS

function vypocet_cs () {
var splatnost
var uver
var urok
var pocet_splatek
var mocnina
var anuita

uver = document.formCs.cena.value;

splatnost = document.formCs.doba_splatnosti.options[document.formCs.doba_splatnosti.options.selectedIndex].value

urok = urokext;
pocet_splatek = splatnost * 12;

IRT = (365.0 / 360.0) * urok / 12.0;
horni = (Math.pow((1.0 + IRT), pocet_splatek) * IRT);
spodni = (Math.pow((1.0 + IRT), pocet_splatek) - 1.0);
splatka = Math.round((horni / spodni) * uver);

document.formCs.mesicni_splatka.value = splatka;
}

var et = {
	addListener : function (where, when, what) {
		if (where.addEventListener) {
			where.addEventListener(when, what, false);
			return true;
		}
		if (where.attachEvent) {
			where.attachEvent('on' + when, function(){ what(et.getIeEvent()); });
			return true;
		}
		return false
	},
	getIeEvent : function() {
		e = w.event;
		e.target = e.srcElement;
		e.preventDefault = function() {e.returnValue = true;}
		e.stopPropagation = function() {e.cancelBubble = true;}
		return e;
	}
}

function submitForm(){
	var form = document.getElementById("cs-kalkulator-form");
	et.addListener(form, 'click', function(e){form.submit()});

	var formInputs = form.getElementsByTagName("input");
	var formSelects = form.getElementsByTagName("select");

	for(i = 0, count = formInputs.length; i < count; i++){
		if(formInputs[i].type != "submit"){
			et.addListener(formInputs[i], 'click', function(e){e.stopPropagation();});
		}
	}

	for(i = 0, count = formSelects.length; i < count; i++){
		et.addListener(formSelects[i], 'click', function(e){e.stopPropagation();});
	}
}

window.onload = function(){
	submitForm();
};

<!-- konec skriptu -->

function RollKalk(){
  roller = document.getElementById('cs-kalk-roller');
  kalk = document.getElementById('cs-kalkulator');
  if(roller.style.height == 0){
    setTimeout("RollOut(1)",1);
  }
}
function RollOut(c){
  if(c < 60){
    roller.style.height = c;
    if(c<20) c = c + 5;
    if(c>=20 && c<40) c = c + 3;
    if(c>=40 && c<50) c = c + 2;
    if(c>=50 && c<60) c++;
    setTimeout("RollOut("+c+")",1);
  }else{
    kalk.style.display = 'block';
  }
}

function GrayFilter(imgId,state){
  imgF = document.getElementById(imgId);
  
  if(state == 0){
    imgF.style.filter = 'void(null);';
  }else{
    imgF.style.filter = 'gray();void(null);';
  }
} 

function CheckForm(){
  result = true;
  resultText = "Musíte vyplnit tyto údaje:\r\n\r\n";
  if(document.getElementById('p_jmeno_id').value == ""){
    resultText += "Jméno a příjmení\r\n";
    result = false;
  }
  if(document.getElementById('p_email_id').value == "" && document.getElementById('p_telefon_id').value == ""){
    resultText += "E-mail nebo telefon\r\n";
    result = false;
  }
  if(document.getElementById('p_lokalita_id').value == ""){
    resultText += "Lokalita - adresa\r\n";
    result = false;
  }
  if(!result)   alert(resultText);
  
  return result;
}
function LoadImg(img,height){
  document.getElementById('main-img').style.backgroundImage = 'url('+img+'_3.jpg)';
  document.getElementById('main-img').style.height = height+'px';
  document.getElementById('zoomicon').style.marginTop = (height-43)+'px';
  document.getElementById('main-img-link').href = img+'_0.jpg';
}

		$(document).ready(function() {
			$("a[rel=galimages]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return 'Foto ' + (currentIndex + 1) + ' / ' + currentArray.length  + '';
				}
			});

			$("a[rel=galimage]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '';
				}
			});

		});
		
		function MenuOver(id){
     document.getElementById(id+'img').src='images/'+id+'o.gif';
    }
		function MenuOut(id){
     document.getElementById(id+'img').src='images/'+id+'.gif';
    }
		function SMenuOver(id){
     document.getElementById(id+'img').src='images/'+id+'o.png';
    }
		function SMenuOut(id){
     document.getElementById(id+'img').src='images/'+id+'.png';
    }


