/*

----------load with:

//<script language="javascript" src="slideshow.js"></script>
----------set variables
//<script>


photo = new Array(
'images/home-honi.jpg',
'images/home-azw.jpg',
'images/home-nni.jpg',
'images/home-kdec.jpg ',
'images/home-rcinc.jpg',
'images/home-dfg.jpg',
'images/home-cbi.jpg',
'images/home-ll.jpg'
);
numphotos = 8;


//</script>
---------call with
	onLoad="initPhoto();"

---------locate

	<div style="background-image: url(/images/blank.gif); background-repeat: no-repeat; width: 300px; height: 257px; margin-left:20px; margin-bottom:5px; float:right;" id="blenddiv">
		<img src="/images/blank.gif" style="width: 300px; height: 257px; border: 0 none; filter: alpha(opacity=0); -moz-opacity: 0; opacity: 0;" id="blendimage" alt="" / border="2px">
	</div> 

*/
initflag=true;
atime=0;
photonum = 0;

var preLoad = new Array()
for (i = 0; i < numphotos; i++){
   preLoad[i] = new Image()
   preLoad[i].src = photo[i]
}

function pixclick(){
	if(initflag==true){
		initPhoto();
		initflag=false;
		ChangeText('Click picture to pause slideshow.');
	}else{
		stopPhoto();
		initflag=true;
		ChangeText('Click picture to resume slideshow.');
	}
}

function stopPhoto(){
	clearTimeout(atime);
}

function ChangeText(newtitle) {
   var pixtext = document.getElementById("pixtext");
   pixtext.firstChild.nodeValue=newtitle;
}


function initPhoto(){
	if(initflag==true){
		blendimage('blenddiv','blendimage', 'images/blank.gif',1000);


	}
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 




function blendimage(divid, imageid, imagefile, millisec) { 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
    imagefile = photo[photonum];
    //set the current image as background 
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 
     
    //make image transparent 
    changeOpac(0, imageid); 
     
    //make new image 
    document.getElementById(imageid).src = imagefile; 

    //fade in image 
    for(i = 0; i <= 99; i++) { 
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
        timer++; 
    }
	photonum = (photonum+1) % numphotos;
	if(autoshow==true){
		atime = setTimeout("blendimage('blenddiv','blendimage', 'images/blank.gif',500)", '3000')
	}
} 

