// Menu Condessa ----------------------------------------
function mmLoadMenus() {
  if (window.mm_menu_1220103813_0) return;
                            window.mm_menu_1220103813_0 = new Menu("root",77,17,"Arial, Helvetica, sans-serif",11,"#990000","#990000","#FFFFFF","#F3F3F3","center","middle",3,0,1000,-5,7,true,true,false,0,true,true);
  mm_menu_1220103813_0.addMenuItem("Histórico","location='#'");
  mm_menu_1220103813_0.addMenuItem("Missão","location='#'");
  mm_menu_1220103813_0.addMenuItem("Valores","location='#'");
  mm_menu_1220103813_0.addMenuItem("Equipe","location='#'");
   mm_menu_1220103813_0.fontWeight="bold";
   mm_menu_1220103813_0.hideOnMouseOut=true;
   mm_menu_1220103813_0.bgColor='#C30101';
   mm_menu_1220103813_0.menuBorder=1;
   mm_menu_1220103813_0.menuLiteBgColor='#C30101';
   mm_menu_1220103813_0.menuBorderBgColor='#FFFFFF';

  window.mm_menu_1222155221_0 = new Menu("root",75,17,"Arial, Helvetica, sans-serif",11,"#990000","#990000","#FFFFFF","#F3F3F3","center","middle",3,0,1000,-5,7,true,true,false,0,true,true);
  mm_menu_1222155221_0.addMenuItem("Teóricos","location='#'");
  mm_menu_1222155221_0.addMenuItem("Práticos","location='#'");
   mm_menu_1222155221_0.fontWeight="bold";
   mm_menu_1222155221_0.hideOnMouseOut=true;
   mm_menu_1222155221_0.bgColor='#C30101';
   mm_menu_1222155221_0.menuBorder=1;
   mm_menu_1222155221_0.menuLiteBgColor='#C30101';
   mm_menu_1222155221_0.menuBorderBgColor='#FFFFFF';

        window.mm_menu_1222174436_0 = new Menu("root",121,17,"Arial, Helvetica, sans-serif",11,"#990000","#990000","#FFFFFF","#F3F3F3","center","middle",3,0,1000,-5,7,true,true,false,0,true,true);
  mm_menu_1222174436_0.addMenuItem("Advertêcia","location='#'");
  mm_menu_1222174436_0.addMenuItem("Regulamentação","location='#'");
   mm_menu_1222174436_0.fontWeight="bold";
   mm_menu_1222174436_0.hideOnMouseOut=true;
   mm_menu_1222174436_0.bgColor='#C30101';
   mm_menu_1222174436_0.menuBorder=1;
   mm_menu_1222174436_0.menuLiteBgColor='#C30101';
   mm_menu_1222174436_0.menuBorderBgColor='#FFFFFF';

mm_menu_1222174436_0.writeMenus();
} // mmLoadMenus()

//-----------------------------------------------------------------------

function question( pergunta )
{
	if ( confirm( pergunta ) ) {
		return true;
	} else {
		return false;
	}
}

// CTRL
function identifyer( folder )
{
	top.document.forms[0].identifyer.value=folder;
}

var old_id;
function showBanda( id )
{
	document.getElementById( id ).style.display=(document.getElementById( id ).style.display=='' ? 'none' : '');
	if ( old_id ) {
		document.getElementById( oldId ).style.display='none';
	}
	old_id = id;
}


var oldMenu = 0;
	function showMenu(xMenu)
	{
		if ( oldMenu )
		{
			offMenu( oldMenu );	
		}
		
		document.getElementById( xMenu ).style.display = '';
		oldMenu = xMenu;
		
	}
	
	function offTimeOutMenu( xMenu )
	{
		setTimeout( "offMenu('"+xMenu+"')", 4000 );
	}
	
	function offMenu( xMenu )
	{
		document.getElementById( xMenu ).style.display = 'none';
	}

// ------------ SCRIPS PARA PÁGINAS --------------------

/*
var oldId = '';
function openFolder( id )
{
	oldId = id;
	var obj = document.getElementById( id );
	obj.style.display = ( obj.style.display == '' )? "none" : "";
}

function newFolder()
{
	var id = oldId.replace( 'f_','' );
	location = '/admin/pages/?show=editFolder&sub=5&id_fk_folder='+id;
}

function newPage()
{
	var id = oldId.replace( 'f_','' );
	location = '/admin/pages/?show=editPage&sub=5&id_fk_folder='+id;
}

function newLink()
{
	var id = oldId.replace( 'f_','' );
	location = '/admin/pages/?show=editLink&sub=5&id_fk_folder='+id;
}

function showPages()
{
	var id = oldId.replace( 'f_','' );
	location = '/admin/pages/?show=index&sub=5&id_fk_folder='+id;
}

function sendUrl( url )
{
	window.opener.document.getElementById( 'f_href' ).value = url;
	window.close();
}

// -------- Fim scrips Páginas ---------------------------

*/

// Galeria --------------------------------
var id;
function triggerMenu( id_menu )
{
	var obj = document.getElementById( id_menu );
	
	// Esconde o id antigo
	hideMenu();
	
	obj.style.display = ( obj.style.display == 'none' ? '' : 'none' );
	id = id_menu;
}

function hideMenu()
{
	if ( id ) {
		document.getElementById( id ).style.display = 'none';
	}
	
}

function showNext( id )
{
	document.getElementById( 'item'+id ).style.display='';
}

function printPic( id )
{
	var obj   = document.getElementById( 'file'+id );
	var addrs = obj.value;
	
	if ( addrs ) {
		addrs = 'file://' + addrs;
		document.getElementById( 'pic'+id ).src = addrs;
	}
}

function cancelImage( id )
{
	var obj = document.getElementById( 'file' + id );
	obj.focus();
	obj.value.replace('C', '');
	
}


var objEditArea; //Uso para compartilhar o objeto que será criptografado diretamente no LT (tpl).
function editPic( id, pTop )
{
	// Trata posicao
	// Cria o numero
	var position  = pTop * 100;
	document.getElementById( 'divEdit' ).style.top  = ( 100 + position );
	
	document.getElementById( 'divEdit' ).style.display = '';
	var obj = document.getElementById( "iframEdit" );
	//obj.src="?show=editPic&id_foto=" + id;
	objEditArea    = obj; 
}

function editPicGo( url )
{
	objEditArea.src = url;
}

function closeEditPic()
{
	parent.document.getElementById( "iframEdit" ).src='';
	parent.document.getElementById('divEdit').style.display = 'none';
}

// NOTICIAS -------------------------------
var oldStatus;
var wasSet;
var oldId;
function changeStatus( id, st, url, url2 )
{
	if ( wasSet == true ) {
		if ( id == oldId ) {
			st = oldStatus
		}
	}
	
	var objFrame = document.getElementById( "atualizer" );
	
	//altera imagem...
	document.getElementById( "img_" + id ).src = url + ( st ? "ic_ativo_off.gif" : "ic_ativo_on.gif" );
	
	// Atualiza o status
	oldStatus = ( st ? 0 : 1 );
	wasSet    = true;
	oldId     = id;
	
	// manda pro FRAME a mensagem de do novo status da noticia
	objFrame.src = url2 + "&st=" + oldStatus;
}

// --- Status Pages ---
var oldStatus;
var wasSet;
var oldId;
function changeStatusPg( id, st, url, url2 )
{
	if ( wasSet == true ) {
		if ( id == oldId ) {
			st = oldStatus
		}
	}
	
	var objFrame = document.getElementById( "atualizer" );
	
	//altera imagem...
	document.getElementById( "img_" + id ).src = url + ( st ? "ic_status0.gif" : "ic_status1.gif" );
	
	// Atualiza o status
	oldStatus = ( st ? 0 : 1 );
	wasSet    = true;
	oldId     = id;
	
	// manda pro FRAME a mensagem de do novo status da noticia
	objFrame.src = url2 + "&st=" + oldStatus;
}

// ----------------------------------------





// Abre uma janela popup
function popup ( url, nome, largura, altura, posicao, resize, barras ) {
	if ( posicao == 0 ) {
		posleft = 20;
		postop  = ( screen.height ) ? ( screen.height - altura ) / 2 - 50 : 100;
	} else if ( posicao == 1 ) {
		posleft = ( screen.width ) ? ( screen.width - largura ) / 2 : 100;
		postop  = ( screen.height ) ? ( screen.height - altura ) / 2 - 50 : 100;
	} else if (posicao == 2 ) {
		posleft = ( screen.width ) ? ( screen.width - largura ) - 28 : 100;
		postop  = ( screen.height ) ? ( screen.height - altura ) / 2 - 50 : 100;
	}
	opBarras = ( barras ) ? "yes" : "no";
	opResize = ( resize ) ? "yes" : "no";

	settings = 'z-lock=yes, width=' + largura + ', height=' + altura + ', top=' + postop + ', left=' + posleft + ', scrollbars=' + opBarras + ', location=no, directories=no, status=no, menubar=no, toolbar=no, resizable=' + opResize;
	window.open( url, nome, settings );
}

// Funcao para checar se um email é valido ou nao.
function checkMail(mail){
    var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
    if(typeof(mail) == "string"){
        if(er.test(mail)){ return true; }
    }else if(typeof(mail) == "object"){
        if(er.test(mail.value)){
                    return true;
                }
    }else{
        return false;
        }
}