$.ctrl = function(key, callback, args) { $(document).keydown(function(e) { if(!args) args=[]; // IE barks when args is null if(e.keyCode == key.charCodeAt(0) && e.ctrlKey) { callback.apply(this, args); return false; } }); }; jQuery.expr[':'].focus = function( elem ) { return elem === document.activeElement && ( elem.type || elem.href ); }; function replaceAll(txt, replace, with_this) { return txt.replace(new RegExp(replace, 'g'),with_this); } function echo(str){} //obsolate, do nothing function jsekho(str) { if (jsdebug) { $("#echo").html($("#echo").html()+"
"+str.replace("<","<").replace(">",">")); } } function stv_htmlspecialchars_decode(code) { code = code.replace(/xxxquotxxx/g,'"'); code = code.replace(/xxxaposxxx/g,"'"); code = code.replace(/xxxltxxx/g,"<"); //> code = code.replace(/xxxgtxxx/g,">"); code = code.replace(/xxxampxxx/g,'&'); code = code.replace(/\%20/g," "); return code; } function switch_how(elem) { var val = elem.val(); var default_val = "Send us a message"; if ((elem.hasClass("howfocused"))&&((val=="") || (val==default_val))) { //j_sekho("A"); elem.addClass("how_normal").removeClass("how_default").val(""); } else if (elem.is(":focus")) { //j_sekho("B"); elem.addClass("how_normal").removeClass("how_default"); } else if ((val=="") || (val==default_val)) { //j_sekho("C"); elem.addClass("how_default").removeClass("how_normal").val(default_val); } else { //j_sekho("D: "+val); elem.addClass("how_normal").removeClass("how_default"); } } function switch_domain(elem) { var val = elem.val(); var default_val = "www.yourdomain.com"; if ((elem.hasClass("domainfocused"))&&((val=="") || (val==default_val))) { //j_sekho("A"); elem.addClass("domain_normal").removeClass("domain_default").val(""); } else if (elem.is(":focus")) { //j_sekho("B"); elem.addClass("domain_normal").removeClass("domain_default"); } else if ((val=="") || (val==default_val)) { //j_sekho("C"); elem.addClass("domain_default").removeClass("domain_normal").val(default_val); } else { //j_sekho("D: "+val); elem.addClass("domain_normal").removeClass("domain_default"); } } function clean_how() { $(".howform .how").each(function(index) { $(this).val("").blur(); }); } function setChanged(type) { //j_sekho("setChanged: "+type); if (type==1) { $("#changed").val(1); $("#outer_footer_highlight").show(); } else { $("#changed").val(0); $("#outer_footer_highlight").hide(); } } function toggleRow(checkboxid, value) { if (typeof(value)!="undefined") { if (value==0) { var checked = $("#" + checkboxid + "_doesntexist:checked").val(); } else { var checked = 1; } } else { var checked = $("#" + checkboxid + ":checked").val(); } //j_sekho("Togglerow "+checkboxid+": "+checked); if (checked == undefined) { //j_sekho("Togglerow hide"); $("#" + checkboxid + "_row").slideUp(100); } else { //j_sekho("Togglerow show"); $("#" + checkboxid + "_row").slideDown(100); if ($("#" + checkboxid + "_row .plupload").length) { var uploader = $("#" + checkboxid + "_row .plupload").pluploadQueue(); if (typeof(parameters)!="undefined") { uploader.refresh(); // } } } } function toggleRowInverse(checkboxid) { var checked = $("#" + checkboxid + ":checked").val(); //j_sekho("TogglerowInverse "+checkboxid+": "+checked); if (checked == undefined) { //j_sekho("TogglerowInverse show"); $("#" + checkboxid + "_inverse_row").show("fast"); } else { //j_sekho("TogglerowInverse hide"); $("#" + checkboxid + "_inverse_row").hide("fast"); if ($("#" + checkboxid + "_inverse_row .plupload").length) { var uploader = $("#" + checkboxid + "_inverse_row .plupload").pluploadQueue(); if (typeof(parameters)!="undefined") { uploader.refresh(); // } } } } // WYSIWYG SECTION START function create_wysiwyg(selector, type) { //j_sekho("create_wysiwyg running: selector: "+selector+", type: "+type+" START"); if (type=="simple") { //j_sekho("create_wysiwyg type: "+type+" START"); $(selector).tinymce({ script_url : "/000_extras/jscss/tiny_mce/tiny_mce_gzip.php", theme : "advanced", mode : "none", language : "en", height:"100", width:"100%", theme_advanced_layout_manager : "SimpleLayout", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", cleanup_on_startup: false, trim_span_elements: false, verify_html: false, cleanup: false, convert_urls: false, nowrap: false, remove_linebreaks: false, convert_fonts_to_spans: false, fix_content_duplication: false, apply_source_formatting: true, force_p_newlines: true, force_br_newlines: false, convert_newlines_to_brs: false, element_format: "html", fix_list_elements: false, force_hex_style_colors: false, forced_root_block: 'p', verify_css_classes: false, accessibility_warnings : false, accessibility_focus : false }); //j_sekho("create_wysiwyg type: "+type+" END"); } else if (type=="advanced") { //j_sekho("create_wysiwyg type: "+type+" START"); $(selector).tinymce({ script_url : "/000_extras/jscss/tiny_mce/tiny_mce_gzip.php", extended_valid_elements : "a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|ceetitle]", extended_valid_elements : "iframe[src|width|height|name|align|frameborder|longdesc|marginheight|marginwidth|scrolling|border]", // General options theme : "advanced", plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", height : "400", // Theme options theme_advanced_buttons1 : "cut,copy,paste,pastetext,pasteword,|,undo,redo,|,bold,italic,underline,strikethrough,sub,sup,|,outdent,indent,blockquote,bullist,numlist,|,justifyleft,justifycenter,justifyright,justifyfull,|,forecolor,backcolor,|,formatselect,fontsizeselect", theme_advanced_buttons2 : "link,unlink,anchor,|,insertdate,inserttime,nonbreaking,charmap,|,image,media,advhr,|,tablecontrols,visualaid,|,removeformat,cleanup,|,code,fullscreen", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, valid_elements: "*[*]", // Example content CSS (should be your site CSS) content_css : "css/content.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "lists/template_list.js", external_link_list_url : "lists/link_list.js", external_image_list_url : "lists/image_list.js", media_external_list_url : "lists/media_list.js", mode : "textareas", cleanup_on_startup : false, trim_span_elements : false, verify_html : false, cleanup : false, convert_urls : false, nowrap : false, remove_linebreaks : false, convert_fonts_to_spans : false, fix_content_duplication: false, apply_source_formatting: true, force_p_newlines: true, force_br_newlines : false, convert_newlines_to_brs: false, element_format: "html", fix_list_elements: false, force_hex_style_colors: false, forced_root_block: 'p', verify_css_classes: false, accessibility_warnings : false, accessibility_focus : false, // Replace values for the template plugin template_replace_values : { username : "Some User", staffid : "991234" }, file_browser_callback : function(field_name, url, type, win) { //j_sekho("file_browser_calback running"); //j_sekho("length:"); //j_sekho($("#elfinder").length); //j_sekho("^length"); aFieldName = field_name, aWin = win; //if($("#elfinder").length != 0) //if ($("#elfinder")[0]) //{ //j_sekho("length!=0, elfinder opening:"); //$("#elfinder").elfinder("open"); //j_sekho("^elfinder opened"); //} //else //{ //j_sekho("length==0, append:"); //$("body").append($("
").attr("id", "elfinder")); //j_sekho("^appended, elfinder starting:"); //$("#elfinder").elfinder $("
").elfinder ( { url : "/000_extras/elfinder/connectors/php/connector.php", dialog : { width: 900, modal: true, title: "Files", zIndex: 900001 }, // open in dialog window editorCallback: function(url) { aWin.document.forms[0].elements[aFieldName].value = url; }, closeOnEditorCallback: true } ); //j_sekho("^elfinder started"); //} }, onchange_callback: function() { setChanged(1); } }); //j_sekho("create_wysiwyg type: "+type+" END"); } //j_sekho("create_wysiwyg running: selector: "+selector+", type: "+type+" END"); } // WYSIWYG SECTION END // PLUPLOAD SECTION START function initializeuploader(selector, pageid, parameters) { //j_sekho("initializeuploader loading"); if (typeof(parameters)=="undefined") { parameters = {}; } if (typeof(parameters.type)=="undefined") { parameters.type = "image"; } if (typeof(parameters.maxnum)=="undefined") { parameters.maxnum = 0; } if (typeof(parameters.cleanup)=="undefined") { parameters.cleanup = 0; } if (typeof(parameters.required)=="undefined") { parameters.required = 0; } if (typeof(parameters.savebutton)=="undefined") { parameters.savebutton = 0; } if (typeof(parameters.max_file_size)=="undefined") { parameters.max_file_size = "10mb"; } if (parameters.type == "unique_image") { parameters.filters = [{ title : "Image files", extensions : "jpg,gif,png" }]; parameters.multipart_params = { "type" : "unique_header_image", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum}; } else if (parameters.type == "unique_flash") { parameters.filters = [{ title : "Flash files", extensions : "swf" }]; parameters.multipart_params = { "type" : "unique_header_flash", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum }; } else if (parameters.type == "unique_customjs") { parameters.filters = [{ title : "Image files", extensions : "jpg,gif,png" }]; parameters.multipart_params = { "type" : "unique_header_customjs", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum }; } else if (parameters.type == "layout_image") { parameters.filters = [{ title : "Image files", extensions : "jpg,gif,png" }]; parameters.multipart_params = { "type" : "layout_header_image", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum}; } else if (parameters.type == "layout_flash") { parameters.filters = [{ title : "Flash files", extensions : "swf" }]; parameters.multipart_params = { "type" : "layout_header_flash", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum }; } else if (parameters.type == "layout_customjs") { parameters.filters = [{ title : "Image files", extensions : "jpg,gif,png" }]; parameters.multipart_params = { "type" : "layout_header_customjs", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum }; } else if (parameters.type == "layout_preview") { parameters.filters = [{ title : "Image files", extensions : "jpg,gif,png" }]; parameters.multipart_params = { "type" : "layout_preview", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum }; } else if (parameters.type == "myfiles") { //j_sekho("initializeuploader type=myfiles"); filters = [{ title : "All files", extensions : "doc,docx,rtf,txt,pdf,xls,xlsx,pps,jpg,gif,png,bmp,svg,eps,swf,fla,mp3,wav,ogg,wma,m4a,zip,rar,gzip,bzip,ace,ttf,mov,wmv,mp4,avi,mpg,eot,ttf,woff,svg" }]; parameters.multipart_params = { "type" : "myfiles", "id" : pageid, dir: "", "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum }; } else if (parameters.type == "site_logos") { //j_sekho("initializeuploader type=site_logos"); parameters.filters = [{ title : "Image files", extensions : "jpg,gif,png" }]; parameters.multipart_params = { "type" : "site_logos", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum }; } else if (parameters.type == "gallery_photo") { //j_sekho("initializeuploader type=gallery_photo"); parameters.filters = [{ title : "Image files", extensions : "jpg,gif,png" }]; parameters.multipart_params = { "type" : "gallery_photo", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum }; } else if (parameters.type == "album_photo") { //j_sekho("initializeuploader type=album_photo"); parameters.filters = [{ title : "Image files", extensions : "jpg,gif,png" }]; parameters.multipart_params = { "type" : "album_photo", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum }; } else if (parameters.type == "store_category_product") { jsekho("initializeuploader type=store_category_product"); parameters.filters = [{ title : "Image files", extensions : "jpg,gif,png" }]; parameters.multipart_params = { "type" : "store_category_product", "id" : pageid, "cleanup" : parameters.cleanup, "maxnum": parameters.maxnum }; } if (parameters.maxnum!=1) { parameters.multi_select = true; } else { parameters.multi_select = false; } //j_sekho("initializeuploader start pluploadQueue"); $(selector).pluploadQueue({ runtimes : "html5,html4",//silverlight,gears,flash,browserplus, max_file_size : parameters.max_file_size, url : "/plupload.php", flash_swf_url : "/000_extras/jscss/plupload/plupload.flash.swf", silverlight_xap_url : "/000_extras/jscss/plupload/plupload.silverlight.xap", rename: true, multi_selection: parameters.multi_select, multipart: true, dragdrop: false, required: parameters.required, required_features: "multipart", filters: parameters.filters, multipart_params: parameters.multipart_params, multiple_queues: true, init: { FilesAdded: function(up, files) { plupload.each(files, function(file) { if ((parameters.maxnum!=0)&&(up.files.length > parameters.maxnum)) { up.removeFile(file); } } ); } } }); if(!$(selector).next().hasClass("uploadButtonDiv")) { $(selector).after(""); $(selector).next().find("A").button({ icons: { primary: "ui-icon-disk" } }).addClass("dontconfirm").click( function(e) { e.preventDefault(); run_client_tracks( { "action":"click", "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "what_name":"away_cancel", "totango_only":1 }, { "module":"Button", "activity": "Upload: "+$("#track_where_name").val() } ); save_this(); } ); } else { } //j_sekho("initializeuploader end"); } var pluploader_binded = 0; var pluploader_image_binded = 0; var pluploader_customjs_binded = 0; var pluploader_flash_binded = 0; function plupload_save(selector, successfunctions) { plupload_files_to_delete = new Array(); //j_sekho("PL "+selector+" started"); if ($(selector).length) { //a_lert($(selector).length +" "+ selector +" "+ successfunctions); //j_sekho("PL "+selector+" length"); var uploader = $(selector).pluploadQueue(); if ((uploader.total.uploaded == 0)) { //j_sekho("PL "+selector+" before binds"); if (selector == "#plupload_image") { pluploader_binded = pluploader_image_binded; } if (selector == "#plupload_customjs") { pluploader_binded = pluploader_customjs_binded; } if (selector == "#plupload_flash") { pluploader_binded = pluploader_flash_binded; } if (!pluploader_binded) { //pluploader_binded = 1; if (selector == "#plupload_image") { pluploader_image_binded = 1; } if (selector == "#plupload_customjs") { pluploader_customjs_binded = 1; } if (selector == "#plupload_flash") { pluploader_flash_binded = 1; } uploader.bind("UploadProgress", function(up, file) { //j_sekho("PL "+selector+" UploadProgress start"); if(uploader.total.percent < 100 && uploader.total.percent >= 1) { $("#progress_bar").progressbar({"value": uploader.total.percent});//.css("width", uploader.total.percent+"%"); } if (uploader.total.uploaded == uploader.files.length) { $( "#progress_bar" ).progressbar("destroy"); // success if files uploaded for (i=0; i < plupload_files_to_delete.length; i++) { //j_sekho("removeFile i:"+i+", l:"+plupload_files_to_delete.length); up.removeFile(plupload_files_to_delete[i]); } up.removeFile(file); plupload_files_to_delete = new Array(); //j_sekho("PL "+selector+" success if files uploaded"); //j_sekho("successfunctions:"+successfunctions); eval(successfunctions); } //j_sekho("PL "+selector+" UploadProgress end"); }); uploader.bind("FileUploaded", function(up, file, ret) { //j_sekho("PL "+selector+" FileUploaded start"); fileUploaded(selector, ret); //jsekho("plupload: "+ret); plupload_files_to_delete.push(file); $(selector+" .plupload_upload_status").css("display", "none"); //up.removeFile(file); //j_sekho("PL "+selector+" FileUploaded end"); }); } } if (uploader.files.length > uploader.total.uploaded) { //j_sekho("PL "+selector+" uploader.files.length start"); open_savingdialog({ "title":"Uploading...", "text":"Please wait until the files are uploaded...


", "anim":0 }); $( "#progress_bar" ).progressbar({"value": 0}); uploader.start(); //j_sekho("PL "+selector+" uploader.files.length end"); } else if ((uploader.settings.required==1) && ($(selector+"_uploaded").val()!=1)) { //j_sekho("PL "+selector+" error start"); open_errordialog({ "text":"You must upload at least one file" }); //j_sekho("PL "+selector+" error end"); } else { // success if no files //j_sekho("PL "+selector+" success if no files"); //j_sekho("successfunctions:"+successfunctions); eval(successfunctions); } } else { // success if no uploader //j_sekho("PL "+selector+" success if no uploader"); eval(successfunctions); } } // PLUPLOAD SECTION END // SAVE SECTION START function savedata(task, data, continueTo, modal, setChange, savingdialogparameters, successfunctions) { responses = ""; if (typeof(setChange)=="undefined") { setChange = 1; } if (typeof(modal)=="undefined") { modal = 1; } if ((typeof(savingdialogparameters)=="undefined") || (typeof(savingdialogparameters)=="string")) { savingdialogparameters = {}; } if (typeof(savingdialogparameters.instantsuccess)=="undefined") { savingdialogparameters.instantsuccess = 0; } if ((typeof(savingdialogparameters.title)=="undefined") || (savingdialogparameters.title=="")) { savingdialogparameters.title = "Saving..."; } if ((typeof(savingdialogparameters.text)=="undefined") || (savingdialogparameters.text=="")) { savingdialogparameters.text = "Please wait until the page is saved...
"; } if (modal==1) { savingdialogparameters.modal = 1; } else { savingdialogparameters.modal = 0; } if (typeof(successfunctions)=="undefined") { successfunctions = ""; } if (continueTo!="") { successfunctions += " window.location.href=\'"+continueTo+"\'; "; } jsekho("sending: "+data); $.ajax({ method: "POST", type: "POST", url: "/000_ajax.php", data: "task="+task+"&data=" + data, beforeSend: function() { if (modal == 2) { $(".simplemodal-container > DIV").hide(); $(".simplemodal-container").prepend("

"+savingdialogparameters.title+"

"+savingdialogparameters.text+"
"); } else { open_savingdialog(savingdialogparameters); } }, error: function(xml, text, thrown) { var response = "0|Error|" + xml.responseText + ", " + text + ", " + thrown + "|"; responses = response.split("|"); if (modal == 2) { $(".simplemodal-container > DIV").hide(); $(".simplemodal-container").prepend("

Error: "+responses[1]+"

"+responses[2]+"
"); } else { open_errordialog({"title":responses[1],"text":responses[2],"modal":modal}); } }, success: function(response) { $("#last_response").val(response); //$("#response").html(response); jsekho(response); responses = response.split("|"); if (responses[0]==1) // Success { var templog = ""; //j_sekho("track_fields_to_update"); $.each(track_fields_to_update, function(index, value) { //j_sekho(value.type+"/"+value.from_id+"/"+value.to_id); if ( ( (value.type=="text") || (value.type=="textarea") ) && ( $("#"+value.from_id.replace(/\[/g,"\\[").replace(/\]/g,"\\]")).is(":visible") ) ) { $("#"+value.to_id).val($("#"+value.from_id).val()); } else if ( (value.type=="select") && ( $("#"+value.from_id).is(":visible") ) ) { $("#"+value.to_id).val($("#"+value.from_id+" OPTION:selected").val()); } else if ( (value.type=="radio") && ( $("INPUT[name="+value.from_id+"]:checked").is(":visible") ) ) { //j_sekho(value.type+" / "+ value.from_id+": "+$("INPUT[name="+value.from_id+"]:checked").val()+" / "+value.to_id+": "+$("#"+value.to_id).val()); $("#"+value.to_id).val($("INPUT[name="+value.from_id+"]:checked").val()); //j_sekho(value.type+" / "+ value.from_id+": "+$("INPUT[name="+value.from_id+"]:checked").val()+" / "+value.to_id+": "+$("#"+value.to_id).val()); } else if ( (value.type=="checkbox") && ( $("#"+value.from_id).is(":visible") ) ) { if ($("#"+value.from_id+":checked").length) { $("#"+value.to_id).val(1); } else { $("#"+value.to_id).val(0); } } else if ( (value.type=="logo_type") && ( $("#"+value.from_id).is(":visible") ) ) { if ($("#"+value.from_id+":checked").length) { $("#"+value.to_id).val("image"); } else { $("#"+value.to_id).val("text"); } } else { //j_sekho(value.from_id+" HIDDEN OR ERROR"); } }); if (modal == 2) { $(".simplemodal-container > DIV").hide(); $(".simplemodal-container").prepend("

"+responses[1]+"

"+responses[2]+"
"); eval(successfunctions); } else { if (!savingdialogparameters.instantsuccess) { open_successdialog({"title":responses[1],"text":responses[2],"modal":modal,"successFunction":successfunctions}); } else { eval(successfunctions); } } if (setChange) { setChanged(0); } //if (continueTo!="") //{ //window.location.href = continueTo; //} } else // Error { if (modal == 2) { $(".simplemodal-container > DIV").hide(); $(".simplemodal-container").css({"background-color":"#cd0a0a","color":"#ffffff"}).prepend("

"+responses[1]+"

"+responses[2]+"
"); $(".simplemodal-container .error H1").css({"text-shadow":"0 1px 0 rgba(0, 0, 0, 0.6)","color":"#ffffff"}); } else { open_errordialog({"title":responses[1],"text":responses[2],"modal":modal}); } } } }); } // SAVE SECTION END // DIALOG SECTION START function open_confirmdialog(type, parameters) { toReturn = true; if (typeof(parameters)=="undefined") { parameters = {}; } if ((typeof(parameters.title)=="undefined") || (parameters.title=="")) { parameters.title = "unsaved changes on this page"; } if (typeof(parameters.icon)=="undefined") { parameters.icon = "ui-icon-alert"; } if (parameters.icon != "") { parameters.icon = ""; } if ((typeof(parameters.text)=="undefined") || (parameters.text=="")) { parameters.text = "Are you sure you want to continue?"; } if (typeof(parameters.modal)=="undefined") { parameters.modal = true; } if (typeof(parameters.width)=="undefined") { parameters.width = 500; } if (typeof(parameters.height)=="undefined") { parameters.height = 180; } if (type=="general") { parameters.buttons = [ { text: "OK", click: function() { $(this).dialog("close").dialog("distroy").remove(); eval(parameters.ok); set_focus(); } }, { text: "Cancel", click: function() { $(this).dialog("close").dialog("distroy").remove(); set_focus(); } } ]; } else if (type=="away") { parameters.buttons = [ { text: "Save and continue", click: function(e) { e.preventDefault(); run_client_tracks( { "action":"click", "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "what_name":"away_cancel", "totango_only":1 }, { "module":"Button", "activity": "Save and Continue: "+$("#track_where_name").val() } ); save_this($(clicked).attr("href")); set_focus(); } }, { text: "Continue without saving", click: function(e) { e.preventDefault(); run_client_tracks( { "action":"click", "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "what_name":"away_continue" },0,"window.location.href = $(clicked).attr(\'href\');" ); } }, { text: "Cancel", click: function() { /**clientrack**/ run_client_tracks( { "action":"click", "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "what_name":"away_cancel" } ); /**clientrack**/ $(this).dialog("close").dialog("distroy").remove(); set_focus(); } } ]; } $(".ui-dialog").dialog("destroy").remove(); confirmdialog = $("
").html(parameters.text) .dialog({ autoOpen: false, title: ""+parameters.icon+""+parameters.title+"", resizable: false, modal: parameters.modal, width: parameters.width, height: parameters.height, buttons: parameters.buttons, open: function() { $(this).parent().attr("id","confirmdialog").addClass("ui-state-confirm"); $buttonPane = $(this).next(); $buttonPane.find("button:nth-child(1)").removeClass("ui-priority-secondary").addClass("ui-priority-primary"); $buttonPane.find("button:nth-child(2)").removeClass("ui-priority-primary").addClass("ui-priority-secondary"); $buttonPane.find("button:nth-child(3)").removeClass("ui-priority-primary").addClass("ui-priority-secondary"); $buttonPane.find("button:nth-child(4)").removeClass("ui-priority-primary").addClass("ui-priority-secondary"); $buttonPane.find("button:nth-child(5)").removeClass("ui-priority-primary").addClass("ui-priority-secondary"); } }); confirmdialog.dialog("open"); } function open_limitdialog(type, parameters) { // type: free_pages or free_gallery_photos toReturn = true; if (typeof(parameters)=="undefined") { parameters = {}; } if ((typeof(parameters.title)=="undefined") || (parameters.title=="")) { parameters.title = "Oops!"; } if (typeof(parameters.icon)=="undefined") { parameters.icon = "ui-icon-locked"; } if (typeof(parameters.redirect_to)=="undefined") { parameters.redirect_to = ""; } if (parameters.icon != "") { parameters.icon = ""; } if (typeof(parameters.limit)=="undefined") { parameters.limit = 10; } if (typeof(parameters.additional)=="undefined") { parameters.limit = 0; } if (typeof(parameters.available)=="undefined") { parameters.available = 0; } if (typeof(parameters.pricing_admin_url)=="undefined") { parameters.pricing_admin_url = "/admin/action/redirect/pricing_admin"; } if (typeof(parameters.modal)=="undefined") { parameters.modal = true; } if (typeof(parameters.width)=="undefined") { parameters.width = 350; } if (typeof(parameters.height)=="undefined") { parameters.height = 220; } if ((typeof(parameters.text)=="undefined") || (parameters.text=="")) { if (type=="free_pages") { parameters.text = "
You've reached your "+(parameters.limit+parameters.additional)+" Page Limit!
Our FREE Plan only includes "+parameters.limit+" pages"; if (parameters.additional>0) { parameters.text += " and you have access to "+parameters.additional+" extra pages"; } parameters.text += ". Delete any pages you are not using to free up space.
Or enhance your plan to unlock more pages."; } else if (type=="startup_pages") { parameters.text = "
You've reached your "+(parameters.limit+parameters.additional)+" Page Limit!
Our STARTUP Plan only includes "+parameters.limit+" pages"; if (parameters.additional>0) { parameters.text += " and you have access to "+parameters.additional+" extra pages"; } parameters.text += ". Delete any pages you are not using to free up space.
Or enhance your plan to unlock more pages."; } else if (type=="free_gallery_images") { parameters.text = "
You've reached your "+(parameters.limit+parameters.additional)+" Gallery Photo Limit!
Our FREE Plan only includes "+parameters.limit+" gallery photos"; if (parameters.additional>0) { parameters.text += " and you have access to "+parameters.additional+" extra photos"; } if (parameters.available>0) { parameters.text += " so you can upload only "+parameters.available+" more"; parameters.height += 20; } parameters.text += ". Delete any gallery photos you are not using to free up space.
Or enhance your plan to unlock more gallery photos."; } else if (type=="startup_gallery_images") { parameters.text = "
You've reached your "+(parameters.limit+parameters.additional)+" Gallery Photo Limit!
Our STARTUP Plan only includes "+parameters.limit+" gallery photos"; if (parameters.additional>0) { parameters.text += " and you have access to "+parameters.additional+" extra photos"; } if (parameters.available>0) { parameters.text += " so you can upload only "+parameters.available+" more"; parameters.height += 20; } parameters.text += ". Delete any gallery photos you are not using to free up space.
Or enhance your plan to unlock more gallery photos."; } else if (type=="free_storage") { parameters.text = "
You've reached your "+(parameters.limit+parameters.additional)+" MB File Storage Limit!
"; /* if (parameters.additional>0) { parameters.text += " and you have access to "+parameters.additional+" extra MB"; }*/ parameters.text += "You have no more space on the FREE Plan. To upload anything else, you will need to enhance your plan. Or, delete some files (see detailed list here)."; parameters.height += 40; } else if (type=="startup_storage") { parameters.text = "
You've reached your "+(parameters.limit+parameters.additional)+" MB File Storage Limit!
"; /* if (parameters.additional>0) { parameters.text += " and you have access to "+parameters.additional+" extra MB"; }*/ parameters.text += "You have no more space on the STARTUP Plan. To upload anything else, you will need to enhance your plan. Or, delete some files (see detailed list here)."; parameters.height += 40; } else if (type=="premium_storage") { parameters.text = "
You've reached your "+(parameters.limit+parameters.additional)+" MB File Storage Limit!
"; /* if (parameters.additional>0) { parameters.text += " and you have access to "+parameters.additional+" extra MB"; }*/ parameters.text += "You have no more space on the PREMIUM Plan. To upload anything else, you will need to contact us for a unique plan. Or, delete some files (see detailed list here)."; parameters.height += 40; } parameters.text += "" } $(".ui-dialog").dialog("destroy").remove(); limitdialog = $("
").html(parameters.text) .dialog({ autoOpen: false, title: ""+parameters.icon+""+parameters.title+"", resizable: false, modal: parameters.modal, width: parameters.width, height: parameters.height, open: function() { $(this).parent().attr("id","limitdialog").addClass("ui-state-limit"); /**clientrack**/ run_client_tracks( { "action":"popup", "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "what_name":"limit_"+type } ); /**clientrack**/ $pricing_button = $(".limit_dialog_pricing_button"); $pricing_button.button( { } ).removeClass("ui-priority-secondary").addClass("ui-priority-primary").unbind("click").click( function(e) { /**clientrack**/ run_client_tracks( { "action":"click", "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "what_name":"pricing_button", } ); /**clientrack**/ limitdialog.dialog("close"); set_focus(); } ); $pricing_link = $(".limit_dialog_pricing_link"); $pricing_link.unbind("click").click( function(e) { /**clientrack**/ run_client_tracks( { "action":"click", "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "what_name":"pricing_link", } ); /**clientrack**/ limitdialog.dialog("close"); set_focus(); } ); $close = $(".limit_dialog_close_link"); $close.unbind("click").click( function(e) { e.preventDefault(); /**clientrack**/ run_client_tracks( { "action":"click", "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "what_name":"stay_free", } ); /**clientrack**/ limitdialog.dialog("close"); if (parameters.redirect_to!="") { window.location.href= parameters.redirect_to; } } ); } }); limitdialog.dialog("open"); } function open_savingdialog(parameters) { if ((typeof(parameters)=="undefined") && ((typeof(parameters)=="string"))) { parameters = {}; } if ((typeof(parameters.title)=="undefined") || (parameters.title=="")) { parameters.title = "Saving..."; } if (typeof(parameters.icon)=="undefined") { parameters.icon = "ui-icon-disk"; } if (parameters.icon != "") { parameters.icon = ""; } if ((typeof(parameters.text)=="undefined") || (parameters.text=="")) { parameters.text = "Please wait until the page is saved...
"; } if (typeof(parameters.anim)=="undefined") { parameters.anim = 1; } if (typeof(parameters.animtext)=="undefined") { parameters.animtext = "

"; } if (parameters.anim == 1) { parameters.text += parameters.animtext; } if (typeof(parameters.modal)=="undefined") { parameters.modal = true; } if (typeof(parameters.width)=="undefined") { parameters.width = 500; } if (typeof(parameters.height)=="undefined") { parameters.height = 180; } if (typeof(parameters.buttons)=="undefined") { parameters.buttons = {}; } $(".ui-dialog").dialog("destroy").remove(); savingdialog = $("
") .html("
"+parameters.text+"
") .dialog({ autoOpen: false, closeOnEscape: true, ///false title: ""+parameters.icon+""+parameters.title+"", resizable: false, modal: parameters.modal, width: parameters.width, height: parameters.height, buttons: parameters.buttons, open: function() { $(this).parent().attr("id","savingdialog"); } }); savingdialog.dialog("open"); } function open_errordialog(parameters) { if (typeof(parameters)=="undefined") { parameters = {}; } if ((typeof(parameters.title)=="undefined") || (parameters.title=="")) { parameters.title = "Error"; } if (typeof(parameters.icon)=="undefined") { parameters.icon = "ui-icon-alert"; } if (parameters.icon != "") { parameters.icon = ""; } if ((typeof(parameters.text)=="undefined") || (parameters.text=="")) { parameters.text = "Saving was unsuccessful"; } if (typeof(parameters.modal)=="undefined") { parameters.modal = true; } if (typeof(parameters.width)=="undefined") { parameters.width = 500; } if (typeof(parameters.height)=="undefined") { parameters.height = 180; } $(".ui-dialog").dialog("destroy").remove(); errordialog = $("
").html(parameters.text) .dialog({ autoOpen: false, title: ""+parameters.icon+""+parameters.title+"", resizable: false, modal: parameters.modal, width: parameters.width, height: parameters.height, buttons: [ { text: "OK", click: function() { $(this).dialog("close"); set_focus(); } } ], open: function() { $(this).parent().attr("id","errordialog").addClass("ui-state-error"); } }); errordialog.dialog("open"); } function open_successdialog(parameters) { if (typeof(parameters)=="undefined") { parameters = {}; } if ((typeof(parameters.title)=="undefined") || (parameters.title=="")) { parameters.title = "Done"; } if (typeof(parameters.icon)=="undefined") { parameters.icon = "ui-icon-check"; } if (parameters.icon != "") { parameters.icon = ""; } if ((typeof(parameters.text)=="undefined") || (parameters.text=="")) { parameters.text = "The page has been saved."; } if (typeof(parameters.modal)=="undefined") { parameters.modal = true; } if (typeof(parameters.width)=="undefined") { parameters.width = 500; } if (typeof(parameters.height)=="undefined") { parameters.height = 180; } if (typeof(parameters.successFunction)=="undefined") { parameters.successFunction = ""; } $(".ui-dialog").dialog("destroy").remove(); successdialog = $("
").html(parameters.text) .dialog({ autoOpen: false, title: ""+parameters.icon+""+parameters.title+"", resizable: false, modal: parameters.modal, width: parameters.width, height: parameters.height, buttons: [ { text: "OK", click: function() { if (parameters.successFunction!="") { eval(parameters.successFunction); } $(this).dialog("close"); set_focus(); } } ], open: function() { $(this).parent().attr("id","successdialog").addClass("ui-state-success").find(".ui-widget-content").css({"height":"auto"}); } }); successdialog.dialog("open"); } // DIALOG SECTION END jQuery( function($) { clicked = ""; serialized = ""; // MENU SECTION START function openclose_adminmenu(id) { if ($("" + id + " > ul").is(":hidden")) { $("" + id + " > ul").slideDown("slow"); } else { $("" + id + " > ul").slideUp("slow"); } $("" + id + " > a").toggleClass("open").toggleClass("close").toggleClass("ui-corner-all").toggleClass("ui-corner-top"); $("" + id + " > a > span.ui-icon").toggleClass("ui-icon-triangle-1-w").toggleClass("ui-icon-triangle-1-s"); } $( "ul.new_adminmenu > li > a").addClass("ui-button-right").click( function() { openclose_adminmenu("#"+$(this).parent().attr("id")); return false; } ).parent().children("ul").addClass("ui-corner-bottom").addClass("ui-widget-content"); $( "ul.new_adminmenu > li > a.open").button( { icons: { secondary: "ui-icon-triangle-1-s" } } ).toggleClass("ui-corner-top").toggleClass("ui-corner-all"); $( "ul.new_adminmenu > li > a.closed").button( { icons: { secondary: "ui-icon-triangle-1-w" } } ).parent().children("ul").toggle(); $( ".ui-button-right").children(".ui-icon").css("left","auto").css("right",".2em").css("margin-left","0"); /* MENU SECTION END*/ /* $(".ui-dialog").live("keyup", function(e){ if (e.keyCode == 13) { $(":button:contains(\"OK\")").click(); } }); $(document).live("keyup", function(e) { if (e.keyCode == 13) { } } ); */ $(document).keyup(function(e){ if (e.keyCode == 27) { //$(".ui-tooltip").qtip("hide"); delete_modal_and_expose(); } else if (e.keyCode == 13) { if ($(".tour_button").length) { $(".tour_button:last").click(); } else if ($(".ui-dialog").length) { $(":button:contains(\"OK\")").click(); } } }); } ); function get_fakebody_height_true() { var a = $(window).height()-$("#stickyfooter").outerHeight(); //alert(a+" = "+$(window).height()+"-"+$("#stickyfooter").outerHeight()); var b = $(".new_headerbox").height() + $(".new_contentwrapper").height() + 20; //j_sekho("get_fakebody_height_true a:"+a+" ,b:"+b+""); if (a > b) { $("#body").css({"overflow":"hidden"}); return a; } else { $("#body").css({"overflow":"auto"}); return b; } } function get_fakebody_width_true() { return $(".new_headerbox").outerWidth(); } function delete_modal_and_expose() { //j_sekho("delete_modal_and_expose()"); if ($(".ui-tooltip").length) { //j_sekho("rct"); run_client_tracks( { "action":"tour", "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "what_details":$(".ui-tooltip-tour .ui-tooltip-title").text(), "what_name":"close" } ); } $("#body").css({"overflow":"auto"}); $(".delete_modal_and_expose").remove(); $(".new_leftbarcontainer").removeClass("notfixed").addClass("fixed"); $("#body").scroll(); set_focus(); $(".ui-tooltip").qtip("hide"); $(".ui-tooltip").remove(); } function modal_and_expose(body_expose_selector, footer_expose_selector, container_type) { $(".delete_modal_and_expose").remove(); //alert("modal_and_expose("+body_expose_selector+", "+footer_expose_selector+", "+container_type+")"); var overlay_body_zindex = 15995; var overlay_footer_zindex = 16005; var expose_body_zindex = overlay_body_zindex+1; var expose_footer_zindex = overlay_footer_zindex+1; var overexpose_body_zindex = overlay_body_zindex+2; var overexpose_footer_zindex = overlay_footer_zindex+2; //var testa = ; //var testb = ; var fakebody = $("#body"); var footer = $("#stickyfooter"); var fakebody_height_true = get_fakebody_height_true(); var footer_height_true = $("#stickyfooter").outerHeight(); //var create_new_overlay = 0; //$("#exposable_overlay_body").length; //if (!create_new_overlay) //{ fakebody.append("
 
") footer.append("
 
") fakebody.append("
 
"); footer.append("
 
"); fakebody.append("
 
"); footer.append("
 
"); //} var overlay_width = get_fakebody_width_true(); //$("#exposable_overlay_body").width(); var overlay_body = $("#exposable_overlay_body"); var overlay_footer = $("#exposable_overlay_footer"); var expose_body = $("#expose_layer_body"); var expose_footer = $("#expose_layer_footer"); var overexpose_body = $("#overexpose_layer_body"); var overexpose_footer = $("#overexpose_layer_footer"); //if (!create_new_overlay) //{ overlay_body.css({"position":"absolute", "top":"0", "left":"0",width:"100%","height":fakebody_height_true, "z-index":overlay_body_zindex}); //overlay_body.prepend("00
01
02
03
04
05
06
07
08
09
"); overlay_footer.css({"position":"absolute", "top":"-1px", "left":"0",width:"100%","height":footer_height_true, "z-index":overlay_footer_zindex}); expose_body.css({"position":overlay_body.css("position"), "top":overlay_body.css("top"), "left":overlay_body.css("left"), width:overlay_width+"px", "height":overlay_body.css("height"), "z-index":expose_body_zindex}); //expose_body.prepend("000
011
022
033
044
055
066
077
088
099
"); expose_footer.css({"position":overlay_footer.css("position"), "top":"0px", "left":overlay_footer.css("left"), width:"100%", "height":overlay_footer.css("height"), "z-index":expose_footer_zindex}); overexpose_body.css({"position":overlay_body.css("position"), "top":overlay_body.css("top"), "left":overlay_body.css("left"), width:overlay_width+"px", "height":overlay_body.css("height"), "z-index":overexpose_body_zindex}).click(function(e){delete_modal_and_expose()}); // , "display":"none" overexpose_footer.css({"position":overlay_footer.css("position"), "top":"0px", "left":overlay_footer.css("left"), width:"100%", "height":overlay_footer.css("height"), "z-index":overexpose_footer_zindex}).click(function(e){delete_modal_and_expose()}); //, "display":"none" //} //expose_body.empty(); //expose_footer.empty(); if (body_expose_selector!="") { expose_elements(body_expose_selector, expose_body, container_type); } if (footer_expose_selector!="") { expose_elements(footer_expose_selector, expose_footer, container_type); } } function expose_elements(expose_selector, expose_layer_element, container_type) { if ((container_type=="static")||(container_type=="footer")) { var parent = $("body"); } else if ((container_type=="body")||(container_type=="menu")) { var parent = $("#body"); } if (container_type!="static") { var elements_to_expose = $(expose_selector); elements_to_expose.each(function(index) { var element = $(this); //element.css({"border-width":"1px","border-style":"solid","border-color":"#ff0000"}); if (container_type=="body") { var p = element.offset(); } else if (container_type=="footer") { var p = element.position(); } else if (container_type=="menu") { var p = element.offset(); } //var p = element.offset(); //"#"+parent.attr("id") if ((p.top!=0) || (p.left!=0)) { //alert(p.top+" "+p.left+"
"); //expose_layer_element.append(p.top+" "+p.left+"
"); if (element.attr("id")=="") { element.attr("id","exposed_"+index); } var clone = element.clone(false, false); if (clone.get(0).tagName=="LI") { } clone.find(".tinymce").each( function(index) { var tinymce_id = $(this).attr("id"); $(this).after("
"); $(this).next().append($(this).next().next()); var clone_container = $(this).next(); var clone_container_html = clone_container.html(); clone_container_html = replaceAll(clone_container_html, tinymce_id, "cloned_tinymce_element_"+tinymce_id); clone_container.html(clone_container_html); $(this).attr("id","cloned_element_"+$(this).attr("id")); } ); /* var clone = element.clone(false,false).appendTo(); if (element.attr("id")=="") { element.attr("id","exposed_"+index); } */ clone.attr("id","clone_"+element.attr("id")).addClass("clone_exposed clone_exposed_"+container_type); clone.css({"position":"absolute", "top":p.top+parent.scrollTop()+"px", "left":p.left+parent.scrollLeft()+"px"}); clone.css({"width":element.width()+"px","height":element.height()+"px"}); clone.appendTo(expose_layer_element); clone.css({"margin-top":"0px","padding-top":"0px"}); //clone.css({"border-width":"1px","border-style":"solid","border-color":"#00ff00"}); } }); } } function create_new_tours_step(body_expose_selector, footer_expose_selector, tooltip_title, tooltip_content, container, target_element, target_position_my, target_position_at, prevbutton, nextbutton, nothankslink) { var counter = tours.length; tours[counter] = new Object(); tours[counter].body_expose_selector = body_expose_selector; tours[counter].footer_expose_selector = footer_expose_selector; tours[counter].tooltip_title = tooltip_title; tours[counter].tooltip_content = tooltip_content; tours[counter].container = container; tours[counter].target_element = target_element; tours[counter].target_position_my = target_position_my; tours[counter].target_position_at = target_position_at; tours[counter].prevbutton = prevbutton; tours[counter].nextbutton = nextbutton; tours[counter].nothankslink = nothankslink; } function clean_tour(start_at) { //alert(start_at); if (original_tours.length == 0) { //j_sekho("original_tours.length==0, loading tours"); original_tours = tours; //j_sekho("original_tours.length="+original_tours.length); } else { //j_sekho("original_tours.length!=0, do nothing"); } tours = new Array(); var original_goto = $("#tour").attr("goto"); for (i = 0; i < original_tours.length; i++) { var add = 0; if (original_tours[i].container == "static") { add = 1; } else { var p = original_tours[i].target_element.offset(); //j_sekho(original_tours[i].target_element.attr("id")+"("+i+", "+original_tours[i].container+"): "+p.top+"/"+p.left+"
"); if ( (p!=null) && ( (p.top!=0) || (p.left!=0) ) ) { add = 1; } } if (add) { if (original_goto == i) { $("#tour").attr("goto",tours.length); } //j_sekho("add: tours["+tours.length+"] = original_tours["+i+"];
"); tours[tours.length] = original_tours[i]; } } //alert("["+start_at+"]"); if (start_at==="") { //alert("goto"); show_tour($("#tour").attr("goto")); } else { //alert("start"); show_tour(start_at); } } function show_tour(counter) { $(".ui-tooltip").remove(); //j_sekho("show_tour/"+counter+": "+tours[counter]); var final_content = tours[counter].tooltip_content; final_content += "
"; if ((tours[counter].prevbutton==0) && (tours[counter].nextbutton==0)) { final_content += "Start Tour"; } if ((counter!=0) && (tours[counter].prevbutton!=0)) { var prev = parseFloat(counter)-1; final_content += "Back"; } if ((counter!=tours.length-1) && (tours[counter].nextbutton!=0)) { var next = parseFloat(counter)+1; final_content += "Continue Tour"; } else if (tours[counter].prevbutton!=0) { var next = parseFloat(counter)+1; final_content += "Start Editing Your Website Now"; } final_content += "
 
"; if (tours[counter].nothankslink!=0) { //final_content += ""; } final_content += "
"; /**clientrack**/ run_client_tracks( { "action":"tour", "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "what_details":tours[counter].tooltip_title, "what_id":counter, "what_name":"open" }, { "module":"Tour", "activity":$("#track_where_name").val()+" / #"+counter +" - "+ tours[counter].tooltip_title } ); /**clientrack**/ modal_and_expose_tooltip(tours[counter].body_expose_selector, tours[counter].footer_expose_selector, tours[counter].tooltip_title, final_content, tours[counter].container, tours[counter].target_element, tours[counter].target_position_my, tours[counter].target_position_at); } function show_qtip_simple(parent, target, content, qtiptype) { if (qtiptype=="stvmodal") { var position_my = 'bottom left'; var position_at = 'top center'; } else { var position_my = 'bottom right'; var position_at = 'top center'; } $('
').qtip( { content: { text: content }, position: { my: position_my, at: position_at, target: $(target), container: parent, viewport: parent, effect: false, adjust: { method: "shift", y: $("#body").scrollTop(), x: $("#body").scrollLeft() } }, show: { ready: true, solo: true, }, hide: { fixed: true, //inactive: 3000, event: "unfocus", //target: $("h2") }, style: { classes: "ui-tooltip-simple ui-tooltip-innershadow", widget: true }, events: { show: function(event, api) { /**clientrack**/ run_client_tracks( { "where_name":$("#track_where_name").val(), "where_id":$("#track_where_id").val(), "where_details":$(target).attr("track_where_details"), "what_details":$(target).attr("track_what_details"), "action":"tooltip" }, { "module":"Tooltip", "activity":$("#track_where_name").val()+" / "+ $(target).attr("track_what_details") } ); /**clientrack**/ //api.reposition(); }, move: function(event, api) { }, hide: function(event, api) { api.destroy(); } } }); } function show_qtip_video(parent, target, title, content, height, width) { $('
').qtip( { id: 'tooltip_'+$(target).attr("id"), content: { text: $("