// JavaScript Document

//ALL Load
$(function(){
	PageTopSet();
	writeYear();
	printPage();
	closeWindow();
    PopUpSet();
    AreaGuide();
	RollOverSet();
/*	PageBack();
	if(document.getElementById("slide_list")){
    slide();
}
*/});


//RollOver
function RollOverSet(){
	RollOver("#gloabalnavi");
}

function RollOver(target){
	$target = $(target);
	$("img", $target).each(function(){
		$(this).mouseover(function(){
			this.setAttribute("src", this.getAttribute("src").replace(".jpg", "_on.jpg"));
        })
		$(this).mouseout(function(){
			this.setAttribute("src", this.getAttribute("src").replace("_on.jpg", ".jpg"));
        })
		$(".stay").unbind();
	});
}


//Slide
/*function slide(){
	$("#slide_list dt").hover(function(){
		$(this).css("cursor","pointer"); 
	},function(){
		$(this).css("cursor","default");
		});
    $("#slide_list dd:not(:first)").hide();
	$("#slide_list dt").click(function(){
	$(this).next("dd")
	.slideToggle("300").find("dd").slideUp("500");
   	return false;
    });
}
*/

//POPUP
function PopUpSet(){
	PopUp("a.popup_allmap","lp.html","allmap",960,700);
	PopUp("a.popup_highmap","high.html","highmap",960,700);
	PopUp("a.popup_detailmap","dp.html","detailmap",960,700);
	PopUp("a.popup_aglmap","agl.html","aglmap",960,700);
	PopUp("a.popup_types","small.html","smalltype",677,700);
	PopUp("a.popup_typem","medium.html","middletype",677,700);
	PopUp("a.popup_typel","large.html","largetype",677,700);
	PopUp("a.popup_typel2","../reservation/large.html","largetype",677,700);
	PopUp("a.popup_typestop","reservation/small.html","smalltype",677,700);
	PopUp("a.popup_typemtop","reservation/medium.html","middletype",677,700);
	PopUp("a.popup_typeltop","reservation/large.html","largetype",677,700);
	PopUp2("a.fujiview","http://bioweather.net/fuji/index.php","fujiview",860,700);
}
function PopUp(classname,url,wname,w,h){
	$(classname).click(function(){
	window.open(url,wname,'width='+w+',height='+h+'left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,favorites=no,resizable=yes');
	return false;
	});
}
function PopUp2(classname,url,wname,w,h){
	$(classname).click(function(){
	window.open(url,wname,'width='+w+',height='+h+'left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,favorites=no,resizable=no');
	return false;
	});
}


//PageBack

/*function PageBack(){
	$("a",".pageback").click(function(){
    history.back();
	return false;
	});
}
*/


//PageTop
function PageTopSet(){
	PageTop("#link_to_top","#header");
	PageTop("#link_to_ss01","#ss01");
	PageTop("#link_to_ss02","#ss02");
	PageTop("#link_to_ss03","#ss03");
	PageTop("#link_to_ss04","#ss04");
	PageTop("#link_to_ss05","#ss05");
	}
function PageTop(target,target2){
$(function () {
		$target = $(target);	
		$target2 = $(target2);	
        $($target).click(function () {
			$(this).blur();
			var targetOffset = $(target2).offset().top;

            $('html,body').animate({ scrollTop: targetOffset }, 'slow');

            return false;
        });
});
}

function writeYear(){
	$("#write_year").text(new Date().getFullYear());
	}
	
function printPage(){
	$("#print_page").click(function(){
    window.print();
	return false;
	});
	}

function closeWindow(){
	$(".b_close a").click(function(){
    window.close();
	return false;
	});	
	}

function AreaGuide(){
	
	$("#guidemap .wrap_agl .trigger").hover(
			function(){
				$(this).next().css({visibility: "visible",display: "none"}).show(600);
	}, 
			function (){
				$(this).next().css({visibility: "hidden"});
	});

}

