// JScript File

function centeredWindow(theURL,winName,features,width,height) { 
	if (parseInt(navigator.appVersion)>3) {
	 screenW = screen.width;
	 screenH = screen.height;
	}
	else if (navigator.appName == "Netscape" 
	    && parseInt(navigator.appVersion)==3
	    && navigator.javaEnabled()
	   ) 
	{
	 var jToolkit = java.awt.Toolkit.getDefaultToolkit();
	 var jScreenSize = jToolkit.getScreenSize();
	 screenW = jScreenSize.width;
	 screenH = jScreenSize.height;
	}
	
	var pos_x = (screenW/2) - (width/2);
	var pos_y = (screenH/2) - (height/2);
	
	window.open(theURL,winName,features+",width="+width+",height="+height+",left="+pos_x+",top="+pos_y);
}

function MovetoWindow(theURL, wnd, winName, width, height) {
	wnd.close();
	OpenDialogWindow(theURL, winName, width, height);
} 

function OpenDialogWindow(theURL, WIdent, width, height) {
	centeredWindow(theURL, WIdent, 'toolbar=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no',width,height);
}

function OpenResizeWindow(theURL, WIdent, width, height) {
	centeredWindow(theURL, WIdent, 'toolbar=no,directories=no,status=no,scrollbars=no,resizable=yes,menubar=no',width,height);
}

var lastClick = ""
var ctrlImagem = ""
var openImg = new Image();
openImg.src = "../images/open.jpg";
var closedImg = new Image();
closedImg.src = "../images/closed.jpg";


function over(obj)
{
    obj.style.background = '#D4A679';//'#F4BBBB';
    obj.style.color = '#485259';
}
function out(obj,cor)
{
obj.style.background = cor;
//obj.style.color = '#485259';

}
function geturl(url)
{

top.frames[2].location=url;
} 
//-->

function showBranch(branch,imagem){
	swapFolder(imagem)	
	var objBranch = document.getElementById(branch).style;	
	if(objBranch.display=="block")
		objBranch.display="none";
	else
		objBranch.display="block";		
	lastClick=branch;
}
function swapFolder(img)
{
objImg = document.getElementById(img);

if(objImg.src.indexOf('closed.jpg')>-1)
objImg.src = openImg.src;
else
    objImg.src = closedImg.src;	
}

// Passagem de ListBox
function CopiaValor(iValor,sTexto,sModo,sClass,sArvore)
{
    sListaDestino =  document.getElementById("Campanhas");
    var iTamanho = sListaDestino.length;
    sListaDestino.options[iTamanho] = new Option(sTexto,iValor);
    sListaDestino.options[iTamanho].className="";
    if(sClass=="yes")
    {
        sListaDestino.options[iTamanho].className="ColaboradorEspera";
    }
        else if (sClass=="no")
        {
            sListaDestino.options[iTamanho].className="ColaboradorOn";
        }
            else 
            {
                sListaDestino.options[iTamanho].className="ColaboradorOff";
            }      
    sListaDestino.options[iTamanho].arvore=sArvore;
    InsereColaborador(iValor,sTexto,sModo);   
}
function Limpa(objLista) {
    sListaDestino =  document.getElementById(objLista);
    var len = sListaDestino.options.length;
    for(var i = (len-1); i >= 0; i--) 
    {
        if ((sListaDestino.options[i] != null) && (sListaDestino.options[i].selected == true)) 
        {
            sListaDestino.options[i] = null;
        }
    }
}
// Fim Passagem de ListBox

/***********************************************************************/
/*              Separador "A Fazer"                                    */
/***********************************************************************/
function AccionaTab(myButtons, button, tab, tipo, onclass, offclass, lang) {
	var a = tabcontrol.all.tags('div');
	var b = myButtons.parentElement.all.tags('td');
	
	if (a!=null) {
	    for (i=0; i<a.length; i++) {
			if (a[i].tab == tipo) {
				if (a[i].id == tab) a[i].style.display ='block'
				else a[i].style.display ='none';
			}
		}
	}
	if (b!=null) {
	    for (i=0; i<b.length; i++) {
			if (b[i].tab == "") {
				if (b[i].id == button) b[i].className = onclass
				else b[i].className = offclass;
			}
		}
	};
	
	document.getElementById('topTable').className="tabTable"+lang;	
}
/***********************************************************************/
/*                   Fim Separador "A Fazer"                           */
/***********************************************************************/


/***********************************************************************
                        Colaboradores                          
/***********************************************************************/
function MostraEscondeTipoColaborador(sTipo)
{
    switch (sTipo)
    {    
    case "Residente":
        document.getElementById('ABVT').style.display='block';
        document.getElementById('URL').style.display='none';
        ValidatorEnable(rfvABVT, true);
         break;
    case "Campanhas":
        document.getElementById('URL').style.display='block';
        document.getElementById('ABVT').style.display='none';
        ValidatorEnable(rfvABVT, false);
        break;    
    }
}
/***********************************************************************
                        Colaboradores Fim                         
***********************************************************************/