﻿// Diary ページジャンプ
function changeframe(tit_url,cnt_url)
	{
	parent.diary_tit.location.href = tit_url;
	parent.diary_cnt.location.href = cnt_url;
	}	
	
	

// Image popup
function popupImage(filepath, width, height){
    var y = 0;
    var x = 0;
    if (!popupImage.imgNode) {
        if (document.all) {
            y = document.body.scrollTop + 32;
            x = document.body.scrollLeft + 32;
            popupImage.imgNode = document.createElement('img');
            popupImage.imgNode.attachEvent('onclick', closeImage);
		
        } else if (document.implementation) {
            y = window.pageYOffset + 32;
            x = window.pageXOffset + 32;
            popupImage.imgNode = document.createElement('img');
            popupImage.imgNode.addEventListener('click' ,closeImage , true);

        } else {
            return;
        }
    }

    with(popupImage){
        imgNode.setAttribute('src', filepath );
        if (width && height) {
            imgNode.setAttribute('width', width );
            imgNode.setAttribute('height', height );
        }
        imgNode.style.position = 'absolute';
        imgNode.style.left = '32px';
        imgNode.style.top = y + 'px';
        imgNode.style.borderColor = 'white';
        imgNode.style.borderWidth = '2px';
        imgNode.style.borderStyle = 'solid';
        imgNode.style.margin = '0';
        document.body.appendChild(imgNode);
    }

    function closeImage(){
        if (popupImage.imgNode) {
            document.body.removeChild(popupImage.imgNode);
            delete popupImage.imgNode;
        }
    }
}



// New / Up mark
function newUp(y, m, d, c) {
  delDay = 14; // 何日後に削除するか
  oldDay = new Date(y,m-1,d);
  newDay = new Date();
  d =(newDay - oldDay) / (1000 * 24 * 3600);
  if(d <= delDay) {
    // Newマーク
    if(c == "new") document.write("<img src='http://neuro-nex.net/images/new.gif' alt='new' width='40' height='25' border='0'>");
    // Upマーク
    if(c == "up") document.write("<img src='http://neuro-nex.net/images/up.gif' alt='up' width='32' height='25' border='0'>");
  }
  else{ document.write("　");}
}
