
function init() {
	/* rollover */
	var imgs = document.getElementsByTagName('img');
	var preloadimgs = new Array();
	var filetype = new Array();
	
	for(i=0;i<imgs.length;i++) {
		if(imgs[i].className == 'rollover') {
			var src = imgs[i].getAttribute('src');
			var filetype = src.substring(src.lastIndexOf('.'), src.length);
			var oversrc = src.replace(filetype, 'o'+filetype);
			
			preloadimgs[i] = new Image();
			preloadimgs[i].src = oversrc;
			
			imgs[i].onmouseover = function() {
				var filetype = this.getAttribute('src').substring(this.getAttribute('src').lastIndexOf('.'), this.getAttribute('src').length);
				this.setAttribute('src', this.getAttribute('src').replace(filetype, 'o'+filetype));
			}
			imgs[i].onmouseout = function() {
				var filetype = this.getAttribute('src').substring(this.getAttribute('src').lastIndexOf('.'), this.getAttribute('src').length);
				this.setAttribute('src', this.getAttribute('src').replace('o'+filetype, filetype));
			}
			imgs[i].onclick = function() {
				var filetype = this.getAttribute('src').substring(this.getAttribute('src').lastIndexOf('.'), this.getAttribute('src').length);
				this.setAttribute('src', this.getAttribute('src').replace('o'+filetype, filetype));
			}
		}
	}
	/* rollover */
	/* tabrollover */
	if(document.getElementById('rentalNavi')){
		var tabimgs = document.getElementById('rentalNavi').getElementsByTagName('img');
		var filetype = new Array();
	
		for(i=0;i<tabimgs.length;i++) {
			var src = tabimgs[i].getAttribute('src');
			var filetype = src.substring(src.lastIndexOf('.'), src.length);
			
			tabimgs[i].onmouseover = function() {
				var filetype = this.getAttribute('src').substring(this.getAttribute('src').lastIndexOf('.'), this.getAttribute('src').length);
				this.setAttribute('src', this.getAttribute('src').replace(filetype, 'o'+filetype));
			}
			tabimgs[i].onmouseout = function() {
				var filetype = this.getAttribute('src').substring(this.getAttribute('src').lastIndexOf('.'), this.getAttribute('src').length);
				this.setAttribute('src', this.getAttribute('src').replace('o'+filetype, filetype));
			}/*
			tabimgs[i].onclick = function() {
				var filetype = this.getAttribute('src').substring(this.getAttribute('src').lastIndexOf('.'), this.getAttribute('src').length);
				this.setAttribute('src', this.getAttribute('src').replace('s'+filetype, filetype));
			}*/
		}
	}
	/* tabrollover */
}

window.onload = init;

function showLayer(layerid){
	document.getElementById(layerid).style.display='block';
}
function hideLayer(layerid){
	document.getElementById(layerid).style.display='none';
}

var showid;
function changePortalEvent(showid){
	for(i=1;i<15;i++){
		var hidelayerid='portalEventInfo'+i;
		hideLayer(hidelayerid);
	}
	var showlayerid='portalEventInfo'+showid;
	showLayer(showlayerid);
	
	for(i=1;i<15;i++){
		var hidelinkbgid='portalEventInfoLink'+i;
		document.getElementById(hidelinkbgid).setAttribute('class','toggleoff');
		document.getElementById(hidelinkbgid).setAttribute('className','toggleoff');
	}

	var showlinkbgid='portalEventInfoLink'+showid;
	document.getElementById(showlinkbgid).setAttribute('class','toggleon');
	document.getElementById(showlinkbgid).setAttribute('className','toggleon');
}

function changeRentalInfo(showid){
	hideLayer('rentalAbout');
	hideLayer('rentalFee');
	hideLayer('rentalFlow');
	hideLayer('rentalFacilities');
	
	document.getElementById('rentalAboutImg').src='images/tab_rental_about.gif';
	document.getElementById('rentalFeeImg').src='images/tab_rental_fee.gif';
	document.getElementById('rentalFlowImg').src='images/tab_rental_flow.gif';
	document.getElementById('rentalFacilitiesImg').src='images/tab_rental_facilities.gif';
	
	var showimgid='rental'+showid+'Img';
	var showimgsrc=showid.toLowerCase();
	document.getElementById(showimgid).src='images/tab_rental_'+showimgsrc+'s.gif';
	var showlayerid='rental'+showid;
	showLayer(showlayerid);
}

function changeLayer(id){
if(document.getElementById){
	layerStatus=document.getElementById(id).style.display;
	if(layerStatus=='none'){
		showLayer(id);
	}else{
		hideLayer(id);
	}
}
}
