function swap_divs(div1, div2) {
	var obj1 = getByID(div1);
	var obj2 = getByID(div2);
	is_ready = 0;
//	alert(obj2.opacity);
	if (obj2.opacity == obj2.aaaaaa) {
//		alert(obj2.opacity);
		obj2.opacity = 0;
		var opacity = 0;
	} else {
		var opacity = obj2.opacity + 10;
	}
	obj2.style.visibility='visible';
	obj2.style.top = '0px';
//	alert(obj2.opacity);
	obj2.opacity = opacity;
	if (opacity > 100) {
		swap_divs_end (div1, div2)
	} else {
		obj2.visibility='';
		obj2.style.opacity = opacity / 100.0;
		obj2.style.filter='alpha(opacity=' + opacity + ')';
		setTimeout('swap_divs("' + div1 + '", "' + div2 + '")', 25);
	}
		
}
function swap_divs_end (div1, div2) {
	var obj1 = getByID(div1);
	var obj2 = getByID(div2);
	obj2.style.visibility='hidden';
	obj2.opacity = 0;
	obj2.style.opacity = 0;
	obj2.style.top='-10000px';
	obj2.style.filter='alpha(opacity=0)';
	var temp = obj1.innerHTML;
	obj1.innerHTML = obj2.innerHTML;
//	obj2.innerHTML = temp;
//	alert(obj1 + "   " + obj2);
	setTimeout(setupnext_slide, 0);
}

var home_images = new Array;
home_images[0] = '/images/home_new/home_photo_academic.jpg';
home_images[1] = '/images/home_new/home_photo_principles.jpg';
home_images[2] = '/images/home_new/home_photo_community.jpg';
var current_slide = -1;
var random_off = 1;
var slide_show_delay = 4 ; // in seconds
var is_ready = 0;
function slideshow_init () {
//	return;
//	alert(home_images.length);
	var x = Math.random()*home_images.length;
	x = Math.floor(x);
	if (random_off) {
		x = 0;
	}
	var obj = getByID("home-top-photo");
//	alert(obj);
	obj.innerHTML = '<img src="' + home_images[x] + '" width=533 height=376>';
	current_slide = x;
	setupnext_slide();
	setTimeout(slideshow, slide_show_delay * 3000);
//	slide_show_delay += 2.5;
}
function setupnext_slide () {
if(random_off==0) {
	var x = current_slide;
	var i = 10;
//	alert('test');
	while (x == current_slide && i-- > 0) {
		x = Math.random()*home_images.length;
		x = Math.floor(x);
	}
} else {
	x = current_slide+1;
	if (x >= home_images.length) {
	x = 0;
	}
}
// alert(x);
	var obj = getByID("home-top-photo2");
//	alert(obj);
//	alert(home_images[x]);
	obj.innerHTML = '<img src="' + home_images[x] + '" width=533 height=376 onload="is_ready = 1">';
	current_slide = x;
}
function slideshow () {
//	return;
	if (is_ready == 1) {
		swap_divs('home-top-photo', 'home-top-photo2');
	//	setTimeout(setupnext_slide, 0);
			is_ready = 0;
		setTimeout(slideshow, slide_show_delay * 1000);
	} else {
		setTimeout(slideshow, 500);
	}
}