jQuery.noConflict();

var RAO = {
	addRollover: function(selector){
		if (!selector) selector = '.imgover';
		var aPre = new Array();
		var imgs = jQuery(selector);
	
		for (var i = 0; i < imgs.length; i++) {
			var obj = imgs[i];
			var src = obj.getAttribute('src');
			var oversrc = src.replace('_out', '_over');
			
			obj.setAttribute('osrc', src);
			obj.setAttribute('hsrc', oversrc);
			
			aPre[i] = new Image();
			aPre[i].src = oversrc;
			
			obj.onmouseover = function() { this.setAttribute('src', this.getAttribute('hsrc')) };
			obj.onmouseout = function() { this.setAttribute('src', this.getAttribute('osrc')) };
		};
	},
	
	initPage: function(){
		jQuery('#okBtn img').live('click', function () {
			RAO.changePage();
		});
		
		jQuery('#startWrapper').css('opacity','0');
		jQuery('#bg, #text, #subtext, #menu, #startFooter').css('opacity','0')
	},
	
	changePage: function(){
		jQuery('#kiyaku').css('visibility','hidden');
		jQuery('#contents').css('opacity','1').animate({opacity: 0}, {queue:true, duration:1500,
			complete: function(){
				jQuery('#contents').css('display','none');
				jQuery('#startWrapper').css('display','block').animate({opacity: 1}, {queue:true, duration:1000,
					complete: function(){
						RAO.viewNewImage();
					}
				});
			}
		});
	},
	
	viewNewImage: function(){
		jQuery('#text').animate({opacity: 1}, {queue:true, duration:1500,
			complete: function(){
				jQuery('#bg').animate({opacity: 1}, {queue:true, duration:1500,
					complete: function(){
						jQuery('#subtext').animate({opacity: 1}, {queue:true, duration:1500});
						jQuery('#menu').delay(1000).animate({opacity: 1}, {queue:true, duration:1500});
						jQuery('#startFooter').delay(1500).animate({opacity: 1}, {queue:true, duration:1500});
					}
				});
			}
		});	
	},
	
	checkFlg: false,
	htmlTimer: '',
	htmlInit: function(){
		if( document.getElementById('contents') ){
			RAO.addRollover();
			RAO.initPage();
		};
	},
	
	/*
	init
	*/
	init: function(){
		/*DOM Ready Event*/
		jQuery(document).ready(function(){
			RAO.htmlTimer = setTimeout(function () {
				clearTimeout(RAO.htmlTimer);
				RAO.htmlInit();
			}, 1000);
		});
	}
};

RAO.init();
