var bannerImg = new Array();
	// Enter the names of the images below
	bannerImg[0]="http://www.closeanimalfactories.org/wp-content/themes/cecaf-jan-2010/images/banner2.png";
	bannerImg[1]="http://www.closeanimalfactories.org/wp-content/themes/cecaf-jan-2010/images/banner1.png";
 
newplace = new Array(3);
	newplace[0] = "#1"
	newplace[1] = "#2"

var newBanner = 1;
var totalBan = bannerImg.length;

function gothere() {
		window.location.href = newplace[newBanner];
}

function cycleBan() {
  newBanner++;
  if (newBanner == totalBan) {
    newBanner = 0;
  }
  document.banner.src=bannerImg[newBanner];
  // set the time below for length of image display
  // i.e., "4*1000" is 4 seconds
  setTimeout("cycleBan()", 9*1000);
}



var videos = new Array();
videos[0] = "http://www.youtube.com/v/5jg4n6TDDJ4&autoplay=0";
videos[1] = "http://www.youtube.com/v/Geb8Qc6WQ8o&autoplay=0";
videos[2] = "http://www.youtube.com/v/qYrFcZd1ACg&autoplay=0";
videos[3] = "http://www.youtube.com/v/Ov2ZF2ki8Fk&autoplay=0";

var videoIndex = 0;
var intervalId;

function initRotation() {
	intervalId = setInterval("rotateVideo()", 7000);
}

function rotateVideo() {
	videoIndex++;
	if ( videoIndex >= videos.length ) {
		videoIndex = 0;
	}
	writeVideoCode(videos[videoIndex], "475", "350");
}

function writeVideoCode(url, w, h) {

	var videocode = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'
	+ w + '" height="' + h + '" onclick="clearInterval(' + intervalId + ')"><param name="movie" value="'
	+ url + 
	'"></param><param name="wmode" value="transparent"></param><embed src="' 
	+ url + 
	'" type="application/x-shockwave-flash" wmode="transparent" width="' + w + '" height="'
	+ h + '"></embed></object>';
	
 	document.getElementById("videospace").innerHTML = videocode;
}

function init(){
	cycleBan ();
	writeVideoCode('http://www.youtube.com/v/5jg4n6TDDJ4&autoplay=0', '475', '350'); 
	initRotation();
}

window.onload=init;