// JavaScript Document
//photo gallery for the CCD Corporate


//set this varible to true if you wnat to shuffle the images. Set it false if you don't
var randominze_images = false;

	
	var photos = new Array();
	var styles = new Array();
	var captions = new Array();
	var current = 0;
	var defaultStyle = "premium-logo";
	

var count = 0;
	
photos[count] = "/images/ccd/the_verge.gif";
styles[count] = "";
captions[count++] = "";

photos[count] = "/images/ccd/laugh_attack.gif";
styles[count] = "";
captions[count++] = "";

photos[count] = "/images/ccd/air_musique.gif";
styles[count] = "";
captions[count++] = "";

photos[count] = "/images/ccd/sur_la_route.gif";
styles[count] = "";
captions[count++] = "";

photos[count] = "/images/ccd/radio_parallele.gif";
styles[count] = "";
captions[count++] = "";



var key_arr= new Array();


for (var i=0; i<photos.length ; i++){
	key_arr[i] = i;
}


	
//shuffle an array	
shuffle = function(o){ 
	for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
	return o;
}


//shuffle images?
if (randominze_images){
	//Shuffle up teh top array so that phtos are in random order
	shuffle(key_arr);
}


function next(){
	current++;
	current = current % (photos.length); //if past end, set to zero
	
	var photo = document.getElementById("photo");
	//var caption = document.getElementById("caption");
	
	photo.src =	photos[key_arr[current]];
	
	if (styles[current] != "" ){
		photo.className = styles[key_arr[current]];
	} else {
		photo.className	= defaultStyle;
	}
	
	//caption.innerHTML = captions[key_arr[current]];
	
}

function prev(){
	current--;
	current = current % (photos.length);
	if (current < 0) { current = photos.length - 1; } //if negative set to end
	
	
	var photo = document.getElementById("photo");
	//var caption = document.getElementById("caption");
	
	
	photo.src =	photos[key_arr[current]];
	
	if (styles[current] != ""){
		photo.className = styles[key_arr[current]];
	} else {
		photo.className	= defaultStyle;
	}
	
	
	//caption.innerHTML = captions[key_arr[current]];
}
