////////////////////////////////////////////////////////
///////////// BANNERS ANIMATION ////////////////////////
////////////////////////////////////////////////////////
function k2kestadao()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="728" height="90">\n');
document.write('<param name="movie" value="img/web/bn_0814_estadao.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0814_estadao.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="728" height="90"></embed>\n');
document.write('</object>\n');

}


function pha1()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="468" height="60">\n');
document.write('<param name="movie" value="img/web/bn_0612_pha1.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0612_pha1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>\n');
document.write('</object>\n');

}

function pha2()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="309" height="227">\n');
document.write('<param name="movie" value="img/web/bn_0612_pha2.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0612_pha2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="309" height="227"></embed>\n');

document.write('</object>\n');

}

function ige1()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="728" height="90">\n');
document.write('<param name="movie" value="img/web/bn_0611_ige1.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0611_ige1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="728" height="90"></embed>\n');
document.write('</object>\n');

}

function ige2()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="200" height="200">\n');
document.write('<param name="movie" value="img/web/bn_0611_ige2.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0611_ige2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="200" height="200"></embed>\n');
document.write('</object>\n');

}

function natal()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="580" height="430">\n');
document.write('<param name="movie" value="img/web/bn_0610_natal.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0610_natal.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="580" height="430"></embed>\n');
document.write('</object>\n');

}

function pele()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="468" height="60">\n');
document.write('<param name="movie" value="img/web/bn_0609_pele.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0609_pele.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>\n');
document.write('</object>\n');

}

function selig1()

{

document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="459" height="222">\n');
document.write('<param name="movie" value="img/web/bn_0608_selig1.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0608_selig1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="459" height="222"></embed>\n');
document.write('</object>\n');

}

function selig2()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="140" height="425">\n');
document.write('<param name="movie" value="img/web/bn_0608_selig2.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0608_selig2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="140" height="425"></embed>\n');
document.write('</object>\n');

}

function papo()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="468" height="60">\n');
document.write('<param name="movie" value="img/web/bn_0607_papo.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0607_papo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>\n');
document.write('</object>\n');

}



function luxemb1()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="468" height="60">\n');
document.write('<param name="movie" value="img/web/bn_0606_luxemb1.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0606_luxemb1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>\n');
document.write('</object>\n');

}



function luxemb2()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="200" height="200">\n');
document.write('<param name="movie" value="img/web/bn_0606_luxemb2.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0606_luxemb2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="200" height="200"></embed>\n');
document.write('</object>\n');

}



function luxemb3()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="243" height="150">\n');
document.write('<param name="movie" value="img/060613/luxemb3.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/060613/luxemb3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="243" height="150"></embed>\n');
document.write('</object>\n');

}

function ovni1()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="340" height="183">\n');
document.write('<param name="movie" value="img/web/bn_0605_ovni1.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0605_ovni1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="340" height="183"></embed>\n');
document.write('</object>\n');

}



function ovni2()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="621" height="31">\n');
document.write('<param name="movie" value="img/web/bn_0605_ovni2.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0605_ovni2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="621" height="31"></embed>\n');
document.write('</object>\n');

}



function ovni3()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="140" height="425">\n');
document.write('<param name="movie" value="img/web/bn_0605_ovni3.swf">\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0605_ovni3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="140" height="425"></embed>\n');
document.write('</object>\n');

}

function icppp()

{

   document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="192" height="322">\n');
document.write('<param name="movie" value="img/web/bn_0613_icppp.swf" />\n');
document.write('<param name="quality" value="high">\n');
document.write('<param name=menu value=false>\n');
document.write('<embed src="img/web/bn_0613_icppp.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="192" height="322"></embed>\n');
document.write('</object>\n');

}

////////////////////////////////////////////////////////
///////////////// SCROLL TOP ///////////////////////////
////////////////////////////////////////////////////////

var scrolltotop={
	//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
	//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
	setting: {startline:600, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
	controlHTML: '<img src="img/up.png" style="width:30px; height:107px" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol"
	controlattrs: {offsetx:5, offsety:5}, //offset of control relative to right/ bottom of window corner
	anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links

	state: {isvisible:false, shouldvisible:false},

	scrollup:function(){
		if (!this.cssfixedsupport) //if control is positioned using JavaScript
			this.$control.css({opacity:0}) //hide control immediately after clicking it
		var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
		if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
			dest=jQuery('#'+dest).offset().top
		else
			dest=0
		this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
	},

	keepfixed:function(){
		var $window=jQuery(window)
		var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
		var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
		this.$control.css({left:controlx+'px', top:controly+'px'})
	},

	togglecontrol:function(){
		var scrolltop=jQuery(window).scrollTop()
		if (!this.cssfixedsupport)
			this.keepfixed()
		this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
		if (this.state.shouldvisible && !this.state.isvisible){
			this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
			this.state.isvisible=true
		}
		else if (this.state.shouldvisible==false && this.state.isvisible){
			this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
			this.state.isvisible=false
		}
	},
	
	init:function(){
		jQuery(document).ready(function($){
			var mainobj=scrolltotop
			var iebrws=document.all
			mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
			mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
			mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
				.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
				.attr({title:'Voltar ao Topo'})
				.click(function(){mainobj.scrollup(); return false})
				.appendTo('body')
			if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
				mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
			mainobj.togglecontrol()
			$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
				mainobj.scrollup()
				return false
			})
			$(window).bind('scroll resize', function(e){
				mainobj.togglecontrol()
			})
		})
	}
}

scrolltotop.init()

////////////////////////////////////////////////////////
///////////////// IE PNG FIX ///////////////////////////
////////////////////////////////////////////////////////


function correctPNG()
   {
   for(var i=0; i<document.images.length; i++)
      {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
         img.outerHTML = strNewHTML
         i = i-1
         }
      }
   }
window.attachEvent("onload", correctPNG);
