function  envie_amigo  (args) {
	if (!args) var args = {'width' : 450, 'height' : 350};
	var attributes = '';
	// coloca os atributos informados e assenta de forma que a janela fique no 
	// centro da tela
	for (var i in args) attributes += ("," +  i + "=" + args[i]); 
	if (args.width && args.height) {
		var winl = (screen.width - args.width)/2;
		var wint = (screen.height - args.height)/2;
	} else {
		var winl = (screen.width)/2;
		var wint = (screen.height)/2;
	}
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	attributes += ", top=" + wint + ", left=" + winl;
	var url_estatica = document.getElementById('a_url').href;
	 
	 window.open(URLENVIE	+ '?url=' + escape(url_estatica) + '&titulo=' + TITULO, 'popup', attributes);
}

 function imprimir_cruzeiro() {
    window.print();
	return; 
}


function aumentar_font(quant) {
            // validacoes      
    var e_corpo = document.getElementById('corpo');
    if (typeof(e_corpo) != 'object') return; 
	var atual_size = e_corpo.style.fontSize;             
	// apanhando o tamanho atual
	if(!atual_size) atual_size = 12;
	else atual_size = parseInt(atual_size.replace('px'));
	if(atual_size >= 20) return;            
	modificar_geral(e_corpo, atual_size + quant);            
}

function diminuir_font(quant) {
	// validacoes      
	var e_corpo = document.getElementById('corpo');
	if (typeof(e_corpo) != 'object') return; 
	var atual_size = e_corpo.style.fontSize;             
	// apanhando o tamanho atual
	if(!atual_size) atual_size = 12;
	else atual_size = parseInt(atual_size.replace('px'));
	if(atual_size <= 12) return;             
	modificar_geral(e_corpo, atual_size - quant);            
}

function  modificar_geral(el, size) { 
	el.style.fontSize = size + 'px';
	document.getElementById('titulo').style.fontSize = size + 'px';
	document.getElementById('subtitulo').style.fontSize = size + 'px';
	
	document.getElementById('legenda_publicacao').style.fontSize = size + 'px';
	
	document.getElementById('legenda_atualizacao').style.fontSize = size + 'px';
	
	document.getElementById('navio').style.fontSize = size + 'px';
	
	document.getElementById('corpo_publicacao').style.fontSize = size + 'px';
	
	document.getElementById('corpo_atualizacao').style.fontSize = size + 'px';
	
	document.getElementById('corpo_duracao').style.fontSize = size + 'px';
	
	document.getElementById('corpo_navio').style.fontSize = size + 'px';
	
	document.getElementById('legenda_duracao').style.fontSize = size + 'px';
	
	
	
	var tags = ['div', 'p', 'h1', 'h2', 'span', 'a','f5','strong'];
	for(var i in tags) {
		// variando nos elmentos e modificando as fontes
		// corrige um eventual "bug" devido a tag dentro de tag
		var l_els = el.getElementsByTagName(tags[i]);
		for(var i=0; i< l_els.length; i++) {
			l_els[i].style.fontSize = size + 'px';
		}
	}
}


function abrir_geral (url, width, height, janela) {
	var winl = (screen.width - width)/2;
	var wint = (screen.height - height)/2;
	var union = '';
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	if(url.indexOf('?') == -1 ) union = '?'
	else{
	   union = '&' 
	} 
	url += union +'opener='+ location.href;
	
	var attributes = 'width=' + width + ', height=' + height + ', scrollbars=yes';
	attributes += ", top=" + wint + ", left=" + winl;
	window.open(url, janela, attributes);
	
	 
}


function abrir_enquete(url) {
    abrir_geral(url, 740, 465, 'enquete');	     
}
       
function abrir_quizz(url) {
    abrir_geral(url, 738, 455, 'quizz');	         
}

function abrir_galeria(url) {
	abrir_geral(url, 720, 595, 'galeria');	         
 }
 


function isEmail(email)
{
    validEmail = /^([\w\.\-])+@+([\w\.\-])+([\.])+([\w\.\-])+$/i;
    return validEmail.test(email);
}

function isEmpty(s){
	var re=/\s/g;
	var s=s.replace(re,"");
	RegExp.multiline=true;
	return(s.length==0 || s=='0,0') ? true : false;
}


