theimage = new Array();

// The dimensions of ALL the images should be the same or some of them may look stretched or reduced in Netscape 4.
// Format: theimage[...]=[image URL, link URL, name/description]
theimage[0]=["http://www.jodek.com.au/wp-content/uploads/homeimage/Jodek1.jpg", "", "Jodek"];
theimage[1]=["http://www.jodek.com.au/wp-content/uploads/homeimage/Jodek2.jpg", "", "Jodek"];
theimage[2]=["http://www.jodek.com.au/wp-content/uploads/homeimage/Jodek3.jpg", "", "Jodek"];
///// Plugin variables

playspeed=6000;// The playspeed determines the delay for the "Play" button in ms
dotrans=1; // if value = 1 then there are transitions played in IE
transtype='blendTrans';// 'blendTrans' or 'revealtrans'
transattributes='23';// duration=seconds,transition=#<24
//#####
//key that holds where in the array currently are
i=0;


//###########################################
window.onload=function(){

	//preload images into browser
	preloadSlide();

	//set transitions
	GetTrans();

	//set the first slide
	SetSlide(0);

	//autoplay
	PlaySlide();
	
	new mq('m1',mqAry1,121);

   mqRotate(mqr); // must come last

}

//###########################################
function SetSlide(num) {
	//too big
	i=num%theimage.length;
	//too small
	if(i<0) i=theimage.length-1;

	//switch the image
	if(document.all&&!window.opera&&dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Apply()')
	document.images.imgslide.src=theimage[i][0];
	if(document.all&&!window.opera&&dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Play()')

}


//###########################################
function PlaySlide() {
	if (!window.playing) {
		PlayingSlide(i);
		if(document.slideshow.play){
			document.slideshow.play.value="   Stop   ";
		}
	}
	else {
		playing=clearTimeout(playing);
		if(document.slideshow.play){
			document.slideshow.play.value="   Play   ";
			
		}
	}
	// if you have to change the image for the "playing" slide
	if(document.images.imgPlay){
		setTimeout('document.images.imgPlay.src="'+imgStop+'"',1);
		imgStop=document.images.imgPlay.src
	}
}


//###########################################
function PlayingSlide(num) {

	playing=setTimeout('PlayingSlide(i+1);SetSlide(i+1);', playspeed);
	

	
}


//###########################################
//desc: picks the transition to apply to the images
function GetTrans() {
	//si=document.slideshow.trans.selectedIndex;

		if((document.slideshow.trans && document.slideshow.trans.selectedIndex == 0) || (!document.slideshow.trans && dotrans==0)){
		dotrans=0;
	}
	else if ((document.slideshow.trans && document.slideshow.trans.selectedIndex == 1) || (!document.slideshow.trans && transtype == 'blendTrans')){
		dotrans=1;
		transtype='blendTrans';
		document.imgslide.style.filter = "blendTrans(duration=1,transition=1)";
	}else{
		dotrans=1;
		transtype='revealtrans';
		if(document.slideshow.trans) transattributes=document.slideshow.trans[document.slideshow.trans.selectedIndex].value;
		document.imgslide.style.filter = "revealTrans(duration=1,transition=" +transattributes+ ")";
	}

}
//###########################################
function preloadSlide() {
	for(k=0;k<theimage.length;k++) {
		theimage[k][0]=new Image().src=theimage[k][0];
	}
}



// Continuous Image Marquee with Links
// copyright 21st September 2008 by Stephen Chapman
// http://javascript.about.com
// permission to use this Javascript on your web page is granted
// provided that all of the code below in this script (including these
// comments) is used without any alteration
var mqr = [];

function mq(id,ary,wid){
	this.mqo=document.getElementById(id);
	var heit = this.mqo.style.height;
	this.mqo.onmouseout=function() {mqRotate(mqr);	};
	this.mqo.onmouseover=function() {clearTimeout(mqr[0].TO);};
	this.mqo.ary=[];

	var maxw = ary.length;
	
	for (var i=0;i<maxw;i++){
		var img=document.createElement('img');
		img.src=ary[i][0];
		var lnk=document.createElement('a');
		lnk.href=ary[i][1];
		lnk.appendChild(img);
		this.mqo.ary[i]=document.createElement('div');
		this.mqo.ary[i].appendChild(lnk);
		this.mqo.ary[i].style.position = 'absolute';
		this.mqo.ary[i].style.left = (wid*i)+'px';
		this.mqo.ary[i].style.width = wid+'px';
		this.mqo.ary[i].style.height = heit;
		this.mqo.appendChild(this.mqo.ary[i]);
	} 
	mqr.push(this.mqo);
} 

function mqRotate(mqr){
	if (!mqr) return;
	
	for (var j=mqr.length - 1;j > -1;j--) {
		maxa = mqr[j].ary.length;
		for (var i=0;i<maxa;i++){
			var x = mqr[j].ary[i].style;
			x.left=(parseInt(x.left,10)-1)+'px';
		} 
		
		var y = mqr[j].ary[0].style;
		if (parseInt(y.left,10)+parseInt(y.width,10)<0) {
			var z = mqr[j].ary.shift();
			z.style.left = (parseInt(z.style.left) + parseInt(z.style.width)*maxa) + 'px';
			mqr[j].ary.push(z);
			}
	} 
	mqr[0].TO=setTimeout('mqRotate(mqr)',20);
}


