var speed = 50
var pause = 2000
var timerID = null
var bannerRunning = false
var ar = new Array()
var arS = new Array()
ar[0] = "Welcome to Kaleidoscope Boutique - Everytime you look, you see something different"
var crosscount = 390
var colorcount = 3;
var currentMessage = 0;
var offset = 0;
var flagNews=0;

var blank = "http://www.your-web-site-address-here.com/blank.gif";

topedge = 440;  // location of news box from top of page
leftedge = 10;  // location of news box from left edge
boxheight = 90;  // height of news box
boxwidth = 210;  // width of news box
scrollheight = 100; // total height of all data to be scrolled

Clothesline_topedge = 170; 
Clothesline_leftedge = 300;
Clothesline_boxheight = 400;
Clothesline_boxwidth = 400;
Clothesline_scrollheight = 600;
Clothesline_cliptop = 0;
Clothesline_scroll = 0;

var     arrPhotos = new Array();
var     arrPhotos_ = new Array();
var     numCurrentPhoto=0;
var     numCurrentPhotoPage=0;
var     numCurrentPhotoView=0;
var     numCountPhotos=0;

var     numPromo=0;

function jsStartAll() {
        startBanner();
//        startFlyin();
        if(flagNews == 1) {
                scrollnews(0);
        }
}

function stopBanner() {
        if (bannerRunning)
        clearTimeout (timerID)
        bannerRunning = false
}
function startBanner() {
        stopBanner()
        showBanner()

}
function showBanner() {
        var text = ar[currentMessage]
        if (offset < text.length) {
        if (text.charAt(offset) == " ")
                offset++
                var partialMessage = text.substring(0, offset + 1)
                window.status = partialMessage
                offset++
                timerID = setTimeout("showBanner()", speed)
                bannerRunning = true
        } else {
                offset = 0
                currentMessage++
                if (currentMessage == ar.length) currentMessage = 0
                timerID = setTimeout("showBanner()", pause)
                bannerRunning = true
        }
}

function animatein() {
        if (document.layers) var ns4def=''
        if (document.getElementById||document.all) {
                var crossheader=document.getElementById? document.getElementById("flyin").style : document.all.flyin.style
        }
        if (parseInt(crossheader.left)<770) {
                crossheader.left=parseInt(crossheader.left)+10
                if (parseInt(crossheader.left)>390) {
                        crossheader.clip="rect(auto," + crosscount + ",50,auto)";
                        (crosscount>=10)?crosscount-=10:0;
                        
                }
        } else {
                crosscount=400;
                crossheader.left=-400
                crossheader.clip="rect(auto,410,50,auto)";
                crossheader.width=crosscount;
                if(colorcount==0) {
                        crossheader.color='Black';
                        colorcount=6;
                }
                if(colorcount==1) crossheader.color='Orange';
                if(colorcount==2) crossheader.color='Blue';
                if(colorcount==3) crossheader.color='Red';
                if(colorcount==4) crossheader.color='Yellow';
                if(colorcount==5) crossheader.color='Green';
                if(colorcount==6) crossheader.color='Cyan';
                colorcount--;
        }
}

function startFlyin() {
        if (document.getElementById||document.all) {
                start=setInterval("animatein()",50)
        }
}

if (document.images) {
     imgRedBall = new Image
     imgBlank = new Image

     imgRedBall.src = 'images/ball.red.gif'
     imgBlank.src = 'images/blank.gif'
}

function jsMoveBall(parmMenuItem,parmImage,parmInOut) {
        if (document.images) {
                if (parmInOut=='IN') {
                        document[parmMenuItem].src='images/ball.red.gif';
                        if(parmImage != "N/A") document.all[parmImage].style.borderStyle='solid';
                }
                if (parmInOut=='OUT') {
                        document[parmMenuItem].src='images/blank.gif';
                        if(parmImage != "N/A") document.all[parmImage].style.borderStyle='none';
                }

        }
}
function jsMoveBox(parmImage,parmInOut) {
        if (document.images) {
                if (parmInOut=='IN') {
                        if(parmImage != "N/A") document.all[parmImage].style.borderStyle='solid';
                }
                if (parmInOut=='OUT') {
                        if(parmImage != "N/A") document.all[parmImage].style.borderStyle='none';
                }

        }
}

var message="Sorry, that function is disabled.\nThis Page is Copyrighted and\nImages and Text protected!\nALL RIGHTS RESERVED";


function click(e) {
        if (document.all) {
                if (event.button == 2) {
                        alert(message);
                        return false;
                }
        }
        if (document.layers) {
                if (e.which == 3) {
                        alert(message);
                        return false;
                }
        }
}

if (document.layers) {
        document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;

function scrollnews(cliptop) {
        if (document.layers) {
                newsDiv = document.news;
                newsDiv.clip.top = cliptop;
                newsDiv.clip.bottom = cliptop + boxheight;
                newsDiv.clip.left = 0;
                newsDiv.clip.right = boxwidth + leftedge;
                newsDiv.left = leftedge;
                newsDiv.top = topedge - cliptop;
        }
        else {
                newsDiv = news.style;
                newsDiv.clip = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
                newsDiv.pixelLeft = leftedge;
                newsDiv.pixelTop = topedge - cliptop;
        }
        cliptop = (cliptop + 1) % (scrollheight + boxheight);
        newsDiv.visibility='visible';
        setTimeout("scrollnews(" + cliptop + ")", 60);
        Clothesline_scroll==0;
}

function scrollClothesline(parmDir) {
        if (document.layers) {
                CL_Div_Height = document.CL.height;
        }
        else {
                CL_Div_Height = CL.style.height;
        }
        if(parmDir==-2) {
                parmDir=-1;
                Clothesline_scroll=1;
        }
        if(parmDir==2) {
                parmDir=1;
                Clothesline_scroll=1;
        }
        if(Clothesline_cliptop==0 && parmDir==-1) {
                parmDir=0;
        }
        if(Clothesline_cliptop>(Clothesline_scrollheight + Clothesline_boxheight + 4)  && parmDir==1) {
                parmDir=0;
        }
        cliptop = (Clothesline_cliptop + (parmDir*4));
        Clothesline_cliptop = cliptop;
        if (document.layers) {
                Clothesline_Div = document.CL;
                Clothesline_Div.clip.top = cliptop;
                Clothesline_Div.clip.bottom = cliptop + Clothesline_boxheight;
                Clothesline_Div.clip.left = 'auto';
                Clothesline_Div.clip.right = Clothesline_boxwidth + Clothesline_leftedge;
                Clothesline_Div.left = Clothesline_leftedge;
                Clothesline_Div.top = Clothesline_topedge - cliptop;
        }
        else {
                Clothesline_Div = CL.style;
                Clothesline_Div.clip = "rect(" + cliptop + "px " + (Clothesline_boxwidth + Clothesline_leftedge) + "px " + (cliptop + Clothesline_boxheight) + "px auto)";
                Clothesline_Div.pixelLeft = Clothesline_leftedge;
                Clothesline_Div.pixelTop = Clothesline_topedge - cliptop;
        }
        Clothesline_Div.visibility='visible';
        if(Clothesline_scroll==1) {
                setTimeout("scrollClothesline(" + parmDir + ")", 1);
        } 
        
}

function jsPreLoad(txtAlbum,cntPhotos) {
        numCountPhotos=cntPhotos;
        arrPhotos[0]='images/colorlogo_image.gif';
        for(i=1;i<=cntPhotos;i++) {
                arrPhotos[i]='storage/albums/' + txtAlbum + '/' + i + '.jpg';
        }
}

function jsShowPhoto(numPhoto) {
        numPreviousPhoto=numCurrentPhoto;
        numCurrentPhotoView=0;
        if(numPhoto==0) {
                numCurrentPhoto++;
                if(numCurrentPhoto > numCountPhotos) numCurrentPhoto=1;
        }
        if(numPhoto==-1) {
                numCurrentPhoto--;
                if(numCurrentPhoto == 0) numCurrentPhoto=numCountPhotos;
        }
        if(numPhoto>0) {
                numCurrentPhoto=numPhoto+(numCurrentPhotoPage*16);
        }
        for(i=1;i<=16;i++) {
                txtPhoto='t'+i;
                document.all[txtPhoto].style.visibility='hidden';
        }               
        txtPhoto='p0';
        document.all[txtPhoto].style.visibility='visible';
        document.all[txtPhoto].src=arrPhotos[numCurrentPhoto];
        
        txtDescr='descr' + numPreviousPhoto;
        document.all[txtDescr].style.visibility='hidden';
        txtDescr='descr' + numCurrentPhoto;
        document.all[txtDescr].style.visibility='visible';
        txtParm='parm' + numCurrentPhoto;
        iy=document.all[txtParm].style.height;
        document.all[txtPhoto].style.height=iy;
        
        txtPromo="promo" + numPromo;
        document.all[txtPromo].style.visibility='hidden';
        numPromo++;
        if(numPromo>=document.all['promoparm'].innerHTML) {
                numPromo=0;
        }
        txtPromo="promo" + numPromo;
        document.all[txtPromo].style.visibility='visible';
}
function jsPopPhoto(numPhoto,txtAlbum) {
        txtParms='parm' + numCurrentPhoto;
        numY=document.all[txtParms].innerHTML;
        parmHTML= "pic=" + numCurrentPhoto + "&albm=" + txtAlbum + "&y=" + numY;
        wndPhoto=window.open("includes/showphoto.php?" + parmHTML ,"Photo","");
}
        
function jsThumbnails(numWhat) {
        numPreviousPhoto=numCurrentPhoto;
        numCurrentPhotoView=1;
        if(numCurrentPhoto==0) numCurrentPhoto=1;
        numPages=Math.floor((numCountPhotos-1)/16);
        if(numWhat==0) numCurrentPhotoPage=Math.floor((numCurrentPhoto-1)/16);
        if(numWhat==1) numCurrentPhotoPage=(numCurrentPhotoPage==numPages)?0:(numCurrentPhotoPage+1);
        if(numWhat==-1) numCurrentPhotoPage=(numCurrentPhotoPage==0)?numPages:(numCurrentPhotoPage-1);
        numPhotosOnPage=(numCurrentPhotoPage==numPages)?numCountPhotos-(numCurrentPhotoPage*16):16;
        for(i=1;i<=numPhotosOnPage;i++) {
                txtPhoto='t'+i;
                document.all[txtPhoto].src=arrPhotos[i+(numCurrentPhotoPage*16)];
                document.all[txtPhoto].style.visibility='visible';
                txtDescr='descr' + (i+(numCurrentPhotoPage*16));
                document.all[txtPhoto].title=document.all[txtDescr].innerHTML;
                txtParms="parm" + (i+(numCurrentPhotoPage*16));
                iys=document.all[txtParms].style.width;
                document.all[txtPhoto].style.height=iys;
        }
        for(i=(numPhotosOnPage+1);i<=16;i++) {
                txtPhoto='t'+i;
                document.all[txtPhoto].style.visibility='hidden';
        }
        txtPhoto='p0';
        document.all[txtPhoto].style.visibility='hidden';

        txtDescr='descr' + numPreviousPhoto;
        document.all[txtDescr].style.visibility='hidden';
}

function jsPhotoNext() {
        if(numCurrentPhotoView==0) jsShowPhoto(0);
        if(numCurrentPhotoView==1) {
                jsThumbnails(1);
        }
        if(numCurrentPhotoView==2) jsShowPhoto(0);
}
function jsPhotoPrev() {
        if(numCurrentPhotoView==0) jsShowPhoto(-1);
        if(numCurrentPhotoView==1) {
                jsThumbnails(-1);
        }
        if(numCurrentPhotoView==2) jsShowPhoto(-1);
}

function jsPhotoHome() {
        numPreviousPhoto=numCurrentPhoto;
        numCurrentPhotoView=0;
        numCurrentPhoto=0;

        for(i=1;i<=16;i++) {
                txtPhoto='t'+i;
                document.all[txtPhoto].style.visibility='hidden';
        }
        txtPhoto='p0';
        document.all[txtPhoto].style.visibility='visible';
        document.all[txtPhoto].src=arrPhotos[numCurrentPhoto];
        document.all[txtPhoto].style.height='410px';
        

        txtDescr='descr' + numPreviousPhoto;
        document.all[txtDescr].style.visibility='hidden';
        txtDescr='descr' + numCurrentPhoto;
        document.all[txtDescr].style.visibility='visible';
}

function jsPhotoMovie(numWhat) {
        numPreviousPhoto=numCurrentPhoto;
        document.all['SLIDESHOWBTN'].src='images/slideshow_over.gif';
        if(numWhat==2) {
                numCurrentPhotoView=2;
        }
        if(numCurrentPhotoView==2) {
                if(numCurrentPhoto==0) numCurrentPhoto=1;
                jsShowPhoto(0);
                numCurrentPhotoView=2;

                setTimeout("jsPhotoMovie(0)", 4000);
        }
}

function jsPhotoOverButton(objButtonOver,numInOut) {
        if(objButtonOver.id=='STARTBTN' && numCurrentPhotoView==0 && numInOut==1) return;
        if(objButtonOver.id=='THUMBPAGEBTN' && numCurrentPhotoView==1 && numInOut==1) return;
        if(objButtonOver.id=='SLIDESHOWBTN' && numCurrentPhotoView==2 && numInOut==1) return;
        
        if(objButtonOver.id=='STARTBTN' && numInOut==0) objButtonOver.src='images/gohome_over.gif'; 
        if(objButtonOver.id=='STARTBTN' && numInOut==1) objButtonOver.src='images/gohome.gif'; 

        if(objButtonOver.id=='THUMBPAGEBTN' && numInOut==0) objButtonOver.src='images/gotothumbpage_over.gif'; 
        if(objButtonOver.id=='THUMBPAGEBTN' && numInOut==1) objButtonOver.src='images/gotothumbpage.gif'; 

        if(objButtonOver.id=='SLIDESHOWBTN' && numInOut==0) objButtonOver.src='images/slideshow_over.gif'; 
        if(objButtonOver.id=='SLIDESHOWBTN' && numInOut==1) objButtonOver.src='images/slideshow.gif'; 

        if(objButtonOver.id=='PREV' && numInOut==0) objButtonOver.border=1;
        if(objButtonOver.id=='PREV' && numInOut==1) objButtonOver.border=0;

        if(objButtonOver.id=='NEXT' && numInOut==0) objButtonOver.border=1;
        if(objButtonOver.id=='NEXT' && numInOut==1) objButtonOver.border=0;
}

function jsPhotoClick(objClicked, numParm) {
        if(objClicked.id=='STARTBTN') {
                objClicked.src='images/gohome_over.gif';
                document.all['THUMBPAGEBTN'].src='images/gotothumbpage.gif';
                document.all['SLIDESHOWBTN'].src='images/slideshow.gif';
                document.all['PREV'].border=0;
                document.all['NEXT'].border=0;
                jsPhotoHome();
        }
        if(objClicked.id=='THUMBPAGEBTN') {
                objClicked.src='images/gotothumbpage_over.gif';
                document.all['STARTBTN'].src='images/gohome.gif';
                document.all['SLIDESHOWBTN'].src='images/slideshow.gif';
                document.all['PREV'].border=0;
                document.all['NEXT'].border=0;
                jsThumbnails(0);
        }
        if(objClicked.id=='SLIDESHOWBTN') {
                objClicked.src='images/slideshow_over.gif';
                document.all['STARTBTN'].src='images/gohome.gif';
                document.all['THUMBPAGEBTN'].src='images/gotothumbpage.gif';
                document.all['PREV'].border=0;
                document.all['NEXT'].border=0;
                jsPhotoMovie(2);
        }
        if(objClicked.id=='PREV') {
                objClicked.border=1;
                document.all['STARTBTN'].src='images/gohome.gif';
                document.all['THUMBPAGEBTN'].src='images/gotothumbpage.gif';
                document.all['SLIDESHOWBTN'].src='images/slideshow.gif';
                document.all['NEXT'].border=0;
                jsPhotoPrev();
        }
        if(objClicked.id=='NEXT') {
                objClicked.border=1;
                document.all['STARTBTN'].src='images/gohome.gif';
                document.all['THUMBPAGEBTN'].src='images/gotothumbpage.gif';
                document.all['SLIDESHOWBTN'].src='images/slideshow.gif';
                document.all['PREV'].border=0;
                jsPhotoNext();
        }
}
function jsSetScrollHeight(numParm) {
        Clothesline_scrollheight = numParm;
}