﻿/*
###################################################################
#This javascript was made on January 31, 2003.
#It is responsible for a MEDAL Co,Ltd.
#Responsibility is not taken although use is free.
###################################################################
#Environment(browser name & varsion) check constructor &  method
###################################################################
*/
//var msg="不正ダウンロード防止のために右クリックを禁止しています。"
//var Mac = navigator.userAgent.indexOf("Mac") != -1 ? true : false;
function mdown(e) {
	var is = new Is_env();
	if (is.IE) {
		//Mac版IE５ではコマンドキーを使ったショートカットでソースを見ることができます。
		if (event.button == 2 || (is.MAC && (event.ctrlKey || event.keyCode == 91))) {
			//alert("コンテクストメニューは利用できません。");
			return(false);
		}
	} else if (is.NN) {
		if (e.which == 3 || e.modifiers == 2 || e.ctrlKey) {
			//alert("コンテクストメニューは利用できません。");
			return false;
		}
	}
}

function noright(){
	//alert("コンテクストメニューは利用できません。");
	return false;
}

window.onload = function(){
	var is = new Is_env();
	/* TEXT SELECT NONE */
	if(is.IE || is.SAFARI){
		document.onselectstart = noright;
	}else{
		document.onmousemove = "window.getSelection().removeAllRanges()"; //OPERA
	}

	document.oncontextmenu = noright;

	if (document.all && (is.MAC || !document.getElementById)) {
		document.onmousedown = mdown;
		document.onkeydown = mdown;
	} else if (document.layers) {
		window.captureEvents(Event.MOUSEDOWN | Event.modifiers | Event.KEYDOWN);
		window.onmousedown = mdown;
		window.onkeydown = mdown;
	} else if((is.NN6X)||(document.getElementById)){
		//onmousedownだとalertが表示されますが、
		//同時にデフォルトのコンテクストメニューも表示されてしまいます。
		//なのでonmouseupを使います
		document.onmouseup = mdown;
		document.onkeydown = mdown;
	}
}

