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_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_findObj(n, d) { //v4.01
  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_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];}
}

function wm(valor)
{
	var dm = "logoseng.com.br";
	var atc = "&#064;"
	if (valor == 'bh')
	{
		em="logos.energia"
	}
	if (valor == 'rj')
	{
		em="logosrio"
	}
	if (valor == 'bs')
	{
		em="bsb"
	}

	if (valor == 'Elisete Gutierrez')
	{
		em="elisete.gutierrez"
	}

	if (valor == 'contatogen')
	{
		em="contato"
	}

	if (valor == 'treinamento')
	{
		em="treinamento"
	}

	if (valor == 'recrutamento')
	{
		em="recrutamento"
	}

	document.write ('<a href="mailto:'+em+atc+dm+'">'+em+atc+dm+'</a>');

}

function wmcp(contactperson)
{
	//alert(contactperson)
	var pessoa = contactperson;
	var atc = "&#064;"
	var ert = "logoseng.com.br"
	var saf = "elisete.gutierrez"

	//var s = '<a href="mailto:'+saf+atc+ert+'">'+saf+atc+ert+'</a>';
	var s = '<a href="mailto:'+saf+atc+ert+'">Elisete Gutierrez</a>';
	document.all.divcontactPerson.innerHTML = s;

}

function setCookie(cookieName, cookieValue, expires, path, domain, secure)
{
	
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; EXPIRES=' + expires.toGMTString() : '')
		+ (path ? '; PATH=' + path : '')
		+ (domain ? '; DOMAIN=' + domain : '')
		+ (secure ? '; SECURE' : '');
}

function getCookie(cookieName)
{
	var cookieValue = null;
	var posName = document.cookie.indexOf(escape(cookieName) + '=');

	if (posName != -1)
	{
		var posValue = posName + (escape(cookieName) + '=').length;
		var endPos = document.cookie.indexOf(';', posValue);
		if (endPos != -1)
		{
		cookieValue = unescape(document.cookie.substring(posValue, endPos));
		}
		else
		{
		cookieValue = unescape(document.cookie.substring(posValue));
		}
	}
	return cookieValue;
}

function LoadMainImage()
{
	var nMaxImageID = 4;
	var oMainImageObj = document.getElementById('imgMain');
	if (oMainImageObj) {
		
		var nNewMainImageID = 0;
		
		var nLastMainImageID = getCookie('LastMainImageID');
		if (nLastMainImageID == null) {
			nLastMainImageID = 0;
		}
		
		nNewMainImageID = parseInt(nLastMainImageID) + 1;
		if (nNewMainImageID > nMaxImageID) {
			nNewMainImageID = 1;
		}
		
		//oMainImageObj.src = '../commomImg/800/homepage/MAIN_' + nNewMainImageID + '.jpg';
		oMainImageObj.src = '../commomImg/800/homepage/MAIN_4.jpg';
		var now = new Date(); 
		var tomorrow = new Date(now.getTime() + 1000 * 60 * 60 * 1);
		setCookie('LastMainImageID', nNewMainImageID, tomorrow, null, null, null);
	}
	
	
}

function ShowFilial(qual)
{
	var d = eval("document.all."+qual);
	if (d.style.display == "none")
	{
		d.style.display = ""
	}
	else
	{
		d.style.display = "none"
	}
}


////////////
//FORM CV //
////////////
function bgc(qual,tipo)
{
	if (tipo == 0)
	{
		qual.style.backgroundColor="white";
	}
	else
	{
		qual.style.backgroundColor="#e1e1e1";
	}
}


function FormataNumero(Obj, Campo){
		if (Obj.keyCode>=48 && Obj.keyCode<=57){
			
		}
		else
		{
			Obj.keyCode="";
		}
	
}

function autoTab(qual, len) {
	
	if (qual.value.length == len) {
		qual2 = getIndex(qual) + 1;
		f1.elements[qual2].focus();
		}
}		
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}

function FormataData(Obj, Campo)
{
	var Data = Campo.value;

	//Verifica o Tamanho da string
	if (Data.length<10)
	{
		// Verifica se é número			
		if (Obj.keyCode>=48 && Obj.keyCode<=57)
		{
			switch(Data.length)
			{
				case 2: Data = Data + "/"; break;
				case 5:	Data = Data + "/"; break;
				case 10: Data = Data + (Obj.keyCode = ""); break;
			}
		}
		else Obj.keyCode = "";
		
	}
	else 
		Data = Data + (Obj.keyCode = "");
				
	Campo.value = Data;
}
////////////
//FORM CV //
////////////












//************************************************
// (C) F. Permadi 2002, 
// programmed by F. Permadi
// Adapted by Egidio CS, 2006
//************************************************

//************************************************
// A basic class to store information on a slide (an image)
// A slide has the following properties:
// - image=the image to be used
// - delay=how long the image is to be displayed
// - transition=what kind of transition is to be used when the image appears
//      (you can specify -1 here to use default transition)
//************************************************
function Slide(imageFilename, delay, transitionEffectId, link, linkText)
{
   // properties:
	this.image=new Image();
	this.image.src=imageFilename;
	this.delay=delay;
	if (transitionEffectId==-1)
		this.transition=-1;
	if (transitionEffectId==-2)
		this.transition=-2;
	else if (transitionEffectId>=0 && transitionEffectId<Slide.prototype.numFilters)
  	   this.transition=Slide.prototype.filters[transitionEffectId];
	this.link=link;
	this.linkText=linkText;
	
	// functions to 
	this.isReady=function(){return this.image.complete;};
	// returns the current filter and rotates filter 
	this.getFilter=function()
	{
	  // -1 indicates no filter
 	  if (this.transition==-1)
 	  	return 0;
	  //  -2 indicates use any
	  if (this.transition && this.transition!=-2)
  	    return this.transition;
	  Slide.prototype.currentFilter++;
	  if (Slide.prototype.currentFilter>Slide.prototype.numFilters)
		 Slide.prototype.currentFilter=0;
	  return Slide.prototype.filters[Slide.prototype.currentFilter];
	};
	// returns the number of miliseconds of the delay value specified
	this.getDelay=function(){return this.delay*1000;};
	this.getImage=function(){return this.image;};
	this.getImageWidth=function(){return this.image.width;};
	this.getImageHeight=function(){return this.image.height;};
	this.getImageSrc=function(){return this.image.src;};
	this.getSize=function(){return this.size;};
	this.getLink=function(){return this.link;};
	this.getLinkText=function()
	{
	  if (this.linkText=="")
	    return"&nbsp;";
	  return this.linkText;
	};
   // increment counter (counts how many slides there are)
	Slide.prototype.size++;	   
}

// Static method.  It increments static variables "numFilters" and stores filters in "filters" static array
Slide.prototype.addFilter=function(filter){Slide.prototype.filters[Slide.prototype.numFilters++]=filter};
// how fast or slow the transition animation will play (in seconds)
var transitionSpeed=1;
var slides=new Array();
var curImage=-1;
// NO NEED TO CHANGE THIS PORTION
Slide.prototype.transitionSpeed=transitionSpeed;				// seconds
Slide.prototype.size=0;
Slide.prototype.numFilters=0;
Slide.prototype.currentFilter=0;
Slide.prototype.filters=new Array();
//********************************************
// LIST OF TRANSITIONS
// you may take out the ones you don't want to use or add more.
//*******************************************
Slide.prototype.addFilter("blendTrans(duration="+transitionSpeed+");");					  // 0 fade
Slide.prototype.addFilter("revealTrans(transition=5, duration="+transitionSpeed+");");  // 1 wipe down
Slide.prototype.addFilter("revealTrans(transition=0, duration="+transitionSpeed+");");  // 2 
Slide.prototype.addFilter("revealTrans(transition=1, duration="+transitionSpeed+");");  // 3
Slide.prototype.addFilter("revealTrans(transition=2, duration="+transitionSpeed+");");  // 4
Slide.prototype.addFilter("revealTrans(transition=3, duration="+transitionSpeed+");");  // 5
Slide.prototype.addFilter("revealTrans(transition=10, duration="+transitionSpeed+");"); // 6
Slide.prototype.addFilter("revealTrans(transition=11, duration="+transitionSpeed+");"); // 7
Slide.prototype.addFilter("revealTrans(transition=12, duration="+transitionSpeed+");"); // 8
Slide.prototype.addFilter("revealTrans(transition=4, duration="+transitionSpeed+");");  // 9
Slide.prototype.addFilter("revealTrans(transition=20, duration="+transitionSpeed+");"); // 10
Slide.prototype.addFilter("revealTrans(transition=14, duration="+transitionSpeed+");"); // 11

//*******************************************
// This function is the core of this application.
// It swaps the image contained in "myImage" object.
// You should therefore declare your image on the page like this:
// <IMG ID="myImage" width="0" height="0" src=""> so that 
// the first image will not be displayed.
// If you wish to set an initial image, you can use
// <IMG ID="myImage" src=imageName>.
//
// Calling method: uses "setTimeout()" to call itself
// periodically depending on
// the delay value specified on each picture.
// If the picture to be displayed has not been loaded yet,
// the function will call itself every 0.5 seconds
// until the picture is loaded.  
//********************************************
function setLinkText(sLink_id, sText){
var el;
if (document.getElementById&& (el = document.getElementById(sLink_id))|| document.all&& (el = document.all[sLink_id])){
while (el.hasChildNodes())
el.removeChild(el.lastChild);
el.appendChild(document.createTextNode(sText));
}
}
function slidePicture()
{
	tmt =500;

 	if (document.images)
	{
		var oldCurImage=curImage;
		curImage++;
		if (curImage>=slides[0].getSize())
			curImage=0;
	
		var canBeFiltered=false;
		if (document.images.myImage)// && 
		{
  		   target=document.images.myImage;
  		   if (document.images.myImage.style)// && document.images.myImage.style.filters)
  		   {
			  canBeFiltered=true;
			}
		}
		if (document.all && document.getElementById("myImage"))
		{
			target= document.getElementById("myImage");
			// If the browser doesn't support "style" or
			// if user specified filter value of 0, then do not use filter
			if (target.style && slides[curImage].getFilter()!=0)
				canBeFiltered=true;
		}
		
       // 	Check if the next image is loaded yet.
       // Note here, if you put an invalid filename on
       // your list, the slide might get stuck here,
       // So make sure all the image filenames are
       // correct.
		if (slides[curImage].isReady())
		{
			if (canBeFiltered)
			{
      			target.style.filter=slides[curImage].getFilter();
      			if (target.filters && target.filters[0])
      			{
		       	target.filters[0].Apply();
		       }
 	       }
 	       
			target.src=slides[curImage].getImageSrc();
			// netscape 4.8 doesn support these, so you might want to use
			// same sized image if you want it to look nice on that browser
			target.height=slides[curImage].getImageHeight();
			target.width=slides[curImage].getImageWidth();
			
			// chane link text
			if (document.getElementById && document.getElementById("myImageLink"))
{
if (slides[curImage].getLinkText()=="1")
{
				
				// setLinkText("myImageLink", slides[curImage].getLink());
 				document.getElementById("myImageLink").setAttribute("href", slides[curImage].getLink());
}

else
{
//document.getElementById("myImageLink").innerHTML=""
}
}				
			if (canBeFiltered)
			{
			   	if (target.filters && target.filters[0])
			   	{
	  		      	target.filters[0].Play();
	  		    }
			}
			// This basically says:
			// Execute this function again after showing
			// the image for the time specified in the delay.
			setTimeout("slidePicture(tmt)", slides[curImage].getDelay());
		}	
		// Next image is not loaded yet, restore counter
		// and check back in 500 miliseconds
		else
		{
			curImage=oldCurImage;
			setTimeout("slidePicture(tmt)", tmt);
			
		}
	
	}
}




