//TOOLTIP
// portugues/scripts
var ua = navigator.userAgent
var ps = navigator.productSub 
var dom = (document.getElementById)? 1:0
var ie4 = (document.all&&!dom)? 1:0
var ie5 = (document.all&&dom)? 1:0
var nn4 =(navigator.appName.toLowerCase() == "netscape" && parseInt(navigator.appVersion) == 4)
var nn6 = (dom&&!ie5)? 1:0
var sNav = (nn4||nn6||ie4||ie5)? 1:0
var cssFilters = ((ua.indexOf("MSIE 5.5")>=0||ua.indexOf("MSIE 6")>=0)&&ua.indexOf("Opera")<0)? 1:0
var Style=[],Text=[],Count=0,sbw=0,move=0,hs="",mx,my,scl,sct,ww,wh,obj,sl,st,ih,iw,vl,hl,sv,evlh,evlw,tbody
var HideTip = "eval(obj+sv+hl+';'+obj+sl+'=0;'+obj+st+'=-800')"
var doc_root = ((ie5&&ua.indexOf("Opera")<0||ie4)&&document.compatMode=="CSS1Compat")? "document.documentElement":"document.body"
var PX = (nn6)? "px" :""

var disType;

/*
 Pleas leave this notice.
 DHTML tip message version 1.2 copyright Essam Gamal 2003 (http://migoicons.tripod.com, migoicons@hotmail.com)
 All modifications are done in the style.js you should not modify this file.  Created on : 06/03/2003
 Script featured on and can be found at Dynamic Drive (http://www.dynamicdrive.com)
*/ 

if(sNav) {
	window.onresize = ReloadTip
	document.onmousemove = MoveTip
	if(nn4) document.captureEvents(Event.MOUSEMOVE) 
}	
if(nn4||nn6) {
	mx = "e.pageX"
	my = "e.pageY"
	scl = "window.pageXOffset"
	sct = "window.pageYOffset"	
	if(nn4) {
		obj = "document.TipLayer."
		sl = "left"
		st = "top"
		ih = "clip.height"
		iw = "clip.width"
		vl = "'show'"
		hl = "'hide'"
		sv = "visibility="
	}
	else obj = "document.getElementById('TipLayer')."
} 
if(ie4||ie5) {
	obj = "TipLayer."
	mx = "event.x"
	my = "event.y"
	scl = "eval(doc_root).scrollLeft"
	sct = "eval(doc_root).scrollTop"
	if(ie5) {
		mx = mx+"+"+scl 
		my = my+"+"+sct
	}
}
if(ie4||dom){
	sl = "style.left"
	st = "style.top"
	ih = "offsetHeight"
	iw = "offsetWidth"
	vl = "'visible'"
	hl = "'hidden'"
	sv = "style.visibility="
}
if(ie4||ie5||ps>=20020823) {
	ww = "eval(doc_root).clientWidth"
	wh = "eval(doc_root).clientHeight"
}	 
else { 
	ww = "window.innerWidth"
	wh = "window.innerHeight"
	evlh = eval(wh)
	evlw = eval(ww)
	sbw=15
}	

function applyCssFilter(){
	if(cssFilters&&FiltersEnabled) { 
		var dx = " progid:DXImageTransform.Microsoft."
		TipLayer.style.filter = "revealTrans()"+dx+"Fade(Overlap=1.00 enabled=0)"+dx+"Inset(enabled=0)"+dx+"Iris(irisstyle=PLUS,motion=in enabled=0)"+dx+"Iris(irisstyle=PLUS,motion=out enabled=0)"+dx+"Iris(irisstyle=DIAMOND,motion=in enabled=0)"+dx+"Iris(irisstyle=DIAMOND,motion=out enabled=0)"+dx+"Iris(irisstyle=CROSS,motion=in enabled=0)"+dx+"Iris(irisstyle=CROSS,motion=out enabled=0)"+dx+"Iris(irisstyle=STAR,motion=in enabled=0)"+dx+"Iris(irisstyle=STAR,motion=out enabled=0)"+dx+"RadialWipe(wipestyle=CLOCK enabled=0)"+dx+"RadialWipe(wipestyle=WEDGE enabled=0)"+dx+"RadialWipe(wipestyle=RADIAL enabled=0)"+dx+"Pixelate(MaxSquare=35,enabled=0)"+dx+"Slide(slidestyle=HIDE,Bands=25 enabled=0)"+dx+"Slide(slidestyle=PUSH,Bands=25 enabled=0)"+dx+"Slide(slidestyle=SWAP,Bands=25 enabled=0)"+dx+"Spiral(GridSizeX=16,GridSizeY=16 enabled=0)"+dx+"Stretch(stretchstyle=HIDE enabled=0)"+dx+"Stretch(stretchstyle=PUSH enabled=0)"+dx+"Stretch(stretchstyle=SPIN enabled=0)"+dx+"Wheel(spokes=16 enabled=0)"+dx+"GradientWipe(GradientSize=1.00,wipestyle=0,motion=forward enabled=0)"+dx+"GradientWipe(GradientSize=1.00,wipestyle=0,motion=reverse enabled=0)"+dx+"GradientWipe(GradientSize=1.00,wipestyle=1,motion=forward enabled=0)"+dx+"GradientWipe(GradientSize=1.00,wipestyle=1,motion=reverse enabled=0)"+dx+"Zigzag(GridSizeX=8,GridSizeY=8 enabled=0)"+dx+"Alpha(enabled=0)"+dx+"Dropshadow(OffX=3,OffY=3,Positive=true,enabled=0)"+dx+"Shadow(strength=3,direction=135,enabled=0)"
	}
}

function stm(t,s) {
  if(sNav) {
  	if(t.length<2||s.length<25) {
		var ErrorNotice = "DHTML TIP MESSAGE VERSION 1.2 ERROR NOTICE.\n"
		if(t.length<2&&s.length<25) alert(ErrorNotice+"It looks like you removed an entry or more from the Style Array and Text Array of this tip.\nTheir should be 25 entries in every Style Array even though empty and 2 in every Text Array. You defined only "+s.length+" entries in the Style Array and "+t.length+" entry in the Text Array. This tip won't be viewed to avoid errors")
		else if(t.length<2) alert(ErrorNotice+"It looks like you removed an entry or more from the Text Array of this tip.\nTheir should be 2 entries in every Text Array. You defined only "+t.length+" entry. This tip won't be viewed to avoid errors.")
		else if(s.length<25) alert(ErrorNotice+"It looks like you removed an entry or more from the Style Array of this tip.\nTheir should be 25 entries in every Style Array even though empty. You defined only "+s.length+" entries. This tip won't be viewed to avoid errors.")
 	}
  	else {
		var ab = "" ;var ap = ""
		var titCol = (s[0])? "COLOR='"+s[0]+"'" : ""
		var txtCol = (s[1])? "COLOR='"+s[1]+"'" : ""
		var titBgCol = (s[2])? "BGCOLOR='"+s[2]+"'" : ""
		var txtBgCol = (s[3])? "BGCOLOR='"+s[3]+"'" : ""
		var titBgImg = (s[4])? "BACKGROUND='"+s[4]+"'" : ""	
		var txtBgImg = (s[5])? "BACKGROUND='"+s[5]+"'" : ""
		var titTxtAli = (s[6] && s[6].toLowerCase()!="left")? "ALIGN='"+s[6]+"'" : ""
		var txtTxtAli = (s[7] && s[7].toLowerCase()!="left")? "ALIGN='"+s[7]+"'" : ""   
		var add_height = (s[15])? "HEIGHT='"+s[15]+"'" : ""
		if(!s[8])  s[8] = "Verdana,Arial,Helvetica"
		if(!s[9])  s[9] = "Verdana,Arial,Helvetica"					
		if(!s[12]) s[12] = 1
		if(!s[13]) s[13] = 1
		if(!s[14]) s[14] = 200
		if(!s[16]) s[16] = 0
		if(!s[17]) s[17] = 0
		if(!s[18]) s[18] = 10
		if(!s[19]) s[19] = 10
		hs = s[11].toLowerCase() 
		if(ps==20001108){
		if(s[2]) ab="STYLE='border:"+s[16]+"px solid"+" "+s[2]+"'"
		ap="STYLE='padding:"+s[17]+"px "+s[17]+"px "+s[17]+"px "+s[17]+"px'"}
		var closeLink=(hs=="sticky")? "<TD ALIGN='right'><FONT SIZE='"+s[12]+"' FACE='"+s[8]+"'><A HREF='javascript:void(0)' ONCLICK='stickyhide()' STYLE='text-decoration:none;color:"+s[0]+"'><B>Close</B></A></FONT></TD>":""
		var title=(t[0]||hs=="sticky")? "<TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='0'><TR><TD "+titTxtAli+"><FONT SIZE='"+s[12]+"' FACE='"+s[8]+"' "+titCol+"><B>"+t[0]+"</B></FONT></TD>"+closeLink+"</TR></TABLE>" : ""
		var txt="<TABLE "+titBgImg+" "+ab+" WIDTH='"+s[14]+"' BORDER='0' CELLPADDING='"+s[16]+"' CELLSPACING='0' "+titBgCol+" ><TR><TD>"+title+"<TABLE WIDTH='100%' "+add_height+" BORDER='0' CELLPADDING='"+s[17]+"' CELLSPACING='0' "+txtBgCol+" "+txtBgImg+"><TR><TD "+txtTxtAli+" "+ap+" VALIGN='top'><FONT SIZE='"+s[13]+"' FACE='"+s[9]+"' "+txtCol +">"+t[1]+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
		if(nn4) {
			with(eval(obj+"document")) {
				open()
				write(txt)
				close()
			}
		}
		else eval(obj+"innerHTML=txt")
		tbody = {
			Pos:s[10].toLowerCase(), 
			Xpos:s[18],
			Ypos:s[19], 
			Transition:s[20],
			Duration:s[21], 
			Alpha:s[22],
			ShadowType:s[23].toLowerCase(),
			ShadowColor:s[24],
			Width:parseInt(eval(obj+iw)+3+sbw)
		}
		if(ie4) { 
			TipLayer.style.width = s[14]
	 		tbody.Width = s[14]
		}
		Count=0	
		move=1
 	 }
  }
}

function MoveTip(e) {
	if(move) {
		var X,Y,MouseX = eval(mx),MouseY = eval(my); tbody.Height = parseInt(eval(obj+ih)+3)
		tbody.wiw = parseInt(eval(ww+"+"+scl)); tbody.wih = parseInt(eval(wh+"+"+sct))
		switch(tbody.Pos) {
			case "left" : X=MouseX-tbody.Width-tbody.Xpos; Y=MouseY+tbody.Ypos; break
			case "center": X=MouseX-(tbody.Width/2); Y=MouseY+tbody.Ypos; break
			case "float": X=tbody.Xpos+eval(scl); Y=tbody.Ypos+eval(sct); break	
			case "fixed": X=tbody.Xpos; Y=tbody.Ypos; break		
			default: X=MouseX+tbody.Xpos; Y=MouseY+tbody.Ypos
		}

		if(tbody.wiw<tbody.Width+X) X = tbody.wiw-tbody.Width
		if(tbody.wih<tbody.Height+Y+sbw) {
			if(tbody.Pos=="float"||tbody.Pos=="fixed") Y = tbody.wih-tbody.Height-sbw
			else Y = MouseY-tbody.Height
		}
		if(X<0) X=0 
		eval(obj+sl+"=X+PX;"+obj+st+"=Y+PX")
		ViewTip()
	}
}

function ViewTip() {
  	Count++
	if(Count == 1) {
		if(cssFilters&&FiltersEnabled) {	
			for(Index=28; Index<31; Index++) { TipLayer.filters[Index].enabled = 0 }
			for(s=0; s<28; s++) { if(TipLayer.filters[s].status == 2) TipLayer.filters[s].stop() }
			if(tbody.Transition == 51) tbody.Transition = parseInt(Math.random()*50)
			var applyTrans = (tbody.Transition>-1&&tbody.Transition<24&&tbody.Duration>0)? 1:0
			var advFilters = (tbody.Transition>23&&tbody.Transition<51&&tbody.Duration>0)? 1:0
			var which = (applyTrans)?0:(advFilters)? tbody.Transition-23:0 
			if(tbody.Alpha>0&&tbody.Alpha<100) {
	  			TipLayer.filters[28].enabled = 1
	  			TipLayer.filters[28].opacity = tbody.Alpha
			}
			if(tbody.ShadowColor&&tbody.ShadowType == "simple") {
	  			TipLayer.filters[29].enabled = 1
	  			TipLayer.filters[29].color = tbody.ShadowColor
			}
			else if(tbody.ShadowColor&&tbody.ShadowType == "complex") {
	  			TipLayer.filters[30].enabled = 1
	  			TipLayer.filters[30].color = tbody.ShadowColor
			}
			if(applyTrans||advFilters) {
				eval(obj+sv+hl)
	  			if(applyTrans) TipLayer.filters[0].transition = tbody.Transition
	  			TipLayer.filters[which].duration = tbody.Duration 
	  			TipLayer.filters[which].apply()
			}
		}
 		eval(obj+sv+vl)
		if(cssFilters&&FiltersEnabled&&(applyTrans||advFilters)) TipLayer.filters[which].play()
		if(hs == "sticky") move=0
  	}
}

function stickyhide() {
	eval(HideTip)
}

function ReloadTip() {
	 if(nn4&&(evlw!=eval(ww)||evlh!=eval(wh))) location.reload()
	 else if(hs == "sticky") eval(HideTip)
}

function htm() {
	if(sNav) {
		if(hs!="keep") {
			move=0; 
			if(hs!="sticky") eval(HideTip)
		}	
	} 
}


//*********************************************************************************************************************************

var ie4;
var dom;
var curcanvas;
var curimageindex;
var slideshow_width;
var slideshow_height;
var pause;
var degree;
var curpos;
var degree;
var nextimageindex;
var on= "#FFFFFF";
var off= "#000000";
var blinkspeed= 500;
var dropimages=new Array();
var droplinks=new Array();
var targetlinks=new Array();
var whichlink=0
var whichimage=0
var pixeldelay=(ie55)? document.images.slide.filters[0].duration*1000 : 0

//*********************************************************************************************************************************

function zera ( campo ) {
	eval("var sItem = document.selCertificado." + campo + ".selectedIndex;");
	eval("var sValor = document.selCertificado." + campo + ".options[sItem].value;");
	if ( sValor != 'Primeiro') {
		eval("habilitaSelecao(document.selCertificado." + campo + ");");
	} else {
		return;
	}
}

function abreArea(qual) {
	parent.Principal.document.location = "/paginaInicial/paginaInicial.htm?par=" + qual;
	document.location  = "/pesquisa/menuPesquisa.htm?par=" + qual;
}

function submeteCertificado(fNome, fTreinamento, fEditor, fRegiao, fDtEvento, fLocal, fDtAss) {
	document.campos.nome.value = fNome;
	document.campos.treinamento.value = fTreinamento;
	document.campos.editor.value = fEditor;
	document.campos.regiao.value = fRegiao;
	document.campos.local.value = fLocal;
	document.campos.dtevento.value = fDtEvento;
	document.campos.dtass.value = fDtAss;
	document.campos.submit();
}

function testa() {
	var iLocal = document.Certificado.local.selectedIndex;
	var rLocal = document.Certificado.local.options[iLocal].value;
	
}

function certificado() {
	var itemEditor = document.Certificado.editor.selectedIndex;
	var itemRegiao = document.Certificado.regiao.selectedIndex;
	var itemLocal = document.Certificado.local.selectedIndex;
	if ( itemEditor != 0 ) {
		var respE = document.Certificado.editor.options[itemEditor].value;
		var respEditor = aEditor[respE][0];
		if ( itemRegiao != 0 ) {
			var respR = document.Certificado.regiao.options[itemRegiao].text;
			for ( i=1; i<aRegiao.length; i++ ) {
				if ( aRegiao[i] == respR ) {
					var respRegiao = i;
					i = aRegiao.length;
				}
			}
			if ( itemLocal != 0 ) {
				var respL = document.Certificado.local.options[itemLocal].value;
				var respLocal = aLocal[respL][0];
				document.location = "../CertificadoNome?editor=" + respEditor + "&regiao=" + respRegiao + "&local=" + respLocal; 
			} else {
				alert("? necess?rio selecionar o Local de realiza??o do treinamento!");
			}
		} else {
			alert("? necess?rio selecionar uma Regi?o!");
		}
	} else {
		alert("? necess?rio selecionar o Editor!");
	}
} 

function carregaCampo (nome) {
	var itemE = document.Certificado.editor.selectedIndex;
	var respostaE = document.Certificado.editor.options[itemE].value;
	var rAnt = "";
	var aReg = new Array();
	var i2;
	if ( nome == 'editor' ) {
		if ( document.Certificado.regiao.length > 1 ) {
			for ( i=document.Certificado.regiao.length-1; i>-1; i-- ) {
				document.Certificado.regiao.remove(i);
			}
			addCampo("regiao","Selecione a Regi?o","-1");
			if ( document.Certificado.local.length > 1 ) {
				for ( i=document.Certificado.local.length-1; i>-1; i-- ) {
					document.Certificado.local.remove(i);
				}
				addCampo("local","Selecione o Local","-1");
			}
		}
		if ( respostaE != '-1' ) {
			eAnt = "";
			i2 = 0;
			for (i=0;i<aTotal.length;i++) {
				if ( respostaE == aTotal[i][0]) {
					if ( rAnt != aTotal[i][1] ) {
						aReg[i2] = aTotal[i][1];
						rAnt = aTotal[i][1];
						i2++;
					}
				}
			}
			for (i=aReg.length-1;i>=0;i--) {
				addCampo("regiao",aRegiao[aReg[i]],aReg[i]);
			}
		} else {
			alert("? necess?rio selecionar um dos Editores!");
		}
	} else if ( nome == 'regiao' ) {
		aValor = aTotal[respostaE][0];
		i2 = 0;
		var itemR = document.Certificado.regiao.selectedIndex;
		var respostaR = document.Certificado.regiao.options[itemR].value;
		var respostaRIndex = "";
		var respostaRTemp = document.Certificado.regiao.options[itemR].text;
		for ( i=1; i<aRegiao.length; i++ ) {
			if ( aRegiao[i] == respostaRTemp ) {
				respostaRIndex = i;
				i = aRegiao.length;
			}
		}
		if ( document.Certificado.local.length > 1 ) {
			for ( i=document.Certificado.local.length-1; i>-1; i-- ) {
				document.Certificado.local.remove(i);
			}
			addCampo("local","Selecione o Local","0");
		}
		if ( respostaR != '-1' ) {
			var lAnt = "";
			aLoc = new Array();
			i2 = 0;
			for (i=0;i<aTotal.length;i++) {
				if ( ( respostaE == aTotal[i][0] )&&( respostaRIndex == aTotal[i][1] ) ) {
					if ( rAnt != aTotal[i][2] ) {
						aLoc[i2] = aTotal[i][2];
						rAnt = aTotal[i][2];
						i2++;
					}
				}
			}
			for (i=aLoc.length-1;i>-1;i--) {
				addCampo("local",aLocal[aLoc[i]][1],aLoc[i]);
			}
		} else {
			alert("? necess?rio selecionar um dos Editores!");
		}
	}
	return;
}

function addCampo(campo,texto,valor) {
	var aOption ;
	aOption = document.createElement("option");
	aOption.text = texto;
	aOption.value = valor;
	eval("document.Certificado." + campo + ".add(aOption,1)");
}

function blink() {
	if (navigator.appName != 'Netscape') {
		if( document.all.blink.style.color == off) {
			document.all.blink.style.color = on;
		} else {
			document.all.blink.style.color = off;
		}
	} else {
		return;
	}
}

function showtip(current,e,text){
	if (document.all||document.getElementById) {
		thetitle=text.split('<br>')
		if (thetitle.length>1) {
			thetitles=''
			for (i=0;i<thetitle.length;i++)
				thetitles+=thetitle[i]
				current.title=thetitles
		} else {
			current.title=text
		}
	} else if (document.layers) {
		document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;">'+text+'</layer>');
		document.tooltip.document.close();
		document.tooltip.left=e.pageX+5;
		document.tooltip.top=e.pageY+5;
		document.tooltip.visibility="show";
	}
}

function hidetip() {
	if (document.layers)
		document.tooltip.visibility="hidden"
}

function dropImagens (qtd,imagem,end,targ) {
	//Drop-in slideshow II (hyperlinked)- By Dynamic Drive
	//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
	//This credit MUST stay intact for use

	slideshow_width=300 //SET SLIDESHOW WIDTH (set to largest image's width if multiple dimensions exist)
	slideshow_height=180 //SET SLIDESHOW HEIGHT (set to largest image's height if multiple dimensions exist)
	pause=8000 //SET PAUSE BETWEEN SLIDE (2000=2 seconds)

	dropimages = parser(imagem,";");
	droplinks = parser(end,";");
	targetlinks = parser(targ,";");

	for (i=0;i<qtd;i++) {
		if (targetlinks[i]=="0") {
			targetlinks[i] = "";
		}
	}

	////NO need to edit beyond here/////////////

	var preloadedimages=new Array()
	for (p=0;p<dropimages.length;p++)
	{
		preloadedimages[p]=new Image()
		preloadedimages[p].src=dropimages[p]
	}

	ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
	dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1

	if (ie4||dom)
	{
		document.write('<div style="position:relative;width:'+slideshow_width+';height:'+slideshow_height+';overflow:hidden"><div id="canvas0" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:-'+slideshow_height+'"></div><div id="canvas1" style="position:absolute;width:'+slideshow_width+';height:'+slideshow_height+';top:-'+slideshow_height+'"></div></div>')
	} else {
		document.write('<a href="javascript:rotatelink()"><img name="defaultslide" src="'+dropimages[0]+'" border=0></a>')
	}
	curpos=slideshow_height*(-1)
	degree=10
	curcanvas="canvas0"
	curimageindex=0
	nextimageindex=1

	if (ie4||dom)
	{
		window.onload=startit
	} else {
		setInterval("rotateimage()",pause)
	}
}

function movepic(){
	if (curpos<0)
	{
		curpos=Math.min(curpos+degree,0)
		tempobj.style.top=curpos
	} else {
		clearInterval(dropslide)
		nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
		tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
		tempobj.innerHTML='<a href="'+droplinks[curimageindex]+'" target="'+targetlinks[curimageindex]+'"><img src="'+dropimages[curimageindex]+'" border=0></a>'
		nextimageindex=(nextimageindex<dropimages.length-1)? nextimageindex+1 : 0
		setTimeout("rotateimage()",pause)
	}
}

function rotateimage()
{
	if (ie4||dom)
	{
		resetit(curcanvas)
		var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
		crossobj.style.zIndex++
		var temp='setInterval("movepic()",40)'
		dropslide=eval(temp)
		curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
	} else {
		document.images.defaultslide.src=dropimages[curimageindex]
	}
	linkindex=curimageindex
	curimageindex=(curimageindex<dropimages.length-1)? curimageindex+1 : 0
}

function rotatelink()
{
	window.location = droplinks[linkindex];
}

function resetit(what)
{
	curpos=slideshow_height*(-1)
	var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
	crossobj.style.top=curpos
}

function startit()
{
	var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
	crossobj.innerHTML='<a href="'+droplinks[curimageindex]+'" target="'+targetlinks[curimageindex]+'"><img src="'+dropimages[curimageindex]+'" border=0></a>'
	rotateimage()
}

function parser (InString, Sep)  {
	NumSeps=0;
	for (Count=1; Count < InString.length; Count++)  {
		if (InString.charAt(Count)==Sep)
			NumSeps++;
	}
	parse = new makeArray (NumSeps);
	Start=0; Count=0; ParseMark=0;
	LoopCtrl=1;
	while (LoopCtrl==1)  {
		ParseMark = InString.indexOf(Sep, ParseMark);
		TestMark=ParseMark+0;
		if ((TestMark==0) || (TestMark==-1)){
			parse[Count]= InString.substring (Start, InString.length);
			LoopCtrl=0;
			break;
		}
		parse[Count] = InString.substring (Start, ParseMark);
		Start=ParseMark+1;
		ParseMark=Start;
		Count++;
	}
	//parse[0]=Count;
	return (parse);
}

function makeArray (NumElements, Fill)  {
	var Count;
	this.length = NumElements;
	for (Count = 1; Count <= NumElements; Count++)  {
		this[Count] = Fill;
	}
	return (this);
}

function submeter(aTipo, aPar, aPar1, aPar2, aPar3) {
	var finalTipo = aTipo;
	var finalPar  = aPar;
	var finalPar1 = aPar1;
	var finalPar2 = aPar2;
	var finalPar3 = aPar3;
	if ( finalTipo == "2" ) {
		finalPar3 = spaceTrim(document.Texto.conteudo.value);
		if ( finalPar3 != '' ) {
			var teste = '';
			if (finalPar3.length > 2) {
				var tam = finalPar3.length;
				var test = new Array(tam);
				for (i=0;i<=(tam-1);i++) {
					test[i] = teste.substring(i,i+1);
					if (test[i] == " ") {
						test[i]="_";
					}
					teste = teste + test[i];
					document.Texto.conteudo.value = '';
				}
					parent.Principal.location = "../PesquisaPeriodico?tipo=" + finalTipo + "&par=" + finalPar + "&par1=" + finalPar1 + "&par2=" + finalPar2 + "&par3=" + teste;

			} else {
				alert("Para que sua pesquisa seja realizada ? exigido no m?nimo 3 caracteres!");
				document.Texto.conteudo.focus();
				document.Texto.conteudo.select();
				return;
			}
		} else {
			alert("Esta pesquisa resultar? em todos os registros, para isso clique em Lista completa!");
			document.Texto.conteudo.focus();
			return;
		}
	}
	parent.Principal.location = "../PesquisaPeriodico?tipo=" + finalTipo + "&par=" + finalPar + "&par1=" + finalPar1 + "&par2=" + finalPar2 + "&par3=" + finalPar3;
}


//*********************************************************************************************************************************

function data () {
	var mydate=new Date();
	var theYear=mydate.getFullYear();
	var day=mydate.getDay();
	var month=mydate.getMonth();
	var daym=mydate.getDate();
	if (daym<10) {
		daym="0"+daym
	}
	var dayarray=new Array("Domingo","Segunda-feira","Ter?a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S?bado");
	var montharray=new Array("janeiro","fevereiro","mar?o","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro");
	document.write( dayarray[day] + ", " + daym + " de " + montharray[month] + " de " + theYear + "&nbsp;&nbsp;");
}

//*********************************************************************************************************************************

function MM_findObj( n, d ) {
	var p,i,x;
	if ( !d ) {
		d=document;
	}
	if ( ( p=n.indexOf( "?" ) ) > 0 && parent.frames.length ) {
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if ( !( x=d[n] ) && d.all ) {
		x=d.all[n];
	}
	for ( i=0; !x && i<d.forms.length; i++ ) {
		x=d.forms[i][n];
	}
	for ( i=0; !x && d.layers&&i<d.layers.length; i++ ) {
		x=MM_findObj( n, d.layers[i].document );
	}
	if ( !x && d.getElementById ) {
		x=d.getElementById(n);
	}
	return x;
}

function MM_nbGroup( event, grpName, nome ) {
	var i,img,nbArr,args=MM_nbGroup.arguments;
	if ( event == "init" && args.length > 2 ) {
		if ( ( img = MM_findObj( args[2] ) ) != null && !img.MM_init ) {
			img.MM_init = true;
			img.MM_up = args[3];
			img.MM_dn = img.src;
			if ( ( nbArr = document[grpName] ) == null ) {
				nbArr = document[grpName] = new Array();
			}
			nbArr[nbArr.length] = img;
			for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
				if ( !img.MM_up ) {
					img.MM_up = img.src;
				}
				img.src = img.MM_dn = args[i+1];
				nbArr[nbArr.length] = img;
			} 
		}
	} else if ( event == "over" ) {
		document.MM_nbOver = nbArr = new Array();
		for ( i=1; i<args.length-1; i+=3 ) {
			if ((img = MM_findObj(args[i])) != null) {
				if ( !img.MM_up ) {
					img.MM_up = img.src;
				}
				img.src = ( img.MM_dn && args[i+2] ) ? args[i+2] : ( ( args[i+1] ) ? args[i+1] : img.MM_up );
				nbArr[nbArr.length] = img;
			}
		}
	} else if ( event == "out" ) {
		for ( i=0; i<document.MM_nbOver.length; i++ ) {
			img = document.MM_nbOver[i];
			img.src = (img.MM_dn) ? img.MM_dn : img.MM_up;
		}
	} else if ( event == "down" ) {
		nbArr = document[grpName];
		if ( nbArr ) {
			for ( i=0; i<nbArr.length; i++) {
				img=nbArr[i];
				img.src = img.MM_up;
				img.MM_dn = 0;
			}
		}
		document[grpName] = nbArr = new Array();
		for ( i=2; i < args.length-1; i+=2 ) {
			if ( ( img = MM_findObj( args[i] ) ) != null ) {
				if ( !img.MM_up ) {
					img.MM_up = img.src;
				}
				img.src = img.MM_dn = ( args[i+1] ) ? args[i+1] : img.MM_up;
				nbArr[nbArr.length] = img;
			}
		}
		if ( ( nome == 'PgInicial' ) || ( nome == 'TxtComp' ) || ( nome == 'Resumos' ) || ( nome == 'Outras' ) || (nome == 'TxtLivros' ) ) {
			trocaMeio(nome);
		}
	}
}

function MM_preloadImages() {
	var d=document;
	if ( d.images ) {
		if ( !d.MM_p ) {
			d.MM_p=new Array();
		}
		var i, j=d.MM_p.length, a=MM_preloadImages.arguments;
		for ( i=0; i<a.length; i++ ) {
			if ( a[i].indexOf( "#" ) != 0 ) {
				d.MM_p[j] = new Image;
				d.MM_p[j++].src = a[i];
			}
		}
	}
}

function trocaMeio( n ) {
	if ( n == 'PgInicial' ) {
		for ( i=0; i<= document.images.length - 1; i++) {
			if ( eval("document.images[" + i + "].name == 'Meio1'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOnOff.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio2'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOffOff.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio3'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOffOff.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio4'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioDirOff.gif';");
			}
		}
	} else if ( n == 'TxtComp' ) {
		for ( i=0; i<= document.images.length - 1; i++) {
			if ( eval("document.images[" + i + "].name == 'Meio1'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOffOn.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio2'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOnOff.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio3'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOffOff.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio4'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioDirOff.gif';");
			}
		}
	} else if ( n == 'Resumos' ) {
		for ( i=0; i<= document.images.length - 1; i++) {
			if ( eval("document.images[" + i + "].name == 'Meio1'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOffOff.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio2'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOffOn.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio3'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOnOff.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio4'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioDirOff.gif';");
			}
		}
	} else if ( n == 'Outras' ) {
		for ( i=0; i<= document.images.length - 1; i++) {
			if ( eval("document.images[" + i + "].name == 'Meio1'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOffOff.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio2'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOffOff.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio3'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioOffOn.gif';");
			} else if ( eval("document.images[" + i + "].name == 'Meio4'") ) {
				eval("document.images[" + i + "].src = 'img/tabs/MeioDirOn.gif';");
			}
		}
	}
}

//*********************************************************************************************************************************

   function novaJanela ( janela ) {
        window.open(janela,'Documentos','toolbar=2,location=0,directories=0,status=0,scrollbars=yes,menubar=1,resizable=1');
   }

//*********************************************************************************************************************************

//specify interval between slide (in mili seconds)
var slidespeed=5000;
//specify images
var slideimages = new Array( "/portugues/img/box/box7.gif","/portugues/img/box/box8.gif","/portugues/img/box/box9.gif");
//14-11-2005 var slideimages = new Array( "/img/box/box1.gif", "/img/box/box2.gif", "/img/box/box3.gif", "/img/box/box4.gif", "/img/box/box5.gif" );
//var slideimages = new Array( "/img/box/centros_federais.gif", "/img/box/base_patentes.gif", "/img/box/proquest.gif", "/img/box/csa.gif",	"/img/box/SPRINGER.gif", "/img/box/kruwer.gif", "/img/box/nature_reviews.gif", "/img/box/inspec.gif", "/img/box/cambridge.gif", "/img/box/esmeralds.gif", "/img/box/hw_wilson.gif", "/img/box/oecs.gif", "/img/box/oxford_journals.gif");
//specify corresponding links
var slidelinks = new Array(	"#", "#", "#");
//14-11-2005 var slidelinks = new Array(	"#", "#", "#", "#", "#", "#");
//var slidelinks = new Array(	"#", "/outrasFontes.jsp", "javascript:novaJanela('http://proquest.umi.com/login?COPT=SU5UPTkmVkVSPTImREJTPUcw')", "#", "javascript:novaJanela('http://www.springerlink.com/app/home/main.asp?wasp=570cd1fb74dxrn4918fg')", "javascript:novaJanela('http://journals.kluweronline.com/')", "javascript:novaJanela('http://www.nature.com/nature/')", "javascript:novaJanela('http://217.154.84.195/inspec/')", "/pesquisa/pesquisa.jsp?par=Cambridge&tipo=2",	"/pesquisa/pesquisa.jsp?par=Emerald&tipo=2", "/pesquisa/pesquisa.jsp?par=Wilson&tipo=2", "#", "/pesquisa/pesquisa.jsp?par=Oxford&tipo=2");
var imageholder = new Array();
var ie55 = window.createPopup;
for ( i=0; i<slideimages.length; i++ ) {
	imageholder[i] = new Image();
	imageholder[i].src = slideimages[i];
}

function slideit(){
	if ( !document.images ) { 
		return;
	}
	if ( ie55 ) {
		document.images.slide.filters[0].apply();
	}
	document.images.slide.src = imageholder[whichimage].src;
	if ( ie55 ) {
		document.images.slide.filters[0].play();
	}
	whichlink=whichimage
	whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
	setTimeout("slideit()",slidespeed+pixeldelay);
}

function gotoshow(){
	window.location = slidelinks[whichlink];
}

//*********************************************************************************************************************************

function onClickCheckBox( objeto ) {
	var sForm = "";
	var sNaci = objeto.checked;
	var sEndereco = "" + parent.Principal.location + "";
	var resultRes = sEndereco.indexOf("resumos");
	var resultTxt = sEndereco.indexOf("outrasFontes");
	if ( resultRes != -1 ) {
		sForm = "resumos";
	} else if ( resultTxt != -1 ) {
		sForm = "outrasFontes";
	}
	eval("parent.Principal.location = './" + sForm + ".jsp?nac=" + sNaci + "';");
}

function checkaLocal( valor ) {
	for ( i=0; i<document.Local.cbLocal.length; i++ ) {
		if ( valor == document.Local.cbLocal[i].value ) {
			if ( document.Local.cbLocal[i].checked == true ) {
				document.Local.cbLocal[i].checked = false;
			} else {
				document.Local.cbLocal[i].checked = true;
			}
		}
	}
}

function checkaNacionais( tipo ) {
	if ( tipo == 'All' ) {
		if ( document.geral.nacionais.checked == true ) {
			document.geral.nacionais.checked = false;
		} else {
			document.geral.nacionais.checked = true;
		}
	} else if ( tipo == '1' ) {
		if ( document.textoCompleto.nacionais.checked == true ) {
			document.textoCompleto.nacionais.checked = false;
		} else {
			document.textoCompleto.nacionais.checked = true;
		}
	} else if ( tipo == '2' ) {
		if ( document.Resumo.nacionais.checked == true ) {
			document.Resumo.nacionais.checked = false;
		} else {
			document.Resumo.nacionais.checked = true;
		}
		onClickCheckBox(document.Resumo.nacionais);
	} else if ( tipo == '+2' ) {
		if ( document.OutrasFontes.nacionais.checked == true ) {
			document.OutrasFontes.nacionais.checked = false;
		} else {
			document.OutrasFontes.nacionais.checked = true;
		}
		onClickCheckBox(document.OutrasFontes.nacionais);
	}
}

/* Executa a pesquisa 2 
 * Autor : Alexandre M. Pinto
 * Alterado : 30/04/2004
 */

function ExecPesquisa ( nome, valor, tipo) {
	var letra = "";
	var palavra = "";
	var editor = "";
	var assunto = "";
	var nacionalidade = ""
	var tipoDocumento = tipo;
	if ( tipo == 'All') {
		if ( parent.Superior.document.geral.nacionais.checked == true ) {
			nacionalidade = "1";
		} else {
			nacionalidade = "0";
		}
	} else if ( tipo == '1') {
		if ( parent.Principal.document.textoCompleto.nacionais.checked == true ) {
			nacionalidade = "1";
		} else {
			nacionalidade = "0";
		}
	}
	if ( nome == 'palavra' ) {
		var txt;
		txt = spaceTrim( valor.value );
		if ( ( txt != null ) && ( txt != "" ) ) {
			if ( valor.form.name == 'geral' ) {
				document.geral.Palavra.value = "";
			}
			palavra = txt;
		} else {
			textoVazio();
			return;
		}
	} 
	if ( nome == 'Letra' ) {
		letra = valor;
	}
	if ( nome == 'editor' ) {
		editor = valor.value;
	}
	if ( nome == 'Bases' ) {
		if ( tipo != '1') {
			if ( valor.selectedIndex == '0' ) {
			
				alert("? necess&aacute;rio selecionar uma op&ccedil;&atilde;o v&aacute;lida!");
				return;
			} else {
				//if ( ( tipo == '3' ) && ( valor.options[valor.selectedIndex].text == 'MICROMEDEX Healthcare Series' ) ) {
				//	alert('A CAPES informa que os dados para acesso a base MICROMEDEX s?o: \nnome de usu?rio;      capes3 \nsenha;                       cp365');
				//} 
				parent.location = spaceTrim( valor.value );
				return;
			}
		} else {
			top.location = valor.value;
		}
	}
	
	if ( nome == 'assunto' ) {
		if ( ( valor == '01' ) || ( valor == '02' ) ) {
			assunto = valor;
		} else {
			if ( valor.value != '0' ) {  
				assunto = valor.value;
			} else {
				alert("? necess?rio selecionar um valor v?lido!");
				return(false);
			}
		}
	}

	parent.Principal.location = "/pesquisa/pesquisa.jsp?palavra=" + palavra +  
									"&letra=" + letra +
									"&editor=" + editor +
									"&assunto=" + assunto +
									"&tipo=" + tipoDocumento +
									"&nac=" + nacionalidade;

}

function mudaEditor ( editor ) {
	var i=0;
	while( document.textoCompleto.Editores[i].value != editor ) {
		i++;
	}
	document.textoCompleto.Editores.selectedIndex = i;
	ExecPesquisaPaginada( "editor", document.textoCompleto.Editores, "1", "true", "" );
}

function ExecPesquisaPaginada ( nome, valor, tipo ) {
	ExecPesquisaPaginada ( nome, valor, tipo, "", tipoAssinatura );
}

/* Executa do menu Superior
 * modificado por: Ronan
 * Alterado : 08/12/2004
 */

function ExecPesquisaPaginada ( nome, valor, tipo, gratis, tipoAssinatura ) {

	var letra = "";
	var palavra = "";
	var editor = "";
	var assunto = "";
	var nacionalidade = ""
	var tipoDocumento = tipo;
	if ( tipo == 'All') {
		if ( parent.Superior.document.geral.nacionais.checked == true ) {
			nacionalidade = "1";
		} else {
			nacionalidade = "0";
		}
	} else if ( tipo == '1' ) {
	
			if ( parent.Principal.document.textoCompleto.nacionais.checked == true ) {
				nacionalidade = "1";
			} else {
				nacionalidade = "0";
			}

		if ( nome == "Bases" ) {
			top.location = valor.value;
			return;
		}
	}
	if ( nome == 'palavra' ) {
		var txt;
		txt = spaceTrim( valor.value );
		if ( ( txt != null ) && ( txt != "" ) ) {
			if ( valor.form.name == 'geral' ) {
				document.geral.Palavra.value = "";
			}
			palavra = txt;
		} else {
			textoVazio();
			return;
		}
	} 
	if ( nome == 'Letra' ) {
		letra = valor;
	}
	if ( nome == 'editor' ) {
		editor = valor.value;
	}
	if ( nome == 'Bases' ) {
		if ( tipo != '1') {
			if ( valor.selectedIndex == '0' ) {
				alert("? necess?rio selecionar uma op??o v?lida!");
				return;
			} else {
				if ( ( tipo == '3' ) && ( valor.options[valor.selectedIndex].text == 'MICROMEDEX Healthcare Series' ) ) {
					alert('A CAPES informa que os dados para acesso a base MICROMEDEX s?o: \nnome de usu?rio;      capes3 \nsenha;                       cp365');
				} 
				parent.location = spaceTrim( valor.value );
				return;
			}
		} else {
			top.location = valor.value;
		}
	}
	
	if ( nome == 'assunto' ) {
		if ( ( valor == '01' ) || ( valor == '02' ) ) {
			assunto = valor;
		} else {
			if ( valor.value != '0' ) {  
				assunto = valor.value;
			} else {
				alert("? necess?rio selecionar um valor v?lido!");
				return(false);
			}
		}
	}

	parent.Principal.location = "/pesquisa.do?palavra=" + palavra +  
									"&letra=" + letra +
									"&editor=" + editor +
									"&assunto=" + assunto +
									"&tipo=" + tipoDocumento +
									"&nac=" + nacionalidade +
									"&gratis=" + gratis +
									"&tipoAssinatura=" + tipoAssinatura ;

}
function textoVazio () {
	alert("? necess?rio digitar algo no campo!"); 
}


function spaceTrim(InString) {
	var LoopCtrl=true;
	while (LoopCtrl) {
		if (InString.indexOf("  ") != -1) {
			Temp = InString.substring(0, InString.indexOf("  "));
			InString = Temp + InString.substring(InString.indexOf("  ")+1, InString.length)
		} else {
			LoopCtrl = false;
		}
		if (InString.substring(0, 1) == " ") {
			InString = InString.substring(1, InString.length);
		}
		if (InString.substring (InString.length-1) == " ") {
			InString = InString.substring(0, InString.length-1);
		}
		return (InString)
	}
}

//*********************************************************************************************************************************
/* Executa a pesquisa passando o controle 
 * Autor : Mateus Batista
 * Alterado : 28/01/2004
 */

function ExecPesq( obj, t ) {
	var sPar  = "";
	var tPesq = "";
	var iTipo = 0;
	var sPArg = obj.name;
	if ( sPArg != 'Principal' ) {
		iTipo = t;
		if ( obj.form.name == 'textoCompleto' ) {
			if ( navigator.appName == 'Netscape') {
				if ( obj.type == 'tex' ) {
					sPar =  obj.value;
				}
			} else {
				if ( obj.type == 'text' ) {
					sPar =  obj.value;
				}
			}
			if ( ( obj.type == 'select-one' ) || ( obj.type == 'select-multiple' ) ) {
				var iIndex = obj.selectedIndex;
				if ( sPArg != 'Editores' ) {
					if ( iIndex != 0 ) {
						sPar = obj.options[iIndex].value;
					} else {
						alert("? necess?rio selecionar uma op??o v?lida!");
						return(false);
					}
				} else {
					sPar = obj.options[iIndex].value;
				}
			}
		} else if ( obj.form.name == 'OutrasFontes' ) {
			if ( obj.type == 'select-one' ) {
				var iIndex = obj.selectedIndex;
				if ( iIndex != 0 ) {
					sPar = obj.options[iIndex].value;
					abreLinkTop(sPar);
					return(false);
				} else {
					alert("? necess?rio selecionar uma op??o v?lida!");
					return(false);
				}
			}
		} else if ( obj.form.name == 'Resumo' ) {
			if ( obj.type == 'select-one' ) {
				var iIndex = obj.selectedIndex;
				if ( iIndex != 0 ) {
					sPar = obj.options[iIndex].value;
					abreLinkTop(sPar);
					return(false);
				} else {
					alert("? necess?rio selecionar uma op??o v?lida!");
					return(false);
				}
			}
		}
	} else {
		if ( ( t != '01' ) && ( t != '02' ) ) {
			iTipo = 3;
		} else {
			iTipo = 4;
		}
		sPar = t;
	}
	document.location = "/pesquisa/pesquisa.jsp?par=" + sPar + 
									"&tipo=" + iTipo +
									"&par2=" + sPArg +
									"&par3=" + tPesq;
}

//*********************************************************************************************************************************

function abreLinkTop( sLink ) {
	top.location = sLink;
}

function abreDetalhe( issn, editor ) {
		window.open( "/pesquisa/detalhe.jsp?issn="+issn+"&editor="+editor,"Detalhe","toolbar=0,scrollbars=1,location=0,status=0,menubar=0,resizable=0,width=500,height=130,left=150,top=145");
	}

//*********************************************************************************************************************************

function selecionaTreinamento( pessoa ) {
	document.selCertificado.codPessoal.value = pessoa;
	novaJanela("/portugues/paginaInicial/certificado/certificadoTreinamento.jsp?codPessoal=" + document.selCertificado.codPessoal.value + "&codRegiao=" + document.selCertificado.codRegiao.value + "&codLocal=" + document.selCertificado.codLocal.value );
}

function escreve(texto) {
	window.frames["iMenuPesquisa"].escreve(texto);
}

function habilitaSelecao ( campo ) {
	eval("var sItem = document." +  campo.form.name + "." + campo.name + ".selectedIndex;");
	eval("var sValor = document." +  campo.form.name + "." + campo.name + ".options[sItem].value;");
	if ( sValor == "Primeiro" ) {
		if ( campo.name == "regiao" ) {
			if ( document.selCertificado.local.style.display != 'none' ) {
				document.selCertificado.local.length = 1;
				document.selCertificado.local.style.display = 'none';
			}
		} else if ( campo.name == "selTreinamento" ) {
			if ( document.Selecao.selLocal.style.display != 'none' ) {
				document.Selecao.selLocal.selectedIndex = 0;
				document.Selecao.selLocal.style.display = 'none';
				var num = document.images.length;
				for ( i=0; i < document.images.length; i++ ) {
					eval("if ( document.images[" + i + "].name == 'novoLocal') { document.images[" + i + "].style.display = 'none'; }");
				}
				if ( document.Selecao.selEditor.style.display != 'none' ) {
					document.Selecao.selEditor.selectedIndex = 0;
					document.Selecao.selEditor.style.display = 'none';
					for ( i=0; i < document.images.length; i++ ) {
						eval("if ( document.images[" + i + "].name == 'novoEditor') { document.images[" + i + "].style.display = 'none'; }");
					}
					if ( document.Data.style.display != 'none') {
						document.Data.style.display = 'none';
					}
					if ( document.dadosPessoais.style.display != 'none') {
						document.dadosPessoais.style.display = 'none';
					}
				}
			}
		} else if ( campo.name == "selLocal" ) {
			if ( document.Selecao.selEditor.style.display != 'none' ) {
				document.Selecao.selEditor.selectedIndex = 0;
				document.Selecao.selEditor.style.display = 'none';
				for ( i=0; i < document.images.length; i++ ) {
					eval("if ( document.images[" + i + "].name == 'novoEditor') { document.images[" + i + "].style.display = 'none'; }");
				}
				if ( document.Data.style.display != 'none') {
					document.Data.style.display = 'none';
				}
				if ( document.dadosPessoais.style.display != 'none') {
					document.dadosPessoais.style.display = 'none';
				}
			}
		} else if ( campo.name == "selEditor" ) {
			if ( document.Data.style.display != 'none' ) {
				document.Data.style.display = 'none';
			}
			if ( document.dadosPessoais.style.display != 'none') {
				document.dadosPessoais.style.display = 'none';
			}
		}
		alert( "? necess?rio selecionar uma op??o v?lida!" );
		return(false);
	} else {
		var i = 0;
		if ( campo.name == 'regiao' ) {
			if ( document.selCertificado.local.style.display == 'none' ) {
				document.selCertificado.local.style.display = '';
			} 
			eval("if (document." + campo.form.name + ".local.options.length > 1 ) { document." + campo.form.name + ".local.options.length = 1; } ");
			for ( i=0; i < aLocal[campo.value].length; i++ ) {
				eval("document." + campo.form.name + ".local.options[" + ( i + 1 ) + "] = new Option('" + aLocal[campo.value][i][1] + "', '" + aLocal[campo.value][i][0] + "' );");			
			} 
			eval("document." + campo.form.name + ".regiaoNome.value = document." +  campo.form.name + ".regiao.options[sItem].text;");			
		} else if ( campo.name == 'local' ) {
			eval("document." + campo.form.name + ".localNome.value = document." +  campo.form.name + ".local.options[sItem].text;");			
			eval("document." +  campo.form.name + ".submit();");
			return(true);
		} else if ( campo.name == 'selTreinamento' ) {
			if ( document.Selecao.selLocal.style.display == 'none' ) {
				document.Selecao.selLocal.style.display = '';
				for ( i=0; i < document.images.length; i++ ) {
					eval("if ( document.images[" + i + "].name == 'novoLocal') { document.images[" + i + "].style.display = ''; }");
				}
			} 
		} else if ( campo.name == 'selLocal' ) {
			//alert(document.Selecao.selEditor.style.display);
			if ( document.Selecao.selEditor.style.display == 'none' ) {
				document.Selecao.selEditor.style.display = '';
				for ( i=0; i <= document.images.length-1; i++ ) {
					eval("if ( document.images[" + i + "].name == 'novoEditor') { document.images[" + i + "].style.display = ''; }");
				}
			} 
			if ( document.Data.style.display == '' ) {
				document.Data.style.display = 'none';
			}
		} else if ( campo.name == 'selEditor' ) {
			if ( document.Data.style.display == 'none' ) {
				document.Data.style.display = '';
			}
		} else if ( campo.name == 'alex' ) {
			if ( document.dadosPessoais.style.display == 'none') {
				document.dadosPessoais.style.display = '';
			}
		}
	}
}


function direcionarPagina( objeto ) {

	if( objeto.name == 'dadosPessoais' ) {
	
		var sItemT1		= document.Selecao.selTreinamento.selectedIndex;
		var sValorT1	= document.Selecao.selTreinamento.options[sItemT1].value;
		var sItemL1		= document.Selecao.selLocal.selectedIndex;
		var sValorL1	= document.Selecao.selLocal.options[sItemL1].value;
		var sItemE		= document.Selecao.selEditor.selectedIndex;
		var sValorE		= document.Selecao.selEditor.options[sItemE].value;
		var sItemE1		= document.dadosPessoais.selEditor1.selectedIndex;
		var sValorE1	= document.dadosPessoais.selEditor1.options[sItemE1].value;
		var sDataIni	= document.Data.dtInicial.value;
		var sDataFim	= document.Data.dtFinal.value;
		var sDuracao    = document.Data.cargaHoraria.value;
		
		for ( i=0; i<objeto.length; i++ ) {
			if ( spaceTrim( objeto[i].value ) == "" ) {
				alert("? necess?rio preencher todos os campos!");
				return;
			}
		}
		
		if( sValorE1 == 'Primeiro' ) {
			alert("Selecione um editor!");
			return;
		}
		
		if( sValorE == sValorE1 ){
			alert("N?o e possivel clonar editores s?o iguais");
			return;
		}
		
		document.location = 'cloneDadosPessoais.jsp?codT1=' + sValorT1 + '&codL1=' + sValorL1 + '&codE=' + sValorE + '&codE1=' + sValorE1 + '&dtIni=' + sDataIni + '&dtFim=' + sDataFim + '&tipo=0' + '&non=sim' + '&codigoEvento=' + '&duracao=' + sDuracao ;
		
	}

}

function submitForm ( objeto ) {
	//todos os campos necess?rios
	if ( ( objeto.name == 'Treinamento' ) || ( objeto.name == 'novoEdit' ) || ( objeto.name == 'dadosPessoais' ) ) {
		for ( i=0; i<objeto.length; i++ ) {
			if ( spaceTrim( objeto[i].value ) == "" ) {
				alert("? necess?rio preencher todos os campos!");
				return;
			}
		}
		
	} else if ( objeto.name == 'novoLocal' ) {
		for ( i=0; i < objeto.length; i++ ) {
			if ( objeto[i].type == 'text' ) {
				if ( spaceTrim( objeto[i].value ) == "" ) {
					alert("? necess?rio preencher o(s) campo(s) texto(s)!");
					objeto[i].focus();
					objeto[i].select()
					return;
				}
			} else if ( (objeto[i].type).substring(0,6) == 'select' ) {
				if ( objeto[i].value == 'Primeiro' ) {
					alert("? necess?rio selecionar a regi?o valida!");
					objeto[i].focus();
					return;
				}
			}
		}
	}
	eval("document." + objeto.name + ".submit();");
}

function cadastramento ( obj, data ) {
	var evento = "";
	if ( obj.name == 'selTreinamento' ) {
		location = '/portugues/cadCertificado/novoTreinamento.jsp';
	} else if ( obj.name == 'selLocal' ) {
		var sItem = document.Selecao.selTreinamento.selectedIndex;
		var sValor = document.Selecao.selTreinamento.options[sItem].value;
		location = 'novoLocal.jsp?codT=' + sValor;
	} else if ( obj.name == 'selEditor' ) {
		var sItemT = document.Selecao.selTreinamento.selectedIndex;
		var sValorT = document.Selecao.selTreinamento.options[sItemT].value;
		var sItemL = document.Selecao.selLocal.selectedIndex;
		var sValorL = document.Selecao.selLocal.options[sItemL].value;
		location = '/portugues/cadCertificado/novoEditor.jsp?codT=' + sValorT + '&codL=' + sValorL;
	} else if ( obj.name == 'rTreinamento' ) {
		if ( obj.value == '1' ) {
			document.updateTrein.submit();
		} else {
			location = 'selecao.jsp?codT=' + trei;
		}
	} else if ( obj.name == 'rLocal' ) {
		if ( obj.value > 0 ) {
			document.updateLocal.submit();
		} else {
			location = '/portugues/cadCertificado/selecao.jsp?codT=' + trei + '&codL=' + loc;
		}
	} else if ( obj.name == 'rEditor' ) {
		if ( obj.value > 0 ) {
			document.updateEditor.submit();
		} else {
			location = '/portugues/cadCertificado/selecao.jsp';
		}
	} else if ( obj.name == 'Data' ) {
		var vTipo		= 0;
		var vIni		= "";
		var vFim		= "";
		var vDuracao    = "";
		var sItemT		= document.Selecao.selTreinamento.selectedIndex;
		var sValorT		= document.Selecao.selTreinamento.options[sItemT].value;
		var sItemL		= document.Selecao.selLocal.selectedIndex;
		var sValorL		= document.Selecao.selLocal.options[sItemL].value;
		var sItemE		= document.Selecao.selEditor.selectedIndex;
		var sItemE1		= document.dadosPessoais.selEditor1.selectedIndex;
		var sValorE		= document.Selecao.selEditor.options[sItemE].value;
		var sValorE1	= document.dadosPessoais.selEditor1.options[sItemE1].value;
		if ( data != 'busca' ) {
			if ( data == 'ok' ) {
				vTipo = 0;
			} else if ( data == 'ok1' ) {
				vTipo = 1;
			}
			for (i=0; i < obj.length; i++) {
				if ( spaceTrim( obj[i].value ) != "" ) {
					if ( obj[i].name == 'dtInicial' ) {
						var dataI	= spaceTrim( obj[i].value );
						var diaI	= dataI.substring(0,dataI.indexOf("/"));
						dataI		= dataI.substring( (dataI.indexOf("/"))+1,dataI.length);
						var mesI	= dataI.substring(0,dataI.indexOf("/"));
						var anoI	= dataI.substring( (dataI.indexOf("/"))+1,dataI.length);
						vIni = anoI + "/" + mesI + "/" + diaI;
					} else if ( obj[i].name == 'dtFinal' ) {
						var dataF	= spaceTrim( obj[i].value );
						var diaF	= dataF.substring(0,dataF.indexOf("/"));
						dataF		= dataF.substring( (dataF.indexOf("/"))+1,dataF.length);
						var mesF	= dataF.substring(0,dataF.indexOf("/"));
						var anoF	= dataF.substring( (dataF.indexOf("/"))+1,dataF.length);
						vFim = anoF + "/" + mesF + "/" + diaF;
					} else if ( obj[i].name == 'cargaHoraria' ) {
						var carga_horaria = spaceTrim( obj[i].value );
						vDuracao = carga_horaria;
						//var h = carga_horaria.substring(0,2); 
						//var m = carga_horaria.substring(3,carga_horaria.length ); 
						//if( parseInt(m) > 0 ){
						//	vDuracao = h + ":" +  m;
						//} else {
						//	vDuracao = h + ":00";
						//}
					}
				} else {
					alert("? necessario o preenchimento das duas datas para a grava??o no BD!");
					return;
				}
			}
			var sNone = 'sim';
		}
		if ( obj[0].name == "cdEvento" ) {
			evento = obj[0].value;
		}
		location = '/portugues/cadCertificado/selecao.jsp?codT=' + sValorT + '&codL=' + sValorL + '&codE=' + sValorE + '&codE1=' + sValorE1 + '&dtIni=' + vIni + '&dtFim=' + vFim + '&tipo=' + vTipo + '&non=' + sNone + '&codigoEvento=' + evento + '&duracao=' + vDuracao;
	}
}

function verificaSelecao() {
	for ( i=0; i< document.Selecao.length ; i++ ) {
		if ( document.Selecao[i].value != 'Primeiro' ) {
			if ( document.Selecao[i].name == 'selEditor' ) {
				if ( document.Data.style.display == 'none' ) {
					document.Data.style.display = '';
				}
			}
			var temp = i;
			if ( temp < document.Selecao.length - 1 ) {
				if ( document.Selecao[++temp].style.display == 'none' ) {
					document.Selecao[temp].style.display = '';
					document.images[temp].style.display = '';
				}
			}
			if ( document.Selecao[i].name == 'selEditor' ) {
				//if ( document.Data.style.display != 'none' ) {
				//	document.dadosPessoais.style.display = '';
				//}
			}
		} else {
			return;
		}
	}
}

function muda( doc ) {
	if ( doc.form.name == 'Selecao' ) {
		if ( doc.name = 'selTreinamento' ) {
			var sItemT = document.Selecao.selTreinamento.selectedIndex;
			var sValorT = document.Selecao.selTreinamento.options[sItemT].value;
			location = '/cadCertificado/selecao.jsp?codT=' + sValorT;
		} else if ( doc.name = 'selLocal' ) {
			var sItemT = document.Selecao.selTreinamento.selectedIndex;
			var sValorT = document.Selecao.selTreinamento.options[sItemT].value;
			var sItemL = document.Selecao.selLocal.selectedIndex;
			var sValorL = document.Selecao.selLocal.options[sItemL].value;
			location = '/cadCertificado/selecao.jsp?codT=' + sValorT + '&codL=' + sValorL;
		} else if ( doc.name = 'selEditor' ) {
			var sItemT = document.Selecao.selTreinamento.selectedIndex;
			var sValorT = document.Selecao.selTreinamento.options[sItemT].value;
			var sItemL = document.Selecao.selLocal.selectedIndex;
			var sValorL = document.Selecao.selLocal.options[sItemL].value;
			var sItemE = document.Selecao.selEditor.selectedIndex;
			var sValorE = document.Selecao.selEditor.options[sItemE].value;
			location = '/cadCertificado/selecao.jsp?codT=' + sValorT + '&codL=' + sValorL + '&codE=' + sValorE + '&dtIni=null&dtDim=null';
		} else if ( doc.name = 'selEditor1' ) {
			var sItemT = document.Selecao.selTreinamento.selectedIndex;
			var sValorT = document.Selecao.selTreinamento.options[sItemT].value;
			var sItemL = document.Selecao.selLocal.selectedIndex;
			var sValorL = document.Selecao.selLocal.options[sItemL].value;
			var sItemE = document.Selecao.selEditor.selectedIndex;
			var sValorE = document.Selecao.selEditor.options[sItemE].value;
			location = '/cadCertificado/selecao.jsp?codT=' + sValorT + '&codL=' + sValorL + '&codE=' + sValorE + '&dtIni=null&dtDim=null';
		}
	}
}

function swap_content( span ) {
	displayType = ( document.getElementById( span ).style.display == 'none' ) ? 'block' : 'none';
	document.getElementById( 'img' + span ).src = ( displayType == "none") ? '/img/paginacao/mais_icone.gif' : '/img/paginacao/menos_icone.gif';
	document.getElementById( span ).style.display = displayType;
}

function close_open_content( count ) {
	if(disType == undefined){
		disType ='block'
	}
	disType = ( disType == 'none' ) ? 'block' : 'none';
	for (i=1; i < count+1; i++) {
		span = "daca"+i;
		document.getElementById( 'img' + span ).src = ( disType == "none") ? '/img/paginacao/mais_icone.gif' : '/img/paginacao/menos_icone.gif';
		document.getElementById( span ).style.display = disType;
	}
	if ( document.getElementById("abrir").style.visibility == "visible" ) {
		document.getElementById("abrir").style.visibility = "hidden";
		document.getElementById("fechar").style.visibility = "visible";
		document.getElementById("ListaFechada").value = "";
	} else {
		document.getElementById("fechar").style.visibility = "hidden";
		document.getElementById("abrir").style.visibility = "visible";
		document.getElementById("ListaFechada").value = "true";
	}
}

//*********************************************************************************************************************************
//Fun??es de analise e emiss?o do fale conosco

function checkrequired( which ){
	var pass=true;
	if ( document.images ) {
		for ( i=0; i<which.length; i++ ) { 
			var tempobj=which.elements[i];
			if ( tempobj.name.substring(0,8) == "required" ) {
				if ( ( ( tempobj.type == "text" || tempobj.type == "textarea" ) && tempobj.value == '' ) || ( tempobj.type.toString().charAt(0) == "s" && tempobj.selectedIndex == -1 ) ) {
					pass=false;
					break;
				}
			}
		}
	}
	if ( !pass ) {
		alert( "Um ou mais campos n?o foram preenchidos. Por favor digite todas as informa??es solicitadas!" );
		return false;
	} else {
		if ( checkEmail ( which[1].value ) ) {
			return true;
		} else {
			alert("? necess?rio um e-mail v?lido para o envio!");
			return false;
		}
	}
}

function checkEmail ( emailStr ) {
	if ( emailStr.length == 0 ) {
		return true;
	}

	var emailPat		= /^(.+)@(.+)$/;
	var specialChars	= "\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
	var validChars		= "\[^\\s" + specialChars + "\]";
	var quotedUser		= "(\"[^\"]*\")";
	var ipDomainPat		= /^(\d{1,3})[.](\d{1,3})[.](\d{1,3})[.](\d{1,3})$/;
	var atom			= validChars + '+';
	var word			= "(" + atom + "|" + quotedUser + ")";
	var userPat			= new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat		= new RegExp("^" + atom + "(\\." + atom + ")*$");
	var matchArray		= emailStr.match( emailPat );

	if ( matchArray == null ) {
		return false;
	}

	var user = matchArray[1];
	var domain = matchArray[2];

	if ( user.match( userPat ) == null ) {
		return false;
	}

	var IPArray = domain.match( ipDomainPat );

	if ( IPArray != null ) {
		for ( var i=1; i<=4; i++ ) {
			if ( IPArray[i] > 255 ) {
				return false;
			}
		}
		return true;
	}

	var domainArray = domain.match( domainPat );

	if ( domainArray == null ) {
		return false;
	}

	var atomPat = new RegExp( atom, "g" );
	var domArr = domain.match( atomPat );
	var len = domArr.length;

	if ( domArr[domArr.length-1].length < 2 || domArr[domArr.length-1].length > 3 ) {
		return false;
	}
	
	if ( len < 2 ) {
		return false;
	}
	
	return true;
}