/*

This script handles the rental detail page picture swapper

*/

function prep_photos() {
	var additional_photos = document.getElementById("additional_photos");
	var photos = additional_photos.getElementsByTagName("a");
	for (var i=0; i < photos.length; i++) {
		//alert(photos[i].firstChild.getAttribute("src"));
		photos[i].onclick = function() {
			var new_pic = this.firstChild.getAttribute("src");
			//alert(new_pic);
			var main_photo = document.getElementById("main_photo");
			//alert(main_photo.getAttribute("id"));
			var old_pic = main_photo.getElementsByTagName("img");
			//alert(old_photos.length);
			for (var j=0; j < old_pic.length; j++) {
				//alert(old_pic[j].getAttribute("src"));
				old_pic[j].setAttribute("src", new_pic);
				return false;
			}
		}
	}
}

function swap_pic() {
	var main_photo = document.getElementById("main_photo");
	
}

jQuery(document).ready(function() {
	prep_photos();
});

//addLoadEvent(swap_pic());
