function showCatsPic(num,txt){
	pop('cats_fotos_pop.php?img='+num+'&txt='+txt,600,600);
}

function swapMenu(mnu){
	for(i=1;i<=4;i++){
		if(i!=mnu)	document.getElementById('menu_'+i).style.display = 'none';
		else document.getElementById('menu_'+i).style.display = '';
	}
}

function goTo(url){
	window.location.href = url;
}

function GE(objid){ return document.getElementById(objid);}

function doOver(obj){
	ext = obj.src.substring(obj.src.length - 4,obj.src.length);
	obj.src = obj.src.substring(0, obj.src.length - 4) + '_over' + ext;
}


function doOut(obj){
	ext = obj.src.substring(obj.src.length - 4,obj.src.length);
	obj.src = obj.src.substring(0, obj.src.length - 9) + ext;
}

function textlen(x,y){
	var thelength = x.value.length;
	window.status=thelength+' of '+y+' maximum characters.';
}

function maxtext(x,y){
	tempstr = x.value;
	if(tempstr.length>y) x.value = tempstr.substring(0,y);
	textlen(x,y);
}

function pop(x,w,h,s) {
	var l = ( (window.screen.width  - w) / 2 );
	var t = ( (window.screen.height - h) / 2 );
    janelinha = window.open(x,'fundo','leftmargin=0,topmargin=0,marginheight=0,marginwidth=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+(s==1?'yes':'no')+',resizable=no,top='+t+',left='+l+',screenX='+l+',screenY='+t+',copyhistory=no,height='+h+',width='+w+'');
	janelinha.focus();
}

function popCGV(x,w,h,s) {
	var l = ( (window.screen.width  - w) / 2 );
	var t = ( (window.screen.height - h) / 2 );
    CGVWindow = window.open(x,'fundo','leftmargin=0,topmargin=0,marginheight=0,marginwidth=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+(s==1?'yes':'no')+',resizable=no,top='+t+',left='+l+',screenX='+l+',screenY='+t+',copyhistory=no,height='+h+',width='+w+'');
}

function addFavorites(lnk, tit){
	if( window.sidebar && window.sidebar.addPanel ) {
	    //Gecko (Netscape 6 etc.) - add to Sidebar
	    window.sidebar.addPanel( tit, lnk, '' );
	} else if( window.external && ( navigator.platform == 'Win32' ||
	      ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
	    //IE Win32 or iCab - checking for AddFavorite produces errors in
	    //IE for no good reason, so I use a platform and browser detect.
	    //adds the current page page as a favourite; if this is unwanted,
	    //simply write the desired page in here instead of 'location.href'
	    window.external.AddFavorite( lnk, tit );
	} else if( window.opera && window.print ) {
	    //Opera 6+ - add as sidebar panel to Hotlist
	    return true;
	} else if( document.layers ) {
	    //NS4 & Escape - tell them how to add a bookmark quickly (adds current page,
	    //not target page)
	    window.alert( 'Por favor, clique em OK e pressione Ctrl+D para adicionar aos favoritos' );
	} else {
	    //other browsers - tell them to add a bookmark (adds current page, not target page)
	    window.alert( 'Por favor, use as opções do seu navegador para adicionar aos favoritos' );
	}
	return false;
}

function showNoLogin(){
	GE('doLogin').style.display = 'none';
	GE('noLogin').style.display = '';
}

function showLogin(){
	GE('noLogin').style.display = 'none';
	GE('doLogin').style.display = '';
}

function showCadastroLogin()
{
	GE('doLogin').style.display = '';
}

// simples validação de e-mail
function checkEmail(email) 
{
	if ((email.indexOf("@") == 0) || (email.indexOf("@") == -1) || (email.indexOf(",") != -1) || (email.indexOf("@.") != -1) || (email.indexOf("..") != -1) || (email.indexOf(" ") != -1) || (email.indexOf(".") == -1) || (email.indexOf(":") != -1)) {
		return false;
	} else if (email.length<6) {
		return false;
	}
	return true;
}

// retorna string sem espaços em brancos no inicio e fim
function trimmer(pVal)
{ 
	TRs=0; 
	for (i=0; i<pVal.length; i++) { 
		if (pVal.substr(i,1)==" ") {TRs++;} else {break;} 
	} 

	TRe=pVal.length-1; 
	for (i=TRe; i>TRs-1;i--) { 
		if (pVal.substr(i,1)==" ") {TRe--;} else {break;} 
	} 

	return (pVal.substr(TRs, TRe-TRs+1)); 
}

function popEsqueci()
{
	pop("esqueci.php",290,290,false);
}