// Data ----------------------------------------------------------------------------------
var hoje = new Date();
var semana = hoje.getDay();
var dia    = hoje.getDate();
var mes    = hoje.getMonth();
var ano    = hoje.getFullYear();

function data() {
	return semanaStr(semana) + ', ' + mesStr(mes) + ' ' + diaStr(dia) + ', ' + ano;
}

function mesStr(arg) {
	var arrayMes = new Array("january", "february", "march", "april", "may", "june",
		"july", "august", "september", "october", "november", "december");
	return arrayMes[arg];
}

function semanaStr(arg) {
	var arraySemana = new Array("sunday", "monday", "tuesday", "wednesday",
		"thursday", "friday", "saturday");
	return arraySemana[arg];
}

function diaStr(arg) {
	var arrayDia = new Array("0th","1st","2nd","3rd","4th","5th","6th","7th","8th",
		"9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th",
		"20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st");
	return arrayDia[arg];
}

// Fim Data ------------------------------------------------------------------------------

// Imagem --------------------------------------------------------------------------------
function trocaImagem(imagem, arquivo) {
	imagem.src = arquivo;
}

function preLoad(){
	var imagens = new Array();
	for (var i = 0; i < arguments.length; i++){
		imagens[i] = new Image();
		imagens[i].src = arguments[i];
	}
}

function preMenu(){
	preLoad('Menu1Over.gif','Menu2Over.gif','Menu3Over.gif','Menu4Over.gif',
			'Menu5Over.gif','Menu6Over.gif','Menu7Over.gif','Menu8Over.gif');
}
// Fim Imagem ----------------------------------------------------------------------------

// Idiomas -------------------------------------------------------------------------------
var isDHTML = 0;
var isLayers = 0;
var isAll = 0;
var isID = 0;


if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

function findDOM(objectID, withStyle) {
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID).style) ; }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}

var seletorIdiomas;
var timerID;

function mostraIdioma(objectID){
	seletorIdiomas = findDOM(objectID, 1);
	seletorIdiomas.visibility = 'visible';
	clearTimeout(timerID);
}

function esconde(){
	seletorIdiomas.visibility = 'hidden';
}

function escondeIdioma(){
	timerID = setTimeout('esconde()',500);	
}
// Fim Idiomas ---------------------------------------------------------------------------

// Scroll --------------------------------------------------------------------------------
function lib_bwcheck(){ 
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}

var bw = new lib_bwcheck()
var speed = 30
var loop, timer
var loop2, timer2
var loop3, timer3
var scrolltextLoaded = false
var scrolltextLoaded2 = false
var scrolltextLoaded3 = false
var px = bw.ns4||window.opera?"":"px";

function makeObj(obj,nest){
    nest=(!nest) ? "":'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	this.up=goUp;this.down=goDown;
	this.moveIt=moveIt; this.x=0; this.y=0;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

function makeObj2(obj,nest){
    nest=(!nest) ? "":'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight-110
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight-110
	this.up=goUp2;this.down=goDown2;
	this.moveIt=moveIt; this.x=0; this.y=0;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

function makeObj3(obj,nest){
    nest=(!nest) ? "":'document.'+nest+'.'
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight-110
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight-110
	this.up=goUp3;this.down=goDown3;
	this.moveIt=moveIt; this.x=0; this.y=0;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}


function moveIt(x,y){
	this.x = x
	this.y = y
	this.css.left = this.x+px
	this.css.top = this.y+px
}

function goDown(move){
	if (this.y>-this.scrollHeight+oCont.clipHeight){
		this.moveIt(0,this.y-move)
			if (loop) setTimeout(this.obj+".down("+move+")",speed)
	}
}

function goDown2(move){
	if (this.y>-this.scrollHeight+oCont.clipHeight){
		this.moveIt(0,this.y-move)
			if (loop2) setTimeout(this.obj+".down("+move+")",speed)
	}
}

function goDown3(move){
	if (this.y>-this.scrollHeight+oCont.clipHeight){
		this.moveIt(0,this.y-move)
			if (loop3) setTimeout(this.obj+".down("+move+")",speed)
	}
}

function goUp(move){
	if (this.y < 0){
		this.moveIt(0,this.y-move)
		if (loop) setTimeout(this.obj+".up("+move+")",speed)
	}
}

function goUp2(move){
	if (this.y < 0){
		this.moveIt(0,this.y-move)
		if (loop2) setTimeout(this.obj+".up("+move+")",speed)
	}
}

function goUp3(move){
	if (this.y < 0){
		this.moveIt(0,this.y-move)
		if (loop3) setTimeout(this.obj+".up("+move+")",speed)
	}
}

function scroll(speed){
	if (scrolltextLoaded){
		loop = true;
		if (speed > 0) oScroll.down(speed)
		else oScroll.up(speed)
	}
}

function scroll2(speed){
	if (scrolltextLoaded2){
		loop2 = true;
		if (speed>0) oScroll2.down(speed)
		else oScroll2.up(speed)
	}
}

function scroll3(speed){
	if (scrolltextLoaded3){
		loop3 = true;
		if (speed>0) oScroll3.down(speed)
		else oScroll3.up(speed)
	}
}


function noScroll(){
	loop = false
	if (timer) clearTimeout(timer)
}

function noScroll2(){
	loop2 = false
	if (timer2) clearTimeout(timer2)
}

function noScroll3(){
	loop3 = false
	if (timer3) clearTimeout(timer3)
}

function scrolltextInit(){
	oCont = new makeObj('newsContexto')
	oScroll = new makeObj('newsTexto','newsContexto')
	oScroll.moveIt(0,0)
	oCont.css.visibility = "visible"
	scrolltextLoaded = true
}

function scrolltextInit2(){
	oCont2 = new makeObj2('principalContexto')
	oScroll2 = new makeObj2('principalTexto','principalContexto')
	oScroll2.moveIt(0,0)
	oCont2.css.visibility = "visible"
	scrolltextLoaded2 = true
}

function scrolltextInit3(){
	oCont3 = new makeObj3('principalBordaContexto')
	oScroll3 = new makeObj3('principalBordaTexto','principalBordaContexto')
	oScroll3.moveIt(0,0)
	oCont3.css.visibility = "visible"
	scrolltextLoaded3 = true
}

// Fim Scroll ----------------------------------------------------------------------------
