/*
 * DO NOT REMOVE THIS NOTICE
 *
 * PROJECT:   mygosuMenu
 * VERSION:   1.1.6
 * COPYRIGHT: (c) 2003,2004 Cezary Tomczak
 * LINK:      http://gosu.pl/dhtml/mygosumenu.html
 * LICENSE:   BSD (revised)
 */





function DropDownMenuX(id) {

    /* Type of the menu: "horizontal" or "vertical" */
    this.type = "horizontal";

    /* Delay (in miliseconds >= 0): show-hide menu
     * Hide must be > 0 */
    this.delay = {
        "show": 0,
        "hide": 400
    }
    /* Change the default position of sub-menu by Y pixels from top and X pixels from left
     * Negative values are allowed */
    this.position = {
        "level1": { "top": 0, "left": 0},
        "levelX": { "top": 0, "left": 0}
    }

    /* fix ie selectbox bug ? */
    this.fixIeSelectBoxBug = true;

    /* Z-index property for .section */
    this.zIndex = {
        "visible": 500,
        "hidden": -1
    };

    // Browser detection
    this.browser = {
        "ie": Boolean(document.body.currentStyle),
        "ie5": (navigator.appVersion.indexOf("MSIE 5.5") != -1 || navigator.appVersion.indexOf("MSIE 5.0") != -1),
        "ie6": (navigator.appVersion.indexOf("MSIE 6.0") != -1)
    };
    
    if (!this.browser.ie) {
        this.browser.ie5 = false;
        this.browser.ie6 = false;
    }

    /* Initialize the menu */
    this.init = function() {
        if (!document.getElementById(this.id)) { return ;
        	//alert("DropDownMenuX.init() failed. Element '"+ this.id +"' does not exist."); 
        	}
        if (this.type != "horizontal" && this.type != "vertical") { return ;
        	//alert("DropDownMenuX.init() failed. Unknown menu type: '"+this.type+"'"); 
        	}
        if (this.browser.ie && this.browser.ie5) { fixWrap(); }
        fixSections();
        parse(document.getElementById(this.id).childNodes, this.tree, this.id);
    }

    /* Search for .section elements and set width for them */
    function fixSections() {
        var arr = document.getElementById(self.id).getElementsByTagName("div");
        var sections = new Array();
        var widths = new Array();
        
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].className == "section") {
                sections.push(arr[i]);
            }
        }
        for (var i = 0; i < sections.length; i++) {
            widths.push(getMaxWidth(sections[i].childNodes));
        }
        for (var i = 0; i < sections.length; i++) {
            sections[i].style.width = (widths[i]) + "px";
        }
        if (self.browser.ie) {
            for (var i = 0; i < sections.length; i++) {
                setMaxWidth(sections[i].childNodes, widths[i]);
            }
        }
    }

    function fixWrap() {
        var elements = document.getElementById(self.id).getElementsByTagName("a");
        for (var i = 0; i < elements.length; i++) {
            if (/item2/.test(elements[i].className)) {
                elements[i].innerHTML = '<div nowrap="nowrap">'+elements[i].innerHTML+'</div>';
            }
        }
    }

    /* Search for an element with highest width among given nodes, return that width */
    function getMaxWidth(nodes) {
        var maxWidth = 0;
        for (var i = 0; i < nodes.length; i++) {
            if (nodes[i].nodeType != 1 || /section/.test(nodes[i].className)) { continue; }
            if (nodes[i].offsetWidth > maxWidth) { maxWidth = nodes[i].offsetWidth; }
        }
        return maxWidth;
    }

    /* Set width for item2 elements */
    function setMaxWidth(nodes, maxWidth) {
        for (var i = 0; i < nodes.length; i++) {
            if (nodes[i].nodeType == 1 && /item2/.test(nodes[i].className) && nodes[i].currentStyle) {
                if (self.browser.ie5) {
                    nodes[i].style.width = (maxWidth) + "px";
                } else {
                    //nodes[i].style.width = (maxWidth - parseInt(nodes[i].currentStyle.paddingLeft) - parseInt(nodes[i].currentStyle.paddingRight)) + "px";
                    //ooo FIXED
                    nodes[i].style.width = (maxWidth) + "px";
                }
            }
        }
    }

    /* Parse nodes, create events, position elements */
    function parse(nodes, tree, id) {
        for (var i = 0; i < nodes.length; i++) {
            if (1 != nodes[i].nodeType) {
                continue;
            }
            switch (true) {
                // .item1
                case /\bitem1\b/.test(nodes[i].className):
                    nodes[i].id = id + "-" + tree.length;
                    tree.push(new Array());
                    nodes[i].onmouseover = itemOver;
                    nodes[i].onmouseout = itemOut;
                    break;
                // .item2
                case /\bitem2\b/.test(nodes[i].className):
                    nodes[i].id = id + "-" + tree.length;
                    tree.push(new Array());
                    nodes[i].onmouseover = itemOver;
                    nodes[i].onmouseout = itemOut;
                    break;
                // .section
                case /\bsection\b/.test(nodes[i].className):
                    // id, events
                    nodes[i].id = id + "-" + (tree.length - 1) + "-section";
                    nodes[i].onmouseover = sectionOver;
                    nodes[i].onmouseout = sectionOut;
                    // position
                    var box1 = document.getElementById(id + "-" + (tree.length - 1));
                    var box2 = document.getElementById(nodes[i].id);
                    var el = new Element(box1.id);
                    if (1 == el.level) {
                        if ("horizontal" == self.type) {
                            box2.style.top = box1.offsetTop + box1.offsetHeight + self.position.level1.top + "px";
                            if (self.browser.ie5) {
                                box2.style.left = self.position.level1.left + "px";
                            } else {
                                box2.style.left = box1.offsetLeft + self.position.level1.left + "px";
                            }
                        } else if ("vertical" == self.type) {
                            box2.style.top = box1.offsetTop + self.position.level1.top + "px";
                            if (self.browser.ie5) {
                                box2.style.left = box1.offsetWidth + self.position.level1.left + "px";
                            } else {
                                box2.style.left = box1.offsetLeft + box1.offsetWidth + self.position.level1.left + "px";
                            }
                        }
                    } else {
                        box2.style.top = box1.offsetTop + self.position.levelX.top + "px";
                        box2.style.left = box1.offsetLeft + box1.offsetWidth + self.position.levelX.left + "px";
                    }
                    // sections, sectionsShowCnt, sectionsHideCnt
                    self.sections.push(nodes[i].id);
                    self.sectionsShowCnt.push(0);
                    self.sectionsHideCnt.push(0);
                    if (self.fixIeSelectBoxBug && self.browser.ie6) {
                        nodes[i].innerHTML = nodes[i].innerHTML + '<iframe id="'+nodes[i].id+'-iframe" src="javascript:false;" scrolling="no" frameborder="0" style="position: absolute; top: 0px; left: 0px; display: none; filter:alpha(opacity=0);"></iframe>';
                    }
                    break;
            }
            if (nodes[i].childNodes) {
                if (/\bsection\b/.test(nodes[i].className)) {
                    parse(nodes[i].childNodes, tree[tree.length - 1], id + "-" + (tree.length - 1));
                } else {
                    parse(nodes[i].childNodes, tree, id);
                }
            }
        }
    }

    /* event, item:onmouseover */
    function itemOver() {
        //debug("itemOver("+this.id+") , visible = " + self.visible);
        self.itemShowCnt++;
        var id_section = this.id + "-section";
        if (self.visible.length) {
            var el = new Element(self.visible.getLast());
            el = document.getElementById(el.getParent().id);
			// ooo fixed
			if (el)            
	            if (/item\d-active/.test(el.className)) {
	                el.className = el.className.replace(/(item\d)-active/, "$1");
	            }
        }
        if (self.sections.contains(id_section)) {
            clearTimers();
            self.sectionsHideCnt[self.sections.indexOf(id_section)]++;
            var cnt = self.sectionsShowCnt[self.sections.indexOf(id_section)];
            var timerId = setTimeout(function(a, b) { return function() { self.showSection(a, b); } } (id_section, cnt), self.delay.show);
            self.timers.push(timerId);
        } else {
            if (self.visible.length) {
                clearTimers();
                var timerId = setTimeout(function(a, b) { return function() { self.showItem(a, b); } } (this.id, self.itemShowCnt), self.delay.show);
                self.timers.push(timerId);
            }
        }
    }

    /* event, item:onmouseout */
    function itemOut() {
        //debug("itemOut("+this.id+") , visible = " + self.visible);
        self.itemShowCnt++;
        var id_section = this.id + "-section";
        if (self.sections.contains(id_section)) {
            self.sectionsShowCnt[self.sections.indexOf(id_section)]++;
            if (self.visible.contains(id_section)) {
                var cnt = self.sectionsHideCnt[self.sections.indexOf(id_section)];
                var timerId = setTimeout(function(a, b) { return function() { self.hideSection(a, b); } }(id_section, cnt), self.delay.hide);
                self.timers.push(timerId);
            }
        }
    }

    /* event, section:onmouseover */
    function sectionOver() {
        //debug("sectionOver("+this.id+") , visible = " + self.visible);
        self.sectionsHideCnt[self.sections.indexOf(this.id)]++;
        var el = new Element(this.id);
        var parent = document.getElementById(el.getParent().id);
		if (parent)
	        if (!/item\d-active/.test(parent.className)) {
	            parent.className = parent.className.replace(/(item\d)/, "$1-active");
	        }
    }

    /* event, section:onmouseout */
    function sectionOut() {
        //debug("sectionOut("+this.id+") , visible = " + self.visible);
        self.sectionsShowCnt[self.sections.indexOf(this.id)]++;
        var cnt = self.sectionsHideCnt[self.sections.indexOf(this.id)];
        var timerId = setTimeout(function(a, b) { return function() { self.hideSection(a, b); } }(this.id, cnt), self.delay.hide);
        self.timers.push(timerId);
    }

    /* Show section (1 argument passed)
     * Try to show section (2 arguments passed) - check cnt with sectionShowCnt */
    this.showSection = function(id, cnt) {
        if (typeof cnt != "undefined") {
            if (cnt != this.sectionsShowCnt[this.sections.indexOf(id)]) { return; }
        }
        //debug("showSection("+id+", "+cnt+") , visible = " + this.visible);
        this.sectionsShowCnt[this.sections.indexOf(id)]++;
        if (this.visible.length) {
            if (id == this.visible.getLast()) { return; }
            var el = new Element(id);
            var parents = el.getParentSections();
            //debug("getParentSections("+el.id+") = " + parents);
            for (var i = this.visible.length - 1; i >= 0; i--) {
				// ooo fixed
                if (typeof parents.contains != "undefined" && parents.contains(this.visible[i]) ) {
              	//if (parents.contains(this.visible[i])) {
                    break;
                } else {
                    this.hideSection(this.visible[i]);
                }
            }
        }
        var el = new Element(id);
        var parent = document.getElementById(el.getParent().id);
		// ooo fixed        
		if (parent) {
	        if (!/item\d-active/.test(parent.className)) {
	            parent.className = parent.className.replace(/(item\d)/, "$1-active");
	        }
		}
        if (document.all) { document.getElementById(id).style.display = "block"; }
		// ooo fixed        
		if (document.getElementById(id)) {
	        document.getElementById(id).style.visibility = "visible";
	        document.getElementById(id).style.zIndex = this.zIndex.visible;
		}
        /*ooo FIXED if (this.fixIeSelectBoxBug && this.browser.ie6) {
            var div = document.getElementById(id);
            var iframe = document.getElementById(id+"-iframe");
            iframe.style.width = div.offsetWidth + parseInt(div.currentStyle.borderLeftWidth) + parseInt(div.currentStyle.borderRightWidth);
            iframe.style.height = div.offsetHeight + parseInt(div.currentStyle.borderTopWidth) + parseInt(div.currentStyle.borderBottomWidth);
            iframe.style.top = -parseInt(div.currentStyle.borderTopWidth);
            iframe.style.left = -parseInt(div.currentStyle.borderLeftWidth);
            iframe.style.zIndex = div.style.zIndex - 1;
            iframe.style.display = "block";
        }*/
        this.visible.push(id);

    }

    /* Emulating an empty non-existent section, we have to hide elements, works like showSection() */
    this.showItem = function(id, cnt) {
        if (typeof cnt != "undefined") {
            if (cnt != this.itemShowCnt) { return; }
        }
        this.itemShowCnt++;
        if (this.visible.length) {
            var el = new Element(id + "-section");
            var parents = el.getParentSections();

            //debug("showItem() getParentSections("+el.id+") = " + parents);
            for (var i = this.visible.length - 1; i >= 0; i--) {
				// ooo fixed
				if (typeof parents.contains != "undefined" && parents.contains(this.visible[i]) ) {
                //if (parents.contains(this.visible[i])) {
                    break;
                } else {
                    this.hideSection(this.visible[i]);
                }
            }
        }
    }

    /* Hide section (1 argument passed)
     * Try to hide section (2 arguments passed) - check cnt with sectionHideCnt */
    this.hideSection = function(id, cnt) {
        if (typeof cnt != "undefined") {
            if (cnt != this.sectionsHideCnt[this.sections.indexOf(id)]) { return; }
            if (id == this.visible.getLast()) {
                //debug("hideSectionAll("+id+", "+cnt+") , visible = " + this.visible);
                for (var i = this.visible.length - 1; i >= 0; i--) {
                    this.hideSection(this.visible[i]);
                }
                return;
            }
        }
        //debug("hideSection("+id+", "+cnt+") , visible = " + this.visible);
        var el = new Element(id);
        var parent = document.getElementById(el.getParent().id);
		//ooo fixed
		if (parent)        
	        if (/item\d-active/.test(parent.className)) {
	            parent.className = parent.className.replace(/(item\d)-active/, "$1");
	        }
		//ooo fixed        
		if (document.getElementById(id)) {
	        document.getElementById(id).style.zIndex = this.zIndex.hidden;
	        document.getElementById(id).style.visibility = "hidden";
		}
        if (document.all) { document.getElementById(id).style.display = "none"; }
        if (this.fixIeSelectBoxBug && this.browser.ie6) {
            var iframe = document.getElementById(id+"-iframe");
            iframe.style.display = "none";
        }
        if (this.visible.contains(id)) {
            if (id == this.visible.getLast()) {
                this.visible.pop();
            } else {
                //throw "DropDownMenuX.hideSection('"+id+"', "+cnt+") failed, trying to hide a section that is not the deepest visible section";
                return;
            }
        } else {
            //throw "DropDownMenuX.hideSection('"+id+"', "+cnt+") failed, cannot hide element that is not visible";
            return;
        }
        this.sectionsHideCnt[this.sections.indexOf(id)]++;
    }





    /* Element (.section, .item2 etc) */
    function Element(id) {
        
        this.menu = self;
        this.id = id;

		this.substrCount = function(s) {
			return this.split(s).length - 1;
		}

        /* Get Level of given id
         * Examples: menu-1 (1 level), menu-1-4 (2 level) */
        this.getLevel = function() {

            var s = this.id.substr(this.menu.id.length);
            // ooo fixed
			if (typeof substrCount != "undefined") 
				return s.substrCount("-");
			else 
				return s.split("-").length - 1;

        }

        /* Get parent Element */
        this.getParent = function() {
            var s = this.id.substr(this.menu.id.length);
            var a = s.split("-");
            a.pop();
            return new Element(this.menu.id + a.join("-"));
        }

        /* Check whether an element has a parent element */
        this.hasParent = function() {
            var s = this.id.substr(this.menu.id.length);
            var a = s.split("-");
            return a.length > 2;
        }

        /* Check whether an element has a sub-section */
        this.hasChilds = function() {
            return Boolean(document.getElementById(this.id + "-section"));
        }

        /* Get parent section elements for current section */
        this.getParentSections = function() {
            var s = this.id.substr(this.menu.id.length);
            s = s.substr(0, s.length - "-section".length);
            var a = s.split("-");
            a.shift();
            a.pop();
            var s = this.menu.id;
            var parents = [];
            for (var i = 0; i < a.length; i++) {
                s += ("-" + a[i]);
                parents.push(s + "-section");
            }
            return parents;
        }
        
        this.level = this.getLevel();
    }

    /* Clear all timers set with setTimeout() */
    function clearTimers() {
        for (var i = self.timers.length - 1; i >= 0; i--) {
            clearTimeout(self.timers[i]);
            self.timers.pop();
        }
    }

    var self = this;
    this.id = id; /* menu id */
    this.tree = []; /* tree structure of menu */
    this.sections = []; /* all sections, required for timeout */
    this.sectionsShowCnt = [];
    this.sectionsHideCnt = [];
    this.itemShowCnt = 0;
    this.timers = []; // timeout ids
    this.visible = []; /* visible section, ex. Array("menu-0-section", ..) , succession is important: top to bottom */
}



/* Finds the index of the first occurence of item in the array, or -1 if not found */
if (typeof Array.prototype.indexOf == "undefined") {
    Array.prototype.indexOf = function(item) {
        for (var i = 0; i < this.length; i++) {
            if (this[i] === item) {
                return i;
            }
        }
        return -1;
    }
}

/* Check whether array contains given string */
if (typeof Array.prototype.contains == "undefined") {
    Array.prototype.contains = function(s) {
        for (var i = 0; i < this.length; i++) {
            if (this[i] === s) {
                return true;
            }
        }
        return false;
    }
}

/* Counts the number of substring occurrences */
if (typeof String.prototype.substrCount == "undefined") {
    String.prototype.substrCount = function(s) {
        return this.split(s).length - 1;
    }
}

/* Get the last element from the array */
if (typeof Array.prototype.getLast == "undefined") {
    Array.prototype.getLast = function() {
        return this[this.length-1];
    }
}

/* **************** *
 * Obrazy
 * *************** */	
 
window.addEvent('domready', function() { 
  
  if(document.getElementById('sirka_obrazu')) {
  
    var sirka_original = parseFloat(document.getElementById('sirka_obrazu_original').value);
    var vyska_original = parseFloat(document.getElementById('vyska_obrazu_original').value);
    var sirka = parseFloat(document.getElementById('sirka_obrazu').value);
    var vyska = parseFloat(document.getElementById('vyska_obrazu').value);
    
    /* konstanty */
    var L = 1572; //Kč/m2
    var G = 1092; //Kč/m2
    var D = 1.452; //Kč/m2
    var Z = 60; //Kč/m 
    var M = 60; //Kč/ks
    var H = 60; //Kč/ks
    var N = 186; //Kč/m 
    var R = 84; //Kč/ks
    
    var Lesk = 1716;
    var Mat = 1716;
    var Baryt = 2460;
    var FineArt = 2772;

  
    // zmena sirky 
    $('sirka_obrazu').addEvent('change',function(){
      
      var sirka_new = parseFloat(document.getElementById('sirka_obrazu').value);
      var vyska_new = vyska*(sirka_new/sirka_original);
      
      document.getElementById('vyska_obrazu').value = Math.round(vyska_new);    
      zobrazCenu();  
    });  
    
    // zmena vysky 
    $('vyska_obrazu').addEvent('change',function(){
      
      var vyska_new = parseFloat(document.getElementById('vyska_obrazu').value);
      var sirka_new = sirka*(vyska_new/vyska_original);
      
      document.getElementById('sirka_obrazu').value = Math.round(sirka_new);
      zobrazCenu();
    });   
  
  
  /* filtrovani */

    $$('input[name=sel_tisk]').addEvent('change',function(){
      var values = 0;
      values = $$('input[name=sel_tisk]:checked').map(function(e) { return e.value; });
      if(values == 1) {
        $$('.sel_adjustace_td').setStyle('visibility', 'visible');
      }
      else {
        
        $$('.sel_adjustace_td').setStyle('visibility', 'hidden');
        $$('.sel_ramovani_td').setStyle('visibility', 'hidden');
        $$('input[name=sel_adjustace]').set('checked',false);
        $$('input[name=sel_ramovani]').set('checked',false);
      }
      zobrazCenu();
      
    }); 
    
    $$('input[name=sel_tisk]').addEvent('click',function(){
      var values = 0;
      values = $$('input[name=sel_tisk]:checked').map(function(e) { return e.value; });
      if(values == 1) {
        $$('.sel_adjustace_td').setStyle('visibility', 'visible');
      }
      else {
        
        $$('.sel_adjustace_td').setStyle('visibility', 'hidden');
        $$('.sel_ramovani_td').setStyle('visibility', 'hidden');
        $$('input[name=sel_adjustace]').set('checked',false);
        $$('input[name=sel_ramovani]').set('checked',false);
      }
      zobrazCenu();
      
    }); 
    
    $$('input[name=sel_adjustace]').addEvent('change',function(){
      var values = $$('input[name=sel_adjustace]:checked').map(function(e) { return e.value; });
      if(values == 1) {
        $$('.sel_ramovani_td').setStyle('visibility', 'visible');
      }
      else {
        $$('.sel_ramovani_td').setStyle('visibility', 'hidden');
        $$('input[name=sel_ramovani]').set('checked',false);
      } 
      zobrazCenu();     
    }); 
    
    $$('input[name=sel_adjustace]').addEvent('click',function(){
      var values = $$('input[name=sel_adjustace]:checked').map(function(e) { return e.value; });
      if(values == 1) {
        $$('.sel_ramovani_td').setStyle('visibility', 'visible');
      }
      else {
        $$('.sel_ramovani_td').setStyle('visibility', 'hidden');
        $$('input[name=sel_ramovani]').set('checked',false);
      } 
      zobrazCenu();     
    }); 
    
    $$('input[name=sel_ramovani]').addEvent('change',function(){
      zobrazCenu();     
    });  
    $$('input[name=sel_ramovani]').addEvent('click',function(){
      zobrazCenu();     
    });
    $$('input[name=pocet]').addEvent('change',function(){
      zobrazCenu();     
    }); 
    $$('input[name=pocet]').addEvent('click',function(){
      zobrazCenu();     
    }); 
  
  /*******************************
   * a - int - sirka v cm
   * b - int - vyska v cm
   * return decimal - plocha v m2
   * *****************************/           
  function plocha(a,b){
    am = a / 100;
    bm = b / 100;
    vysledek = am*bm;
    return vysledek;
  }
  /*******************************
   * s - decimal
   * return decimal
   * *****************************/           
  function koeficient(s){
    var k = 1.0;
    if(s <= 0.1){
      k = 1.1;
    }
    else if(s > 0.1 && s <= 0.2){
      k = 1.2;
    }
    else if(s > 0.2 && s <= 0.5){
      k = 1.3;
    }
    else if(s > 0.5 && s <= 1.0){
      k = 1.4;
    }
    else if(s > 1.0){
      k = 1.5;
    }
    else {
      k = 1.0
    }
    return k;
  }
  
  function cenaTisku(sel,s){
    if(sel == 0) {
      alert ("Zvolte nejprve volbu tisku");
      return 0;
    }
    else if(sel == 1) {
      return s * Lesk;
    }
    else if(sel == 2) {
      return s * Mat;
    }
    else if(sel == 3) {
      return s * Baryt;
    }
    else if(sel == 4) {
      return s * FineArt;
    }    
  }
  
  function cenaAdjustace(sel,s,k,sirka,vyska){
    if(sel == 0) {
      return 0;
    }
    else if(sel == 1) {
      var vysledek = (((L*s)/k)+(G*s)) * s;
      return vysledek; 
    }
    else if(sel == 2) {
      var sirkam = sirka/100;
      var vyskam = vyska/100;
      var vysledek = ((((L*s)/k)+(D*s)) * s) + ((sirkam * ((2*(sirkam+vyskam)) * Z)) + M);
      return vysledek;
    }   
  }
  
  function cenaRamovani(sel,s){
    if(sel == 0) {
      return 0;
    }
    else if(sel == 1) {
      var vysledek = H;
      return vysledek; 
    }
    else if(sel == 2 || sel == 3 || sel == 4 || sel == 5) {
      var sirkam = sirka/100;
      var vyskam = vyska/100;
      var vysledek = ((2 * (sirkam+vyskam) * (N * (2*(sirkam+vyskam)))) + R);
      return vysledek; 
    }   
  }
  
  function zobrazCenu() {
    var cenaCelkem = 0;
    var cenaAdj = 0;
    var cenaRam = 0;
    var cenaTisk = 0;
    
    var sirka = parseFloat(document.getElementById('sirka_obrazu').value);
    var vyska = parseFloat(document.getElementById('vyska_obrazu').value);
    var pocetKs = parseFloat(document.getElementById('kosik_pocet').value);
    var cenaAutor = parseFloat(document.getElementById('autorsky_poplatek').value);
    var s = plocha(sirka,vyska);
    var k = koeficient(s);
    var sel_tisk = $$('input[name=sel_tisk]:checked').map(function(e) { return e.value; });  
    var sel_adjustace = $$('input[name=sel_adjustace]:checked').map(function(e) { return e.value; }); 
    var sel_ramovani = $$('input[name=sel_ramovani]:checked').map(function(e) { return e.value; }); 

    cenaTisk = cenaTisku(sel_tisk,s);
    cenaAdj = cenaAdjustace(sel_adjustace,s,k,sirka,vyska);
    cenaRam  = cenaRamovani(sel_ramovani,s,sirka,vyska);
    
    cenaCelkem = (cenaTisk + cenaAdj + cenaRam + cenaAutor) * pocetKs;
    document.getElementById('cena_celkem').value = Math.round(cenaCelkem); 
  }
  
  zobrazCenu();
  
  
  /***************/
    var slider = $('slider');

  new Slider(slider, slider.getElement('.knob'), {
    range: [30, 100],
    initialStep: sirka_original,
    wheel: true,
    onChange: function(value){
      
      document.getElementById('sirka_obrazu').value = value;
      var vyska_new = vyska*(value/sirka_original);
      document.getElementById('vyska_obrazu').value = Math.round(vyska_new);
      zobrazCenu();
    }
  });
  

  } 
  

  
}); 


/******************************/
/* MODUL
/********************************/

function tiskFunction() {
		box = new LightFace({ 
		title: 'Tisk', 
		width: 400,
		height: 120,
		content: "<ul><li>Konzistentní profesionální kvalita tisku s inkousty Epson UltraChrome K3 a technologií tiskové hlavy Micro Piezo™ </li><li>EpsonUltrajemný tiskový rastr. Masivní barvový gamut. Neutrální ČB reprodukce</li><li>Vysoká stálost obrazů na světle až 75 roků pro barevný výstup a více než 100 roků pro černobílý výstup </li></ul> ",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}


function termsFunction() {
		box = new LightFace({ 
		title: 'Tisk', 
		width: 400,
		height: 110,
		content: "<ul><li>Konzistentní profesionální kvalita tisku s inkousty Epson UltraChrome K3 a technologií tiskové hlavy Micro Piezo™ </li><li>EpsonUltrajemný tiskový rastr. Masivní barvový gamut. Neutrální ČB reprodukce</li><li>Vysoká stálost obrazů na světle až 75 roků pro barevný výstup a více než 100 roků pro černobílý výstup </li></ul> ",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}


function leskFunction() {
		box = new LightFace({ 
		title: 'Lesk', 
		width: 400,
		height: 160,
		content: "<ul><li>ILFORD Galerie Smooth Gloss je fotografické lesklé voděodolné RC médium </li><li>ILFORD Galerie je řada luxusních švýcarských inkjet médií</li><li>Ve spojení s pigmentovými inkousty poskytne Galerie Smooth archivační potenciál </li><li>Díky vysoké hustotě zčernání, širokému barvovému gamutu a velmi vysoké hranové ostrosti zaručuje technicky excelentní fotografie všech žánrů</li><li>Gramáž 290 g/m2</li><li>Materiál vhodný pro laminaci a kašírovámí</li></ul> ",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}

function matFunction() {
		box = new LightFace({ 
		title: 'Mat', 
		width: 400,
		height: 210,
		content: "<ul><li>ILFORD Galerie Smooth Pearl je fotografický voděodolný pearl (strukturovaný polomatný) papír s RC podložkou vhodný pro portrétní i uměleckou fotografii</li><li>ILFORD Galerie je řada luxusních švýcarských inkjet médií</li><li>Ve spojení s pigmentovými inkousty poskytne Galerie Smooth archivační potenciál</li><li>Jedinečný polev typu „lumina“ patentovaný firmou ILFORD zaručuje extrémní hranovou ostrost, vysokou hustotu zčernání a saturaci barev</li><li>Gramáž 290 g/m2</li><li>Materiál vhodný pro adjustaci pod sklo, paspartování, kašírování bez laminace</li><li>Možnosti adjustace je třeba dohodnout individuálně telefonicky nebo mailem</li></ul> ",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}

function barytFunction() {
		box = new LightFace({ 
		title: 'Baryt', 
		width: 400,
		height: 210,
		content: "<ul><li>ILFORD Galerie Gold Fibre Silk  představuje jedinečný materiál na barytové podložce s obrovským rozsahem denzit a barev</li><li>ILFORD Galerie je řada luxusních švýcarských inkjet médií</li><li>I přes unikátní jemnou texturu poskytuje naprosto výjimečnou hranovou ostrost, kterou nelze najít u žádného jiného druhu inkjet média. To je dáno použitím high-end vláken ve vrstvě přijímající inkoust</li><li>Gold Fibre Silk je krémově bílý (barevně neutrální, bez nádechu), protože neobsahuje žádná chemická bělidla. A proto je také vhodný pro dlouhodobou archivaci fotografií</li><li>Gramáž 310 g/m2</li><li>Materiál vhodný pro adjustaci pod sklo, paspartování, kašírování bez laminace</li><li>Možnosti adjustace je třeba dohodnout individuálně telefonicky nebo mailem</li></ul> ",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}
	 	
function fineartFunction() {
		box = new LightFace({ 
		title: 'Fine Art', 
		width: 400,
		height: 210,
		content: "<ul><li>ILFORD Galerie Smooth Fine Art Matt je umělecký akvarelový materiál na bázi bavlny s matným povrchem a velmi jemnou texturou</li><li>ILFORD Galerie je řada luxusních švýcarských inkjet médií</li><li>Tento akvarelový papír představuje špičku dané třídy, speciální potah zaručuje prvotřídní reprodukci. Vhodný pro barevnou i čb fotografii , uměleckou grafiku a reprodukce</li><li>Neobsahuje ani optické zjasňovače, ani kyselé přísady, proto disponuje archivačním potenciálem</li><li>Gramáž 310 g/m2</li><li>Exkluzivní povrch předurčuje tento materiál pro adjustaci bez krycího skla - nalepené na podložce a v rámu. Fotografie na tomto materiálu působí neopakovatelným dojmem fotografie na ručním papíru.</li><li>Možnosti adjustace je třeba dohodnout individuálně telefonicky nebo mailem</li></ul> ",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}	 	
	 	
function adjustaceFunction() {
		box = new LightFace({ 
		title: 'Adjustace', 
		width: 400,
		height: 210,
		content: "<ul><li>Povrchová úprava laminační fólií Protac Matt chrání fotografie před UV paprsky (prodlužuje barevnou životnost fotografie ) a zvyšuje odolnost vůči mechanickému poškození (zalaminovanou fotografii lze čistit i vlhkým měkkým hadříkem ) </li><li>Nakašírováním na sendvičovou desku Gatorfoam vzniká lehký ale pevný celek, který je možno dále zarámovat bez nutnosti použití krycího skla. Popřípadě lze opatřit závěsem a přímo pověsit na zeď bez rámování (vhodné do formátu 60x90 cm ) </li><li>Nakašírováním na sendvičovou hliníkovou desku Dibond vzniká velmi pevný celek, který po nalepení závěsu stačí přímo pověsit na zeď. Vhodné i pro velké formáty (až 100x300 cm) </li><li>Jiné způsoby adjustace ( lesklá laminace, kašírování bez povrchové laminace, paspartování apod.) je třeba dohodnout individuálně telefonicky nebo mailem </li></ul> ",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}

function laminace5Function() {
		box = new LightFace({ 
		title: 'Laminace mat (adjustace gatorfoam 5 mm)', 
		width: 400,
		height: 210,
		content: "<ul><li>Povrchová úprava laminační fólií Protac Matt chrání fotografie před UV paprsky (prodlužuje barevnou životnost fotografie ) a zvyšuje odolnost vůči mechanickému poškození ( zalaminovanou fotografii lze čistit i vlhkým měkkým hadříkem ) </li><li>Protac Matt UV 100μ (4.0 mil) je matná PVC (vinyl) laminační fólie 75μ potažená solventní akrylovou samolepkou 25μ. Profesionální fólie eliminující reflexe při zachování barevného kontrastu a detailu. Indoor/outdoor aplikace, vysoký stupeň UV ochrany. </li><li>Nakašírováním na sendvičovou desku Gatorfoam vzniká lehký ale pevný celek, který je možno dále zarámovat bez nutnosti použití krycího skla. Popřípadě lze opatřit závěsem a přímo pověsit na zeď bez rámování (vhodné do formátu 60x90 cm ) </li><li>Desky Gatorfoam jsou 5mm silné lehčené sendvičové desky pro použití v interiéru. Tvrdé jádro z extrudovaného polystyrénu a pryskyřicí impregnované extra tuhé hladké stěny zaručují vynikající tuhost a povrchovou rovinnost </li><li>Celek je možno dále rámovat bez nutnosti použití krycího skla. Popřípadě lze opatřit závěsem a přímo pověsit na zeď bez rámování (vhodné do formátu 60x90 cm ) </li><li>Jiné způsoby adjustace ( lesklá laminace, kašírování bez povrchové laminace, paspartování apod.) je třeba dohodnout individuálně telefonicky nebo mailem </li></ul> ",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}

function laminace3Function() {
		box = new LightFace({ 
		title: 'Laminace mat (adjustace dibond 3 mm, závěs hliníkový)', 
		width: 400,
		height: 210,
		content: "<ul><li>Povrchová úprava laminační fólií Protac Matt chrání fotografie před UV paprsky (prodlužuje barevnou životnost fotografie ) a zvyšuje odolnost vůči mechanickému poškození ( zalaminovanou fotografii lze čistit i vlhkým měkkým hadříkem ) </li><li>Protac Matt UV 100μ (4.0 mil) je matná PVC (vinyl) laminační fólie 75μ potažená solventní akrylovou samolepkou 25μ. Profesionální fólie eliminující reflexe při zachování barevného kontrastu a detailu. Indoor/outdoor aplikace, vysoký stupeň UV ochrany </li><li>Nakašírováním na sendvičovou hliníkovou desku Dibond vzniká velmi pevný celek, který po nalepení závěsu stačí přímo pověsit na zeď. Vhodné i pro velké formáty (až 100x300 cm) </li><li>Deska Dibond je vysoce kvalitní 3 mm silná hliníková sendvičová deska. Polyetylénové jádro a oboustranné krytí vrstvou hliníku o tloušťce 0,30 mm jim zajišťuje dokonale rovný a hladký povrch, dlouhou životnost a vysokou tvarovou stabilitu. Ideální materiál pro náročné a dlouhodobé exteriérové aplikace, použití v interiéru pro špičkové aplikace </li><li>Jiné způsoby adjustace ( lesklá laminace, kašírování bez povrchové laminace, paspartování apod.) je třeba dohodnout individuálně telefonicky nebo mailem </li></ul>",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}

function ramovaniFunction() {
		box = new LightFace({ 
		title: 'Rámování', 
		width: 400,
		height: 120,
		content: "<ul><li>Po nakašírování na Gatorfoam je fotografii možno zarámovat do hliníkového rámu Nielsen </li><li>Druhou možností je fotografii na desce opatřit závěsem a přímo pověsit na zeď bez potřeby obraz rámovat </li><li>Jiné způsoby rámování (jiný profil nebo barva rámu, rámování pod sklo, paspartování, dřevěný rám apod.) je třeba dohodnout individuálně telefonicky nebo mailem </li></ul>",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}

function zavesFunction() {
		box = new LightFace({ 
		title: 'Závěs', 
		width: 400,
		height: 80,
		content: "<ul><li>Po nakašírování na desku Gatorfoam je fotografie opatřena závěsem a lze ji přímo pověsit na zeď bez potřeby obraz rámovat </li></ul>",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}

function nielsenFunction() {
		box = new LightFace({ 
		title: 'Rám NIELSEN 02', 
		width: 400,
		height: 80,
		content: "<ul><li>Po nakašírování na Gatorfoam je fotografii možno zarámovat do hliníkového rámu Nielsen </li><li>Jiné způsoby rámování (jiný profil nebo barva rámu, rámování pod sklo, paspartování, dřevěný rám apod.) je třeba dohodnout individuálně telefonicky nebo mailem </li></ul>",
		buttons: [					
			{
				title: 'Zavřít',
				event: function() { this.close(); }
			}
		]
	});
	box.open();		
}




