// (C) 2002 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header.


// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 10000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;

var Picture = new Array(); // don't change this
var Caption = new Array(); // don't change this
var aUrl = new Array();
var aTitle = new Array();
var aTarget = new Array();



var tss;
var iss;
var jss = 1;
var pss = 5; //Picture.length-1;
var paused = false;
var init = false;
var max = 5;

var preLoad = new Array();
//for (iss = 1; iss < pss+1; iss++){
//preLoad[iss] = new Image();
//preLoad[iss].src = Picture[iss];}

function initSlideShow(thismax,datastring){
  try{
    max = thismax;
    aPhotos = datastring.split(";");

    for (i=0;i<max;i++){
      aPhotoItems  = aPhotos[i].split("|");
      Picture[i+1] = aPhotoItems[0];
      aUrl[i+1]    = aPhotoItems[1];
      aTitle[i+1]  = aPhotoItems[2];
      aTarget[i+1] = aPhotoItems[3];
    }
    for (iss = 1; iss <= max; iss++){
      preLoad[iss] = new Image();
      preLoad[iss].src = Picture[iss];
    }
    runSlideShow(max);
  }
  catch(err){

  }
}
function runSlideShow(){
    if (!(init)){

      init=true;
    }
    if (document.all){
        document.images.PictureBox.style.filter="blendTrans(duration=2)";
        document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
        document.images.PictureBox.filters.blendTrans.Apply();
    }
    document.images.PictureBox.src = preLoad[jss].src;
    document.images.PictureBox.alt = aTitle[jss];
    document.images.PictureBox.title = aTitle[jss];
	
    if (aTarget[jss]=="_blank"){
      document.getElementById('PictureBox').onclick = new Function("window.open('"+aUrl[jss]+"')");
    }else{
      document.getElementById('PictureBox').onclick = new Function("location.href='"+aUrl[jss]+"'");
    }

    if (document.all) document.images.PictureBox.filters.blendTrans.Play();
    jss = jss + 1;
    if (jss > (max)) jss=1;
    if (!(paused)) tss = setTimeout('runSlideShow('+max+')', SlideShowSpeed);
}


function pauseit(i,bool){
    try{
        clearTimeout(tss);
        paused = bool;
        jss = i;
        runSlideShow();
    }catch(err){
        //alert(err.description);
    }
}

function StoryLink(){
	try{
	    imgTag = document.getElementById("home-profile-link").innerHTML;
	    imgHref = imgTag.substr(imgTag.indexOf("href=")+6);
	    imgUrl = imgHref.substr(0,imgHref.indexOf("\""));
	    if (document.all){
	        imgTitle = document.getElementById("home-profile-caption").innerText;
	    }else{
	        imgTitle = document.getElementById("home-profile-caption").textContent;
	    }
	    StoryBlock = document.getElementById("home-profile");
	    StoryBlock.style.cursor = "pointer";
	    StoryBlock.title = imgTitle;
	    StoryBlock.onclick = new Function("location.href='"+imgUrl+"'");
	}
	catch(err){
	}
}
