function reload_code(){ elem = document.getElementById("code_image"); var xpto = new Image(); xpto.src='/captcha.php?'+Math.random(); elem.src = xpto.src; } function show_log(source, vars){ $.fn.colorbox({href:source+'?'+vars, open:true, maxHeight:200}); } function show_pesquisa(){ $.fn.colorbox({href:"#pesquisa", inline:true, open:true, maxHeight:400}); } function open_image(imageID){ $.fn.colorbox({href:'ajax_image.php?imageID='+imageID, open:true, maxHeight:700}); } function open_notice(msg){ /* object test for iframe popups */ if(typeof(parent.$) != 'undefined') $ = parent.$; $.fn.colorbox({html:'

'+msg+'

', open:true}); $(document).bind('cbox_complete', function(){ setTimeout($.fn.colorbox.close, 1000); $(document).unbind('cbox_complete'); }); } function open_error(msg){ /* object test for iframe popups */ if(typeof(parent.$) != 'undefined') $ = parent.$; $.fn.colorbox({html:'

'+msg+'

', open:true}); $(document).bind('cbox_complete', function(){ setTimeout($.fn.colorbox.close, 1000); $(document).unbind('cbox_complete'); }); } function open_required(msg){ /* object test for iframe popups */ if(typeof(parent.$) != 'undefined') $ = parent.$; $.colorbox({html:'

'+msg+'

', open:true}); $(document).bind('cbox_complete', function(){ setTimeout($.colorbox.close, 4000); $(document).unbind('cbox_complete'); }); } function lock(msg){ /* object test for iframe popups */ if(typeof(parent.$) != 'undefined') $ = parent.$; $.fn.colorbox({html:'

'+msg+'

', open:true, overlayClose:false, close:""}); } function unlock(){ /* object test for iframe popups */ if(typeof(parent.$) != 'undefined') $ = parent.$; if(typeof($.fn.colorbox) != 'undefined') $.fn.colorbox.close(); } function excluir(removeID, pagina, query){ $.fn.colorbox({html:'

'+conf_itm+'

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

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

'+conf_itm+'

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

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

'+conf_itm+'

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

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

'+conf_itm+'

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

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

'+conf_itm+'

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

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

'+conf_sel+'

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

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

'+conf_itm+'

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

', open:true}); $("#yesButtonLnk").click( function() { $.post( "components/lnk_remove.php", { remLnkID: removeID}, function(data){ $.fn.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 ''; } function noButton(){ return ''; } 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 checkTermos(campo, nome) { if (campo) { if(!campo.checked){ open_required("You have to consent to receive content from OES"); return(false); } return true; } return(true); } function checkRadio(campo, nome) { if (campo) { var checked = false; for(idx = 0; idx < campo.length; idx++){ if(campo[idx].checked == true) checked = true; } if(!checked){ open_required(fill_1 + " " + nome + "!"); return(false); } return true; } return(true); } function vazio(campo, nome) { if (campo && campo.value == "") { open_required(fill_1 + " " + nome + "!"); return(false); } return(true); } function checkWeight(campo, nome) { if (campo && campo.value == 0) { open_required(fill_1 + " " + nome + "!"); return(false); } return(true); } function imagens(campo, nome){ if(document.formulario.tem_img.value == "0"){ if(vazio(campo,nome)) return true; return false; } else return true; } // Verifica select parado function parado(campo, nome) { if (campo && campo.selectedIndex == 0 && campo.options.length>0) { open_required(fill_2 + " " + nome + "!"); return(false); } return(true); } function numeric(campo, nome) { if (campo && !IsNumeric(campo.value)) { open_required(fill_4 + " " + nome + "!"); return(false); } return(true); } function paradoMultiple(campo, nome) { if (campo && campo.type == "select-multiple") { if (campo && campo.selectedIndex == -1) { open_required(fill_2 + " " + nome + "!"); return(false); } return(true); } return(true); } function validaPassword(campo, nome) { if (campo && campo.value == "") { open_required(fill_3 + " " + nome + "!"); return(false); } else if(campo.value != document.formulario.password2.value){ open_required(fill_3 + " " + nome + "!"); return(false); } return(true); } // valida campo de email function validaEmail(email, nome) { valido = /^.*\@.*\..*$/i; if (email && email.value.search(valido) == -1) { open_required(fill_3 + " " + nome + "!"); return(false); } return(true); } function checkDates(campo, nome) { if (campo) { var checked = false; for(idx = 0; idx < campo.length; idx++){ if(campo[idx].checked == true) checked = true; } if(!checked){ open_required(fill_1 + " " + nome + "!"); return(false); } else{ if(campo[0].checked && document.formulario.dataInicio1.value == ""){ open_required(fill_1 + " " + nome + "!"); return(false); } else if (campo[1].checked && (document.formulario.dataInicio2.value == "" || document.formulario.dataFim.value == "")){ open_required(fill_1 + " " + nome + "!"); return(false); } } return true; } return(true); } function loading(msg){ var loading = '
'+msg+'
'; return loading; } function pop_page(form, w, h){ $.fn.colorbox({href:form, width: w, height: h, open:true, iframe:true}); } function open_update(mensagem) { createAlert(0, "", "", contentUpdate(mensagem)); } function contentAlert(mensagem){ createLayer(); var html; html = '
'+ok+'

' + mensagem + '
'; return html; } function contentPrompt(id, pagina, query){ createLayer(); var html; html='
'+ok+'

'+conf_itm+'
'; return html; } function contentUpdate(mensagem){ createLayer(); var html; html = '
'+ok+'

' + mensagem + '
'; return html; } function linkPrompt(id, pagina, query){ createLayer(); var html; html='
'+ok+'

'+conf_lnk+'
'; return html; } function imagemPrompt(id, pagina, query){ createLayer(); var html; html='
'+ok+'

'+conf_img+'
'; return html; } function documentoPrompt(id, pagina, query){ createLayer(); var html; html='
'+ok+'

'+conf_doc+'
'; return html; } 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(input){ return (input - 0) == input && input.length > 0; } 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; }; })();