$.page = {
	init: function() {
		for (module in $.page) {
			if ($.page[module].init)
				$.page[module].init();
		}
	}
};

$(document).ready($.page.init);

$.page.fn = {
	init: function() {
		$('a').not('.outerText, .naviImage').bind('click', this.click);
		$(window).bind('unload', this.unload);
	},
	click: function() {
		var t;var l;var w;var h;
		var loc = this.href;
		var snum = $('#container').children().length-1;
		var swait = 0;
		if(loc){
			if(this.className.match(/pageChange/)){
				$('#stage').animate({opacity:0},1000);
			}
			$('#stage').children().each(function(){
				var pos = $(this).position();
				h = $(this).outerHeight({margin:true})+7;
				w = $(this).outerWidth({margin:true})+7;
				if(525<w){w=(w<h)?w+200:w;}
				this.sid = $(this).attr("id")+'_shade';
				pos.top=(pos.top)?pos.top:0;
				pos.left=(pos.left)?pos.left:0;
				$(this).after('<div id="'+this.sid+'" style="z-index:999;position:absolute;background-color:white;opacity:0;top:'+(pos.top-3)+'px;left:'+(pos.left-3)+'px;width:'+w+'px;height:'+h+'px;"></div>');
				if(swait<snum || snum==0){
					$('#'+this.sid).animate({opacity:1},1000, function(){location.href=loc;});
				}else{
					$('#'+this.sid).animate({opacity:1},1000)
					swait++;
				}
			});
		}
		return false;
	},
	unload : function(){
		$.isReady = false
	}
};
