// JavaScript Document

/* _____________________________________
  |                                                                                        	|
  |   IT'S NOT COPY, WAS MADE BY TRISSO      	|
  | 	   thiago.risso@gmail.com                                        	|
  |______________________________________	|*/
											
// IE 5.0 , FIREFOX 1.0 , MOZILLA 1.7 , NETSCAPE 7.0 , MACIE 5.1 , OPERA 7.54
//Não foi TESTADO EM : SAFARI , CAMINO , Konqueror ...  MAS SERÁ...	

var ultPosMenuLeft = new Array();
var ultPosMenuTop = new Array();

var smenuVisivel = null;
var tmpMenuRight = null;
var ultMenuSubMenu = null;

var classDropOut = null;
var classDropOver = null;
var classDisable = null;
var classDisable = 'td_over disable';

var lastDisable = false;

function Inicia_Menu(Hmz,cand) //Hmz = Alterar altura da DIV MainMenu no Mozilla
{
	if(document.getElementById("Geral"))
		distLeft = document.getElementById("Geral").offsetLeft + 2;
	else
		distLeft = 0;
	dHvisible=false;		
	cont_tmp=0;	
	TimeMoz = 0;
	classDropOut  = "";
	classDropOver = "";
	tIMove = 0;
	lIMove = 0;
	EnableMove = false;
	DropTypeId = 0;
	DropMenuType = false;
	time1=0;
	ab = false;
	h_menu = new Array();
	obj_vis=-1;
	cont=0;
	visivel=-1;
	e='';
	el_menu=0;
	temp=false;
	tmp=0;
	h_d = 3; //QTD DE PIXEL QUE SOBE POR VEZ
	h_s = 3; //QTD DE PIXEL QUE DESCE POR VEZ
	
	Brw = navigator.userAgent;	
	Op=false;
	IE=false;
	Net=false;
	Moz=false;
	
	if(Brw.indexOf("Opera") > -1)
	{
		Op=true;
		a=Brw.indexOf("Opera");
		version = Brw.substr(a+6,4);
		if(version < 7.54)
		{
			for(x=0;x<10;x++)
			{
				if(document.getElementById("Layer"+x))
					document.getElementById("Layer"+x).style.backgroundColor = "#DEDEDE";
			}
			alert("As Cores Do Menu DROPDOWN podem não funcionar Corretamente\nno OPERA versão menor que 7.54!");
		}
	}
	else if((Brw.indexOf("MSIE") > -1) && (Brw.indexOf("Opera") == -1))
	{
				IE=true;	
	}
	else if((Brw.indexOf("Netscape") > -1))
	{
				Net=true;
	}
	else if((Brw.indexOf("Mozilla") > -1)&& (Brw.indexOf("MSIE") == -1)&& (Brw.indexOf("Opera") == -1)&& (Brw.indexOf("Netscape") == -1))
	{
				Moz=true;
	}
			
	var i=0;
	var ii=0;
	
	for($i=0;$i<=10;$i++)
	{
		if(document.getElementById("item_" + i))
		{
			tit=document.getElementById("item_" + i)
			h_menu[i]=tit.clientHeight;
			if(h_menu[i]==0)
				h_menu[i]=80;
		}
	}
	MnuIt = new Array;
	controle = 0;
	// Obtem as permissoes do USUARIO de Acordo com os MENUS VISIVEIS
	for(x=0;x<=15;x++)
	{	
		if(document.getElementById("Layer"+x))
		{
				document.getElementById("Layer"+x).style.height='auto';
		}
		if(document.getElementById("titulo_menu_"+x))
		{
			document.getElementById("titulo_menu_"+x).className = "titulo_menu_out";
			el_menu++;
			MnuIt[controle]=x;
			controle++;
		}
	}
	width_tmenu = parseInt(778 / el_menu);
	
	
			
	// === TAMANHO MAXIMO DA CELULA DE TITULO 130px
	
	if((document.getElementById("table_menu"))||(document.getElementById("MainMenu")))
	{
		/*if(width_tmenu > 128)
			{
				width_tmenu = 128;
				w_tabmnu = 128 * el_menu;
				//document.getElementById("table_menu").width = w_tabmnu;
			}*/
		
		//width_tmenu --;
		if(document.getElementById("img_topo"))
			if(document.getElementById("img_topo").clientHeight>0)
				img=document.getElementById("img_topo").clientHeight;
			else
				img = document.getElementById("img_topo").height;
		else
			img=0;
			
		if(document.getElementById("mnu_h"))
			mnu=document.getElementById("mnu_h").height;
		else if(document.getElementById("MainMenu"))
			mnu=document.getElementById("MainMenu").clientHeight;
		if(mnu==0)
			mnu=18;
			

		PPTop  = Math.abs(img) + Math.abs(mnu);
		
		//Ajusta a Posição da Div de TEMPO DE VERIFICAçAO DO CPF
		PPLeft = 0 ;
		time=0;
		
		
		//TAMANHOS DO MENUS
		if(cand)
		{
			width_tmenu = new Array(110,90,100,85,120,130,90,130,130);
		}
		else	
		{
			width_tmenu = new Array(90,110,130,105,150,140,110,120,130,130,130,155);
		}
		if(browser()=='IE')
			{	
				time_menu = 3;
				over_flow = 'hidden';
				val_y = 0;
				val_x = 1;
				document.onmousemove = verifica ;
				document.onclick     = ver_click ;
				document.onmousedown = click_move ;
				document.onmouseout = Mout ;
				document.onmouseup  = click_move_stop ; 
				//document.oncontextmenu = return false;'
				
			}
			else
			{
				time_menu = 1;
				over_flow = 'hidden';
				val_y = 0;
				val_x = 1;
				window.releaseEvents(Event.MOUSEMOVE);
				window.onmousemove = verifica ;
				window.releaseEvents(Event.EnableMovemout);
				window.onmouseout = Mout ;
				window.releaseEvents(Event.MOUSEDOWN);
				window.onmousedown = click_move ;
				window.releaseEvents(Event.CLICK);
				window.onclick = ver_click ; 
				window.releaseEvents(Event.MOUSEUP);
				window.onmouseup   = click_move_stop;
				
			}
			
			// ================ POSICIONA ITENS E REDIMENCIONA DE ACORDO COM A QTD DE PERMISSOES =========== //
			Pos_x = 0;
			for(n = 0 ; n < el_menu ; n++ )
			{
				nL= MnuIt[n];
				if(document.getElementById("Layer" + nL))
				{
					document.getElementById("Layer" + nL).style.width = width_tmenu[nL] + "px";
					Ll = document.getElementById("Layer" + nL).style.width.length;
					Lw = document.getElementById("Layer" + nL).style.width.substr(0,Ll-2);
					Pos_x += Lw;	
					//Pos_x = (Lw * n) ;
					if((Moz)||(Net))
						Pos_x+=(n*2);
					//Pos_x = (width_tmenu * n) ;
					
					ultPosMenuTop[n] = PPTop + val_y;
					document.getElementById("Layer" + nL).style.top  = ultPosMenuTop[n] + 'px';
					
					//document.getElementById("Layer" + nL).style.left = distLeft + Pos_x -1 + 'px';
					
					//EXIBE O MENU PARA PODER PEGAR AS POSIçÔES
					document.getElementById("HiddenMenu").style.display='block';												
					
					if(browser() == 'IE')
						ultPosMenuLeft[n] = document.getElementById('titulo_menu_'+nL).offsetLeft+distLeft-1;
					else
						ultPosMenuLeft[n] = document.getElementById('titulo_menu_'+nL).offsetLeft;
						
					document.getElementById("Layer" + nL).style.left=ultPosMenuLeft[n]+"px";

					//ESCONDE O MENU 
					document.getElementById("HiddenMenu").style.display='none';
					
					document.getElementById("Layer" + nL).style.overflow = over_flow;
				}
				if(document.getElementById("item_"+nL))
				{
					//document.getElementById("item_" + nL).style.width = width_tmenu  + "px";
				}
				if(document.getElementById("titulo_menu_" + nL))
				{
					//document.getElementById("titulo_menu" + nL).style.width = width_tmenu + "px";
				}
			}
			
			if(window.DropStart)
			{
				DropStart(); //Inicia o Menu DROP;
			}
	}
	// ======= FIM DO POSICIONAMENTO ======= //
	ST = true;
}
//FIM DA FUNCAO INICIA_TOPO


function iniciaMov()
{
	tIMove = 0;
	lIMove = 0;
	visivel = -1;
	EnableMove = false;

	if(browser()=='IE')
	{	
		document.onmousemove = verifica ;
		document.onmousedown = click_move ;
		document.onmouseup  = click_move_stop ;
		//document.oncontextmenu = return false;'
	}
	else
	{
		window.releaseEvents(Event.MOUSEMOVE);
		window.onmousemove = verifica ;
		window.releaseEvents(Event.MOUSEDOWN);
		window.onmousedown = click_move ;
		window.releaseEvents(Event.MOUSEUP);
		window.onmouseup   = click_move_stop;
	}
}

function Posicao_Div()  //REPOSICIONA OS MENUS CASO SEJA INSERIDA BARRA DE ROLAGEM E DIMINUA A AREA DA TELA...
{	
	if(document.getElementById("Geral"))
	{
		distLeftNew = document.getElementById("Geral").offsetLeft+2;
		if(distLeftNew!=distLeft)
		{
			distLeft=distLeftNew;
			for(n = 0 ; n < el_menu ; n++ )
			{		
				nL= MnuIt[n];
				if(document.getElementById("Layer" + nL))
				{
					document.getElementById("Layer" + nL).style.width = width_tmenu + "px";
					Ll = document.getElementById("Layer" + nL).style.width.length;
					Lw = document.getElementById("Layer" + nL).style.width.substr(0,Ll-2);
					Pos_x = (Lw * n) ;
					if((Moz)||(Net))
						Pos_x+=(n*2);
					//document.getElementById("Layer" + nL).style.left = distLeft + Pos_x -1 + 'px';
				
					if(browser() == 'IE')
						document.getElementById("Layer" + nL).style.left=document.getElementById('titulo_menu_'+nL).offsetLeft+distLeft-2+"px";
					else
						document.getElementById("Layer" + nL).style.left=document.getElementById('titulo_menu_'+nL).offsetLeft+1+"px";
						
					ob = document.getElementById("Layer"+nL);
					DVS = ob.getElementsByTagName("div");
					
					for(x=0;x<DVS.length;x++)
					{
						if(DVS[0].className.indexOf("item_menu_link") > -1)
							DVS[0].style.width = document.getElementById("Layer" + nL).style.width -2;
					}
				}			
			}
		}
	}
}



// ========= VERIFICA O CLIQUE ========= //

function click_move_stop(e)
{
	EnableMove = false;
}

function click_move(e)
{
	if(!e)e=window.event;
	if(browser()=='IE')
	  objEv1 = event.srcElement;
    else
      objEv1 = e.target;
	   
	if((objEv1.id == "barra_titulo_cancela")||(objEv1.id == "lbl_titulo_contrato"))
	{
		hD = document.getElementById(divmove).style.top;
		hD = hD.substr(0,hD.length - 2);
		hE =e.clientY;
		wD = document.getElementById(divmove).style.left;
		wD = wD.substr(0,wD.length - 2);
		wE =e.clientX;
		lIMove = wE - wD;
		tIMove = hE - hD;
		//alert(tIMove);
		EnableMove = true;
	}
}

function ver_click(e)
{
	if(! e) e= window.event;
	//alert(e.which);
	//return false;
	if(browser()=='IE')
	  objEv = event.srcElement;
    else
      objEv = e.target;
	  
    if(!objEv.id)
		{
		OBID = "";
		OBCLASS = "";
		}
	else
	{
		OBID = objEv.id;
		OBCLASS = objEv.className;
	}
	ID=OBID.substr((objEv.id.length -1 ),1);
	if((OBCLASS.indexOf("menu")==-1)||(OBID.indexOf("menu")==-1))
	{
		obj_vis=-1;
		id=-1;
		esconde_outro(ID);
	}
	/*	else if (objEv.id.indexOf("menu") > -1)
			{
				if(ID!=obj_vis)
					aparece(ID);
			}*/
	if(!e)e=window.event;	
	//if((e.which==3)||(e.which==2))
	//{
		
	//alert(OBID+' '+DropMenuType);
		
			
	if((DropMenuType)&&(OBID.indexOf(DropMenuType.toLowerCase())>-1))
		DropMenu(e,true);
	else if(DropTypeId!=0)
		DropMenu(e,true);
		//return false;
	/*	}
	else
		{
		DropMenu(e,false);
		}*/
}
	
// =========  VERIFICA O POSICIONAMENTO DO CURSOR  ========== //
function verifica(e)
{
	if(!e)e=window.event;
	
	if(browser()=='IE')
		objEv = event.srcElement;
      else
        objEv = e.target;
		
	if(objEv.id)
	{
		if((EnableMove))
		{
			MoveDiv(e);
		}
		
		 ID = objEv.id.substr(objEv.id.lastIndexOf('_')+1,objEv.id.length);
		 
		if(ID)
		{
			if((objEv.id.indexOf("menu") > -1))
			{			
				Posicao_Div();
				ab = true;
				//ID=objEv.id.substr((objEv.id.length -1 ),1)
				if(window.aparece)
					aparece(ID);
			}
			else if ((objEv.className.indexOf("menu") > -1))
			{
				Posicao_Div()
				ab = true;
				ID=obj_vis;
				if(ID>=0)
					aparece(ID);
			}
			else if(visivel >= 0)
			{
				if(!temp)
				{
					ab = false;
					tempo(obj_vis,0);
				}
			}
		}
	}
	
	if(objEv.className=='help')
	{
		Help(objEv.id,e);
	}
}

function fecha(div,origem)
{
	for(x=0;x<div.length;x++)
	{
		chr = div.charAt(x);
		if(!isNaN(chr))
		{
			posIni = x;
			qtd = div.length - posIni ;
			break;
		}
	}
	
	id=div.substr(posIni,qtd);
	
	document.getElementById("titulo_menu_"+id).className="titulo_menu_out";
	dv = div;
	var h =  document.getElementById(div).style.height;
	var dh = document.getElementById(div).style.height.length;
	h = h.substr(0,dh-2);
	if(h >= h_s)
	{
		h = Math.abs(h) - h_s;
		if(h < 0) h=1;
		document.getElementById(div).style.height = h  + 'px';
		cont_tmp = setTimeout("fecha('"+dv+"')",time_menu);
	}
	else
	{
		clearTimeout(cont_tmp);
		document.getElementById(div).style.visibility='hidden';
		if(smenuVisivel)
			document.getElementById(smenuVisivel).style.visibility = 'hidden';
			
		var ifrMenu = document.getElementById('ifrMenu');
		
		ifrMenu.style.visibility = 'hidden';
			
		//alert("MUDOU PRA FALSE 1");
		if(origem != "esconde")
		{
			visivel=-1;
		}
		return true;
	}
}

function esconde_outro(id,origem)
{
	var cont = 0;
	var x=0;
	var tot_esc = 0;
	//while((obj=document.getElementById("Layer"+x)))
	for(x=0;x<20;x++)
	{
		if(obj=document.getElementById("Layer"+x))
			{
				if(id!=x)
				{
					if(obj.style.visibility == 'visible')
					{
						visivel = -1;
						{
							dv = "Layer"+x;
							fecha(dv);
						}
						cont++;
						
					}
					else
					{
						if(document.getElementById("titulo_menu_"+x))
							document.getElementById("titulo_menu_"+x).className = 'titulo_menu_out';
						tot_esc ++;
					}
				}
			}
		
		
	}
	if(cont>0)
	{
		obj_vis = -1;
		visivel = -1;
		if(origem == 'aparece')
			aparece(id);
	}
	return true;
}

function abre(div)
{
	dv = div;
	id = document.getElementById(div).id;
	id = id.substr(id.length-1,id.length);
	var h =  document.getElementById(div).style.height;
	hl = h.length;
	
	h = h.substr(0,hl-2);
	var dh = document.getElementById(div).style.height.length;
	while(h <= h_menu[id])
	//if(h <= h_menu[id])
	{
		h = Math.abs(h) + h_d;
		document.getElementById(div).style.height = h  + 'px';
		//cont_tmp = setTimeout("abre('"+dv+"')",time_menu);
	}
	return true;
	//else
	//{
	//	clearTimeout(cont_tmp);
	//	window.visivel=id;
	//	//alert("MUDOU PRA TRUE");
	//	return true;
	//}
}
		
function aparece(id,t)
{
	clearTimeout(tmp);	
	temp=false;
	//alert("APARECE(" + id + ")");
	if((visivel==-1) && (document.getElementById("Layer" + id) && id != -1))
	{
		visivel = id;
		div="Layer" + id;
		if(document.getElementById('titulo_menu_'+id).className == 'titulo_menu_out')
			document.getElementById('titulo_menu_'+id).className ='titulo_menu_over';
	
		dvMenu = document.getElementById(div);
		
		dvMenu.style.zIndex = 10;
		var ifrMenu = document.getElementById('ifrMenu');
		
		ifrMenu.style.top = findPosY(dvMenu);
		ifrMenu.style.left = findPosX(dvMenu);		
		ifrMenu.style.width = dvMenu.offsetWidth;
		ifrMenu.style.height = dvMenu.offsetHeight;		
		
		ifrMenu.style.visibility="visible";
		dvMenu.style.visibility="visible";
		
		a=abre(div)
		if(a)
		{
			obj_vis=id;
			return false;
		}
	}
	else if(id != -1)
	{
		esconde_outro(id,'aparece');
		return false;
	}
}


function tempo(id,t)
{
	temp=true;
	if(t==1)
	{
		div="Layer" + id;
		if(visivel >= 0 && id >= 0)
			fecha(div);
		temp=false;
		t=0;
		clearTimeout(tmp);
		return false;
	}
	tmp=setTimeout("tempo("+ id +",1)",1000);	 // conta tempo para remover o MENU
}


// ############################################################################################################
// ##						FIM DAS FUNÇÕES DO DROP MENU DE BUSCA DE CAND (RESULTADOS)   					 ##
// ############################################################################################################

TimeMoz = 0;

function DropMenu(e,Show)
{
	if(browser()=='IE')
		IE = true;
		
	if(window.DropStart)
		DropStart();
		
	if(!DropMenuType)
	{
		return;
	}
	
	if(DropMenuType) // ---------- SE O TIPO DE DROP MENU FOI DECLARADO....
	{
		if(window.ClassDrop)
			ClassDrop();
		Inicia_Drop(objEv.id)                                     
		
//////////////////////////////////////////////////////////////////////
		var N=0;                                                //
		for(z=0;z<LinksDropId.length;z++)                       //
		{                                                   	//
			if(document.getElementById(LinksDropId[z]))     	//
				N++;                                        	// 
		}                                                   	//
																//
		if(N==0) 												// <<< VERIFICA SE HÁ ALGUM ITEM DO DROP VISIVEL 
			return false;                                       // <<< NAUM AFETADO PELAS PEMISSOES...
//////////////////////////////////////////////////////////////////////			
		
		if(!e)e=window.event;
		DropTdId= DropMenuType.toLowerCase();
		
		// ----- SE O ITEM QUE RECEBEU O EVENTO FOR O ITEM DECLARADO NA PAGINA DO DROP
		if((objEv.id.indexOf(DropTdId)>-1)&&(Show))
		{
			ADType = objEv.id.substr(0,1);
			//SCRIPT PARA RETORNAR CASO SEJA BOTAO ESQ OU SEJA SÒ FAZ COM O BOTAO DIREITO
			//if(((IE)&&((e.button!=2)&&(e.button!=3)))||((!IE)&&((e.which!=2)&&(e.which!=3)))){return true;}
			
			Id_Drop = objEv.id.substr(objEv.id.lastIndexOf("_")+1,objEv.id.length);
			
			if((DropTypeId != 0)) 
			{
				// --- > MUDA A CLASSE DO OBJETO ANTIGO...CASO O CLIQUE TENHA SIDO EFETUADO 
				// ----- DE UM ITEM DIRETO PRA OUTRO
				if((!classDropOut) || (classDropOut==""))
				{
					if(document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId))
					{
						document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = "td_out";
						document.getElementById("row_2_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = "td_out";
					}
					else
					{
						if(lastDisable)
							document.getElementById("row_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDisable;
						else
						{
							document.getElementById("row_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = "td_out";
						}
						
					}
				}
				else
				{	
					if(document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId))
					{
						document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDropOut;
						document.getElementById("row_2_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDropOut;
					}
					else
					{
						document.getElementById("row_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDropOut;	
					}
				}
				if((ADType == 'D')&&(classDisable))
					lastDisable = true;
				else
					lastDisable  = false;
			}
			else
			{
				if((ADType == 'D')&&(classDisable))
					lastDisable = true;
				else
					lastDisable  = false;
					
			}
			
				DropTypeId = Id_Drop;
								
			//--------------------------- >>>>> VERIFICAÇÃO DE POSICIONAMENTO EM DIVERSOS BROWSERS
			if(typeof(e.pageX) == 'number')
			{
				 var L = e.pageX;
				 var T = e.pageY;
			} 
			else
			{
				if(typeof(e.clientX) == 'number')
				{
					var L = e.clientX;
					var T = e.clientY;
				}
			}
	
			if(browser()=='IE') 
			{
				PagePosX= document.body.scrollLeft;
				PagePosY= document.body.scrollTop;
			}
			else  
			{
			  PagePosX = document.documentElement.scrollLeft ;
			  PagePosY = document.documentElement.scrollTop;
			}
			
			if((!document.body.scrollTop)&&(document.documentElement.scrollTop))
			{
					PagePosY = objEv.offsetTop;
					alert("Brownser Incompatível com Posicionamento de Scroll.\nTalves o SubMenu não apareça no lugar correto!");
			}
			
			if(PagePosX > 0)
				DivPosX = (L - PagePosX) + 'px';
			else
				DivPosX = (L - PagePosX) + 'px';						
			DivPosY = (T + PagePosY) + 'px';
		
			// ------- FIM DA VERIFICAçÃO DE POSICIONAMENTO	------------------------------- //
			
			
			// ------- ATUALIZA O POSICIONAMENTO E VISIBILITY DA DIV DE DROP MENU------- //
			if((!classDropOver) || (classDropOver==""))
			{
				//alert("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId);
				if(document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId))
				{
					document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = "td_over";
					document.getElementById("row_2_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = "td_over";
				}
				else
				{
					document.getElementById("row_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = "td_over";
				}
			}
			else
			{
				if(document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId))
				{
					document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDropOver;
					document.getElementById("row_2_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDropOver;						
				}
				else
				{
					document.getElementById("row_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDropOver;						
				}
			}
			document.getElementById(DropDivId).style.overFlow = 'Auto';
			document.getElementById(DropDivId).style.left = DivPosX;
			document.getElementById(DropDivId).style.top = DivPosY;
			document.getElementById(DropDivId).style.visibility = 'visible';
			// ------- FIM DE ATUALIZAçÂO DA DIV ---------------------------------------- //
			
			// ------------------- ATUALIZAÇÃO DOS LINKS -------------------------------- //
			
			for(x=0;x<LinksDropId.length;x++)
			{
				if(document.getElementById(LinksDropId[x]))
				{
					if(LinksDropURL[x].indexOf("--id--") > -1)
						var LNK=LinksDropURL[x].replace("--id--",DropTypeId);
					else if(typeof ClickDropURL == 'undefined')
						var LNK=LinksDropURL[x]+DropTypeId;
					else
						var LNK=LinksDropURL[x];
					document.getElementById(LinksDropId[x]).href=LNK;
					document.getElementById(LinksDropId[x]).target="_top";
				}
			}
			
	
			if(typeof ClickDropURL != 'undefined')
				for(x=0;x<ClickDropURL.length;x++)
				{
					if(document.getElementById(LinksDropId[x]))
					{
						if(ClickDropURL[x].indexOf("--id--") > -1)
							var LNK=ClickDropURL[x].replace("--id--",DropTypeId);
						
						document.getElementById(LinksDropId[x]).onclick=new Function(LNK);
						//document.getElementById(LinksDropId[x]).target="_top";
					}
				}
			
			
			// --------------------FIM DA ATULIZAÇÂO DOS LINKS ----------------------//
			
			
			// --------------------- MUDA OS NOMES DAS CELULAS DO CORPO DO CURRICULO
			// --------------------- PARA QUE NO PROX CLIQUE O DROP SEJA RETIRADO 
			// --------------------- CASO O BROWSER SEJA IE...
			if((DropMenuType.toLowerCase() == "curr")&&(browser()=='IE'))
			{
				/*if(document.getElementById(DropDivId).style.visibility == "visible")
				{
					document.getElementById(DropDivId).style.visibility = "hidden";
					DropTypeId = 0;
					return false;
				}*/
				ys = document.getElementsByTagName("TD");
				for(x=0;x<ys.length;x++)
				{
					nom = "row_drop_curr_"+DropTypeId;
					if(ys[x].id == nom )
						ys[x].id = "";
				}
			}
			//------------------- FIM ---------------------------------------//
				
				
			// -------LOGICA DE TIMERS PARA MOZILLA PARA QUE NO PROXIMO CLIQUE O
			// -------DROP MENU SUMA....
			if(DropMenuType.toLowerCase() == "curr")
			{
				//alert(!IE);
				//alert(TimeMoz == 1);
				//alert(document.getElementById(DropDivId).style.visibility=='visible');
				if((!IE)&&(TimeMoz == 1)&&(document.getElementById(DropDivId).style.visibility=='visible'))
				{
					setTimeout("TimeMoz = 0;" , 300);
					document.getElementById(DropDivId).style.visibility='hidden';
					DropTypeId = 0;
				}
				else if((TimeMoz == 0))
				{
					setTimeout("TimeMoz = 1;" , 300);
				}
			}
			//------FIM DA LÓGICA DO MOZILLA	
				
		}
		else  	// ----- >>>>>>> CASO NÃO TENHA CLICADO EM UM ITEM QUE DEVA APARECER O DROP....
				// ----- DEVE - SE RETIRAR O DROP VISIVEl ... CASO NESSE ESTADO ELE ESTEJA....
		{
			if((DropDivId)&&(document.getElementById(DropDivId)))
			{
				if(document.getElementById(DropDivId).style.visibility == 'visible')
				{
					document.getElementById(DropDivId).style.visibility = 'hidden';
					
					// ----- LÓGICA DO IE PRA VOLTAR OS NOMES DAS CÉLULAS DO CORPO DO CURRICULO
					if((DropMenuType.toLowerCase() == "curr")&&(IE))
					{
						ys = document.getElementsByTagName("TD");
						for(x=0;x<ys.length;x++)
							{
							nom = "row_drop_curr_"+DropTypeId;
							if(ys[x].id == "" )
								ys[x].id = nom;
							}
					}
					
					// ------- FIM DA LóGICA DO IE -------
					if((!classDropOut) || (classDropOut==""))
					{
						if(document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId))
						{
							document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = "td_out";
							document.getElementById("row_2_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = "td_out";
						}
						else
						{
							if(lastDisable)
								document.getElementById("row_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDisable;
							else
								document.getElementById("row_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = "td_out";
						}
					}
					else
					{
						if(document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId))
						{
							document.getElementById("row_1_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDropOut;
							document.getElementById("row_2_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDropOut;
						}
						else
						{
							if(lastDisable)
								document.getElementById("row_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDisable;
							else
								document.getElementById("row_drop_"+DropMenuType.toLowerCase()+"_"+DropTypeId).className = classDropOut;
						}
					}
					
					DropTypeId = 0;
				}
			}
			return false;
		}
	}
	else // CASO NÃO TENHA SIDO DECLARADO O TIPO DE DROP ...
	{
		return false;
	}
	return false;
}
	
function DropOut(th,lnI,disable)
{
	if(window.ClassDrop)
	ClassDrop();

	id=th.id.substr(th.id.lastIndexOf("_")+1,th.id.length);

	if((!DropMenuType)&&(window.DropStart))
	DropStart();

	if(!DropMenuType)
	return false;

	if((DropTypeId==0)&&((DropMenuType)||(Name)))
		if((!classDropOut) || (classDropOut==""))
		{
			if(DropMenuType)
				Name = DropMenuType.toLowerCase();

			if((disable!='') && (disable!=null))
				th.className = "td_out disable";
			else
				th.className = "td_out";
				
			if(document.getElementById("row_"+lnI+"_drop_"+Name+"_"+id))
			{
				document.getElementById("row_1_drop_"+Name+"_"+id).className = "td_out";
				document.getElementById("row_2_drop_"+Name+"_"+id).className = "td_out";
			}
		}
	else
	{
		th.className = classDropOut;
		if(DropMenuType)
			Name = DropMenuType.toLowerCase();
		if(document.getElementById("row_"+lnI+"_drop_"+Name+"_"+id))
		{			
			document.getElementById("row_1_drop_"+Name+"_"+id).className = classDropOut;
			document.getElementById("row_2_drop_"+Name+"_"+id).className = classDropOut;
		}
	}
}

function DropOver(th,lnI)
{
	if(window.ClassDrop)
		ClassDrop();
	id=th.id.substr(th.id.lastIndexOf("_")+1,th.id.length);

	if((!DropMenuType)&&(window.DropStart))
		DropStart();

	if(!DropMenuType)
		return false;

	if((DropTypeId==0)&&((DropMenuType)||(Name)))
		if((!classDropOver) || (classDropOver==""))
		{
			if(DropMenuType)
				Name = DropMenuType.toLowerCase();	
			th.className = "td_over";
			if(document.getElementById("row_"+lnI+"_drop_"+Name+"_"+id))
			{
				document.getElementById("row_1_drop_"+Name+"_"+id).className = "td_over";
				document.getElementById("row_2_drop_"+Name+"_"+id).className = "td_over";
			}
		}
		else
		{
			if(DropMenuType)
				Name = DropMenuType.toLowerCase();
			th.className = classDropOver;
			if(document.getElementById("row_"+lnI+"_drop_"+Name+"_"+id))
			{
				document.getElementById("row_1_drop_"+Name+"_"+id).className = classDropOver;
				document.getElementById("row_2_drop_"+Name+"_"+id).className = classDropOver;
			}
		}
}
		
function MoveDiv(e)
{
	if(EnableMove)
	{
		Acima = ((e.clientY>0) ? (e.clientY - tIMove) : 0);
		Esquerda = e.clientX - lIMove;
	
		document.getElementById(divmove).style.top = Acima;
		document.getElementById(divmove).style.left = Esquerda;
		
		if(ifr=document.getElementById('ifrJanMoldura'))
		{
			ifr.style.top = Acima;
			ifr.style.left = Esquerda;
		}
	}
}
	
	
function Help(tipo,e)
{
	if(!e)e=window.event;
	if(document.getElementById("DV_HELP"))
	{
		dH = document.getElementById("DV_HELP");
		HELPOBJ = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Objetivo Profissional</b><br />Adicione as funções onde você deseja atuar em nossa empresa.<br />Máximo de 3 Objetivos!<br />Para isso preencha os campos obrigatórios(<font class='frm_fonte_asterisco'>*</font>) e clique no botão <b>Próximo</b>.</font>";
		HELPTEL = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Telefones</b> <br /> Adicione  mo máximo de 3 Telefones!<br />Para isso preencha os campos obrigatórios(<font class='frm_fonte_asterisco'>*</font>) e clique no botão <b>Próximo</b>.</font>";
		HELPHIS = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Histórico Profissional</b> <!--<br />--> Máximo de 5 Históricos!<br />Para isso preencha os campos obrigatórios(<font class='frm_fonte_asterisco'>*</font>) e clique no botão <b>Próximo</b>.</font>";
		HELPESC = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Escolaridade</b> <br /> Adicione suas Formações/Estudos iniciando do mais antigo para o mais atual.<br />Máximo de 5 Escolaridades!<br />Para Isso Preencha os campos obrigatórios(<font class=\"frm_fonte_asterisco\">*</font>) e Clique no botão <b>Próximo</b>.</font>";
		HELPCUR = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Cursos</b> <br /> Adicione seus Cursos Completos(Marque o campo 'Completo') ou ainda em Curso.<br />Para Isso Preencha os campos obrigatórios(<font class='frm_fonte_asterisco'>*</font>) e clique no botão <b>Próximo</b>.</font>";
		HELPIDI = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Idiomas</b> <br /> Adicione todos os Idiomas de seu conhecimento e seus respectivos níveis.<br />Para Isso Preencha os campos obrigatórios(<font class='frm_fonte_asterisco'>*</font>) e clique no botão <b>Próximo</b>.</font>";
		HELPTIPO = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Tipo de Currículo</b> <br /><b>C</b> - Currículo enviado pelo Candidato<br /><b>S</b> Currículo Selecionado";
		HELPTIPOC = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Currículo enviado pelo Candidato</b><br />";
		HELPTIPOS = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Currículo Selecionado</b><br />";
		HELPNTIPO = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Currículos não visualizados.</b><br />Possuem <font class=\"frm_fonte_asterisco\">*</font> neste campo.<br />";
		HELPOBS = "<font class=\"frm_fonte_hint\" style=\"font-size:12px;\">Candidatos com observação neste processo possuem <font class=\"frm_fonte_asterisco\">*</font> neste campo.<br />";
		HELPAPARECE = "<font class=\"frm_fonte_hint\" style=\"font-size:12px;\">Clique aqui para visualizar o MiniCurrículo.<br />"
		HELPESCONDE = "<font class=\"frm_fonte_hint\" style=\"font-size:12px;\">Clique aqui para ocultar o MiniCurrículo.<br />";
		HELPENTREV  = "<font class=\"frm_fonte_hint\" style=\"font-size:12px;\"><b>Entrevista ainda não visualizados.</b><br />Possuem <font class=\"frm_fonte_asterisco\">*</font> neste campo.<br />";
		HELPRTIPO = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Recebidos</b></font>";
		HELPSTIPO = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Selecionados</b></font>";
		HELPETIPO =	"<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Encaminhados</b></font>";
		HELPATIPO = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Aprovados</b></font>";
		HELPAPTIPO = "<font class=\"frm_fonte_hint\" style=\"font-size:11px;\"><b>Aptos</b></font>";
		
		if(tipo)
		{
			if(tipo=='help_obj')
			{
				dH.innerHTML = HELPOBJ;
			}
			else if(tipo=='help_tel')
			{
				dH.innerHTML = HELPTEL;
			}
			else if(tipo=='help_his')
			{
				dH.innerHTML = HELPHIS;
			}
			else if(tipo=='help_esc')
			{
				dH.innerHTML = HELPESC;
			}
			else if(tipo=='help_cur')
			{
				dH.innerHTML = HELPCUR;
			}
			else if(tipo=='help_idi')
			{
				dH.innerHTML = HELPIDI;
			}
			else if(tipo=='help_tipo')
			{
				dH.innerHTML = HELPTIPO;
			}
			else if(tipo=='help_tipo_C')
			{
				dH.innerHTML = HELPTIPOC;
			}
			else if(tipo=='help_tipo_S')
			{
				dH.innerHTML = HELPTIPOS;
			}
			else if(tipo=='help_Ntipo')
			{
				dH.innerHTML = HELPNTIPO;
			}
			else if(tipo=='help_rtipo')
			{
				dH.innerHTML = HELPRTIPO;
			}
			else if(tipo=='help_stipo')
			{
				dH.innerHTML = HELPSTIPO;
			}
			else if(tipo=='help_etipo')
			{
				dH.innerHTML = HELPETIPO;
			}
			else if(tipo=='help_atipo')
			{
				dH.innerHTML = HELPATIPO;
			}
			else if(tipo=='help_aptipo')
			{
				dH.innerHTML = HELPAPTIPO;
			}
			
			else if(tipo=='help_Obs')
			{
				dH.innerHTML = HELPOBS;
			}
			else if(tipo=='help_nova_entrev')
			{
				dH.innerHTML = HELPENTREV;
			}
			else if(tipo.indexOf("span_div_")>-1)
			{
				if(trim(document.getElementById(tipo).innerHTML) == '-')
				{
					dH.innerHTML = HELPESCONDE;
				}
				else
				{
					dH.innerHTML = HELPAPARECE;
				}
			}
			
			
			if(typeof(e.pageX ) == 'number')
			{
				var L = e.pageX;
				var T = e.pageY;
			}
			else
			{
				if(typeof( e.clientX ) == 'number')
				{
					var L = e.clientX;
					var T = e.clientY;
				}
			}
			
			if(document.body) 
			{
				PagePosX= document.body.scrollLeft;
				PagePosY= document.body.scrollTop;
			} 
			else if(document.documentElement)  
			{
				PagePosX = document.documentElement.scrollLeft ;
				PagePosY = document.documentElement.scrollTop;
			}
			
			if(window.innerHeight)
			{
				wHeight =window.innerHeight;
				wWidth  =window.innerWidth;
			}
			else if(document.body.clientHeight)
			{
				wHeight =document.body.clientHeight;
				wWidth  =document.body.clientWidth;
			}
			else if(document.documentElement.clientHeight)
			{
				wHeight =document.documentElement.clientHeight;
				wWidth  =document.documentElement.clientWidth;
			}
				
			//L+=PagePosX;
			if((L+dH.clientWidth)>(wWidth + PagePosX))
			{
				L-=dH.clientWidth;
			}
			
			if(browser()=='IE')
				T+=PagePosY;
			
			//alert('COND2'+(wHeight + PagePosY));
			
			if((T+dH.clientHeight)>(wHeight + PagePosY))
			{
				T -= dH.clientHeight +10;
			}
			else
				T+=20;
			dH.style.top = T ; // -dH.clientHeight
			dH.style.left = L;
			dH.style.visibility = 'visible';
			dHvisible = true;
		}
	}
}

function Mout(e)
{
	e = window.event || e;
    var obj = e.srcElement || e.target;
	  
	if(typeof obj != 'undefined' && obj.className=='help')
	{
		dH = document.getElementById("DV_HELP");
		dH.style.visibility = 'hidden';
		dHvisible = false;
	}
}

