/* no click */

setin = window.onload;
window.onload = ocm;

function ocm() {
	if(document.getElementById && !window.opera){
		t=document.getElementsByTagName('body');
		(!document.all)?t[0].setAttribute('oncontextmenu','return(ocmReturn()); ') : t[0].oncontextmenu=ocmReturn;
	}
	if(setin)setin();
}

function ocmReturn(){return false;}

/* pull navi 20091020 */

var TimeOut = 300;
var currentLayer = null;
var currentitem = null;
var currentLayerNum = 0;
var noClose = 0;
var closeTimer = null;



function mopen(n) {
	var l  = document.getElementById("menu"+n);
	var mm = document.getElementById("mmenu"+n);
	if(l) {
		mcancelclosetime();
		l.style.visibility='visible';
		if(currentLayer && (currentLayerNum != n))currentLayer.style.visibility='hidden';
		currentLayer = l;
		currentitem = mm;
		currentLayerNum = n;
	} else if(currentLayer) {
	currentLayer.style.visibility='hidden';
	currentLayerNum = 0;
	currentitem = null;
	}
}

function mclosetime() {
	closeTimer = window.setTimeout(mclose, TimeOut);
}

function mcancelclosetime() {
	if(closeTimer) {
		window.clearTimeout(closeTimer);
		closeTimer = null;
	}
}



function mclose() {
	if(currentLayer && noClose!=1)   {
		currentLayer.style.visibility='hidden';
		currentLayerNum = 0;
		currentLayer = null;
		currentitem = null;
	} else {
		noClose = 0;
	}
	currentLayer = null;
	currentitem = null;
}

document.onclick = mclose; 

// popupWindow ver1.2

function popupWindow (url, width, height, option, windowName)
{	
	if (!width) width = window.innerWidth || document.documentElement.clientWidth;
	if (!height) height = window.innerHeight || document.documentElement.clientHeight;
	if (!option) option = 'menubar=yes, toolbar=yes, location=yes, status=yes, scrollbars=yes, resizable=yes';
	if (!windowName) windowName = "popup";
	var x = (screen.availWidth - width)/2;
	var y = (screen.availHeight - height)/4;
	var o = option+', width='+width+', height='+height+', left='+x+', top='+y;
	var blockMessage = "ウィンドウがお使いのブラウザでポップアップブロックされました。\nポップアップブロックを解除してください。";
	var win = window.open(url, windowName, o);
	if (win)
	{
		win.focus();
	} else {
		alert(blockMessage);
	}
}


function SWindowOpen(targEt){
	var headUrl = '';
	var tailURL='';
	switch(targEt)
	{
		case 'download': alurl = '/pickup/panpanda/download_readme.html'; alWidth=517; alHight=600; Resiz='no'; optScroll='yes'; break;
		case 'newitem': alurl = '/lineup/newitem.html'; alWidth=625; alHight=649; Resiz='yes'; optScroll='no'; break;
		case 'info': alurl = '/info.html'; alWidth=500; alHight=490; Resiz='yes'; optScroll='no'; break;
	}
	var optLine = 'width=' + alWidth + ', height=' + alHight + ',toolbar=no,resizable=' + Resiz + ',menubar=no,directories=no,status=no,location=no,scrollbars=' + optScroll;
	subal=window.open(headUrl+alurl+tailURL,targEt,optLine);
	var blockMessage = "ウィンドウがお使いのブラウザでポップアップブロックされました。\nポップアップブロックを解除してください。";
	if (subal)
	{
		subal.focus();
	} else {
		alert(blockMessage);
	}

}

