<!-- 
//Javascript for interface stuff

if (Sources==null)var Sources=new Array("0001a.html","0002a.html","0003a.html");
var Buttons = new Array("http://us.i1.yimg.com/us.yimg.com/i/us/nws/gl/b_replay_off.gif",
                        "http://us.i1.yimg.com/us.yimg.com/i/us/nws/gl/b_back_off.gif",
                        "http://us.i1.yimg.com/us.yimg.com/i/us/nws/gl/b_play_off.gif",
                        "http://us.i1.yimg.com/us.yimg.com/i/us/nws/gl/b_play_on.gif",
                        "http://us.i1.yimg.com/us.yimg.com/i/us/nws/gl/b_stop_off.gif",
                        "http://us.i1.yimg.com/us.yimg.com/i/us/nws/gl/b_stop_on.gif",
                        "http://us.i1.yimg.com/us.yimg.com/i/us/nws/gl/b_fwd_off.gif");

if(queryString('url')!=''){
	var Url=queryString('url');
	for (k=0;k<=Sources.length;k++){
		if (Url==Sources[k]){
			ActualIndex=k;
			break;
		}else{
		ActualIndex=0;
		}
	}
}else{
ActualIndex=0;
}

var Speeds=new Array(7500,5000,2500);
var Speed=Speeds[0];
var Selected;
var IntervalId;
var BackgroundColor="#FFF";
var LoadingText="Carregando..."
var PlayingText="Slideshow acionado..."
var StoppedText="Slideshow parado"
var GlobalTransDuration=250;
var playing=false;
var slideshowEnabled=false;

//Specific Functions to SlideShow
function GetFirst(){
	ActualIndex=0;
	GetHtml(Sources[ActualIndex],"PhotoAndTextContent",BackgroundColor);
	SetPhotoCount("PhotoCount");
}
function GetActual(){
	preloadImageList(Buttons);
	GetHtml(Sources[ActualIndex],"PhotoAndTextContent",BackgroundColor);
	SetPhotoCount("PhotoCount");
	preloadImageList(ImageSources);
	slideshowEnabled = true;
}
function GetNext_(){
	GetNextHtml(Sources,"PhotoAndTextContent");
	SetPhotoCount("PhotoCount");
}
function GetPrev_(){
	GetPrevHtml(Sources,"PhotoAndTextContent");
	SetPhotoCount("PhotoCount");
}


function GetNext(){
	try{tn=setTimeout("GetNext_()",GlobalTransDuration);}
	catch(e){tn=setTimeout(GetNext_,GlobalTransDuration);}
    opacity("FadePhotoAndTextContent", 0, 100, GlobalTransDuration);
    StopSlideShow();
}

function GetPrev(){
	try{tp=setTimeout("GetPrev_()",GlobalTransDuration);}
	catch(e){tp=setTimeout(GetPrev_,GlobalTransDuration);}
    opacity("FadePhotoAndTextContent", 0, 100, GlobalTransDuration);
    StopSlideShow();
}

function GetNextSlide(){
	try{tn=setTimeout("GetNext_()",GlobalTransDuration);}
	catch(e){tn=setTimeout(GetNext_,GlobalTransDuration);}
    opacity("FadePhotoAndTextContent", 0, 100, GlobalTransDuration);
}


function PlaySlideShow(){
    if (slideshowEnabled && !playing)
    {
        playing = true;
		try{IntervalId=setInterval("GetNextSlide()",Speed+GlobalTransDuration);}
		catch(e){IntervalId=setInterval(GetNextSlide,Speed+GlobalTransDuration);}
		document.getElementById("SlideShowIndicator").className="on"
		document.getElementById("SlideShowIndicator").innerHTML='<span>'+PlayingText+'</span>'
		document.getElementById("BtnPlay").className="on"
		document.getElementById("BtnStop").className="off"
	}
}

function StopSlideShow(){
	clearInterval(IntervalId);
	IntervalId=null;
	document.getElementById("SlideShowIndicator").className="off"
	document.getElementById("SlideShowIndicator").innerHTML='<span>'+StoppedText+'</span>'
	document.getElementById("BtnPlay").className="off"
	document.getElementById("BtnStop").className="on"
	playing=false;
}


///////////////////////////////////////////////////////////////////////////////////
//basic functions
function GetSpeed(obj_id){
	var obj=document.getElementById(obj_id)
	Selected=obj.selectedIndex
	Speed=Speeds[Selected]
	if (IntervalId!=null){
	StopSlideShow();
	PlaySlideShow();
	}
}
function SetPhotoCount(obj_id){
	var obj=document.getElementById(obj_id)
	obj.innerHTML='Foto <strong>'+ (ActualIndex+1) +'</strong> de <strong>'+ Sources.length +'</strong>'
	}

function GetSelected(obj_id){
	var obj=document.getElementById(obj_id)
	obj.selectedIndex=Selected;
	//alert(obj.selectedIndex);  
}
function GetNextHtml(source_array,container_id){
	GetHtml(source_array[RealIndex(source_array,ActualIndex+1)],container_id,BackgroundColor);
}

function GetPrevHtml(source_array,container_id){
	GetHtml(source_array[RealIndex(source_array,ActualIndex-1)],container_id,BackgroundColor);
}

function RealIndex(source_array,source_index){
	var real;
	if (source_index>=0 && source_index<=source_array.length-1) {real=source_index;}
	if (source_index==-1) {real=source_array.length-1;}
	if (source_index>=source_array.length) {real=0;}
	ActualIndex=real;
	//alert(real);
	return real;
}

//Ajax Reloading
//Creating the xmlhttp object
//Creating the xmlhttp object
function CreateXMLHttpRequest(){ 
 try{
    var xmlhttp = new XMLHttpRequest();
	}catch(ee){
    try{
        var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            var xmlhttp = false;
        }
      }
    }
	return xmlhttp;
}
//
//
function GetHtml(filepath,container_id,color_background){
	var xmlhttp= CreateXMLHttpRequest();
    var target=filepath
    if (ActualHtml==null){
	var ActualHtml='<div id="Fade'+container_id+'">&nbsp;</div>';
	}else{
	var ActualHtml=	container.innerHTML;
	}
	//Loading feature
    var container=document.getElementById(container_id);
	container.innerHTML=ActualHtml+'<div class="loading">'+ LoadingText +'</div>';
    changeOpac(100, "Fade"+container_id+""); 
	
	//Open the content
	xmlhttp.open("GET", target);
	//
   xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4){
			var container=document.getElementById(container_id);
			var text=xmlhttp.responseText
			//initial content
			container.innerHTML='<div id="Fade'+container_id+'">&nbsp;</div>';
			//unescaping            
           // text=text.replace(/\+/g," ");
            text=unescape(text);
            
			//defining Fade object...
            
			
			FadeObj=document.getElementById("Fade"+container_id+"");
            FadeObj.style.position="absolute";
            FadeObj.style.backgroundColor=color_background;
            FadeObj.style.zIndex="1";
            FadeObj.style.width="100%"
			if (navigator.appName=="Microsoft Internet Explorer"){
			FadeObj.style.width="120%";
			container.style.overflowX="hidden";
			}
			
            FadeObj.style.height="100%"
			FadeObj.style.top="0"
			FadeObj.style.left="0"
            
			opacity("Fade"+container_id+"", 100, 0, GlobalTransDuration);
			
			try{hf=setTimeout("HideElement('"+ "Fade"+container_id+"" +"')",GlobalTransDuration);}
			catch(e){hf=setTimeout(HideElement,GlobalTransDuration,"Fade"+container_id+"");}
			
		   container.innerHTML+=text;
           ActualHtml=container.innerHTML; 
           
           try{
           var friendlinkobj=document.getElementById('FriendURL');
           friendlinkobj.href+='&url='+ escape(window.location.href+'?url='+Sources[ActualIndex]) +''
           }catch(e){}
			
               
        }
    }
    xmlhttp.send(null)
}


//Opacity Functions
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;
    var obj=document.getElementById(id);
    obj.style.display="block";
	//determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
           
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
    
} 

function HideElement(obj_id){
	var obj=document.getElementById(obj_id);
    obj.style.display="none";
}

//QueryString

function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}
}
this.getKeyValuePairs = function() { return this.keyValuePairs; }

this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
	if(this.keyValuePairs[j].split("=")[0] == s)
	return this.keyValuePairs[j].split("=")[1];
}
	return false;
}

this.setValue = function(s,v) {
for(var j=0; j < this.keyValuePairs.length; j++) {
	if(this.keyValuePairs[j].split("=")[0] == s)
	this.keyValuePairs[j].split("=")[1]=v;
	}
}


this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() { return this.keyValuePairs.length; } 
}

function queryString(key){
var page = new PageQuery(window.location.search); 
return unescape(page.getValue(key)); 
}

function setQueryString(key,value){
var page = new PageQuery(window.location.search); 
page.setValue(key,value); 
}

function preloadImageList(sourcesList) { 
 var d=document; 
	if(d.images){ 
			if(!d.imagesPreloaded) {
			d.imagesPreloaded=new Array();
			}
		
var i,j=d.imagesPreloaded.length; 
		
		for(i=0; i<sourcesList.length; i++){
			if (sourcesList[i].indexOf("#")!=0){ 
				d.imagesPreloaded[j]=new Image; 
				d.imagesPreloaded[j++].src=sourcesList[i];
			}
		}
	}
}
-->