var erro = false; var timer; function add_favoritos(){window.external.AddFavorite(self.location.href,"Maquinas Industriais");} function ve_pai(w_MIT){ str_procura = ","+w_MIT+",";param = str_pai.search(str_procura);if(parseInt(param)>-1){ v_a = str_procura;v_str_a_passar = str_pai.replace(v_a,",");str_pai = v_str_a_passar;}else{str_pai = str_pai + "," + w_MIT + ",";}} function ve_add(w_URL){if(w_URL.substr(w_URL,4,1)=="http"){window.open(w_URL);}else{if(w_URL.substr(w_URL,3,1)=="ftp"){window.open(w_URL);}else{self.location.href = w_URL + "&xpto=1&a[]=" + str_pai;}}} function ABMenu(w_menu_id){v_div = document.getElementById("l_"+w_menu_id);ve_pai(w_menu_id);if(v_div){if(v_div.style.display=="none"){v_div.style.display = "block";}else{v_div.style.display = "none";return;}}} function TPL(w_template_id,w_MIT){v_url = "../index.php?mit="+w_MIT+"&template_id=" + w_template_id;ve_add(v_url);} function Comando(w_qual,w_MIT){v_url=w_qual;v_url+=(w_qual.indexOf("?")>1) ? "&" : "?";v_url+="mit="+w_MIT;ve_add(v_url);} function IFRAMA(w_qual,w_MIT){self.location.href="/iframe.php?MIT="+w_MIT+"&p="+w_qual;} function setCookie(name, value, expires, path, domain, secure) {document.cookie= name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");} function getCookie(name){ var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } function abreMisto(w_obj,w_url,w_width,w_height){Abrew(w_url, w_obj, w_width, w_height, 1);} function veNumerico(w_obj){return isNaN(w_obj.value);} var erro; function validaCampo(wForm,wQual,wMsg,wTipo){ //alert(wForm+"--"+wQual+"--"+wMsg+"--"+wTipo) v_f = document.forms[wForm].elements[wQual]; if(erro)return false; if (v_f.value==""){ alert(wMsg); v_f.focus(); erro=true; return false; }else{ if(wTipo=="E"){ var filter=/^([a-zA-Z0-9])([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+((\.){1})([a-zA-Z0-9]{2,6})+$/; if ((v_f.value.length>0) && (!filter.test(v_f.value))) { alert("Por favor introduza um E-Mail válido!"); v_f.select(); v_f.focus(); erro=true; return false; } }else if(wTipo=="N"){ if (veNumerico(v_f)){ alert("Por favor introduza valores numéricos!"); v_f.select(); v_f.focus(); erro=true; return false; } }else if(wTipo=="D"){ if (veNumerico(v_f)){ alert("Por favor introduza valores numéricos!"); v_f.select(); v_f.focus(); erro=true; return false; } } } } function validaCombo(wForm,wQual,wSel,wMsg){if(erro)return false; v_f = document.forms[wForm].elements[wQual];if(v_f.options.selectedIndex==wSel){alert(wMsg); erro=true;}} function addOption(w_form,w_campo,w_texto,w_valor){v_form = document.forms[w_form];newoption = new Option(w_texto,w_valor, false, false);v_form.elements[w_campo].options[v_form.elements[w_campo].length] = newoption;} function delOptions(w_campo,w_form){v_form = document.forms[w_form];for(j=v_form.elements[w_campo].length;j>-1;j--){v_form.elements[w_campo].options[j]=null;}} function encheCombo(wObj,wForm,wCombo,wLimpa) { a = wLimpa.split('#'); //alert(wCombo+"---"+wObj.value+"----"); for(i=0;i'+wMsg).show(200); timer = setTimeout('$("#msg").hide(200)',3000); } function MSG_CUSTOM(wMsg){clearTimeout(timer);$("#msg_custom").hide();$("#msg_custom").html(''+wMsg).show("drop");timer = setTimeout('$("#msg_custom").html("").hide("drop")',2000);} function cal(wQual){ $("#id_"+wQual).datepicker( $.extend({ speed: 'fast' , showOn: 'both' , showAnim: 'show' , nextText: '>>' , prevText: '<<' , changeMonth: true , changeYear: true , buttonImageOnly: true , yearRange: '-70:+10' , buttonImage: "/img/cal.png" , useThemeRoller: true , mandatory: false , showStatus: true , autoSize: true , constrainInput: true , showButtonPanel: true , dateFormat: 'yy-mm-dd' , buttons: {'clear': function(event, ui){ $(this).val('');} } } , $.datepicker.regional['pt'])); } function dameHTML(w_idCaixa,w_Request,w_cal){ $("#loader").show();$("#"+w_idCaixa).html(); var v_param = w_Request + "&idc=" + w_idCaixa+"&d=" + new Date(); $.ajax({url: "/inc/dameGrelhas.php",data: w_Request + "&idc=" + w_idCaixa+"&d=" + new Date(),cache: false,success: function(html){ $("#"+w_idCaixa).html(html); if(w_cal!="" && w_cal!=undefined){var aux = w_cal.split(",");for(var i = 0; i < aux.length; ++i){cal(aux[i]);}} $("#loader").hide(); } }); } function dmHTMLGen(w_pagina,w_idCaixa,w_Request,w_cal){ $("#"+w_idCaixa).html(TXT_LOADING);$("#"+w_idCaixa).html(); var v_param = w_Request + "&idc=" + w_idCaixa+"&d=" + new Date(); $.ajax({url: w_pagina, data: w_Request + "&idc=" + w_idCaixa+"&d=" + new Date(),cache: false,success: function(html){ $("#"+w_idCaixa).html(html); if(w_cal!="" && w_cal!=undefined){var aux = w_cal.split(",");for(var i = 0; i < aux.length; ++i){cal(aux[i]);}} } }); } function imprimir(elem){var style = '';$("#"+elem).print(style);} function disableEnterKey(e){var key;if(window.event)key = window.event.keyCode;else key = e.which;return (key != 13);} function imprimeIsto(w_idcaixa,w_special,w_titulo){Abrew("/inc/print.php?idCaixa="+w_idcaixa+"&spec="+w_special+"&tit="+escape(w_titulo),w_idcaixa+"_janela",940,600,1);} function noBack(){}