function checkwords(editor){ $.post("services/checkWords.php",{body:editor.getData(), instance:editor.name}, function(txt){ $('#matchedset').html(txt); if(txt.indexOf('checkbox') >0){ $.colorbox({ href:"#matches", inline:true, close:'Gem og forts�t', open:true }); $(document).bind('cbox_cleanup', function(){ vars = $('#matchedset').children().serialize(); $.ajax({ type: "POST", url: "services/linkWords.php", data: vars, success: function(data){ CKEDITOR.instances[$('#instance').val()].setData(data); } }); $(document).unbind('cbox_cleanup'); }); } else{ vars = $('#matchedset').children().serialize(); $.ajax({ type: "POST", url: "services/linkWords.php", data: vars, success: function(data){ CKEDITOR.instances[editor.name].setData(data); } }); $('#matchedset').html(''); } } ); } function CKUpdate(){ if(typeof(CKEDITOR) != "undefined"){ for ( instance in CKEDITOR.instances ) CKEDITOR.instances[instance].updateElement(); } } function processForm(json, b, c, d){ try { var reply = JSON.parse(json); } catch (e) { open_error(language.get('__erro_act')); d.find(".submit").removeClass("disabled"); return false; } if(reply.message){ if(reply.popup == 1) open_notice(reply.message, 3000); else if(reply.formID){ $("#"+reply.formID).html('') } } if(reply.update && typeof(reply.update) == 'object' && Object.keys(reply.update).length){ for(var field in reply.update) { $("INPUT[name='__h["+field+"]']").val(reply.update[field]); } } if(reply.updateOpen && typeof(reply.updateOpen) == 'object' && Object.keys(reply.updateOpen).length){ for(var field in reply.updateOpen) { $("#"+field).val(reply.updateOpen[field]); } } if(reply.success && reply.seoTarget){ /* gtag('config', 'UA-74196231-3', { 'page_title': '', 'page_location': 'https://www.nfacademy.dk/'+reply.seoTarget+'/', 'page_path': '/'+reply.seoTarget+'/' }); */ } if(reply.success && reply.fbTarget){ fbq('track', reply.fbTarget); } if(reply.success && reply.url){ $(document).on('cbox_closed', function(){ $(document).off('cbox_closed'); location.href=reply.url; }); } d.find(".submit").removeClass("disabled"); } function processError(json, b, c, d){ open_error(language.get('__erro_act')); d.find(".submit").removeClass("disabled"); } function getPrice(attrib, p, target){ $.post("services/getPrice.php", {"attrib":attrib, "pID":p},function(data) { target.html(data); }); } function setPage(url){ window.location.href = url; } function show_log(source, vars){ $.colorbox({href:source+'?'+vars, open:true, maxHeight:200}); } function show_help(mID, lang){ $.colorbox({href:'ajax_help.php', data:{"moduleID":mID, "languageID":lang }, open:true, maxHeight:200}); } function open_image(imageID){ var selectBut = ''; if(cEditor != null) selectBut = '&select=1'; $.colorbox({href:'_ajax_image.php?imageID='+imageID+selectBut, open:true, maxHeight:700}); } function processLogin(json){ var reply = JSON.parse(json); if(reply.success && reply.url){ location.href=reply.url; } if(reply.message){ open_notice(reply.message); } if(reply.url){ location.href=reply.url; } } function open_notice(msg, time){ if (typeof time === 'undefined') time = 1000; if(typeof($.fn.modal) === 'undefined') { /* object test for iframe popups */ if(typeof(parent.$) != 'undefined') $ = parent.$; $.colorbox({html:'

'+msg+'

', open:true}); $(document).bind('cbox_complete', function(){ setTimeout($.colorbox.close, time); $(document).unbind('cbox_complete'); }); } else { showBSModal({ "body":msg, "size": 'small', "css": 'alert_modal information' }); } } function open_error(msg){ if(typeof($.fn.modal) === 'undefined') { /* object test for iframe popups */ if(typeof(parent.$) != 'undefined') $ = parent.$; $.colorbox({html:'

'+msg+'

', open:true}); $(document).bind('cbox_complete', function(){ setTimeout($.colorbox.close, time); $(document).unbind('cbox_complete'); }); } else { showBSModal({ "body":msg, "size": 'small', "css": 'alert_modal danger' }); } } function excluir(removeID, pagina, query){ $.colorbox({html:'

'+language.get('__conf_itm')+'

'+ yButton('yesButton')+noButton()+'

', open:true}); $("#yesButton").click(function(){location.href = pagina + '?removeID=' + removeID +'&' + query; }); } function exclude(doThis){ $.colorbox({html:'

'+language.get('__conf_itm')+'

'+ yButton('yesButton')+noButton()+'

', open:true}); $("#yesButton").click(doThis); } function approve(doThis){ $.colorbox({html:'

'+language.get('__conf_act')+'

'+ yButton('yesButton')+noButton()+'

', open:true}); $("#yesButton").click(doThis); } function excluirCv(removeID, pagina, query){ $.colorbox({html:'

'+language.get('__conf_itm')+'

'+ yesButtonCv(removeID, pagina, query)+noButton()+'

', open:true}); } function excluirImg(removeID,type){ $.colorbox({html:'

'+language.get('__conf_itm')+'

'+ yButton('yesButtonImg')+noButton()+'

', open:true}); $("#yesButtonImg").click( function() { $.post( "components/img_remove.php", { remImgID: removeID}, function(data){ $.colorbox.close(); if(eval(data)) open_notice(imgrem); else open_error(erro_img); eval('getImg'+type+'()'); } ); } ); } function excluirDoc(removeID){ $.colorbox({html:'

'+language.get('__conf_itm')+'

'+ yButton('yesButtonDoc')+noButton()+'

', open:true}); $("#yesButtonDoc").click( function() { $.post( "components/doc_remove.php", { remDocID: removeID}, function(data){ $.colorbox.close(); if(eval(data)) open_notice(docrem); else open_error(erro_doc); getDocs(); } ); } ); } function excluirImgGal(){ $.colorbox({html:'

'+language.get('__conf_sel')+'

'+ yButton('yesButtonImg')+noButton()+'

', open:true}); $("#yesButtonImg").click(function() {removeImages();}); } function excluirLink(removeID){ $.colorbox({html:'

'+language.get('__conf_itm')+'

'+ yButton('yesButtonLnk')+noButton()+'

', open:true}); $("#yesButtonLnk").click( function() { $.post( "components/lnk_remove.php", { remLnkID: removeID}, function(data){ $.colorbox.close(); if(eval(data)) open_notice(lnkrem); else open_error(erro_lnk); getLinks(); } ); } ); } function yesButton(removeID, pagina, query){ return ''; } function yesButtonCv(removeID, pagina, query){ return ''; } function yButton(btnID){ return ''+language.get('__confirm')+''; } function noButton(){ return ''+language.get('__cancel')+''; } function show_fields(fields){ if(fields == 1){ if($("#home_promo:checked").val() != undefined){ $("#home_title").parent().show(); $("#home_desc").parent().show(); } else{ $("#home_title").parent().hide(); $("#home_desc").parent().hide(); } } else if(fields == 3){ if($("#fixed:checked").val() != undefined){ $("#aberto").parent().hide(); } else{ $("#aberto").parent().show(); } } } function show_promo(fields){ var swap; if($("#home_promo:checked").val() != undefined){ swap = $("#home_promo").parent().next(); for(var idx = 0; idx0){ $("#descricao").parent().parent().show(); } else{ $("#descricao").parent().parent().hide(); } } function setin(field, value){ if(field.value==value) field.value =''; } function setout(field, value){ if(field.value=='') field.value=value; } function checkDisable(obj, target){ var input = target.find('INPUT'); if(obj.val() == '0'){ input.val('0.00'); input.prop('disabled', true); } else{ input.prop('disabled', false); } } /*-------------------------------------------------------------------------------------------------*/ function imagens(campo, nome){ if(document.formulario.tem_img.value == "0"){ if(vazio(campo,nome)) return true; return false; } else return true; } function loading(msg){ var loading = '
'+msg+'
'; return loading; } function pop_page(form, w, h){ $.colorbox({href:form, width: w, height: h, open:true, iframe:true}); } var checkflag = false; function selectItem(row, cor1, cor2, id){ if(document.getElementById('list_item_'+id).checked==true){ document.getElementById('list_item_'+id).checked=false; row.bgColor=cor1; } else { document.getElementById('list_item_'+id).checked=true; row.bgColor=cor2; } } function mouse_over(row, cor1, bg){ if(row.bgColor==bg) row.bgColor = cor1; } function mouse_out(row, cor1, cor2){ if(row.bgColor==cor2) row.bgColor = cor1; } function selectAll(field){ if (!checkflag) { for (i = 0; i < field.length; i++) { field[i].checked = true; } checkflag = true; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = false; } } function IsNumeric(n) { return !isNaN(parseFloat(n)) && isFinite(n); } /* Array.prototype.rotate = (function() { // save references to array functions to make lookup faster var push = Array.prototype.push, splice = Array.prototype.splice; return function(count) { var len = this.length >>> 0, // convert to uint count = count >> 0; // convert to int // convert count to value in range [0, len[ count = ((count % len) + len) % len; // use splice.call() instead of this.splice() to make function generic push.apply(this, splice.call(this, 0, count)); return this; }; })();*/ function makeid() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for( var i=0; i < 10; i++ ) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } function updateDrop(source, cw, target){ var filter = $(source).val(); var drop = $(source).closest("FORM, FIELDSET").find("#"+target); //var drop = $("#"+target); $.ajax({ url:URL_GETMORE, type:'POST', data: { 'changeWhat': cw, 'param': filter, 'script' : '' }, dataType: 'json', success: function( json ) { //$('#reasonID').empty(); drop.removeOption(/[1-9]./); var arr = []; //necessary to preserve order $.each(json, function(i, value){ arr.push([i, value]); });/* arr.sort(function(a, b) { var nameA = a[1].label.toUpperCase(); // ignore upper and lowercase var nameB = b[1].label.toUpperCase(); // ignore upper and lowercase if (nameA < nameB) { return -1; } if (nameA > nameB) { return 1; } // names must be equal return 0; });*/ arr.forEach(function(v, idx){ var opt = $('