function getPageScroll(){

	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
//	console.log(self.innerWidth);
//	console.log(document.documentElement.clientWidth);

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

//	console.log("xScroll " + xScroll)
//	console.log("windowWidth " + windowWidth)

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
//	console.log("pageWidth " + pageWidth)

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

var t;
var t2;
var video;
var texto;
var opacidade=100;
function anima(xx,yy,video1, texto1){
}
function anima1(xx,yy,video1, texto1){
video=video1;
texto=texto1;
        var box1=document.getElementById("box");
	
		s=getPageScroll();
		d=getPageSize();
		
        box1.style.top=(s[1]+yy)+'px';
        box1.style.left=(s[0]+xx - 70) +'px';		
		box1.style.width='196px';
        box1.style.height='153px';		
		box1.style.display='block';
		opacidade=100;
		//box1.innerHTML = img.innerHTML;
		box1.style.filter ="alpha(style=0,opacity=100)";
		//opacidade=60;      	
        t=setInterval("moveDiv()",100);			
    }
function anima_youtube(xx,yy,video1, texto1){
video=video1;
texto=texto1;
        var box1=document.getElementById("box");
			
		
		s=getPageScroll();
		d=getPageSize();
	
		
        box1.style.top=(s[1]+yy)+'px';
        box1.style.left=(s[0]+xx - 70) +'px';		
		box1.style.width='196px';
        box1.style.height='153px';		
		box1.style.display='block';
		opacidade=100;
		//box1.innerHTML = img.innerHTML;
		box1.style.filter ="alpha(style=0,opacity=100)";
		//opacidade=60;      	
        t=setInterval("moveDiv_youtube()",100);			
    }
	
function fechar(){
	var box2=document.getElementById("exibevideo");
	var txt=document.getElementById("textovideo");
	
	box2.innerHTML ='';
	txt.innerHTML="";
	opacidade=100;
	t2=setInterval("fechadiv()",100);	
	
	
	
}

function fechadiv(){
 var box1=document.getElementById("box");
	opacidade-=20;
	box1.style.filter ="alpha(style=0,opacity=" + opacidade + ")";
	if(opacidade==0){	
	
	box1.style.display='none';

	clearInterval(t2);
	}

}

    function moveDiv(){
		s=getPageScroll();
		d=getPageSize();
		
        var box1=document.getElementById("box");
	
        var topo =  parseFloat(box1.style.top.substr(0,box1.style.top.length-1));
        var esquerda =  parseFloat(box1.style.left.substr(0,box1.style.top.length-1));		
        box1.style.top=parseInt((((d[3]/2) - 200) + s[1]+ topo)/2)+'px';
        box1.style.left=parseInt((((d[2]/2) - 250) + esquerda)/2)+'px';
		
		var w =  parseFloat(box1.style.width.substr(0,box1.style.width.length-1));
        var h =  parseFloat(box1.style.height.substr(0,box1.style.height.length-1));		
        box1.style.width=parseInt((500+ w)/2)+'px';
        box1.style.height=parseInt((430+ h)/2)+'px';
	
	
		if(parseInt((500+ w)/2)>=499){	
			
			var box2=document.getElementById("exibevideo");
			var txt=document.getElementById("textovideo");
			var caption=document.getElementById("caption"+texto);
			box2.innerHTML ='<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="480" height="360"><param name="movie" value="player.swf" ><param name="quality" value="high" ><param name="menu" value="false" ><param name="FlashVars" value="&v=http://www.agenciafire.com.br/videos/'+video+'" ><embed src="player.swf" FlashVars="&v=http://www.agenciafire.com.br/videos/'+video+'" width="480" height="360" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed></object>';
			txt.innerHTML='&nbsp;&nbsp;<font color="#000000">'+caption.innerHTML+'</font>';
			
			
			clearInterval(t);
		}
    }

	
    function moveDiv_youtube(){
		s=getPageScroll();
		d=getPageSize();
		
        var box1=document.getElementById("box");
	
        var topo =  parseFloat(box1.style.top.substr(0,box1.style.top.length-1));
        var esquerda =  parseFloat(box1.style.left.substr(0,box1.style.top.length-1));		
        box1.style.top=parseInt((((d[3]/2) - 200) + s[1]+ topo)/2)+'px';
        box1.style.left=parseInt((((d[2]/2) - 250) + esquerda)/2)+'px';
		
		var w =  parseFloat(box1.style.width.substr(0,box1.style.width.length-1));
        var h =  parseFloat(box1.style.height.substr(0,box1.style.height.length-1));		
        box1.style.width=parseInt((500+ w)/2)+'px';
        box1.style.height=parseInt((430+ h)/2)+'px';
	
	
		if(parseInt((500+ w)/2)>=499){	
			
			var box2=document.getElementById("exibevideo");
			var txt=document.getElementById("textovideo");
			var caption=document.getElementById("caption"+texto);
			box2.innerHTML ='<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'+video+'&hl=pt_BR&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+video+'&hl=pt_BR&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="360"></embed></object>';
			txt.innerHTML='&nbsp;&nbsp;<font color="#000000">'+caption.innerHTML+'</font>';
			
			
			clearInterval(t);
		}
    }


