// online administration scripts $(document).ready(function () { var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0)); $(".ca_toggle").click(isTouch ? 'touchend' : 'click', function(){ var folded = $(this).hasClass("fa-chevron-right"); if (folded){ $(".a_body").removeClass("small"); $(this).toggleClass('icon_right').toggleClass('fa-chevron-left') .removeClass('fa-chevron-right').removeClass('icon_left'); setCookie("ca_folded", "0", "1000", "/"); } else{ $(".a_body").addClass("small"); $(this).toggleClass('icon_left').toggleClass('fa-chevron-right') .removeClass('fa-chevron-left').removeClass('icon_right'); setCookie("ca_folded", "1", "1000", "/"); } }); }); function assign_edits() { $(".autosize").each(function () { if ($(this).val() != "") $(this).css("width", "auto"); }); $(".direct_edit").keydown(function () { if ($(this).hasClass("autosize")) $(this).css("width", "auto"); $(this).next().show(); }); } ; function sv(id) { $('#' + id).toggle(); } ; function add_Editor(id) { var cid=id.replace('reply_to_',''); if($("#editor_"+cid).length==0&&$('#txtContent'+cid).length) { $("
").insertAfter($('#txtContent'+cid)); if(typeof window["oEdit1"] !== "undefined") //InnovaEditor { window['oEdit1'+cid]=new InnovaEditor("oEdit1"+cid); window['oEdit1'+cid].arrCustomButtons=window['oEdit1'].arrCustomButtons; window['oEdit1'+cid].groups=window['oEdit1'].groups; window['oEdit1'+cid].arrStyle=window['oEdit1'].arrStyle; window['oEdit1'+cid].flickrUser=window['oEdit1'].flickrUser; window['oEdit1'+cid].css=window['oEdit1'].css; window['oEdit1'+cid].fileBrowser=window['oEdit1'].fileBrowser; window['oEdit1'+cid].customColors=window['oEdit1'].customColors; window['oEdit1'+cid].mode=window['oEdit1'].mode; window['oEdit1'+cid].REPLACE("txtContent"+cid, "editor_"+cid); } else if(tinyMCE !== "undefined") //tinyMCE tinyMCE.execCommand('mceAddEditor',false,'txtContent'+cid); } } function svc(id) { $("#" + id).hide(); } function add_category_ajax() { var data = {}; data.cname = $("#cname").val(); data.ccolor = $("#ccolor").val(); data.parentid = $("#parentid").val(); if ($("#cmark").size() > 0) data.cmark = $("#cmark").val(); if ($("#cmark_color").size() > 0) data.cmark_color = $("#cmark_color").val(); if ($("#cat_invisible").size() > 0) data.cat_invisible = $("#cat_invisible").val(); if ($("#restricted").size() > 0) data.restricted = $("#restricted").val(); $.post("?action=add_category_ajax", data, function (re) { if (re.charAt(0) == "#") { $("#category").append(""); $("#new_cat").hide(); } else alert(re); }); } function vAddCategory(id, msg) { if ($("#cname" + id).val() == "" || $("#ccolor" + id).val() == "") { alert(msg); return false; } ; return true; } ; function vAddFeature(id, msg) { if ($(feature_name).val() == "") { alert(msg); return false; } ; return true; } ; function toggle_comment(th, id) { $.post("?action=comments&do=toggle", {comment_id: id}, function (re) { if (re == 0) alert('error!'); else { re = re.split('|'); $("#status_" + id).html(re[1]); $(th).html(re[0]); } }); } var act = null; function s_roll(id, tg, th, cn) { if (act == null) { th.className = cn; if (id != '') $('#' + id).css('visibility', (tg ? "visible" : "hidden")); } ; } function request_order(ev) { ev.preventDefault(); var th = $(this).parents("tr"), thcols = $("td", th).length; ex = ($(th).next().hasClass('order_detail')); $(".order_detail").remove(); if (ex) return; $.get($(this).attr("href") + "&hidetpl", function (data) { x = $(data).html(); $(th).closest('tr').after(''+settings.lang_l.no_prodcuts+'
'); return false; } else // there are real, published products in stock { var pr_fromInput=get_products_fromInput(); $rows=''; if(pr_fromInput.length) { $.each(pr_fromInput, function(i,v){ $rows +=build_prodcut_row(i,v,pr_fromInput.length,settings.id,settings.primaryItem); }); } else // empty input so build two empty products rows { for(var i=0;i<2;i++){ $rows +=build_prodcut_row(i,'',2,settings.id,settings.primaryItem); } } bundle_prodcuts.html('