var Rollover = {
	
	main : function() {
		var img = document.images, ipt = document.getElementsByTagName('input'), i, preLoadImg = [];
		// img elements
		for (i = 0; i <img.length; i++) {
			if ((img[i].src.match(/.*_n\./))||(img[i].style.filter)){
				preLoadImg[preLoadImg.length] = new Image;
				preLoadImg[preLoadImg.length-1].src = img[i].src.replace('_n.', '_r.');

				img[i].onmouseover = Rollover.over;
				img[i].onmouseout  = Rollover.out;
				try {img[i].addEventListener('click', Rollover.click, false);}
				catch(e){img[i].attachEvent('onclick', (function(el){return function(){Rollover.click.call(el);};})(img[i]));}
			}
		}
		// input[image] elements
		for (i = 0; i <ipt.length; i++) {
			if ((ipt[i].src.match(/.*_n\./))&&(ipt[i].getAttribute('type')=='image')){
				preLoadImg[preLoadImg.length] = new Image;
				preLoadImg[preLoadImg.length-1].src = img[i].src.replace('_n.', '_r.');

				ipt[i].onmouseover = Rollover.over;
				ipt[i].onmouseout  = Rollover.out;
				try {ipt[i].addEventListener('click', Rollover.click, false);}
				catch(e){ipt[i].attachEvent('onclick', (function(el){return function(){Rollover.click.call(el);};})(ipt[i]));}
			}
		}
	}
	,
	
	over : function() {
		var imgSrc, preLoadImgSrc;
		if((this.style.filter)&&(this.style.filter.match(/_n\.png/)))//(IE5.5-6 && png)
			this.style.filter = this.style.filter.replace('_n.png', '_r.png');
		else
			this.src = this.src.replace('_n.', '_r.');
	},

	out : function(){
		if((this.style.filter)&&(this.style.filter.match(/_r\.png/)))//(IE5.5-6 && png)
			this.style.filter = this.style.filter.replace('_r.png', '_n.png');
		else
			this.src = this.src.replace('_r.', '_n.');
	},
	
	click : function(){
		if((this.style.filter)&&(this.style.filter.match(/_r\.png/)))//(IE5.5-6 && png)
			this.style.filter = this.style.filter.replace('_r.png', '_n.png');
		else
			this.src = this.src.replace('_r.', '_n.');
	},

	addEvent : function(){
		try {
			window.addEventListener('load', this.main, false);
		} catch (e) {
			window.attachEvent('onload', this.main);
		}
	}
}

Rollover.addEvent();


//
function message(n){
	document.write('<dt>Messages &amp; Memories</dt>');
	if(n=="1"){
		document.write('<dd>Thank you all for sending a personal online message to be commemorated at 2009 Lantern Floating Hawaii. <br /><a href="http://www.lanternfloatinghawaii.com/messageAndMemories/">Click here to see messages.</a></dd>');
	}else{
		document.write('<dd>Thank you all for sending a personal online message to be commemorated at 2009 Lantern Floating Hawaii. <br /><a href="messageAndMemories/">Click here to see messages.</a></dd>');
		}
}

function youtube(n){
	if(n=="1"){
		document.write('<dt>Video of the Lantern Floating event</dt>');
		document.write('<dd>');
		document.write('<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/x_bq9LF0jAg&hl=ja&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/x_bq9LF0jAg&hl=ja&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="231" height="191"></embed></object></p>');
		document.write('<p><a href="../photoAndMovieArchive.html">Click here to experience<br />Lantern Floating Hawaii.</a></p>');
		document.write('</dd>');
	}else{
		document.write('<dt>Video of the Lantern Floating event</dt>');
		document.write('<dd>');
		document.write('<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/x_bq9LF0jAg&hl=ja&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/x_bq9LF0jAg&hl=ja&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="231" height="191"></embed></object></p>');
		document.write('<p><a href="photoAndMovieArchive.html">Click here to experience<br />Lantern Floating Hawaii.</a></p>');
		document.write('</dd>');
	}
}

function flickr(n){
	if(n=="1"){
		document.write('<dt>Photo Gallery</dt>');
		document.write('<dd>');
		document.write('<p><a href="http://www.flickr.com/photos/37175635@N08/show/" target="_blank"><img src="../common/img/img_photo.jpg" alt="Photo Gallery" width="231" height="231" /></a></p>');
		document.write('<a href="http://www.flickr.com/photos/37175635@N08/show/" target="_blank">Click here to see more photos</a><br /><span>( <strong>flick</strong><strong class="red">r</strong> )</span>');
		document.write('</dd>');
	}else{
		document.write('<dt>Photo Gallery</dt>');
		document.write('<dd>');
		document.write('<p><a href="http://www.flickr.com/photos/37175635@N08/show/" target="_blank"><img src="common/img/img_photo.jpg" alt="Photo Gallery" width="231" height="231" /></a></p>');
		document.write('<a href="http://www.flickr.com/photos/37175635@N08/show/" target="_blank">Click here to see more photos</a><br /><span>( <strong>flick</strong><strong class="red">r</strong> )</span>');
		document.write('</dd>');
	}
}




