// ------------------------------------------------------------
// ホスト名によるターゲット(_self or _blank)の指定
// ------------------------------------------------------------

document.onclick = function(e) {
	var url, ie;
	if (document.all) {
		url = window.event.srcElement.href;
		ie = (!window.opera) ? 1 : 0;
	}
	else if (document.getElementById && e.which == 1) {
		url = e.target.href || e.target.parentNode.href;
	}

	if (url && url.match(location.hostname)) {		// 自分のサイトのホスト名が含まれるリンクは通常表示
		return true;
	}
	else if (url && url.match(/^(https?|ftp):\/\//)) {	// 上記以外のリンクは新しいウインドウ表示
		if (ie && url.match(/[^\x21-\x7E]/)) {
			if (!window.createPopup) {
				window.event.srcElement.target = "_blank";
				return true;
			}
			url = escape(url);
			url = decodeURIComponent(url);
			url = encodeURI(url);
		}
		window.open(url);
		return false;
	}
}

// ------------------------------------------------------------
// ニューウィンドウ(新窓)
// ------------------------------------------------------------
function disp(url){
	window.open(url, "newwin", "");
}

// ------------------------------------------------------------
// サブウィンドウ(小窓)
// ------------------------------------------------------------
// function disp(url){
// 	window.open(url, "subwin", "width=***,height=***,toolbar=0,channelmode=0,titlebar=1,status=0,scrollbars=1,resizable=1,menubar=0,location=0,fullscreen=0,directories=0,left=0,top=0");
// }
