var helpwin = null;
var helploc = null;
function help(loc) {
if (helpwin && !helpwin.closed) {
helpwin.close();
helpwin = '';
helploc = loc;
setTimeout("openhelp()",500)
} else {
helploc = loc;
openhelp();
}
}
function openhelp() {
helpwin=window.open(helploc,"help",'screenX=100,screenY=100,width=350,height=350,scrollbars=yes');
if (window.focus) {helpwin.focus()}
}
function print_self(){
window.focus();
if (typeof(window.print) != "undefined"){
window.print();
} else {
show_print_alert();
}
}
function show_print_alert() {
alert("Please use your browser's print button");
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
var pic = null;
var t_url;
var t_w;
var t_h;
//window.onunload = closePic;
function viewImage(url,w,h) {
openpic(url,w,h);
}
function openpic(url,w,h) {
if (w == null || w == 0) {
w = 120;
}
if (h == null || h == 0){
h = 120;
}
if (pic){
pic.close();
pic = null;
t_url = url;
t_w = w;
t_h = h;
setTimeout("openit()",500);
} else {
do_openpic(url,w,h);
}
}
function openit() {
do_openpic(t_url,t_w,t_h);
t_url = null;
t_w = null;
t_h = null;
}
function do_openpic(url,w,h) {
w +=30;
h +=30;
//var features = "scrollbars=auto,toolbar=yes,location=yes,menubar=yes,screenx=150,screeny=150";
var features = "dependent=yes,width=" + w + ",height=" + h + ",noresize,scrollbars=auto,toolbar=no,location=no,menubar=no,screenx=150,screeny=150";
// alert(features);
pic = window.open(url,"picwin",features);
// setTimeout("createContent()",100);
}
function createContent(){
if (!pic.document){
setTimeout("createContent()",100);
} else {
var url ="aaa";
var w=100;
var h=200;
pic.document.write('
');
pic.document.write('
');
if (window.focus){pic.focus();}
}
}
function validarEmail(email){
var re = new RegExp("^[\\w\.\_\-]+@[\\\w\_\-]\.+[\\w\_\-]$");
if (email.value.length == 0) {
alert("É necessário informar um e-mail");
email.focus();
return false;
}
if (!email.value.match(re)) {
alert("O formato do e-mail informado não é válido");
email.focus();
return false;
}
return true;
}
/////
var marcados=0;
function incr(chk)
{
marcados = (chk) ? marcados + 1 : marcados - 1;
}
function confirma(formul)
{
if(marcados == 0)
return;
if(confirm("Tem certeza que deseja apagar? ("+marcados+") selecionados"))
{
formul.confDel.value = 1;
formul.submit();
}
formul.confDel.value = 0;
}
function marcarTodos(field, box)
{
if(!field.length)
field.checked = box.checked;
for (i = 0; i < field.length; i++){
field[i].checked = box.checked;
}
}
function desmarcarTodos(field)
{
if(!field.length)
field.checked = '';
for (i = 0; i < field.length; i++){
field[i].checked = '';
}
}
function marcarEbloquearTodos(field, box)
{
if(field==null){
return;
}
if(!field.length){
field.checked = box.checked;
if(field.checked)
field.disabled = true;
else
field.disabled = false;
}
for (i = 0; i < field.length; i++){
field[i].checked = box.checked;
if(field[i].checked)
field[i].disabled = true;
else
field[i].disabled = false;
}
}
function bloquearTodos(field, box)
{
if(field==null){
return;
}
if(!field.length){
if(box.checked)
field.disabled = true;
else
field.disabled = false;
}
for (i = 0; i < field.length; i++){
if(box.checked)
field[i].disabled = true;
else
field[i].disabled = false;
}
}
function marcarTodosCount(el)
{
var formu = el.form;
var i=0;
for(i=0; i< formu.length; i++)
{
if(formu[i].type == "checkbox" && formu[i].name != el.name)
{
formu[i].checked = el.checked;
el.checked ? marcados++ : marcados--;
}
}
}
function isDefined(variable)
{
return (!(!( variable||false )))
}
function mostraDiv(id, type){
if(!isDefined(type)){
type = 'block';
}
$$(id).style.display = type;
}
function escondeDiv(id){
$$(id).style.display = 'none';
}
function mostraEsconde_div(div,padrao) {
var e = document.getElementById(div);
if(padrao || "") {
if(padrao=='table-row-custom'){
e.style.display = e.style.display=='none'? '':'none';
}
else{
e.style.display = padrao;
}
}
else {
e.style.display = e.style.display=='none'? 'block':'none';
}
}
function mostraEsconde_inline(elemento) {
var e = document.getElementById(elemento).style;
e.display = e.display=='none'? 'inline':'none';
}
function mostraEsconde_rows(tableId, rowId, tag){
var table = document.getElementById(tableId);
var len = table.rows.length;
for(var row=0; row 255) {
alert( "Unicode Character '"
+ ch
+ "' cannot be encoded using standard URL encoding.\n" +
"(URL encoding only supports 8-bit characters.)\n" +
"A space (+) will be substituted." );
encoded += "+";
} else {
encoded += "%";
encoded += HEX.charAt((charCode >> 4) & 0xF);
encoded += HEX.charAt(charCode & 0xF);
}
}
} // for
return encoded;
};
function URLDecode( str ) {
var histogram = {};
var ret = str.toString();
var replacer = function(search, replace, str) {
var tmp_arr = [];
tmp_arr = str.split(search);
return tmp_arr.join(replace);
};
// The histogram is identical to the one in urlencode.
histogram["'"] = '%27';
histogram['('] = '%28';
histogram[')'] = '%29';
histogram['*'] = '%2A';
histogram['~'] = '%7E';
histogram['!'] = '%21';
histogram['%20'] = '+';
histogram['\u20AC'] = '%80';
histogram['\u0081'] = '%81';
histogram['\u201A'] = '%82';
histogram['\u0192'] = '%83';
histogram['\u201E'] = '%84';
histogram['\u2026'] = '%85';
histogram['\u2020'] = '%86';
histogram['\u2021'] = '%87';
histogram['\u02C6'] = '%88';
histogram['\u2030'] = '%89';
histogram['\u0160'] = '%8A';
histogram['\u2039'] = '%8B';
histogram['\u0152'] = '%8C';
histogram['\u008D'] = '%8D';
histogram['\u017D'] = '%8E';
histogram['\u008F'] = '%8F';
histogram['\u0090'] = '%90';
histogram['\u2018'] = '%91';
histogram['\u2019'] = '%92';
histogram['\u201C'] = '%93';
histogram['\u201D'] = '%94';
histogram['\u2022'] = '%95';
histogram['\u2013'] = '%96';
histogram['\u2014'] = '%97';
histogram['\u02DC'] = '%98';
histogram['\u2122'] = '%99';
histogram['\u0161'] = '%9A';
histogram['\u203A'] = '%9B';
histogram['\u0153'] = '%9C';
histogram['\u009D'] = '%9D';
histogram['\u017E'] = '%9E';
histogram['\u0178'] = '%9F';
for (replace in histogram) {
search = histogram[replace]; // Switch order when decoding
ret = replacer(search, replace, ret) // Custom replace. No regexing
}
// End with decodeURIComponent, which most resembles PHP's encoding functions
ret = decodeURIComponent(ret);
return ret;
}
function showDivAndHideAllOthers(classToHide, divIdToShow, classToUncheck, radioIdToCheck){
actualDisplay = $('#'+divIdToShow).css('display');
$('.'+classToHide).hide();
$('.session-title').attr('class','session-title clickable');
$('.'+classToUncheck).attr('checked', '');
if(actualDisplay=='none'){
$('#'+divIdToShow).show();
$('#'+divIdToShow+'_title').attr('class','session-title clickable');
$('#'+radioIdToCheck).attr('checked', 'checked');
}
else{
$('#'+divIdToShow).hide();
$('#'+divIdToShow+'_title').attr('class','session-title clickable');
}
}
function changeMoreOptionsImg(imgId){
imgId = '#'+imgId;
if($(imgId).attr('src') == 'images/icone-seta-busca-up-branco.gif'){
$(imgId).attr('src','images/icone-seta-busca-down.gif');
}
else{
$(imgId).attr('src','images/icone-seta-busca-up-branco.gif');
}
}
function changeMoreOptionsImg2(imgId){
imgId = '#'+imgId;
if($(imgId).attr('src') == 'images/icone-seta-right.gif'){
$(imgId).attr('src','images/icone-seta-busca-down.gif');
}
else{
$(imgId).attr('src','images/icone-seta-right.gif');
}
}
function changeMoreOptionsImg3(imgId){
imgId = '#'+imgId;
if($(imgId).attr('src') == 'images/icone-seta-busca-down-preta.gif'){
$(imgId).attr('src','images/icone-seta-busca-up.gif');
}
else{
$(imgId).attr('src','images/icone-seta-busca-down-preta.gif');
}
}
function showContextMenu(tdId, divId, offsetTop) {
var left = $('#'+tdId).offset().left;
var top = $('#'+tdId).offset().top;
var widthDiv = $('#'+tdId + ' span:first').width() + 25;
showContextMenuPosition(left, top, widthDiv, divId, offsetTop);
}
function showContextMenuPositionLeft(tdId, divId, positionLeft, offsetTop) {
var left = $('#'+tdId).offset().left - positionLeft;
var top = $('#'+tdId).offset().top;
showContextMenuPosition(left, top, 0, divId, offsetTop);
}
function showContextMenuPosition(left, top, widthDiv, divId, offsetTop) {
$('#'+divId).css('left', left + widthDiv);
$('#'+divId).css('top', top + offsetTop);
}
function changeImagemAndResetOthers(imgId, imgClass, imgSrc1, imgSrc2){
actualArc = $('#'+imgId).attr('src')
$('.'+imgClass).attr('src',imgSrc1);
imgSrc = (actualArc == imgSrc1 ? imgSrc2 : imgSrc1)
$('#'+imgId).attr('src',imgSrc);
}
function validateUrl(url){
if(url == null || url.value == ''){
alert('Campo URL não pode ser vazio');
return false;
}
var urlregex = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
if(urlregex.test(url)){
return(true);
}
else{
alert('É necessário digitar uma URL válida.');
return(false);
}
}
function showDivAndHideOthers(divIdToShow, imgIdToChange, offsetLeft){
//seta valores default
$('.image-arrow2').attr('src','images/icone-seta-incluir-contatos.gif');
$('.image-arrow-in_table').attr('src','images/icone-seta-incluir-contatos.gif');
$('.image-arrow-in_table-enabled').attr('src','images/icone-seta-incluir-contatos-azul.gif');
$('.modal-extremehard').hide();
//mostra div e inverte imagem da seta
if(divIdToShow) {
$('#'+divIdToShow).css('left',$('#'+imgIdToChange).offset().left + $('#'+imgIdToChange).width() - $('#'+divIdToShow).width() + offsetLeft);
$('#'+divIdToShow).css('top',$('#'+imgIdToChange).offset().top + $('#'+imgIdToChange).height());
$('#'+divIdToShow).show();
$('#'+imgIdToChange).attr('src','images/icone-seta-incluir-contatos-up.gif');
$('#modal-overlay').css('opacity',0);
$('#modal-overlay').css('filter','alpha(opacity=0)');
$('#modal-overlay').css('width',$(window).width());
$('#modal-overlay').css('height',$('#geral').height()+40);
$('#modal-overlay').show();
}
}
function closePopup(){
interface.display('pop-conteudo', 'none');
interface.overlay();
}
function checkOrUncheckId(checkboxId){
if($('#'+checkboxId).attr('checked')){
$('#'+checkboxId).attr('checked','');
}
else{
$('#'+checkboxId).attr('checked','checked');
}
}
function checkOrUncheckClass(checkBoxIdReference, checkboxClass){
if(!$('#'+checkBoxIdReference).attr('checked')){
$('.'+checkboxClass).attr('checked','');
}
else{
$('.'+checkboxClass).attr('checked','checked');
}
}
function checkOrUncheckClassAndDisableIfChecked(checkBoxIdReference, checkboxClass){
if(!$('#'+checkBoxIdReference).attr('checked')){
$('.'+checkboxClass).attr('checked','');
$('.'+checkboxClass).attr('disabled','');
}
else{
$('.'+checkboxClass).attr('checked','checked');
$('.'+checkboxClass).attr('disabled','disabled');
}
}