﻿
var imageFile = {
	targ_area: new Object,
	targ_list: Array(),
	targ_data: Array(),
	init: function(){
		if (document.getElementById('imageList')){
			imageFile.targ_area = document.getElementById('imageList');
			imageFile.targ_list = imageFile.targ_area.getElementsByTagName('a');
			for(i=0; i<imageFile.targ_list.length; i++){
				var temp_obj = imageFile.targ_list[i];
				imageFile.targ_data[i] = new Image;
				imageFile.targ_data[i].alt = temp_obj.title;
				imageFile.targ_data[i].src = temp_obj.href;
/*
				imageFile.targ_data[i] = {
					title: temp_obj.title,
					url: temp_obj.href
				}
*/
				temp_obj.href = 'javascript:;';
				temp_obj.title = '';
				temp_obj.rel = i;
				temp_obj.onclick = imageFile.changeImage;
			}
			imageFile.changeImage();
		}
	},
	changeImage: function(){
		var num = (this.rel) ? this.rel: 0;
		document.getElementById('photoPlace').src = imageFile.targ_data[num].src;
		document.getElementById('openPhotoDesc').innerHTML = imageFile.targ_data[num].alt;
	}
}

Kaas.addEvent(window, 'load', imageFile.init);
