// Replace All Letters ---------------------------------------------------function replaceAll(expression, org, dest){  
     return expression.split(org).join(dest);   
} // YOUBI -------------------------------------------------------------------youbi = new Array();	youbi[0] = new Array("日","月","火","水","木","金","土");	youbi[1] = new Array("sun","mon","tue","wed","thu","fri","sat");	youbi[2] = new Array("Son","Mon","Die","Mit","Don","Fre","Sam");	youbi[3] = new Array("일","월","화","수","목","금","토");function youbicheck(datedate , lang) {	var d = new Date( replaceAll(datedate, '.' , '/'));
	return youbi[lang][d.getDay()];}// Today -------------------------------------------------------------------	var nowdate = new Date();
	var year = nowdate.getFullYear(); // 年
	var mon  = nowdate.getMonth() + 1; // 月
	var day = nowdate.getDate(); // 日
	var today = String(year)+String(mon)+String(day);// 日数差 ------------------------------------------------------------------------function RestDays (count){	var yearyear 	= date[count].slice(0,4);	var monthmonth 	= date[count].slice(5,7);		if (monthmonth == "--") {monthmonth="01"};	var dayday		= date[count].slice(8,10);		if (dayday == "--") {dayday="01"};	var eventday = new Date(yearyear, monthmonth-1, dayday);
	var dayms = 24 * 60 * 60 * 1000;	var n = Math.floor((eventday.getTime()-nowdate.getTime())/dayms) + 1;	return n;}// upcoming new タグ -------------------------------------------------------------- var i=0;while (date[i] != null) {	if ((RestDays(i) == 1) && (place[i][0] != "")) {newnew[i] = '<B>tomorrow! </B><BR>'}		else if ((RestDays(i) == 0) && (place[i][0] != "")) {newnew[i] = '<B>today! </B><BR>'}	else if (RestDays(i) > 0) {newnew[i] = '<B>upcoming! </B><BR>'}
	else if ((RestDays(i) > -15) && (RestDays(i) <= 0) && (place[i][0] == "")) {newnew[i] = '<B>new! </B><BR>'}
	else {newnew[i] = ""}	i++;}// onMouseover Album TItle -------------------------------------------------function AlbumTitle (x, y) {	alert(x);}// Live Date & Ticket Info -------------------------------------------------function livedate(article , kotoba){	var basho;	if (place[article][0] != "") {		if (googlemap[article] != null) {			basho = "<a href=\'"+googlemap[article] + "\'>"+place[article][kotoba]+"</a>";		}		else {			basho = place[article][kotoba];		}			if (RestDays(article) >= 0) {				return (date[article] + "(" + youbicheck(date[article] , kotoba)  + ") @" + basho + '<BR>' + expire[article] );			}			else {				return (date[article] + "(" + youbicheck(date[article] , kotoba)  + ") @" + basho + '<BR>' );			}	}	else {		return "";	}}// onMouse TextInfomation ---------------------------------------------------this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("img.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("img.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};



// starting the script on page load
$(document).ready(function(){
	tooltip();
});
// onMouse ImageInfomation ---------------------------------------------------this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "" + this.t : "";
		$("body").append("<p id='preview'>"+c +"<BR><img src='"+ this.href +"' alt='Image preview' />"+ "</p>");
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});// Menu Slider -------------------------------------------------------------------------------------
$(document).ready(function() {

	$('a.panel').click(function () {

		$('a.panel').removeClass('selected');
		$(this).addClass('selected');
		
		current = $(this);
				
		$('#wrapper').scrollTo($(this).attr('href'), 800);		
		
		return false;
	});
	
	$(window).resize(function () {
		resizePanel();
	});
	
});

function resizePanel() {

	width = $(window).width();
	height = $(window).height();

	mask_height = height * $('.menuitem').length;
		
	$('#debug').html(width  + ' ' + height + ' ' + mask_height);
	
	$('#wrapper, .menuitem').css({width: width, height: height});
	$('#mask').css({width: width, height: mask_height});
	$('#wrapper').scrollTo($('a.selected').attr('href'), 0);		
}

