(function(jQuery) { 'jQuery:nomunge'; // Used by YUI compressor. // A few vars used in non-awesome browsers. var interval_id, last_hash, cache_bust = 1, // A var used in awesome browsers. rm_callback, // A few convenient shortcuts. window = this, FALSE = !1, // Reused internal strings. postMessage = 'postMessage', addEventListener = 'addEventListener', p_receiveMessage, // I couldn't get window.postMessage to actually work in Opera 9.64! has_postMessage = window[postMessage] && !jQuery.browser.opera; // Method: jQuery.postMessage // // This method will call window.postMessage if available, setting the // targetOrigin parameter to the base of the target_url parameter for maximum // security in browsers that support it. If window.postMessage is not available, // the target window's location.hash will be used to pass the message. If an // object is passed as the message param, it will be serialized into a string // using the jQuery.param method. // // Usage: // // > jQuery.postMessage( message, target_url [, target ] ); // // Arguments: // // message - (String) A message to be passed to the other frame. // message - (Object) An object to be serialized into a params string, using // the jQuery.param method. // target_url - (String) The URL of the other frame this window is // attempting to communicate with. This must be the exact URL (including // any query string) of the other window for this script to work in // browsers that don't support window.postMessage. // target - (Object) A reference to the other frame this window is // attempting to communicate with. If omitted, defaults to `parent`. // // Returns: // // Nothing. jQuery[postMessage] = function(message, target_url, target) { if (!target_url) { return; } // Serialize the message if not a string. Note that this is the only real // jQuery dependency for this script. If removed, this script could be // written as very basic JavaScript. message = typeof message === 'string' ? message : jQuery.param(message); // Default to parent if unspecified. target = target || parent; if (has_postMessage) { // The browser supports window.postMessage, so call it with a targetOrigin // set appropriately, based on the target_url parameter. target[postMessage](message, target_url.replace(/([^:]+:\/\/[^\/]+).*/, 'jQuery1')); } else if (target_url) { // The browser does not support window.postMessage, so set the location // of the target to target_url#message. A bit ugly, but it works! A cache // bust parameter is added to ensure that repeat messages trigger the // callback. target.location = target_url.replace(/#.*jQuery/, '') + '#' + (+new Date) + (cache_bust++) + '&' + message; } }; // Method: jQuery.receiveMessage // // Register a single callback for either a window.postMessage call, if // supported, or if unsupported, for any change in the current window // location.hash. If window.postMessage is supported and source_origin is // specified, the source window will be checked against this for maximum // security. If window.postMessage is unsupported, a polling loop will be // started to watch for changes to the location.hash. // // Note that for simplicity's sake, only a single callback can be registered // at one time. Passing no params will unbind this event (or stop the polling // loop), and calling this method a second time with another callback will // unbind the event (or stop the polling loop) first, before binding the new // callback. // // Also note that if window.postMessage is available, the optional // source_origin param will be used to test the event.origin property. From // the MDC window.postMessage docs: This string is the concatenation of the // protocol and "://", the host name if one exists, and ":" followed by a port // number if a port is present and differs from the default port for the given // protocol. Examples of typical origins are https://example.org (implying // port 443), http://example.net (implying port 80), and http://example.com:8080. // // Usage: // // > jQuery.receiveMessage( callback [, source_origin ] [, delay ] ); // // Arguments: // // callback - (Function) This callback will execute whenever a // message is received, provided the source_origin matches. If callback is // omitted, any existing receiveMessage event bind or polling loop will be // canceled. // source_origin - (String) If window.postMessage is available and this value // is not equal to the event.origin property, the callback will not be // called. // source_origin - (Function) If window.postMessage is available and this // function returns false when passed the event.origin property, the // callback will not be called. // delay - (Number) An optional zero-or-greater delay in milliseconds at // which the polling loop will execute (for browser that don't support // window.postMessage). If omitted, defaults to 100. // // Returns: // // Nothing! jQuery.receiveMessage = p_receiveMessage = function(callback, source_origin, delay) { if (has_postMessage) { // Since the browser supports window.postMessage, the callback will be // bound to the actual event associated with window.postMessage. if (callback) { // Unbind an existing callback if it exists. rm_callback && p_receiveMessage(); // Bind the callback. A reference to the callback is stored for ease of // unbinding. rm_callback = function(e) { if ((typeof source_origin === 'string' && e.origin !== source_origin) || (jQuery.isFunction(source_origin) && source_origin(e.origin) === FALSE)) { return FALSE; } callback(e); }; } if (window[addEventListener]) { window[callback ? addEventListener : 'removeEventListener']('message', rm_callback, FALSE); } else { window[callback ? 'attachEvent' : 'detachEvent']('onmessage', rm_callback); } } else { // Since the browser sucks, a polling loop will be started, and the // callback will be called whenever the location.hash changes. interval_id && clearInterval(interval_id); interval_id = null; if (callback) { delay = typeof source_origin === 'number' ? source_origin : typeof delay === 'number' ? delay : 100; interval_id = setInterval(function() { var hash = document.location.hash, re = /^#?\d+&/; if (hash !== last_hash && re.test(hash)) { last_hash = hash; callback({ data: hash.replace(re, '') }); } }, delay); } } }; })(jQuery); // funcoes personalizadas // Edil FC 2010 // abrir links sem uso do target / validacao w3c jQuery(document).ready(function() { jQuery('a[rel=external]').attr('target', '_blank'); }); // RESIZE DA FONTE var G_valor = 2;// tamanho padrão da fonte do portal ANS --> 13px var G_tamanho = new Array(); G_tamanho[0] = '11px'; G_tamanho[1] = '12px'; G_tamanho[2] = '13px'; // tamanho padrão da fonte do portal ANS --> 13px G_tamanho[3] = '15px'; G_tamanho[4] = '16px'; G_tamanho[5] = '17px'; G_tamanho[6] = '18px'; G_tamanho[7] = '19px'; function mudafonte(valor){ G_valor = G_valor + valor; if (G_valor>G_tamanho.length-1){G_valor = 7;} if (G_valor<0){G_valor = 0;} window.document.body.style.fontSize =G_tamanho[G_valor]; } //FIM RESIZE DA FONTE jQuery.noConflict(); // FALE COM A ANS FORMULÁRIOS. UTILIZA JQUERY function organizaAbas(etapaAtual,tabNavegacaoAnterior,tabNavegacaoAtual,tabNavegacaoSeguinte){ tabNavegacaoSeguinte2 = "#tabEtapa_" + parseInt(etapaAtual+2); tabNavegacaoSeguinte2 = String(tabNavegacaoSeguinte2); tabNavegacaoAnterior2 = "#tabEtapa_" + parseInt(etapaAtual-2); tabNavegacaoAnterior2 = String(tabNavegacaoAnterior2); existeTabAnterior = jQuery(tabNavegacaoAnterior).is(':visible'); existeTabSeguinte = jQuery(tabNavegacaoSeguinte).is(':visible'); existeTabAnterior2 = jQuery(tabNavegacaoAnterior2).is(':visible'); existeTabSeguinte2 = jQuery(tabNavegacaoSeguinte2).is(':visible'); // a atual existe // atualizo a tab atual com a cor jQuery(tabNavegacaoAtual).removeClass().addClass('botaoAzulParaBranco'); // verifico se a tab atual tem mais dois níveis atrás if (existeTabAnterior2){ jQuery(tabNavegacaoAnterior2).removeClass().addClass('botaoCinzaParaCinza'); jQuery(tabNavegacaoAnterior).removeClass().addClass('botaoCinzaParaAzul'); } // verifico se a tab atual tem mais um nível atrás if (existeTabAnterior){ jQuery(tabNavegacaoAnterior).removeClass().addClass('botaoCinzaParaAzul'); } // verifico se a tab atual tem mais um nível a frente if (existeTabSeguinte){ jQuery(tabNavegacaoAtual).removeClass().addClass('botaoAzulParaCinza'); jQuery(tabNavegacaoSeguinte).removeClass().addClass('botaoCinzaParaBranco'); } // verifico se a tab atual tem mais dois níveis a frente if (existeTabSeguinte2){ jQuery(tabNavegacaoSeguinte).removeClass().addClass('botaoCinzaParaCinza'); } } // verifica e organiza os botões de enviar ou continuar automaticamente function verificaEtapaSeguinte(etapaAtual){ tabNavegacaoAtual = "#tabEtapa_" + etapaAtual; tabNavegacaoSeguinte = "#tabEtapa_" + parseInt(etapaAtual+1); tabNavegacaoAnterior = "#tabEtapa_" + parseInt(etapaAtual-1); btnEnviar = "#btnEnviarEtapa_" + parseInt(etapaAtual); btnContinuar = "#btnContinuarEtapa_" + parseInt(etapaAtual); tabNavegacaoAtual = String(tabNavegacaoAtual); // tab atual tabNavegacaoSeguinte = String(tabNavegacaoSeguinte); // tab seguinte tabNavegacaoAnterior = String(tabNavegacaoAnterior); //tab anterior btnEnviar = String(btnEnviar); btnContinuar = String(btnContinuar); // se a navegacao seguinte estiver visível, esconder o botão enviar, exibir o botao continuar if ( jQuery(tabNavegacaoSeguinte).is(':visible')){ escondeLayer(btnEnviar,'Slow'); exibeLayer(btnContinuar,'Slow'); }else{ escondeLayer(btnContinuar,'Slow'); exibeLayer(btnEnviar,'Slow'); } // acerto as cores das abas organizaAbas(etapaAtual,tabNavegacaoAnterior,tabNavegacaoAtual,tabNavegacaoSeguinte) } // funcao para alterar tamanho do iframe function createIframe(url) { var browser = jQuery.browser; var postMsg = false; if (window.postMessage) postMsg = true; var scrolling = postMsg ? "no" : "auto"; var height = postMsg ? "200" : "500"; document.write(''); } if (window.postMessage) jQuery(window).bind('message', receiveMessage, false); function receiveMessage(e){ var attr = eval('(' + e.originalEvent.data + ')'); if (attr.message == 'redimensionar'){ var iframe = jQuery('#frameConteudo'); if (iframe.length > 0 && iframe.height() != attr.height){ iframe.css("visibility", "hidden"); iframe.height(attr.height); iframe.css("visibility", "visible"); if (attr.load == true){ window.location.hash="#"; } } } } // fim funcao redimensionamento iframe // fim funcoes fale com a ANS formularios // MENU DE FUNCOES REUTILIZÁVEIS function removeClasse(objeto, classe){ jQuery(objeto).removeClass(classe); } // troca a classe de um objeto function trocaClasse(objeto, novaClasse){ jQuery(objeto).removeClass().addClass(novaClasse); } // alterna a classe de um objeto var globalClasse = false; var globalObjetoSetaAnterior = ""; // guarda o registro id do ultimo objeto exibido function alternaClasses(objeto, classe1, classe2){ if ((globalClasse==false)&&(jQuery(objeto).hasClass(classe1))){ trocaClasse(objeto, classe2) globalClasse = true; globalObjetoSetaAnterior = objeto; // guarda o registro id do objeto editado return true; // retorna valor para a chamada da funcao, caso use várias chamadas dependentes de retorno } else if(jQuery(objeto).hasClass(classe2)){// se a seta está para baixo ... suspender a seta trocaClasse(objeto, classe1) globalClasse = false; globalObjetoSetaAnterior = ""; // limpo o registro id do objeto editado return true; }else if(jQuery(globalObjetoSetaAnterior).hasClass('listaComSetasAtiva')){ // subo o item anterior que estava aberto (guardado na memoria) trocaClasse(globalObjetoSetaAnterior,'listaComSetasInativa'); escondeLayer(globalObjetoConteudoAnterior,'slow'); //abro o item atual trocaClasse(objeto, classe2) globalClasse = true; globalObjetoSetaAnterior = objeto; // guarda o registro id do objeto editado return true; } } //retorna o valor do select pela funcao function pegaValorSelect(paramSelect){ return jQuery(paramSelect).find('option').filter(':selected').text(); } // alterna a exibição de layers var globalObjetoConteudoAnterior = "" function alternaExibicaoLayer(objeto){ if (jQuery(objeto).is(':visible')) { jQuery(objeto).hide('hide'); globalObjetoConteudoAnterior = ""; return true;// retorna valor para a chamada da funcao, caso use várias chamadas dependentes de retorno } else { jQuery(objeto).show('slow'); globalObjetoConteudoAnterior = objeto; return true; } } // esconde layer,span etc... function escondeLayer(paramLayer,paramJquery){ jQuery(paramLayer).hide(paramJquery); } // exibe layer,span etc... function exibeLayer(paramLayer, paramJquery) { jQuery(paramLayer).show(paramJquery); } function autofitIframe(load) { if (load == null || load == undefined) { load = false; } if (window.postMessage) { parent.postMessage('{message:"redimensionar", height:' + jQuery('#content').height() + ', load:' + load + '}', 'http://answeb-homolog'); parent.postMessage('{message:"redimensionar", height:' + jQuery('#content').height() + ', load:' + load + '}', 'http://answeb-desenv'); parent.postMessage('{message:"redimensionar", height:' + jQuery('#content').height() + ', load:' + load + '}', 'http://answeb-producao'); parent.postMessage('{message:"redimensionar", height:' + jQuery('#content').height() + ', load:' + load + '}', 'http://www.ans.gov.br'); } } jQuery(document).ready(function() { autofitIframe(true); }); function autofitIframeWithDelay(load, tmpDelay) { setTimeout(function() { if (load == null || load == undefined) { load = false; } if (window.postMessage) { parent.postMessage('{message:"redimensionar", height:' + jQuery('#content').height() + ', load:' + load + '}', 'http://answeb-homolog'); parent.postMessage('{message:"redimensionar", height:' + jQuery('#content').height() + ', load:' + load + '}', 'http://answeb-desenv'); parent.postMessage('{message:"redimensionar", height:' + jQuery('#content').height() + ', load:' + load + '}', 'http://answeb-producao'); parent.postMessage('{message:"redimensionar", height:' + jQuery('#content').height() + ', load:' + load + '}', 'http://www.ans.gov.br'); } }, tmpDelay); } // ---------------- INICIO DHTML COM 3 NÍVEIS DE ABERTURA (ACORDEON) -------------- var globalClasse2 = false; var globalObjetoSetaAnterior2 = ""; // guarda o registro id do ultimo objeto exibido function alternaClasses2(objeto, classe1, classe2){ if ((globalClasse2==false)&&(jQuery(objeto).hasClass(classe1))){ trocaClasse(objeto, classe2) globalClasse2 = true; globalObjetoSetaAnterior2 = objeto; // guarda o registro id do objeto editado return true; // retorna valor para a chamada da funcao, caso use várias chamadas dependentes de retorno } else if(jQuery(objeto).hasClass(classe2)){// se a seta está para baixo ... suspender a seta trocaClasse(objeto, classe1) globalClasse2 = false; globalObjetoSetaAnterior2 = ""; // limpo o registro id do objeto editado return true; }else if(jQuery(globalObjetoSetaAnterior2).hasClass('listaComSetasAtiva')){ // subo o item anterior que estava aberto (guardado na memoria somente se ele estiver visível). Isso mantem o item de outra aba aberta se o usuario deixar if (jQuery(globalObjetoSetaAnterior2).is(':visible')){ trocaClasse(globalObjetoSetaAnterior2,'listaComSetasInativa'); jQuery(globalObjetoConteudoAnterior2).hide('slow'); } //abro o item atual trocaClasse(objeto, classe2) globalClasse2 = true; globalObjetoSetaAnterior2 = objeto; // guarda o registro id do objeto editado return true; } autofitIframe(); } // alterna a exibição de layers var globalObjetoConteudoAnterior2 = "" function alternaExibicaoLayer2(objeto){ if (jQuery(objeto).is(':visible')){ jQuery(objeto).hide('hide'); globalObjetoConteudoAnterior2 = ""; return true; }else{ jQuery(objeto).show('slow'); globalObjetoConteudoAnterior2 = objeto; return true; } autofitIframe(); } // ---------------- FIM DHTML COM 3 NÍVEIS DE ABERTURA (ACORDEON) --------------