
var slsAutoStart=true;
var slsPauseTime=10;
var slsMode="slide";
var slsViewModeIcons=false;
var slsFadeSpeed=2;
var slsWidth=654;
var slsHeight=253;
var slsColor="#C6CEDE";
var slsOverflow="hidden";
var slsBorderWidth=0;
var slsBorderStyle="none";
var slsBorderColor="#C6CEDE";
var slsBarHeight=0;
var slsBarSpace=0;
var slsBarPosition="top";
var slsImgPrev="/Style%20Library/Images/Smallbiz/blank.gif";
var slsImgPrevWidth=13;
var slsImgNext="/Style%20Library/Images/Smallbiz/blank.gif";
var slsImgNextWidth=13;
var slsImgPlay="/Style%20Library/Images/Smallbiz/blank.gif";
var slsImgPlayWidth=13;
var slsImgStop="/Style%20Library/Images/Smallbiz/blank.gif";
var slsImgStopWidth=13;
var slsImgSlide="/Style%20Library/Images/Smallbiz/blank.gif";
var slsImgSlideWidth=13;
var slsImgFade="/Style%20Library/Images/Smallbiz/blank.gif";
var slsImgFadeWidth=13;
var slsImgBlank="/Style%20Library/Images/Smallbiz/blank.gif";
var slsIndView=true;
var slsIndCount=10;
var slsIndSpace=8;
var slsIndColor="";
var slsIndFont="Arial, Helvetica";
var slsIndFontSize=14;
var slsIndPosition="top";
var slsContents=new Array();
var slideone=document.getElementById("slide-one")
var slidetwo=document.getElementById("slide-two")
var slidethree=document.getElementById("slide-three")
if(slideone!=null) slsContents[0]=document.getElementById("slide-one").innerHTML;
if(slidetwo!=null) slsContents[1]=document.getElementById("slide-two").innerHTML;
if(slidethree!=null) slsContents[2]=document.getElementById("slide-three").innerHTML;
var DOM=document.getElementById;
var OP=(window.opera||navigator.userAgent.indexOf('Opera')!=-1);
var IE4=(document.all&&!OP);
var slsBord,slsCont,slsArea,slsBarArea,slsIndArea,slsIV,slsTimer,slsPrevious;
var slsIndStart=slsCurPage=0;
var slsPages=(typeof(slsContents)!='undefined')?slsContents.length:0;
var slsAnimation=false;
var slsW=slsWidth+slsBorderWidth*2;
var slsH=slsHeight+slsBorderWidth*2+slsBarSpace+slsBarHeight;
if(slsIndView) slsH+=slsIndSpace+slsIndFontSize;

function slsObject(id)
{
    this.elem=DOM?document.getElementById(id):document.all[id];
    this.css=this.elem.style;
    this.width=this.elem.offsetWidth;
    this.left=this.elem.offsetLeft;
    return this;
}
function slsSetMode(type)
{
    type=type.toLowerCase();
    if(type=='slide')
    {
        if(document.images.slsFade) {document.images.slsFade.style.backgroundColor='#666666';}
        if(document.images.slsSlide){document.images.slsSlide.style.backgroundColor='#FF0000';}
    }
    else if(type=='fade')
    {
        if(document.images.slsSlide){document.images.slsSlide.style.backgroundColor='#666666';}
        if(document.images.slsFade){document.images.slsFade.style.backgroundColor='#FF0000';}
    }
    else 
    {
        alert('Wrong type: '+type);
        return false;
    }
    slsPrevious=null;
    slsMode=type;
    slsJump(slsCurPage);
    if(slsPauseTime&&slsAutoStart) slsStartAnimation();
}
function slsPrevPage()
{
    if(!slsAnimation&&slsCurPage>0) {slsJump(slsCurPage-1);}
}
function slsNextPage()
{
    if(!slsAnimation&&slsCurPage<slsPages-1) {slsJump(slsCurPage+1);}
}
function slsJump(page)
{
    if(!slsAnimation)
    {
        var newPage=new slsObject('slsPage'+page);
        if(page!=slsCurPage)
        {
            slsPrevious=new slsObject('slsPage'+slsCurPage);
            slsPrevious.css.zIndex=1;
            if(slsMode=='fade')
            {
                newPage.css.left='0px';
                slsOpacity=0;
                slsSetOpacity(newPage);
                newPage.css.display='block';
                newPage.css.zIndex=2;
                slsIV=setInterval('slsFader('+page+')',1);
            }
            else
            {
                var offset=(page>slsCurPage)?slsWidth:-slsWidth;
                newPage.css.left=offset+'px';
                newPage.css.display='block';
                newPage.css.zIndex=2;
                slsIV=setInterval('slsSlider('+page+', '+slsCurPage+')',1);
            }
            slsCurPage=page;
        }
        else newPage.css.display='block';
    }
}
function slsCheckImg()
{
    var iconbar=0;
    /*var img=document.images['slsLeft'];
    if(slsCurPage<=0) img.src=slsImgBlank;
    else img.src=iconbar=slsImgPrev;
    img=document.images['slsRight'];
    if(slsCurPage>=slsPages-1) img.src=slsImgBlank;
    else img.src=iconbar=slsImgNext;*/
    iconbar=slsImgNext;
    if(!iconbar) slsBarArea.css.visibility=slsIndArea.css.visibility='hidden';
}
function slsGetIndStart()
{
    var start=0;
    if(slsCurPage%slsIndCount==0) {start=slsCurPage+1;}
    else if(slsCurPage%slsIndCount==slsIndCount-1) {start=slsCurPage-slsIndCount+2;}
    return start;
}
function slsSetIndex(start)
{
    if(!slsAnimation)
    {
        if(start) slsIndStart=start-1;
        var html=link='';
        for(var i=slsIndStart;i<slsPages&&i<slsIndStart+slsIndCount;i++)
        {
            if(i&&html) html+='';
            if(i==slsCurPage)
            {
                link='javascript:slsStopAnimation(); slsJump('+i+')';
                html+='<li id="link'+(parseInt(i)+1)+'" class="on"><a class="activeSlide" href="'+link+'" style="text-decoration:none">'+(i+1)+'</a></li>';
            }
            else
            {
                link='javascript:slsStopAnimation(); slsJump('+i+')';
                html+='<li id="link'+(parseInt(i)+1)+'" class=""><a class="" href="'+link+'" style="text-decoration:none">'+(i+1)+'</a></li>';
            }
        }
        if(slsIndStart)
        {
            link='javascript:slsSetIndex('+(slsIndStart-slsIndCount+1)+')';
            html+=' <li id="link'+(parseInt(i)+1)+'" class=""><a class="" href="'+link+'" style="text-decoration:none">&lt;&lt;</a></li> ';
        }
        if(i<slsPages)
        {
            link='javascript:slsSetIndex('+(i+1)+')';
            html+=' <li id="link'+(parseInt(i)+1)+'" class=""><a class= ""href="'+link+'" style="text-decoration:none">&gt;&gt;</a></li>';
        }
        slsIndArea.elem.innerHTML=html;
    }
}
function slsDoAnimation()
{
    if(slsCurPage>=slsPages-1) slsJump(0);
    else slsNextPage();
}
function slsStopAnimation()
{
    if(slsAutoStart)
    {
        if(slsTimer)clearInterval(slsTimer);
        var img=document.images['slsPlayStop'];
        /*img.src=slsImgPlay;*/
        img.width=slsImgPlayWidth;
        img.onclick=function(){slsStartAnimation(true);this.blur();}
        slsAutoStart=false;
    }
}
function slsStartAnimation(showNext)
{
    slsStopAnimation();
    slsTimer=setInterval('slsDoAnimation()',slsPauseTime*1000);
    var img=document.images['slsPlayStop'];
    /*img.src=slsImgStop;*/
    img.width=slsImgStopWidth;
    img.onclick=function(){slsStopAnimation();this.blur();}
    slsAutoStart=true;
    if(showNext) slsDoAnimation();
}
function slsInit()
{
    if(DOM||IE4)
    {
        if(!slsPages)
        {
            alert("No contents found.");
            return false;
        }
        slsBord=new slsObject('slsBorder');
        slsCont=new slsObject('slsContainer');
        slsArea=new slsObject('slsSlider');
        slsBarArea=new slsObject('slsBar');
        if(slsIndView) slsIndArea=new slsObject('slsInd');
        if(slsColor) slsCont.css.backgroundColor=slsColor;
        if(slsIndColor) slsIndArea.css.backgroundColor=slsIndColor;
        if(slsBorderWidth) slsBord.css.borderWidth=slsBorderWidth+'px';
        if(slsBorderStyle) slsBord.css.borderStyle=slsBorderStyle;
        if(slsBorderColor) slsBord.css.borderColor=slsBorderColor;
        var bordTop=0;
        if(slsBarPosition=='top') bordTop+=(slsBarHeight+slsBarSpace);
        if(slsIndView&&slsIndPosition=='top') bordTop+=(slsIndFontSize+slsIndSpace);
        slsArea.width=slsWidth;
        slsArea.css.width=slsArea.width+'px';
        slsArea.css.position='absolute';
        slsCont.css.width=slsWidth+'px';
        slsCont.css.height=slsHeight+'px';
        slsCont.css.visibility='visible';
        var content='<img src="'+slsImgPrev+'" name="slsLeft" height="'+slsBarHeight+'"'+' width="'+slsImgPrevWidth+'" style="margin:0px 5px; cursor:pointer"'+' onClick="slsStopAnimation(); slsPrevPage(); this.blur()">'+'<img src="'+slsImgPlay+'" name="slsPlayStop" height="'+slsBarHeight+'"'+' width="'+slsImgPlayWidth+'" style="margin:0px 5px; cursor:pointer"'+' onClick="slsStartAnimation(true); this.blur()">'+'<img src="'+slsImgNext+'" name="slsRight" height="'+slsBarHeight+'"'+' width="'+slsImgNextWidth+'" style="margin:0px 5px; cursor:pointer"'+' onClick="slsStopAnimation(); slsNextPage(); this.blur()">';
        if(slsViewModeIcons) {content+='';}
        var barTop=0;
        if(slsBarPosition!='top') barTop+=slsHeight+slsBorderWidth*2+slsBarSpace;
        if(slsIndView&&slsIndPosition=='top') barTop+=slsIndFontSize+slsIndSpace;
        slsBarArea.elem.innerHTML=content;
        if(slsIndView) {slsSetIndex();}
        var obj;
        for(var i=0;i<slsPages;i++)
        {
            obj=new slsObject('slsPage'+i);
            obj.css.position='absolute';
            obj.css.display='none';
            obj.css.zIndex=1;
        }
        setTimeout('slsCheckImg()',100);
        slsSetMode(slsMode);
    }
    else alert("Sorry, this script doesn't work with your browser.");
}
function slsSlider(nextPage,prevPage)
{
    var nextObj=new slsObject('slsPage'+nextPage);
    var prevObj=new slsObject('slsPage'+prevPage);
    if(prevObj&&nextObj&&nextObj.left!=0)
    {
        slsAnimation=true;
        var pixel=0.1*nextObj.left;
        if(pixel>0) pixel=Math.ceil(pixel);
        else pixel=Math.floor(pixel);
        prevObj.css.left=(prevObj.left-pixel)+'px';
        nextObj.css.left=(nextObj.left-pixel)+'px';
    }
    else
    {
        slsAnimation=false;
        if(slsIV) clearInterval(slsIV);
        slsCheckImg();
        if(slsIndView) slsSetIndex(slsGetIndStart());
    }
}
function slsBuildContainers()
{
    var sContent='';
    if(slsIndView) sContent+='<ul id="slsInd"></ul>';
    sContent+='<div id="slsBar" style="display:none;position:absolute; z-index:69;"></div><div id="slsBorder" style="position:absolute;"><div id="slsContainer" style="position:absolute; z-index:0; overflow:hidden; clip:rect(0,'+slsWidth+','+slsHeight+',0); visibility:hidden"><div id="slsSlider">';
    for(var i=0;i<slsPages;i++)
    {
        sContent+='<div id="slsPage'+i+'" style="width:654px;position:relative;height:253px;">'+slsContents[i]+'</div>';
    }
    sContent+='</div></div></div>';
    if(slsPages==2)
    {
        sContent+='<style>#slideshow #slsInd { background-image:url(\'/Style%20Library/Images/Smallbiz/slideshow_2tabs.gif\'); }#slideshow #slsInd #link2 { padding-right:22px; }#slideshow #slsInd #link2.on { background-image:url(\'/Style%20Library/Images/Smallbiz/slideshow_2tabs2.gif\'); }</style>';
    }
    document.getElementById('slideshow').innerHTML=sContent;
}
slsBuildContainers();
window.onload=slsInit;
