
var e;
/*
var listP= new Array(
				'/_img/rotate-index/random_index_1.jpg',
				'/_img/rotate-index/random_index_2.jpg',
				'/_img/rotate-index/random_index_3.jpg',
				'/_img/rotate-index/random_index_4.jpg',
				'/_img/rotate-index/random_index_5.jpg',
				'/_img/rotate-index/random_index_6.jpg'				
				);
*/
var tmpP=new Array();
var Pic=listP;
var j=1;


Event.observe(window, 'load', 
		function() {
				 loadS();
					//runSlideShow();
				Event.observe('bgImg', 'click', doLink);
		}
);


function loadS(){
	
	//alert(listP.length);
	for(i=0;i<listP.length;i++){
	    
  		tmpP[i]=new Image();
		tmpP[i].src=listP[i];
				
	}
	//alert(tmpP.length);
	$("bgImg").style.backgroundImage="url("+tmpP[0].src+")";
	last=tmpP.length-1;
	
	tmpP[last].onLoad=stopLoading();
		
	}

function stopLoading(){
	
	//e=tmpP.shift(); tmpP.push(e);
	j=(j+1)%(tmpP.length);
	$("bgImg").style.backgroundImage="url("+tmpP[j].src+")";
	//alert('start');
	new Effect.Fade('SlideShow', {duration:2, from:1.0, to: 0});
	window.setTimeout('appP()', 2000);
	
	}

function nextP(){
	window.setTimeout('appP()', 5);
	}
function appP(){
	
	$("SlideShow").src=tmpP[j].src;
	new Effect.Appear('SlideShow', {duration: 1, from:1, to: 1});
	window.setTimeout('stopLoading()', 1000);
	}
	
function doLink(event){
	window.location=listUrl[j];
	
}
/*
var t
var j = 0
var p = Pic.length
var preLoad = new Array()
var SlideShow;

preLoad[0] = new Image()
preLoad[0].src = Pic[0]

function getNext(j){
preLoad[j] = new Image()
preLoad[j].src = Pic[j]
}

function runSlideShow(numi){
if (document.all){
document.images.SlideShow.style.filter="blendTrans(duration=2)"
document.images.SlideShow.style.filter="blendTrans(duration=3)"
document.images.SlideShow.filters.blendTrans.Apply()      
}
document.images.SlideShow.src = preLoad[j].src
if (document.all){
document.images.SlideShow.filters.blendTrans.Play()
}else{
fade()
}
j = j + 1
if (j > (p-1)) j=0
getNext(j);
t = setTimeout('runSlideShow()', 5000)
}


var baseopacity=20
function fade(){
imgobj=SlideShow

instantset(baseopacity)
hfade=setInterval("gfade(imgobj)",20)
}

function instantset(degree){
imgobj.style.MozOpacity=degree/100
}

function cleartimer(){
if (window.hfade) clearInterval(hfade)
}

function gfade(cur2){

if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.01, 0.99)
}

*/
