var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; function ControlVersion() { var version; var axo; var e; // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry try { // version will be set for 7.X or greater players axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); version = axo.GetVariable("$version"); } catch (e) { } if (!version) { try { // version will be set for 6.X players only axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); // installed player is some revision of 6.0 // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, // so we have to be careful. // default to the first public version version = "WIN 6,0,21,0"; // throws if AllowScripAccess does not exist (introduced in 6.0r47) axo.AllowScriptAccess = "always"; // safe to call for 6.0r47 or greater version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 4.X or 5.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 3.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = "WIN 3,0,18,0"; } catch (e) { } } if (!version) { try { // version will be set for 2.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); version = "WIN 2,0,0,11"; } catch (e) { version = -1; } } return version; } // JavaScript helper required to detect Flash Player PlugIn version information function GetSwfVer(){ // NS/Opera version >= 3 check for Flash plugin in plugin array var flashVer = -1; if (navigator.plugins != null && navigator.plugins.length > 0) { if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; var descArray = flashDescription.split(" "); var tempArrayMajor = descArray[2].split("."); var versionMajor = tempArrayMajor[0]; var versionMinor = tempArrayMajor[1]; var versionRevision = descArray[3]; if (versionRevision == "") { versionRevision = descArray[4]; } if (versionRevision[0] == "d") { versionRevision = versionRevision.substring(1); } else if (versionRevision[0] == "r") { versionRevision = versionRevision.substring(1); if (versionRevision.indexOf("d") > 0) { versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); } } var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; } } // MSN/WebTV 2.6 supports Flash 4 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; // WebTV 2.5 supports Flash 3 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; // older WebTV supports Flash 2 else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; else if ( isIE && isWin && !isOpera ) { flashVer = ControlVersion(); } return flashVer; } // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) { versionStr = GetSwfVer(); if (versionStr == -1 ) { return false; } else if (versionStr != 0) { if(isIE && isWin && !isOpera) { // Given "WIN 2,0,0,11" tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] tempString = tempArray[1]; // "2,0,0,11" versionArray = tempString.split(","); // ['2', '0', '0', '11'] } else { versionArray = versionStr.split("."); } var versionMajor = versionArray[0]; var versionMinor = versionArray[1]; var versionRevision = versionArray[2]; // is the major.revision >= requested major.revision AND the minor version >= requested minor if (versionMajor > parseFloat(reqMajorVer)) { return true; } else if (versionMajor == parseFloat(reqMajorVer)) { if (versionMinor > parseFloat(reqMinorVer)) return true; else if (versionMinor == parseFloat(reqMinorVer)) { if (versionRevision >= parseFloat(reqRevision)) return true; } } return false; } } function AC_AddExtension(src, ext) { if (src.indexOf('?') != -1) return src.replace(/\?/, ext+'?'); else return src + ext; } function AC_Generateobj(objAttrs, params, embedAttrs) { var str = ''; if (isIE && isWin && !isOpera) { str += ' '; } str += ''; } else { str += '=0) { newname += " invisible_ln"; } elm.setAttribute(cname, newname); if (mut_active_added) { $('#i2_mut_active').data("value", ln_choosed); } else { var mut_active = document.createElement("input"); mut_active.setAttribute("type", "hidden"); mut_active.setAttribute("id", "i2_mut_active"); mut_active.setAttribute("name", "i2_mut_active"); mut_active.setAttribute("value", ln_choosed); $('#form1').append(mut_active); mut_active_added = true; } for (var i=0;i0) { try { tmpobj = iframe[0].contentDocument.body; } catch (e) { try { tmpobj = iframe[0].contentWindow.document.body; } catch (e) { alert("i2error - Please, contact administrator"); } } tmpobj.value = tmpvalue; tmpobj.innerHTML = tmpvalue; } else { tmpinput.value = tmpvalue; } } i2_closeAjaxWindow(); } } function copyLangGetLabel(elm) { var labels = elm.getElementsByTagName("label"); var label; if (labels.length>0) { label = labels[0].innerHTML; // odstraneni vseho v tagu (h) return label.substr(0,label.indexOf("<")); } else { if (elm.parentNode) { try { return copyLangGetLabel(elm.parentNode); } catch (e) { return null; } } } } function saveTdWidths() { var trs = document.getElementById('form1').getElementsByTagName("tr"); var w=0;w2=0; var tds = new Array(); var tds2 = new Array(); var skip = false; var skipbox = new Array(); var tmp; for (var i=0;i0) { try { tmpobj.innerHTML = iframe[0].contentDocument.body.innerHTML; tmpobj.value = iframe[0].contentDocument.body.innerHTML; } catch (e) { try { tmpobj.value = iframe[0].contentWindow.document.body.innerHTML; } catch (e) { alert("i2error - Please, contact administrator"); } } tmpobj.parentNode.removeChild(document.getElementById(tmpobj.id+"_parent")); try { tmpobj.removeAttribute("class"); tmpobj.removeAttribute("className"); } catch (e) { //iehack } delete tinymce.EditorManager.editors[tmpobj.id]; if (ln_choosed == defaultlang) { oldobj = document.getElementById(items_ml[i]); try { oldobj.setAttribute("class", "mceEditor"); oldobj.setAttribute("className", "mceEditor"); } catch (e) { //ie hack } oldobj.style.display = "block"; } else { oldobj = document.getElementById("difln-"+ln_choosed+"-"+items_ml[i]); oldobj.setAttribute("class", "mceEditor"); oldobj.setAttribute("className", "mceEditor"); oldobj.style.display = "block"; } // tinymce i2_tmp_tinyid_styleremoving = tmpobj.id+"_parent"; i2_tinyMCEInit("i2_tinyRemoveStyle"); } else { oldobj = tmpobj; tmpobj.style.display = "none"; if (ln_choosed != defaultlang) { tmpobj=document.getElementById("difln-"+ln_choosed+"-"+items_ml[i]); } else { tmpobj=document.getElementById(items_ml[i]); } tmpobj.style.display = "inline"; // seotitle hack if (items_ml[i] == 'seotitle' && document.getElementById('seotitle_skip')) { if (document.getElementById('seotitle_skip').checked) { oldobj.value = "_onlythis_"+oldobj.value; } if (tmpobj.value.indexOf("_onlythis_")>=0) { tmpobj.value = tmpobj.value.substring(10); document.getElementById('seotitle_skip').checked = true; } else { document.getElementById('seotitle_skip').checked = false; } } } } for (var i=0;i= 0) { if (lnch == dl) { inputs[i].parentNode.parentNode.style.display = "block"; } else { inputs[i].parentNode.parentNode.style.display = "none"; } } } } function i2_ln_loadNewValues() { if (ax.readyState == 4) { i2_ajaxWaitHide(); try { ax.responseXML.normalize(); } catch (e) { // normalizovani XML, aby parser ve FF zvladl vic jak pouze 4096 bytu } if (navigator.appName == "Microsoft Internet Explorer") { var rootobj = ax.responseXML.childNodes[1]; } else { var rootobj = ax.responseXML.childNodes[0]; } var tmp = rootobj.childNodes[3]; var tmpname; var tmpinput; var tmpvalue; var tmpdiv; var j; var i; var al = rootobj.childNodes[2].firstChild.data; var dl = rootobj.childNodes[1].firstChild.data; ln_loaded.push(al); // ulozeni, ktera pole jsou promenna if (items_ml == null) items_ml = tmp; for (i=0;i=0) { $('#'+newinput[0].id).attr("value", value.substring(10)); document.getElementById('seotitle_skip').checked = true; } else { document.getElementById('seotitle_skip').checked = false; } $(input).before(newinput[0]); } else { input.parentNode.appendChild(newinput[0]); } //tinymce if ((iframe = input.parentNode.getElementsByTagName("iframe")).length>0) { tmpobj = newinput[0]; //tmpobj.innerHTML = value; tmpobj.value = value; try { input.innerHTML = iframe[0].contentDocument.body.innerHTML; input.value = iframe[0].contentDocument.body.innerHTML; } catch (e) { try { input.value = iframe[0].contentWindow.document.body.innerHTML; } catch (e) { alert("i2error - Please, contact administrator"); } } input.parentNode.removeChild(document.getElementById(input.id+"_parent")); try { document.getElementById(input.id).removeAttribute("class"); document.getElementById(input.id).removeAttribute("className"); } catch (e) { //iehack } delete tinymce.EditorManager.editors[input.id]; // tinymce i2_tinyMCEInit("i2_tinyRemoveStyle"); i2_tmp_tinyid_styleremoving = tmpobj.id+"_parent"; } } function i2_tinyRemoveStyle() { try { document.getElementById(i2_tmp_tinyid_styleremoving).style.display = "block"; } catch (e) { // catalog hack } } function i2_ln_diactiveAllTabs() { var root = document.getElementById("i2_localizedAdminTabs"); var childs = root.getElementsByTagName("div"); var cname = "class"; var newname; if (!childs[0].getAttribute(cname)) { cname = "className"; } for (var i=0;i=0) { newname += " invisible_ln"; } childs[i].setAttribute(cname, newname); } } function htmlspecialchars_decode(string, quote_style) { // Convert special HTML entities back to characters // // version: 912.1315 // discuss at: http://phpjs.org/functions/htmlspecialchars_decode // + original by: Mirek Slugen // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Mateusz "loonquawl" Zalega // + input by: ReverseSyntax // + input by: Slawomir Kaniecki // + input by: Scott Cariss // + input by: Francois // + bugfixed by: Onno Marsman // + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Brett Zamir (http://brett-zamir.me) // + input by: Ratheous // + input by: Mailfaker (http://www.weedem.fr/) // + reimplemented by: Brett Zamir (http://brett-zamir.me) // + bugfixed by: Brett Zamir (http://brett-zamir.me) // * example 1: htmlspecialchars_decode("

this -> "

", 'ENT_NOQUOTES'); // * returns 1: '

this -> "

' // * example 2: htmlspecialchars_decode("&quot;"); // * returns 2: '"' var optTemp = 0, i = 0, noquotes= false; if (typeof quote_style === 'undefined') { quote_style = 2; } string = string.toString().replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&'); var OPTS = { 'ENT_NOQUOTES': 0, 'ENT_HTML_QUOTE_SINGLE' : 1, 'ENT_HTML_QUOTE_DOUBLE' : 2, 'ENT_COMPAT': 2, 'ENT_QUOTES': 3, 'ENT_IGNORE' : 4 }; if (quote_style === 0) { noquotes = true; } if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags quote_style = [].concat(quote_style); for (i=0; i < quote_style.length; i++) { // Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4 if (OPTS[quote_style[i]] === 0) { noquotes = true; } else if (OPTS[quote_style[i]]) { optTemp = optTemp | OPTS[quote_style[i]]; } } quote_style = optTemp; } if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) { string = string.replace(/�*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should // string = string.replace(/'|�*27;/g, "'"); // This would also be useful here, but not a part of PHP } if (!noquotes) { string = string.replace(/"/g, '"'); } // Put this in last place to avoid escape being double-decoded string = string.replace(/&/g, '&'); return string; } function showEditWindow(func, elm, lang) { _tmp_active_div = elm; i2_showAjaxEditWindow(400,250,func,lang) return false; } function i2_ajaxProceedFile(fp, lang, file) { try { var name = document.getElementById("file_name").value; var desc = document.getElementById("file_desc").value; var p = "fp="+fp+"&name="+name+"&desc="+desc+"&lang="+lang+"&file="+file; _file_tmp_active_fp = file; } catch (e) { alert(e); } i2_ajaxProceedCall("I2_Attachments::fileAjaxProceed()", fileProceed, p, lang); } var _file_tmp_active_fp; var _file_tmp_active_name; var _file_tmp_active_desc; function fileProceed() { if (ax.readyState == 4) { fileActualizeOldContent(); alert('Uloženo'); i2_closeAjaxWindow(); } else { try { _file_tmp_active_name = document.getElementById("file_name").value; var gc = document.getElementById("i2_ajaxWindowGC"); gc.style.width = 400; var savet = 'Ukládám'; gc.innerHTML = '
'+savet+'
'; } catch (e) { // nekdy to nastane, nevim proc, ale img_name je // nedostupne, asi nastane stav 4 driv nez toto. Ale to je // celkem kravina } } } function fileActualizeOldContent() { try { var name = _file_tmp_active_name; if (name.length<1) name = _file_tmp_active_fp; var tr = _tmp_active_div.parentNode.parentNode; var td = tr.getElementsByTagName("td")[0]; var t = $(td).find("a"); $(t[0]).text(name); } catch (e) { //alert(e); } } function ajax_clist_choose_multi(itemid, contentid) { var inputs = document.getElementById('ctools-list').getElementsByTagName('input'); for (var i = 0; i0) $(divs[i]).css('left', width); $(divs[i]).css('top', 0); $(divs[i]).css('position', 'absolute'); } } eval('timeout_'+id+' = setTimeout("js_content_slideshow_change(\''+id+'\',null)", 5000);'); } function js_content_slideshow_fade(id) { var index = i2_ss_index.length; var width; var height; i2_ss_index.push(id); var divs = document.getElementById(id).getElementsByTagName("div"); width = $(divs[0]).width(); height = $(divs[0]).height(); $("#"+id).css('position','relative'); $("#"+id).css('overflow', 'hidden'); $("#"+id).css('width', width); $("#"+id).css('height', height); if (divs.length<2) return; for (var i=0;i0) $(divs[i]).css('display', 'none'); $(divs[i]).css('top', 0); $(divs[i]).css('left', 0); $(divs[i]).css('position', 'absolute'); } } eval('timeout_'+id+' = setTimeout("js_content_slideshow_fade_change(\''+id+'\',null)", 7000);'); } function js_content_slideshow_fade_change(id, change) { try { var divs = document.getElementById(id).getElementsByTagName("div"); var max = divs.length; var active = 0; var next = null; var index = 0; for (var i=0;i=max) next = 0; if (next<0) next = (max-1); try { $(tools[next]).removeClass('noactive'); $(tools[next]).addClass('active'); } catch (e) { } $(divs[ss_divs[active]]).stop(true,true); $(divs[ss_divs[next]]).stop(true,true); $(divs[ss_divs[active]]).fadeOut(2000); $(divs[ss_divs[next]]).fadeIn(2000); eval('timeout_'+id+' = setTimeout("js_content_slideshow_fade_change(\''+id+'\',null)", 7000);'); } catch (e) { alert(e); } } function js_content_slideshow_change(id, change) { var divs = document.getElementById(id).getElementsByTagName("div"); var max = divs.length; var active = 0; var next = null; var index = 0; for (var i=0;i=max) next = 0; if (next<0) next = (max-1); try { $(tools[next]).removeClass('noactive'); $(tools[next]).addClass('active'); } catch (e) { } $(divs[ss_divs[active]]).stop(true,true); $(divs[ss_divs[next]]).stop(true,true); $(divs[ss_divs[next]]).css('left', width); $(divs[ss_divs[active]]).css('left', 0); $(divs[ss_divs[active]]).animate({left: -width},{ queue:true, duration:1000 }); $(divs[ss_divs[next]]).animate({left: 0},{ queue:true, duration:1000 }); eval('timeout_'+id+' = setTimeout("js_content_slideshow_change(\''+id+'\',null)", 5000);'); } function i2_ss_clickNumber(elm, id) { if ($(elm.parentNode).hasClass('active')) return false; var test = 'clearTimeout(timeout_'+id+')'; try { eval(test); } catch(e) { } var num = $(elm).text(); js_content_slideshow_change(id,num); return false; } var ajaxmesid = 0; function showAjaxMessage(message) { // toto nefunguje v ie, nezjistoval jsem proc //$('#ajax-messages').append('
"+message+"
"; $('#ajax_message_id_'+ajaxmesid).css('display', 'none'); $('#ajax_message_id_'+ajaxmesid).css('float', 'right'); $('#ajax_message_id_'+ajaxmesid).fadeIn().delay(3000).slideUp(); ajaxmesid++; } $(document).ready(function() { $("#ajax-messages").css("position", "absolute"); $("#ajax-messages").css("right", "0px"); $("#ajax-messages").css("top", $(window).scrollTop() + "px"); }); $(document).ready(function() { $(".i2_dynamic_tr_sorter select").attr('onchange', 'this.parentNode.submit();'); }); $(window).scroll(function() { $("#ajax-messages").css("top", $(window).scrollTop() + "px"); }); var __skyscraper_init = false function setContentSkyscraper(img,topmargin, imgwidth, imgheight, link) { if (__skyscraper_init) return; __skyscraper_init = true; var tmpwidth = ($("#page").width()+imgwidth); var winwidth = ($(window).width()); if (winwidth < tmpwidth) return; var divover = document.createElement("div"); divover.style.width = tmpwidth + "px"; $(divover).css('margin', 'auto'); $("#page").css('float', 'left'); divover.setAttribute("id", "i2_sp_page_over"); $("#page").appendTo(divover); // $("body embed").remove(); $(".i2_flash").remove(); $("body").prepend(divover); // $(document.getElementById("__js_skyscrapper_hook").parentNode).remove(); var imgobj = document.createElement("img"); imgobj.setAttribute("src", img); var divimg = document.createElement("div"); divimg.setAttribute("id", "i2_sp_image"); imgobj.setAttribute("width", imgwidth); imgobj.setAttribute("height", imgheight); if (link == 'nolink') { $(divimg).append(imgobj); } else { var lnk = document.createElement("a"); lnk.setAttribute('href', link); $(lnk).append(imgobj); $(divimg).append(lnk); } $(divimg).css('float', 'left'); $(divimg).css('margin-top', topmargin); $(divover).append(divimg); } function i2_at_fw_proceed() { var email = $("#i2_at_fw_emails").val(); var from = $("#i2_at_fw_email_from").val(); var desc = $("#i2_at_fw_email_body").val(); var captcha_hash = $(".i2_at_captcha input").val(); var captcha_input = $("#i2_captcha_input").val(); var url = $("#i2_at_fw_url").val(); var id = $("#i2_at_fw_id").val(); var param = "email="+email+"&from="+from+"&desc="+desc+"&captcha_hash="+captcha_hash+"&captcha_input="+captcha_input+"&url="+url+"&objid="+id; i2_ajaxProceedCall("I2_Module_addthis::sendFriendProceed()", i2_at_fw_ajax_proceed, param); } function i2_at_fw_ajax_proceed() { if (ax.readyState == 4) { var resp = ax.responseText; switch(resp) { case 'error_captcha': alert('Neopsali jste správně kód z obrázku'); break; case 'error_email_from': alert('Zadali jste email ve špatném formátu (položka Od)'); break; case 'error_email_to': alert('Zadali jste email ve špatném formátu (položka Pro)'); break; case 'all_ok': alert('Email byl odeslán úspěšně.'); $("#i2_at_friend_window").dialog("destroy"); break; default: alert(' Neznámá chyba'); } } } function i2_addfavourites(url,pageName) { if (window.external) { try { window.external.AddFavorite(url,pageName) ; } catch (e) { try { window.sidebar.addPanel(pageName, url, "") } catch (f) { alert('Nelze přidat automaticky, zkuste ctrl+D'); } } } else { alert('Tuto funkci nepodporuje Váš prohlížeč'); } return false; } function dynamic_updateFields(field, ui) { dynamic_updateFields_setONOFF("ts_col_0", "on"); dynamic_updateFields_setONOFF("ts_col_1", "off"); dynamic_updateFields_controlWeight(); } function dynamic_updateFields_setONOFF(id, onoff) { var list = $("#"+id+" .id"); var length = list.length; var i; var tmp; for (i=0;i0) params += "&"; params += slcts[i].name + "=" + slcts[i].value; } params += "&selectid="+elm.getAttribute("id"); ajaxRequest(url, catalogueHandleRequestStateChange, params); } function catalogue_ajax_proceed() { var xmlDoc=ax.responseXML.documentElement; //nastaveni id pro submit //var varid = xmlDoc.getElementsByTagName("varid")[0].childNodes[0].nodeValue; //document.getElementById("_catalogue_ajax_variation_id_").value = varid.trim(); //galerie var orig = xmlDoc.getElementsByTagName("galleryimg")[0].getElementsByTagName("orig")[0].childNodes[0].nodeValue; var thumb = xmlDoc.getElementsByTagName("galleryimg")[0].getElementsByTagName("thumb")[0].childNodes[0].nodeValue; var href = xmlDoc.getElementsByTagName("galleryimg")[0].getElementsByTagName("href")[0].childNodes[0].nodeValue; var width = xmlDoc.getElementsByTagName("galleryimg")[0].getElementsByTagName("width")[0].childNodes[0].nodeValue; var height = xmlDoc.getElementsByTagName("galleryimg")[0].getElementsByTagName("height")[0].childNodes[0].nodeValue; var gdiv = document.getElementById("product_detail_gallery"); var img = gdiv.getElementsByTagName("img")[0]; img.src = thumb; img.width = width; img.height = height; var a = gdiv.getElementsByTagName("a")[0]; a.setAttribute("onclick", href); var item; var value; var i;var j; var k; var tmps; var tmpslength; var node; // promenne pole if (_catalogue_variables_fields) { for (i = 0;i<_catalogue_variables_fields.length;i++) { item = _catalogue_variables_fields[i]; value = xmlDoc.getElementsByTagName("fields")[0].getElementsByTagName(item)[0].childNodes[0].nodeValue; document.getElementById("_cat_param_"+item).innerHTML = value; } } // omezeni vyberu var filters = xmlDoc.getElementsByTagName("filters")[0]; var filterslength = filters.childNodes.length; if (filterslength) { var fname; for (i=0;istep;i--) { $(slcsts[(i-1)]).parent().parent().remove(); } } function df_addOptionSelect(oid, step,svalue,param,unique) { ajaxCreateHttp(); ajaxRequest("handle.php", df_addOptionSelectHandle, "cmd=df_addOption&oid="+oid+"&step="+step+"&svalue="+svalue+"¶m="+param+"&unique="+unique); } function df_addOptionSelectHandle() { if (ax.readyState == 4) { try { ax.responseXML.normalize(); } catch (e) { } var options = ax.responseXML.getElementsByTagName("option"); var step = $(ax.responseXML.getElementsByTagName("step")[0]).text(); var id = $(ax.responseXML.getElementsByTagName("nparam")[0]).text(); var oid = $(ax.responseXML.getElementsByTagName("oid")[0]).text(); var unique = $(ax.responseXML.getElementsByTagName("unique")[0]).text(); var ftitle = $(ax.responseXML.getElementsByTagName("title")[0]).text(); $(".ajax-loader-dynamic-form").remove(); if (options.length > 0) { var div = document.createElement("div"); var left = document.createElement("div"); var clear = document.createElement("div"); var over = document.createElement("div"); $(over).addClass("df_option"); $(clear).addClass("clear"); $(left).addClass("df_left"); $(left).text(ftitle); $(div).attr("id", id+"##df-select-step-"+step+"__"+unique); $(div).addClass("df_right") var select = document.createElement("select"); $(select).attr("id", oid+"##"+id+"__"+unique); $(select).attr("name", id); $(select).change(function () {df_changeSelect(select)}); var option = document.createElement("option"); $(option).text('Nevybráno'); $(option).attr('value', 'none'); $(select).append(option); for (var i=0;i 0){ date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat, $(dates_items[i]).val(), instance.settings ); if(date){ date.setDate(date.getDate()+plusday); $(dates_items[i]).parent().find(".end_interval_date").datepicker( "option", option, date ); } } } } $('input[class="osoba"]').change(function(){ $.post('handle.php?cmd=df_changeOsoba', {name: $(this).attr('name'), value: $(this).val()}); }); } var item_ajax_price; function df_checkPrice(elm) { var root = $(elm).parent().parent().parent().parent(); var unique = $(root).attr('title'); if (!unique) { root = $(elm).parent().parent().parent(); unique = $(root).attr('title'); } var price_elm = $(root).find(".price"); if (price_elm.length != 1) return; var isdate = false; if ($(root).find(".start_interval_date").length) { var start_date = $(root).find(".start_interval_date").val(); var end_date = $(root).find(".end_interval_date").val(); if (!start_date || !end_date) { df_removePrice(unique); return; } isdate = true; } var selects = $(root).find('select'); var tmpval; var tmpname; var val_str = ""; if (selects.length) { for (var i=0;i 0){ poplatek1 = $(poplatek1[0]).text(); poplatek1a = $(poplatek1a[0]).text(); $('#variation_hook_' + unique).parents('table').find('.poplatek1_' + unique).remove(); if(poplatek1 * 1 > 0){ $('#variation_hook_' + unique).parents('tr').after('
Lázeňský poplatek ' + days + ' x ' + poplatek1a + ' Kč
' + poplatek1 + ' Kč
'); } } if(poplatek2.length > 0){ poplatek2 = $(poplatek2[0]).text(); poplatek2a = $(poplatek2a[0]).text(); $('#variation_hook_' + unique).parents('table').find('.poplatek2_' + unique).remove(); if(poplatek2 * 1 > 0){ $('#variation_hook_' + unique).parents('tr').after('
Poplatek z hotelové kapacity ' + ((days * 1) + 1) + ' x ' + poplatek2a + ' Kč
' + poplatek2 + ' Kč
'); } } } } } function df_checkPriceComplete(price) { $('#priceComplete').find(".df_right").text(price); $('#df_hook_info_price').text(price); } function df_removePrice(unique) { $("#variation_hook_"+unique).parent().find(".price").find("div").remove(); } var date_ajax; function df_dateInputChange(elm) { var name = $(elm).attr('id'); var value = $(elm).val(); date_ajax = ajaxCreateHttp(true); ajaxRequest("handle.php?cmd=df_changeInterval", ajax_empty,"df_interval_name="+name+"&df_interval_value="+value, date_ajax); } function ajax_empty() { var completePrice = null; try { var tmpax = null if (date_ajax && date_ajax.readyState == 4) { tmpax = date_ajax; } if (remove_ajax && remove_ajax.readyState == 4) { tmpax = remove_ajax; } if (tmpax) { completePrice = $(tmpax.responseXML.getElementsByTagName("completeprice")[0]).text(); date_ajax = null; remove_ajax = null; } } catch (e) { } if (completePrice) { df_checkPriceComplete(completePrice); df_updateHooks(); } } var addition; var $this; function df_addAddition(id, obj, add) { $('.sloupec2 .info').hide(); $this = $(obj); addition = ajaxCreateHttp(true); ajaxRequest("handle.php?cmd=df_addAddition", ajax_addAddition,"id="+id+'&add='+add, addition); return false; } function ajax_addAddition() { if (addition.readyState == 4) { var overdiv = document.createElement("div"); var td1 = document.createElement("td"); var tr = document.createElement("tr"); $(td1).attr("colspan", "2"); $(td1).append(overdiv); $(tr).append(td1); try { addition.responseXML.normalize(); } catch (e) { } var l = $(addition.responseXML.getElementsByTagName("label")[0]).text(); var unique = $(addition.responseXML.getElementsByTagName("unique")[0]).text(); var oid = $(addition.responseXML.getElementsByTagName("oid")[0]).text(); var price = $(addition.responseXML.getElementsByTagName("price")[0]).text(); var itemurl = $(addition.responseXML.getElementsByTagName("url")[0]).text(); var label = document.createElement("div"); $(label).addClass("label"); var buttons = document.createElement("div"); $(buttons).addClass("buttons"); $(label).html(l); var removelabel = 'odebrat'; var button = document.createElement("div"); var link = document.createElement("a"); $(link).attr("href", "#"); $(link).attr("title", removelabel); $(link).text(removelabel); var link2 = document.createElement("a"); $(link2).attr("href", itemurl); $(link2).attr("title", 'detail'); $(link2).attr('target', '_blank'); $(link2).text('detail'); $(button).append(link2); $(button).append(link); $(buttons).append(button); $(overdiv).append(label); $(link).click(function(){ return df_removeFromSession(this, oid, unique); }); if (price) { var pricediv = document.createElement("div"); var priceleft = document.createElement("div"); var priceright = document.createElement("div"); $(pricediv).addClass("price"); $(pricediv).text(price); $(overdiv).append(pricediv); } $(overdiv).append(buttons); var clear = document.createElement('div'); $(clear).addClass('clear'); $(overdiv).append(clear); $(overdiv).css("display", "none"); $(overdiv).parents('tr').css('display', 'none'); $(overdiv).addClass("dynamic_field"); $this.parents('tr').before(tr); $(overdiv).slideDown(); $(overdiv).parents('tr').show(); try { var completeprice = $(addition.responseXML.getElementsByTagName("completeprice")[0]).text(); df_checkPriceComplete(completeprice); } catch (e) { } df_updateHooks(); } } function df_updateHooks() { var products_count = $("form .dynamic_field:has(.buttons a):visible").length; var txt = String(products_count); if (products_count == 1) { txt += ' položku '; } else if (products_count>1 && products_count<5) { txt += ' položky '; } else { txt += ' položek '; } $("#df_hook_info_count").text(txt); } var remove_ajax; function df_removeFromSession(elm, id, unique, add) { add = add || ''; remove_ajax = ajaxCreateHttp(true); ajaxRequest("handle.php?cmd=df_removeUnique", ajax_empty,"unique="+unique+"&id="+id+"&add="+add, remove_ajax); $(elm).parent().parent().slideUp(function(){ $(elm).parent().parent().parent().parent().remove(); $('.poplatek1_' + unique).remove(); $('.poplatek2_' + unique).remove(); $('.addition_' + unique).remove(); }); return false; } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function df_switchAdditionShow(id, el) { $("#" + id).slideToggle(500, function(){ if($("#" + id).is(':hidden')){ $(el).text($(el).text().indexOf('k pobytu') > -1 ? 'Přiobjednat proceduru k pobytu' : 'Přiobjednat samostatnou proceduru (nesouvisející s pobytem)'); } else{ $(el).text($(el).text().indexOf('k pobytu') > -1 ? 'Zavřít seznam procedur k pobytu' : 'Zavřít seznam procedur'); } }); return false; } function eraseCookie(name) { createCookie(name,"",-1); }