// JavaScript Document
function popupQuiz(){
	var heigth = 768;
	var width = 1024;
	var x = (window.screen.width - width)/2;
	var y = (window.screen.height - heigth)/2;
	window.open("quiz/OneForm.html", "Quiz SOA SeedTS", "width=550,height=400,scrollbars=no,resizable=no,menubar=no,location=no,toolbar=no,top="+y+",left="+x);
}

function MM_preloadImages() { //v3.0
  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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
MM_preloadImages('img/sh_quad1a.gif')

//funcoes que desabilitam a selecao de texto no site

function disableselect(e ){  
return false 
} 
function reEnable(){ 
return true 
} 
document.onselectstart=new Function ("return false") 
if (window.sidebar){ 
//document.onmousedown=disableselect 
//document.onclick=reEnable 
} 


var xmlDoc;	
	var arrFlashSlide = new Array(); // hold string value to be passed to flash 
	//// Counters to be used for moving with presentation////
	var currSlide = 0;
	var counter = -1;
	var bNext = false;
	var strTitle;
	/********************************************************************************
	This function will be called on the onload of page from body tag of html page.
	It will load XML file beased on if it's IE or Mozilla browser
	********************************************************************************/
	function loadXML()
	{
		// load xml file
		// code for IE
		if (window.ActiveXObject)
		{
			xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.async = false;
			xmlDoc.load("Slides.Xml");
			parseXML()
		}
		// code for Mozilla, etc.
		else if (document.implementation &&	document.implementation.createDocument)
		{
			xmlDoc = document.implementation.createDocument("","",null);
			xmlDoc.load("Slides.Xml");
			xmlDoc.onload = parseXML;
		}
		else
		{
			alert('Your browser cannot handle this script');
		}
	}
		
	/********************************************************************************
		This function will parse the xml file loaded in the document
		and will perform two tasks.
		 1. Fill up the arrays to be used with with next previous control buttons	
		 2. Fill up the combo box dynamically so that slides can be changed 
			from combo box as well
	*********************************************************************************/		
	function parseXML()
	{
		var x = xmlDoc.getElementsByTagName("slide");
		var j = 0;		
		for(i = 0; i < xmlDoc.getElementsByTagName("slide").length; i++)
		{					
			nodeVal = "";
			nodeVal += x.item(i).getAttribute("name");
			nodeVal += ","+ x.item(i).getAttribute("frame");
			nodeVal += ","+ x.item(i).getAttribute("swidth");
			nodeVal += ","+ x.item(i).getAttribute("sheight");
			nodeVal += ","+ x.item(i).getAttribute("transition");
			// dynamically fill up combo box
			if(x.item(i).getAttribute("name") != 0)
			{			
				k = 0;
				j += 1;
				arrFlashSlide[j - 1] = new Array();
				arrFlashSlide[j - 1][k] = nodeVal;
				k += 1;
				//document.fsPlayer.cmbSlides.options[document.fsPlayer.cmbSlides.options.length] = new Option("Slide " + j, (j - 1));
				strTitle = x.item(i).getAttribute("title").substring(0, 4).toLowerCase();
				document.fsPlayer.cmbSlides.options[document.fsPlayer.cmbSlides.options.length] = new Option(j+". "+x.item(i).getAttribute("title"), (j - 1));			
			}else if(x.item(i).getAttribute("name") == 0)
			{
				arrFlashSlide[j - 1][k] = nodeVal;
				k += 1;
			}
		}
		counterTotalSlide = arrFlashSlide.length;
	}
	
	/********************************************************************************
		This function perfrom Javascript interaction with Flash.
		It sets variable value in flash and then it will 
		ask flash to move to Label in a flash clip 
	********************************************************************************/
	function callFlashFn(loadString)
	{
		
		document.PlayerWithFS.SetVariable("slideString",loadString);	
		document.PlayerWithFS.TGotoLabel("vbCall", "loadSlide");
	}

	// Load next slide or animation based on counters value 
	function loadNext()
	{
		// if Next slide
		if(bNext == true)
		{
			bNext = false;
			counter = -1;
			if(currSlide < (arrFlashSlide.length - 1))
			{
				currSlide += 1;
			}
		}
		// get total animation in current slide
		var slideAnim = arrFlashSlide[currSlide].length;
		if(currSlide <= (arrFlashSlide.length - 1)  && counter < (slideAnim - 1))
		{
			counter += 1;	
			// call function 'callFlashFn' with next animation or slide in arrayFlashSlide 
			callFlashFn(arrFlashSlide[currSlide][counter]);
			document.fsPlayer.cmbSlides.selectedIndex = currSlide + 1;
			if(strTitle == "page")
			{
				document.getElementById("status").innerHTML = "  Page:   " + (currSlide + 1);
			}
			else
			{
				document.getElementById("status").innerHTML = "Slide: " + (currSlide + 1) +" - Animation: "+ counter;
			}
			// to check for the last animation & loading the next slide or animation(if any)
			if(counter == (slideAnim - 1))
			{
				bNext = true; // last animation; next slide
			}
			else
			{
				bNext = false; // animation are there ; next animation
			}
		}
		else
		{
			bNext = true; // next slide			
		}	
		// check for the last slide
		if(currSlide >= (arrFlashSlide.length - 1)) 
		{
			bNext = false; // last slide; no click event for Next button
		}
	}
	
	// Load previous slide or animation based on counters value 	
	function loadPrevious()
	{	
		// get total animation in current slide
		var slideAnim = arrFlashSlide[currSlide].length;
		// if there is any previous animation
		if(counter >= 1)
		{
			counter -= 1;			
			// call function 'callFlashFn' with previous slide in arrayFlashSlide
			callFlashFn(arrFlashSlide[currSlide][counter]);
			document.getElementById("status").innerHTML = "Slide: " + (currSlide + 1) +" - Animation: "+ counter;
			bNext = false;
			// else move to previous slide if present							
		}else if(counter <= 1  && currSlide >= 1 && (arrFlashSlide.length - 1) >= 0)
		{  
			currSlide -= 1;
			// animation at first counter
			counter = 0; 
			// call function 'callFlashFn' with previous slide in arrayFlashSlide
			callFlashFn(arrFlashSlide[currSlide][counter]);
			document.fsPlayer.cmbSlides.selectedIndex = currSlide + 1;
			if(strTitle == "page")
			{
				document.getElementById("status").innerHTML = "  Page:   " + (currSlide + 1);
			}
			else
			{
				document.getElementById("status").innerHTML = "Slide: " + (currSlide + 1) +" - Animation: "+ counter;
			}
			bNext = false;	
		}
		if(counter <= 0 && arrFlashSlide[currSlide].length == 1)
		{
			bNext = true;
		}	
	}
	
	// Change slide based on selected value in combo box
	function changeSlide()
	{	
		if(document.fsPlayer.cmbSlides.options[document.fsPlayer.cmbSlides.selectedIndex].value >= 0)
		{
			// call function 'callFlashFn' with selected slide's index in arrayFlashSlide
			callFlashFn(arrFlashSlide[document.fsPlayer.cmbSlides.options[document.fsPlayer.cmbSlides.selectedIndex].value][0]);
			currSlide =  Number(document.fsPlayer.cmbSlides.options[document.fsPlayer.cmbSlides.selectedIndex].value);		if(strTitle == "page")
			{
				document.getElementById("status").innerHTML = "  Page:   " + (currSlide + 1);
			}
			else
			{
				document.getElementById("status").innerHTML = "Slide: " + (currSlide + 1) +" - Animation: "+ 0;
			}			
			counter = 0;
			// checks for animations in the selected slide from combo box
			if(arrFlashSlide[document.fsPlayer.cmbSlides.selectedIndex - 1].length > 1)
			{
				bNext = false;
			}
			else
			{
				bNext = true;
			}				
		}
	}

//Inicio Script do banner rotativo da Home
// by William Borba

		var indexCorrente = null;
		var closetimer = null;
		var timeout = 15800;
		var ids=new Array(5);
		var abas1 = new Array(2);
		var abas2 = new Array(2);
		var abas3 = new Array(2);
		var abas4 = new Array(2);
		var abas5 = new Array(2);
		ids[0]=abas1;
		ids[1]=abas2;
		ids[2]=abas3;
		ids[3]=abas4;
		ids[4]=abas5;
		
		//ids dos divs de noticia
		ids[0][0] = "note1"; 
		ids[1][0] = "note2"; 
		ids[2][0] = "note3"; 
		ids[3][0] = "note4"; 
		ids[4][0] = "note5"; 
		//ids das abas referentes
		ids[0][1] = "tab1"; 
		ids[1][1] = "tab2"; 
		ids[2][1] = "tab3"; 
		ids[3][1] = "tab4"; 
		ids[4][1] = "tab5"; 
				
		function mudar(id){
			for(var i = 0; i < ids.length; i++){
				var d = document.getElementById(ids[i][0]);
				var t = document.getElementById(ids[i][1]);
				if(id == d.id){
					indexCorrente = i;
					d.style.display = "block";
					t.style.background = 'url("img/bannerhome/tabSelected.gif")';
					t.style.color = "white";
				}else{
					d.style.display = "none";
					t.style.background = "white";
					t.style.color = "#9c9c9c";
				}
			}			
		}
		
		function mudarNote(id){
			stop();
			mudar(id);
		}
		
		function mudarAuto(){
			indexCorrente = indexCorrente + 1;
			if(indexCorrente == ids.length)
				indexCorrente = 0;
			var id = ids[indexCorrente][0];
			mudar(id);		
			closetimer = window.setTimeout(mudarAuto, timeout);
		}
		
		function play(){
			document.getElementById('stop').style.display = 'block';
			document.getElementById('play').style.display = 'none';
			closetimer = window.setTimeout(mudarAuto, timeout);
		}
		
		function stop(){
			document.getElementById('stop').style.display = 'none';
			document.getElementById('play').style.display = 'block';
			window.clearTimeout(closetimer);
		}
		
function validarForm(form) {

	var _bReturn = false;
	var icount = 0;
	with( document.form)
	{
	
		while(_bReturn!= true)
		{
			if(selecao[icount] != null )
			{
				if( selecao[icount].checked )
				{
					_bReturn = true;
					break;
				}
			}		
			else
			{
				break;
			}
			icount++;
		}
		
	}
	
	if (!_bReturn) {
		alert("Por favor, selecione uma palestra");
		return false;
	}	
}
function validarFormTreinamento(form) {

	var _bReturn = false;
	var icount = 0;
	with( document.form)
	{
	
		while(_bReturn!= true)
		{
			if(selecao[icount] != null )
			{
				if( selecao[icount].checked )
				{
					_bReturn = true;
					break;
				}
			}		
			else
			{
				break;
			}
			icount++;
		}
		
	}
	
	if (!_bReturn) {
		alert("Por favor selecione um treinamento");
		return false;
	}	
}

function validarEnvioPalestra(form){

if (document.form.nomeDoInscrito.value=="") { 
		alert("Por favor, informe o seu Nome"); 
		document.form.nomeDoInscrito.focus(); 
		return false;
	}
	
if (document.form.Telefone.value=="") { 
		alert("Por favor, informe o seu Telefone"); 
		document.form.Telefone.focus(); 
		return false;
	}

parte1 = document.form.email.value.indexOf("@");
parte2 = document.form.email.value.indexOf(".");
parte3 = document.form.email.value.length;
		if (!(parte1 >= 3 && parte2 >= 1 && parte3 >= 9)) {
			alert("O campo E-mail deve conter um endereco eletronico valido");
			document.form.email.focus();
			return false;
		}
	
		
	return true;
}

function opendescwindow(lURL){       
mydescwin = window.open("http://education.oracle.co.uk/html/oracle/378219/162/260/"+lURL,"descwin",'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=800,height=600'); 
} 	  
	  
function showHideExibe(id) {
 var obj = document.getElementById(id); 
  if(obj.style.display == "" || obj.style.display == "none") {
  obj.style.display = "block";
 } else {
   obj.style.display = "none";
 }
}

function showHideEsconde(id,id2) {
 var obj = document.getElementById(id); 
 var obj2 = document.getElementById(id2);
  if(obj.style.display == "") {
  obj.style.display = "none";
  obj2.style.display = "none";
 } else {
  obj.style.display = "";
  obj2.style.display = "";
 }
}




function loadXMLDocPalestras(fname)
{
var xmlDoc;
// code for IE
if (window.ActiveXObject)
  {
  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  xmlDoc.async=false;
  xmlDoc.load(fname);
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
	  if (window.devicePixelRatio)  //If WebKit browser
		{
   		if (escape(navigator.javaEnabled.toString()) == 'function%20javaEnabled%28%29%20%7B%20%5Bnative%20code%5D%20%7D')
   			{
     		 //alert('Chrome');
			var xmlhttp = new window.XMLHttpRequest();
	  		xmlhttp.open("GET",fname,false);
      		xmlhttp.send(null);
      		xmlDoc = xmlhttp.responseXML.documentElement;
  			 }
   		else if (escape(navigator.javaEnabled.toString()) != 'function%20javaEnabled%28%29%20%7B%20%5Bnative%20code%5D%20%7D')
   			{
     		 //alert('Safari');
			var xmlhttp = new window.XMLHttpRequest();
	  		xmlhttp.open("GET",fname,false);
      		xmlhttp.send(null);
      		xmlDoc = xmlhttp.responseXML.documentElement;
   			}
	  }else{
  		xmlDoc=document.implementation.createDocument("","",null);
  		xmlDoc.async=false;
 		xmlDoc.load(fname);
	  }
  }
else
  {
  	alert('Seu navegador não consegue executar esse script');
  }
  
return(xmlDoc);
}

function displayPalestras(selecionada)
{
xml=loadXMLDocPalestras("palestras/palestras" + selecionada + ".xml");
if(selecionada != 'atual'){
	xsl=loadXMLDocPalestras("palestras/palestratable.xsl");
	//document.getElementById('enviaselecao').style.display='none';
}else{
	xsl=loadXMLDocPalestras("palestras/palestraatualtable.xsl");
	//document.getElementById('enviaselecao').style.display='block';
}
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("palestraativa").innerHTML="";
  document.getElementById("palestraativa").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("palestraativa").innerHTML="";
  document.getElementById("palestraativa").appendChild(resultDocument);
  }
}


function displayDepoimentos(selecionada)
{
xml=loadXMLDocPalestras("treinamento/depoimentos/depoimentos" + selecionada + ".xml");
	xsl=loadXMLDocPalestras("treinamento/depoimentos/depoimentotable.xsl");
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("depoimentos").innerHTML="";
  document.getElementById("depoimentos").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("depoimentos").innerHTML="";
  document.getElementById("depoimentos").appendChild(resultDocument);
  }
}

function displayCalendarioTreinamento(selecionada)
{
xml=loadXMLDocPalestras("treinamento/calendario/calendario" + selecionada + ".xml");
	xsl=loadXMLDocPalestras("treinamento/calendario/calendariotable.xsl");
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("calendario").innerHTML="";
  document.getElementById("calendario").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("calendario").innerHTML="";
  document.getElementById("calendario").appendChild(resultDocument);
  }
}


function displayCarreirasOracle(selecionada)
{
	if(selecionada != ''){
		xml=loadXMLDocPalestras("treinamento/carreiras/carreira" + selecionada + ".xml");
		xsl=loadXMLDocPalestras("treinamento/carreiras/carreirastable.xsl");
	}
// code for IE
if (window.ActiveXObject && selecionada != '')
  {
  ex=xml.transformNode(xsl);
  document.getElementById("carreirasdisplay").innerHTML="";
  document.getElementById("carreirasdisplay").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument && selecionada != '')
  { 
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("carreirasdisplay").innerHTML="";
  document.getElementById("carreirasdisplay").appendChild(resultDocument);
  }else{
	  document.getElementById("carreirasdisplay").innerHTML="";  
  }
}

function displayTreinamentos(selecionada)
{
	xml=loadXMLDocPalestras("treinamento/treinamento/treinamentos" + selecionada + ".xml");
	xsl=loadXMLDocPalestras("treinamento/treinamento/treinamentostable.xsl");
// code for IE
	if (window.ActiveXObject)
  	{
	  ex=xml.transformNode(xsl);
	  document.getElementById("treinamentos").innerHTML="";
	  document.getElementById("treinamentos").innerHTML=ex;
  	}
	// code for Mozilla, Firefox, Opera, etc.
	else if (document.implementation && document.implementation.createDocument)
  	{
	  xsltProcessor=new XSLTProcessor();
	  xsltProcessor.importStylesheet(xsl);
	  resultDocument = xsltProcessor.transformToFragment(xml,document);
	  document.getElementById("treinamentos").innerHTML="";
	  document.getElementById("treinamentos").appendChild(resultDocument);
  	}
	
	if(document.getElementById("treinamentos").innerHTML.trim()==""){
		displayTreinamentos(selecionada);
	}
}

function displayDetalheCursoSelecionado(tipo,selecionada)
{
	if(tipo=='webage'){
		xml=loadXMLDocPalestras("treinamento/treinamento/contentwebage/" + selecionada + ".xml");
		xsl=loadXMLDocPalestras("treinamento/treinamento/detalhecurso.xsl");
	}else if(tipo=='soaschool'){
		xml=loadXMLDocPalestras("treinamento/treinamento/contentsoaschool/" + selecionada + ".xml");
		xsl=loadXMLDocPalestras("treinamento/treinamento/detalhecurso.xsl");
	}
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("detalhecurso").innerHTML="";
  document.getElementById("detalhecurso").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("detalhecurso").innerHTML="";
  document.getElementById("detalhecurso").appendChild(resultDocument);
  }
}

function displayDetalheCertificacaoSelecionada(tipo,selecionada)
{
	if(tipo=='soaschool'){
		xml=loadXMLDocPalestras("treinamento/certificacao/contentsoaschool/" + selecionada + ".xml");
		xsl=loadXMLDocPalestras("treinamento/certificacao/detalhecertificacao.xsl");
	}
// code for IE
if (window.ActiveXObject)
  {
  ex=xml.transformNode(xsl);
  document.getElementById("detalhecertificacao").innerHTML="";
  document.getElementById("detalhecertificacao").innerHTML=ex;
  }
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
  {
  xsltProcessor=new XSLTProcessor();
  xsltProcessor.importStylesheet(xsl);
  resultDocument = xsltProcessor.transformToFragment(xml,document);
  document.getElementById("detalhecertificacao").innerHTML="";
  document.getElementById("detalhecertificacao").appendChild(resultDocument);
  }
}