/****************************************************************
 * 画像拡大スクリプト Lightbox2.04 の読込
 *
 ****************************************************************/

document.write('<script type="text/javascript" src="http://www.figure.kanaya440.com/lightbox/js/prototype.js"></script>');
document.write('<script type="text/javascript" src="http://www.figure.kanaya440.com/lightbox/js/scriptaculous.js?load=effects,builder"></script>');
document.write('<script type="text/javascript" src="http://www.figure.kanaya440.com/lightbox/js/lightbox.js"></script>');
document.write('<script type="text/javascript" src="http://www.figure.kanaya440.com/js/af.js"></script>');

/****************************************************************
 * メールアドレスを正しい順に並び替えて表示する（スパム対策）
 *
 ****************************************************************/
function maddr(){
    mail=maddr.arguments[4] + maddr.arguments[2] + maddr.arguments[1] + maddr.arguments[3] + maddr.arguments[0];
    document.write(mail.link('mailto:' + maddr.arguments[4] + maddr.arguments[2] + maddr.arguments[1] + maddr.arguments[3] + maddr.arguments[0]));
}
function kaddr(){
    waddr('&#46;&#99;&#111;&#109;','&#97;&#110;&#97;&#121;','&#105;&#111;&#64;&#107;','&#97;&#52;&#52;&#48;','&#121;&#111;&#115;&#104;');
}
function waddr(){
    mail='Contact Me';
    document.write(mail.link('mailto:' + waddr.arguments[4] + waddr.arguments[2] + waddr.arguments[1] + waddr.arguments[3] + waddr.arguments[0]));
}

/****************************************************************
 * メールアドレスを表示する（スパム対策）
 *
 ****************************************************************/
function wmaddr(){
    mail='&#121;&#111;&#115;&#104;&#105;&#111;&#64;&#107;&#97;&#110;&#97;&#121;&#97;&#52;&#52;&#48;&#46;&#99;&#111;&#109;'
    document.write(mail.link('mailto:' + mail));
}

var newWin=0;
function winOpen(pic,width,height){
    var obj = document.all && document.all('pic') || document.getElementById && document.getElementById('pic');
    obj.value = pic;
    var intLeft   = (screen.width - width) / 2;
    var intTop    = (screen.height - height) / 2;
    if(newWin) {
        if(!newWin.closed) newWin.close();
    }
    newWin = window.open('pop.html','','status=0,location=0,scrollbars=0,resizable=0,toolbar=0,directories=0,menubar=0,width='+width+',height='+height+',left='+intLeft+', top='+intTop+',screenX='+intLeft+',screenY='+intTop+'');
}

/****************************************************************
 * 拡大画像表示用ウィンドウオープン
 *
 ****************************************************************/
var newWin=0;
function winOpen(pic,width,height){
    var obj = document.all && document.all('pic') || document.getElementById && document.getElementById('pic');
    obj.value = pic;
    var intLeft   = (screen.width - width) / 2;
    var intTop    = (screen.height - height) / 2;
    if(newWin) {
        if(!newWin.closed) newWin.close();
    }
    newWin = window.open('pop.html','','status=0,location=0,scrollbars=0,resizable=0,toolbar=0,directories=0,menubar=0,width='+width+',height='+height+',left='+intLeft+', top='+intTop+',screenX='+intLeft+',screenY='+intTop+'');
}

/****************************************************************
 * アドセンス用画像表示
 ****************************************************************
 * 引数
 *   path：画像ディレクトリのパス（相対、絶対どちらでも可）（文字列）
 *   num ：ファイルにある画像の数（数値）
 *   vew ：表示する画像の数（数値）
 *   ext ：画像ファイルの拡張子（文字列）
 *   w   ：画像の幅（数値）
 *   h   ：画像の高さ（数値）
 *   s   ：画像と画像の間隔（数値）
****************************************************************/
function RandomImg(path,num,vew,ext,w,h,s){
    if(vew > 0){
        document.write('<table border="0" cellpadding="0" cellspacing="0"><tr><td nowrap>');
        for (i = 0; i < vew; i++) {
            n = 0;
            while (n < 1) n = Math.floor(Math.random() * num);
            img = n + '.' + ext;
			if(i+1 == vew) s=0;
            document.write('<img src="'+path+img+'" width="'+w+'" height="'+h+'" style="border:0px; margin:0px '+s+'px 0px 0px;">');
        }
        document.write('</td></tr></table>');
        document.close()
    }       
}

/****************************************************************
 * お気に入りに登録
 ****************************************************************/
function addBookmark(title,url) {
	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}
}


/************************************************************************************
 グローバルメニューのポップアップ用スクリプト
************************************************************************************/
var mmOpenContainer = null;
var mmOpenMenus = null;
var mmHideMenuTimer = null;

function mSTimeout(hideTimeout) {
    mmHideMenuTimer = setTimeout("HideMenus()", hideTimeout);
}

function HideMenus() {
    mRTimeout();
    if(mmOpenContainer) {
        var c = document.getElementById(mmOpenContainer);
        c.style.visibility = "hidden";
        c.style.left = "-225px";
        mmOpenContainer = null;
    }
}

function mRTimeout() {
    if (mmHideMenuTimer) clearTimeout(mmHideMenuTimer);
    mmHideMenuTimer = null;
}

function mShowMenu(containName, menuName, xOffset, yOffset) {
    HideMenus();
    mRTimeout();
    ShowMenuContainer(containName, xOffset, yOffset);
}

function ShowMenuContainer(containName, x, y) {
    var c = document.getElementById(containName);
    var s = c.style;
    s.visibility = "inherit";
    s.left = "585px";

    mmOpenContainer = "" + containName;
}



