/* <![CDATA[ */

// COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

var sslock = 0;
var sspositions = new Array();
var ssinnerheights = new Array();
var ssvisibleslides = new Array();
var ssslides = new Array();
var ssenabledcolors = new Array();
var ssdisabledcolors = new Array();
var sshorizontals = new Array();
var ssspeeds = new Array();
var sshidebuttons = new Array();
var ssrunfunctions = new Array();

// COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

function ssslider(ssdiv, sswidth, ssinnerheight, ssvisibleslidesnum, ssslidenum, ssenabledcolor, ssdisabledcolor, sshorizontal, ssspeed, sshidebuttonsvar, ssrunfunction)
{
 
 // COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

 if(isaccessible()) return;

 try
 {   
  sspositions[ssdiv] = 0;
  ssvisibleslides[ssdiv] = ssvisibleslidesnum;
  ssinnerheights[ssdiv] = ssinnerheight;
  ssslides[ssdiv] = ssslidenum;
  ssenabledcolors[ssdiv] = ssenabledcolor;
  ssdisabledcolors[ssdiv] = ssdisabledcolor;
  sshorizontals[ssdiv] = sshorizontal;
  ssspeeds[ssdiv] = ssspeed;
  sshidebuttons[ssdiv] = sshidebuttonsvar;
  ssrunfunctions[ssdiv] = ssrunfunction;
  var sscontent = new String();
  sscontent = document.getElementById(ssdiv).innerHTML;
  var ssgenerated = new String();
  if(!sshidebuttons[ssdiv])
   ssgenerated = "<div id='slider"+ssdiv+"up' onclick='ssslide(\""+ssdiv+"\", -1)'></div>\n";
  ssgenerated+= "<div id='slider"+ssdiv+"frame'>\n";
  ssgenerated+= "<div id='slider"+ssdiv+"'>"+sscontent+"</div>\n";
  ssgenerated+= "</div>\n";
  if(!sshidebuttons[ssdiv])
   ssgenerated+= "<div id='slider"+ssdiv+"down' onclick='ssslide(\""+ssdiv+"\", 1)'></div>\n";
  var ssactualdiv = document.getElementById(ssdiv);
  ssactualdiv.className = "slideractual";
  ssactualdiv.innerHTML = ssgenerated;
  if(sshorizontals[ssdiv])
  {
   ssactualdiv.style.height = sswidth+"px";
   if(!sshidebuttons[ssdiv])
    ssactualdiv.style.width = ssinnerheight*ssvisibleslidesnum + 32 + "px";
   else
    ssactualdiv.style.width = ssinnerheight*ssvisibleslidesnum + "px";
  }
  else
  {
   ssactualdiv.style.width = sswidth+"px";
   if(!sshidebuttons[ssdiv])
    ssactualdiv.style.height = ssinnerheight*ssvisibleslidesnum + 32 + "px";
   else
    ssactualdiv.style.height = ssinnerheight*ssvisibleslidesnum + "px";
  }
  if(!sshidebuttons[ssdiv])
  {
   var sstopdiv = document.getElementById("slider"+ssdiv+"up");
   sstopdiv.className = "sliderbuttonup";
   if(sshorizontals[ssdiv])
   {
    sstopdiv.style.height = sswidth+"px";
    sstopdiv.style.width = "15px";
   }
   else
   {
    sstopdiv.style.width = sswidth+"px";
    sstopdiv.style.height = "15px";
   }
   sstopdiv.style.backgroundColor = ssdisabledcolor;
  }
  var ssframediv = document.getElementById("slider"+ssdiv+"frame");
  ssframediv.className = "sliderframe";
  if(sshorizontals[ssdiv])
  {
   ssframediv.style.height = sswidth+"px";
   ssframediv.style.width = ssinnerheight*ssvisibleslidesnum + "px";
  }
  else
  {
   ssframediv.style.width = sswidth+"px";
   ssframediv.style.height = ssinnerheight*ssvisibleslidesnum + "px";
  }
  var ssinnerdiv = document.getElementById("slider"+ssdiv);
  ssinnerdiv.className = "sliderinner";
  if(sshorizontals[ssdiv])
  {
   ssinnerdiv.style.height = sswidth+"px";
   ssinnerdiv.style.width = ssinnerheight * ssslidenum +"px";
  }
  else
  {
   ssinnerdiv.style.width = sswidth+"px";
   ssinnerdiv.style.height = ssinnerheight * ssslidenum +"px";
  }
  if(!sshidebuttons[ssdiv])
  {
   var ssbottomdiv = document.getElementById("slider"+ssdiv+"down");
   ssbottomdiv.className = "sliderbuttondown";
   if(sshorizontals[ssdiv])
   {
    ssbottomdiv.style.height = sswidth+"px";
    ssbottomdiv.style.width = "15px";
   }
   else
   {
    ssbottomdiv.style.width = sswidth+"px";
    ssbottomdiv.style.height = "15px";
   }
 
   if(ssinnerheight * ssslidenum > ssinnerheight * ssvisibleslidesnum)
   {
    ssbottomdiv.style.backgroundColor = ssenabledcolor;
    ssbottomdiv.style.backgroundRepeat = "no-repeat";
    if(sshorizontals[ssdiv])
    {
     ssbottomdiv.style.backgroundPosition = "0px";
     ssbottomdiv.style.backgroundImage = "url('../imagens/scrolldireita.png')";
    }
    else
    {
     ssbottomdiv.style.backgroundPosition = "0px";
     ssbottomdiv.style.backgroundImage = "url('../imagens/scrollbaixo.png')";
    }
    ssbottomdiv.style.cursor = "pointer";
   }
   else
    ssbottomdiv.style.backgroundColor = ssdisabledcolor;
  }
 }
 catch(err) { null }
 
 // COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED. 

}

// COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

function ssslide(ssdiv, ssorientation)
{

 // COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.
 
 if(isaccessible()) return;
 
 if(sspositions[ssdiv] + ssorientation >= 0 && sspositions[ssdiv] + ssorientation <= ssslides[ssdiv] - ssvisibleslides[ssdiv] && sslock ==0)
 {
  if(ssrunfunctions[ssdiv] == 1)
   ssfslider(ssdiv, sspositions[ssdiv] + ssorientation);
  sslock = 1;
  ssmoveslide(ssdiv, sspositions[ssdiv], sspositions[ssdiv] + ssorientation);
  sspositions[ssdiv] = sspositions[ssdiv] + ssorientation;
 }

// COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

}

// COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

function ssmoveslide(ssdiv, ssfrom, ssto)
{

 // COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

 if(isaccessible()) return;

 var ssinnerdiv = document.getElementById("slider"+ssdiv);
 if(ssspeeds[ssdiv])
  var ssactualposition = parseFloat(ssfrom) * ssinnerheights[ssdiv] + (ssto * ssinnerheights[ssdiv] - parseFloat(ssfrom) * ssinnerheights[ssdiv]) / 2;
 else
  var ssactualposition = ssto * ssinnerheights[ssdiv];
 if(sshorizontals[ssdiv])
  ssinnerdiv.style.left = - Math.round(ssactualposition) +"px";
 else
  ssinnerdiv.style.top = - Math.round(ssactualposition) +"px";
 if(Math.round(ssactualposition) != Math.round(ssto * ssinnerheights[ssdiv]))
 {
   var ssnewstep = ssfrom + (ssto - ssfrom) / 2;
   setTimeout("ssmoveslide(\""+ssdiv+"\", "+ssnewstep+", "+ssto+")", ssspeeds[ssdiv]);
 }
 else
 {
  sslock = 0;
  if(!sshidebuttons[ssdiv])
  {
   var sstopdiv = document.getElementById("slider"+ssdiv+"up");
   var ssbottomdiv = document.getElementById("slider"+ssdiv+"down");
   if(sspositions[ssdiv] == 0)
   {
    sstopdiv.style.backgroundColor = ssdisabledcolors[ssdiv];
    sstopdiv.style.backgroundImage = "none";
    sstopdiv.style.cursor = "default";   
   }
   else
   {
    sstopdiv.style.backgroundColor = ssenabledcolors[ssdiv];
    sstopdiv.style.backgroundRepeat = "no-repeat";
    if(sshorizontals[ssdiv])
    {
     sstopdiv.style.backgroundPosition = "0px";
     sstopdiv.style.backgroundImage = "url('../imagens/scrollesquerda.png')";
    }
    else
    {
     sstopdiv.style.backgroundPosition = "0px";
     sstopdiv.style.backgroundImage = "url('../imagens/scrollcima.png')";
    }
    sstopdiv.style.cursor = "pointer";
   }
   if(sspositions[ssdiv] == ssslides[ssdiv] - ssvisibleslides[ssdiv])
   {
    ssbottomdiv.style.backgroundColor = ssdisabledcolors[ssdiv];
    ssbottomdiv.style.backgroundImage = "none";
    ssbottomdiv.style.cursor = "default";
   }
   else
   {
    ssbottomdiv.style.backgroundColor = ssenabledcolors[ssdiv];
    ssbottomdiv.style.backgroundRepeat = "no-repeat";
    if(sshorizontals[ssdiv])
    {
     ssbottomdiv.style.backgroundPosition = "0px";
     ssbottomdiv.style.backgroundImage = "url('../imagens/scrolldireita.png')";
    }
    else
    {
     ssbottomdiv.style.backgroundPosition = "0px";
     ssbottomdiv.style.backgroundImage = "url('../imagens/scrollbaixo.png')";
    }
    ssbottomdiv.style.cursor = "pointer";
   }
  }
  if(ssrunfunctions[ssdiv] == 2)
   ssfslider(ssdiv, ssto);
 }

 // COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

}

// COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

function ssgoslide(ssdiv, ssslidenum)
{

 // COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED. 

 if(isaccessible()) return;

 if(ssslidenum > ssslides[ssdiv] - ssvisibleslides[ssdiv])
  ssslidenum = ssslides[ssdiv] - ssvisibleslides[ssdiv];
 var ssorientation = ssslidenum - sspositions[ssdiv];
 ssslide(ssdiv, ssorientation);

 // COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED. 

}

function isaccessible()
{

 // COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

 if(typeof window["acessibilidade"] != "undefined" && acessibilidade == 1)
  return 1;
 else
  return 0;
  
  // COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.
}

// COPYRIGHT 2007 ANDRE RIBOIRA. ALL RIGHTS RESERVED.

/* ]]> */
