// JavaScript Document

$(function(){
$('a').each(function() {
	//別ウィンドウ表示
	var rel = $(this).attr('rel');
	if(rel=='eternal'){
		$(this).attr({ target: '_blank' });
		}

		//現在ページへのリンク判定
	var href = $(this).attr('href');//aタグのhref内容

	if(href != undefined){

		//アンカーリンクだった場合,#から前の部分で判定
		var noanc = $(this).attr('href').split('#');
		if(noanc[1] != undefined){
				href = noanc[0];
			}

		//hrefを/で分割して、先頭部分で分岐
		var ahref = $(this).attr('href').split('/');
		switch(ahref[0]){

			// httpからの絶対パスの場合
			case"http:":
			if(href == location.href){
				$(this).addClass("current");
			}
			break;

			// 相対パスで別階層の場合
			case"..":
			break;

			// ルートからの絶対パスの場合
			case"":
			if(href == location.pathname){
				$(this).addClass("current");
			}
			break;

			//相対パスで同階層,アンカーリンクの場合
			default:
		 var lhref = location.href.split('/');
			var xx = lhref.length - 1;
			if(href == lhref[xx]){
				$(this).addClass("current");
			}
	}
	}

		});
$('.pageClose a').click(function() {
	window.close();
	return false;
	});
$('.pageTop a').click(function() {
	$.scrollTo($('#pagetop'),1000);
	return false;
	});
});

//Open Window
function movie(url){ 
window.open(url, "movie", "width=500,height=450,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1"); 
} 