function popImagem(imagem,legenda,width,height)
{
	var features= "'menubar=no,scrollbars=no,resizable,titlebar=no,top=50,left=100, width="+ width +",height="+ height+"'";
	win = window.open('','',features);	
	win.document.write("<body topmargin=2 leftmargin=3 rightmargin=3 bgcolor='#666666'><br><div align=center><img style='border:1px solid black;' src='"+imagem+"'></div><p align=right><div style='font-family:arial; font-size:11px; color:white;' align=center>"+legenda+"</div> <a href='#' style='font-family:arial; font-size:11px; color:white;' onclick='window.close()'>[ Fechar ]</a></p></body>");
}

function pop_adiciona(tipo, id)
{
	var features= "'menubar=no,scrollbars=yes,resizable=yes,titlebar=no,top=50,left=100, width=740,height=380'";
	win = window.open('boletim/adiciona_conteudo.php?tipo='+tipo+'&id='+id,'',features);
}


function testa_campos(campos)
{
	for(var x=0;x<campos.length;x++)
	{
		var campo = document.getElementById(campos[x]);
		if(campo.value=='')
		{
			alert('Preencha o campo '+campo.id+'!');
			campo.focus();
			return false;
		}
		
		if(campo.id == 'E-mail')
		{
			var emailRegxp = /^([\w]+)(.[\w]+)*@([\w]+)(.[\w]{2,3}){1,2}$/;
			if(!emailRegxp.test(campo.value))
			{
				alert('E-mail Inválido!');
				return false;
			}	
		}
	}
	return true;
}

function popup(url,w,h)
{
	window.open(url, '','width='+w+',height='+h+',resizable=yes,scrollbars=yes');
}

function mostra_div(div_id)
{
	div = document.getElementById(div_id);
	div.style.display = ( div.style.display == 'block' )? 'none' : 'block';
}

function envia_msg(id_tenista)
{	
	window.open('modulos/envia_msg.php?id_tenista='+id_tenista, '','width=400,height=300,resizable=yes');
}

function ReplaceTags(xStr)
{
	var regExp = /<\/?[^>]+>/gi;
	xStr = xStr.replace(regExp,"");
	return xStr;
}

function delay(gap){ /* gap is in millisecs */
	var then,now; then=new Date().getTime();
	now=then;
	while((now-then)<gap)
	{
		now=new Date().getTime();
	}
}//
