// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 3000

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'images/pincode.gif'
Pic[1] = 'images/Diary.jpg'
Pic[2] = 'images/Clock1.jpg'
Pic[3] = 'images/Clock2.jpg'
Pic[4] = 'images/Clock3.jpg'

// =======================================
// do not edit anything below this line
// =======================================

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e)
{
    topDog = isIE ? "BODY" : "HTML";
    topDog2= isIE ? "BODY" : "HTML";
	topDog3= isIE ? "BODY" : "HTML";
    whichDog = isIE ? document.all.theLayer1  : document.getElementById("theLayer1") ;  
    whichDog2= isIE ? document.all.theLayer2 : document.getElementById("theLayer2"); 
	whichDog3= isIE ? document.all.theLayer3 : document.getElementById("theLayer3");  
    hotDog =isIE ? event.srcElement : e.target;  
    hotDog2=isIE ? event.srcElement : e.target;
	hotDog3=isIE ? event.srcElement : e.target;  
    while (hotDog.id!="titleBar1" && hotDog.tagName!=topDog )
    {
        hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
    }
    while (hotDog2.id!="titleBar2"&& hotDog2.tagName!=topDog2 )
    {
        hotDog2=isIE ? hotDog2.parentElement : hotDog2.parentNode;
    }
	while (hotDog3.id!="titleBar3"&& hotDog3.tagName!=topDog3 )
    {
        hotDog3=isIE ? hotDog3.parentElement : hotDog3.parentNode;
    }  
    if (hotDog.id=="titleBar1")
    {
        offsetx=isIE ? event.clientX : e.clientX;
        offsety=isIE ? event.clientY : e.clientY;
        nowX=parseInt(whichDog.style.left);
        nowY=parseInt(whichDog.style.top);
        ddEnabled=true;
        document.onmousemove=dd;
    }
    if (hotDog2.id=="titleBar2")
    {
        offsetx2=isIE ? event.clientX : e.clientX;
        offsety2=isIE ? event.clientY : e.clientY;
        nowX2=parseInt(whichDog2.style.left);
        nowY2=parseInt(whichDog2.style.top);
        ddEnabled2=true;
        document.onmousemove=dd2;
    }
	 if (hotDog3.id=="titleBar3")
    {
        offsetx2=isIE ? event.clientX : e.clientX;
        offsety2=isIE ? event.clientY : e.clientY;
        nowX2=parseInt(whichDog3.style.left);
        nowY2=parseInt(whichDog3.style.top);
        ddEnabled2=true;
        document.onmousemove=dd3;
    }
    
    
}

function dd(e)
{
    if (!ddEnabled) return;
    whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
    whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
    return false;  
}
function dd2(e)
{
    if (!ddEnabled2) return;
    whichDog2.style.left=isIE ? nowX2+event.clientX-offsetx2 : nowX2+e.clientX-offsetx2; 
    whichDog2.style.top=isIE ? nowY2+event.clientY-offsety2 : nowY2+e.clientY-offsety2;
    return false;  
}
function dd3(e)
{
    if (!ddEnabled2) return;
    whichDog3.style.left=isIE ? nowX2+event.clientX-offsetx2 : nowX2+e.clientX-offsetx2; 
    whichDog3.style.top=isIE ? nowY2+event.clientY-offsety2 : nowY2+e.clientY-offsety2;
    return false;  
}
function ddN4(whatDog)
{
    if (!isN4) return;
    N4=eval(whatDog);
    N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
    N4.onmousedown=function(e)
    {
        N4.captureEvents(Event.MOUSEMOVE);
        N4x=e.x;
        N4y=e.y;
    }
  
    N4.onmousemove=function(e)
    {
        if (isHot)
        {
          N4.moveBy(e.x-N4x,e.y-N4y);
          return false;
        }
    }
    N4.onmouseup=function()
    {
        N4.releaseEvents(Event.MOUSEMOVE);
    }
}
function hideMe1()
{
    if (isIE||isNN) whichDog.style.visibility="hidden";
    else if (isN4) document.theLayer1.visibility="hide";
}
function hideMe2()
{
    if (isIE||isNN) whichDog2.style.visibility="hidden";
    else if (isN4) document.theLayer2.visibility="hide";
}
function hideMe3()
{
    if (isIE||isNN) whichDog3.style.visibility="hidden";
    else if (isN4) document.theLayer3.visibility="hide";
}

document.onmousedown=ddInit;
document.onmouseup = Function("ddEnabled=false;ddEnabled2=false");

var t;
var j = 0;
var p = Pic.length;

var preLoad = new Array()
for (i = 0; i < p; i++)
{
    preLoad[i] = new Image();
    preLoad[i].src = Pic[i];
}

function runSlideShow()
{
    if (document.all)
    {
        document.images.SlideShow.style.filter="blendTrans(duration=2)";
        document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
        document.images.SlideShow.filters.blendTrans.Apply();      
    }
    if (!isN4) document.images.SlideShow.src = preLoad[j].src;
    if (isN4) document.layers['theLayer'].document.images['SlideShow'].src = preLoad[j].src;
    if (document.all)
    {
        document.images.SlideShow.filters.blendTrans.Play();
    }
    j = j + 1;
    if (j > (p-1)) j=0;
    t = setTimeout('runSlideShow()', slideShowSpeed);
}


