/* -----------------------------------------------
functions
----------------------------------------------- */

function open_win(url,width,height) {
	
	//ポップアップ
	var win = window.open(url, "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=" + width + ",height=" + height + "\"");
	win.focus();
}

//ロールオーバー処理
function initRollOver() {
	//グローバルメニュー
	var image_cache = new Object();
	$("#sub_menu a img").not("[src*='_on.']").each(function(i) {
		var imgsrc = this.src;
		var dot = this.src.lastIndexOf('.');
		var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
		image_cache[this.src] = new Image();
		image_cache[this.src].src = imgsrc_on;
		$(this).hover(
			function() { this.src = imgsrc_on;
			},
			function() { this.src = imgsrc;
			}
		);
	});
	//サブメニュー
	var image_cache2 = new Object(); 
	$("#sub_menu a img").not("[src*='_on.']").each(function(i) {
		var imgsrc = this.src;
		var dot = this.src.lastIndexOf('.');
		var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
		image_cache2[this.src] = new Image();
		image_cache2[this.src].src = imgsrc_on;
		$(this).hover(
			function() { this.src = imgsrc_on;
				$(this).parent().parent().css("background", "#fff");
			},
			function() { this.src = imgsrc;
				$(this).parent().parent().css("background", "transparent");
			}
		);
	});
}

//外部リンク
window.onload = function() {
	var node_a = $('a');
	var thisPage = location.href;
	for (var i in node_a) {
		if (node_a[i].className == 'newwin') {
			node_a[i].onclick = function() {
				window.open(this.href, '', '');
				return false;
			};
		}
	}
};

//ページスクロール
function pageTopScroll() {
	var scrj = 1;
	var scdist = document.body.parentNode.scrollTop;
	if(scrj<50 && scdist) {
		scdist = (scdist>2) ? Math.ceil(scdist*.2) : 1;
		scrj++;
		scrollBy(0,-scdist);
		setTimeout("pageTopScroll()",20);
	} else {
		scrollTo(0,0);
		scrj = 1;
	}
}

//ページクローズ
function close_win(){
var nvua = navigator.userAgent;
if(nvua.indexOf('MSIE') >= 0){
	if(nvua.indexOf('MSIE 5.0') == -1) {
		top.opener = '';
	}
}
else if(nvua.indexOf('Gecko') >= 0){
	top.name = 'CLOSE_WINDOW';
	wid = window.open('','CLOSE_WINDOW');
}
	top.close();
}

