// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


var images = new Array();

function preload(topreload) {
	for(var i = 0; i < topreload.length; i++) {
		loaded[i] = new Image();
		loaded[i].src = topreload[i];
	}
}

function show_photo(phototoshow, newwidth, newheight) {
	var newphoto = phototoshow;
	document.getElementById('main_image').innerHTML="<img id='main_photo' alt='' border='1' width='"+newwidth+"' height='"+newheight+"' />";
	document.images.main_photo.src = newphoto;
	document.images.main_photo.width = newwidth;
	document.images.main_photo.height = newheight;
}

function slideshow(idtochange) {
	if(count>=loaded.length) count=0;
	Effect.Fade(idtochange,{duration:1.5});
	setTimeout(function() {
		$(idtochange).src = loaded[count].src;
		count++;
		Effect.Appear(idtochange,{duration:1.5});
		setTimeout("slideshow('"+idtochange+"');",5500);
	},1500);
}

function replaceimage(imageid, outerid, newphoto) {
	Effect.Fade(outerid,{duration:0.7});
	setTimeout(function() {
		$(outerid).innerHTML = '<img alt=\"\" id=\"'+imageid+'\" />';
		$(imageid).src = newphoto.src;
		Effect.Appear(outerid,{duration:1.0});
	},800);
}