//ロールオーバーのスクリプト
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//コンテクストメニュー禁止
var Mac   = navigator.userAgent.indexOf("Mac") != -1   ? true : false;
	function mdown(e) {
	if (navigator.appName == "Microsoft Internet Explorer") {
		//Mac版IE5ではコマンドキーを使ったショートカットでソースを見ることができます。
		if (event.button == 2 || (Mac && (event.ctrlKey || event.keyCode == 91))) {
			alert("コンテクストメニューは利用できません。");
			return(false);
		}
	  } else if (navigator.appName == "Netscape") {
		if (e.which == 3 || e.modifiers == 2 || e.ctrlKey) {
			alert("コンテクストメニューは利用できません。");
			return false;
	    }
	  } 
	}
	function noright(){
		alert("コンテクストメニューは利用できません。");
		return false;
	}
	document.oncontextmenu = noright;
	if (document.all && (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(navigator.userAgent.indexOf("Netscape6")!=-1){
		//onmousedownだとalertが表示されますが、
		//同時にデフォルトのコンテクストメニューも表示されてしまいます。
		//なのでonmouseupを使います
  		document.onmouseup = mdown; 
		document.onkeydown = mdown;
	}


//ステータスバーの表示
defaultStatus = "伝える技、伝えたい心 | 丸中醤油"; 


//ポップアップウィンドウのスクリプト
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//印刷ページポップアップのスクリプト
function winOpen_print(myURL){
  subWin = window.open(myURL,"subwindow","width=600,height=600");
  subWin.print();
}

//ページアップのスクリプト
function pageup(e) {
	UAGENT = navigator.userAgent.toUpperCase();
	if (UAGENT.indexOf("MSIE") >=0) { posi = event.y; }
	else { posi = e.pageY; }
	moveObje(posi);
}
function moveObje(position) {
	move = position / 10;
	point = parseInt(position - move);
	scrollTo(0,point);
	if (point > 0) { setTimeout("moveObje(point)",10); }
}


//隠す〜見せるのスクリプト
function showImg(id){
	if(document.getElementById){
		if(document.getElementById(id).style.display == "none")
		document.getElementById(id).style.display = "inline";
	}
}
function hydeImg(id){
	if(document.getElementById){
		if(document.getElementById(id).style.display == "inline")
		document.getElementById(id).style.display = "none";
	}
}


//CSS振り分けのスクリプト
//ブラウザの名前とバージョンを取得&代入
 var detect = navigator.userAgent.toLowerCase();
//各変数の宣言
 var OS,browser,version,total,thestring;
//取得した値から判別したいブラウザの名前が入っているか判別
 function checkIt(string){
 place = detect.indexOf(string) + 1;
 thestring = string;
 return place;
 }
//ブラウザチェック
 if (checkIt('konqueror')){
 browser = "Konqueror";
 OS = "Linux";
 }
 else if (checkIt('safari')) browser = "Safari";
 else if (checkIt('omniweb')) browser = "OmniWeb";
 else if (checkIt('opera')) browser = "Opera";
 else if (checkIt('webtv')) browser = "WebTV";
 else if (checkIt('icab')) browser = "iCab";
 else if (checkIt('msie')) browser = "InternetExplorer";
 else if (checkIt('netscape')) browser = "NN";
 else if (checkIt('mozilla')) browser = "Mozilla";
 else if (!checkIt('compatible')){
 browser = "Netscape Navigator";
 version = detect.charAt(8);
 }
 else browser = "An unknown browser";
//各ブラウザのバージョンチェック
 if (!version) version = detect.charAt(place + thestring.length);
//OSチェック
 if (!OS){
 if (checkIt('linux')) OS = "Linux";
 else if (checkIt('x11')) OS = "Unix";
 else if (checkIt('mac')) OS = "Mac";
 else if (checkIt('win')) OS = "Windows";
 else OS = "an unknown operating system";
 }
//ユーザーの環境に合わせてCSS書き出し
 //WindowsのIEを使っている人はIE用のCSS
 if((OS=="Windows") && (browser=="InternetExplorer")){
// alert('windowsIE');
 document.write(" <link href=\"../common/css/browser/win_ie.css\" rel=\"stylesheet\" type=\"text/css\" /> ");
 }
 else if((OS=="Mac") && (browser=="InternetExplorer")){
// alert('macIE');
 document.write(" <link href=\"../common/css/browser/mac_ie.css\" rel=\"stylesheet\" type=\"text/css\" /> ");
 }
 else if((OS=="Mac") && (browser=="Safari")){
// alert('Safari');
 document.write(" <link href=\"../common/css/browser/safari.css\" rel=\"stylesheet\" type=\"text/css\" /> ");
 }
 else if((OS=="Windows") && (browser=="Opera")){
// alert('windowsOpera');
 document.write(" <link href=\"../common/css/browser/win_opera.css\" rel=\"stylesheet\" type=\"text/css\" /> ");
 }
 else if((OS=="Mac") && (browser=="Opera")){
// alert('macOpera');
 document.write(" <link href=\"../common/css/browser/mac_opera.css\" rel=\"stylesheet\" type=\"text/css\" /> ");
 }
 else if((OS=="Windows") && (browser=="NN")){
// alert('winNetscape');
 document.write(" <link href=\"../common/css/browser/win_nn.css\" rel=\"stylesheet\" type=\"text/css\" /> ");
 }
 else if((OS=="Mac") && (browser=="NN")){
// alert('macNetscape');
 document.write(" <link href=\"../common/css/browser/mac_nn.css\" rel=\"stylesheet\" type=\"text/css\" /> ");
 }
 else if((OS=="Windows","Mac") && (browser=="Mozilla")){
// alert('mozilla');
 document.write(" <link href=\"../common/css/browser/mozilla.css\" rel=\"stylesheet\" type=\"text/css\" /> ");
 }
//それ以外は普通のCSS
 else{
// alert('other');
 document.write(" <link href=\"../common/css/browser/other.css\" rel=\"stylesheet\" type=\"text/css\" /> ");
 }
