var Site = {
	activeIndexGalleryItem : null,
	
	init : function() {
		var div = document.getElementById('gallerySize');
		if(div != null) {
			var a = div.getElementsByTagName('a');
			if(a != null) {
				var exp = new Date( );
				var nowPlusOneWeek = exp.getTime( ) + (7 * 24 * 60 * 60 * 1000);
				exp.setTime(nowPlusOneWeek);
				a[1].onclick = function() { 
					document.cookie = 'gallerySize=small; expires=' + exp.toGMTString() + '; path=/';
					window.location.reload();
				}
				a[2].onclick = function() {
					document.cookie = 'gallerySize=large; expires=' + exp.toGMTString() + '; path=/'; 
					window.location.reload();
				}
			}
		}
		div = document.getElementById('indexgallery');
		if(div != null) {
			var spans = div.getElementsByTagName('span');
			var i = -1;
			while(spans[++i] != null) {
				if(spans[i].className.indexOf('hoverable') != -1) {
					spans[i].onmousemove = function() {
						if(Site.activeIndexGalleryItem != null)
							Site.activeIndexGalleryItem.parentNode.classname = '';
						this.parentNode.className = 'hover';
						Site.activeIndexGalleryItem = this;
					}
				} else {
					spans[i].onmouseout = function() {
						this.parentNode.parentNode.className = '';
						if(Site.activeIndexGalleryItem != null)
							Site.activeIndexGalleryItem.parentNode.classname = '';
					}
				}
			}
		}
	}
}
window.onload = Site.init;
