// 画像を対話モードに置き換える
// 引数 sw: SW名
// 引数 momid: momエントリーid 
// 引数 no: jmolスクリプトファイル番号
// 引数 pos: 置換枠番号
function inter_open(sw,momid,no,pos)
{
    var no_def = 1; // noのデフォルト値
    switch (arguments.length) {
	// 既定のソフトウェアはjmol
    case 0: sw = 'jmol';
	// momidの既定値はなし
    case 1: momid = '';
	// 既定の挿入ソースファイル番号は1（mom???_1.jmol）
    case 2: no = 1;
	// 既定のページ内ジャンプ位置は1（#inter1）
    case 3: pos = 1;
    }
    window.open('index.php?p=' + momid + '&i=' + sw + '&n=' + no + '&f=' + pos + '#inter' + pos,'_self');
}

// マウスポインタの相対位置を得る
function getScreenPosition() {
    var px=0,py=0;
    if (self.pageYOffset) {
	// all except Explorer
	px = self.pageXOffset;
	py = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
	// Explorer 6 Strict
	px = document.documentElement.scrollLeft;
	py = document.documentElement.scrollTop;
    } else if (document.body) {
	// all other Explorers
	px = document.body.scrollLeft;
	py = document.body.scrollTop;
    }
    return [ px, py ];
}

// 画面サイズを得る
function getScreenSize() {
    var sw = 0, sh = 0; 
    if (typeof window.innerWidth != 'undefined') {
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	sw = window.innerWidth;
	sh = window.innerHeight;
    } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	sw = document.documentElement.clientWidth;
	sh = document.documentElement.clientHeight;
    } else {
	// older versions of IE
	sw = document.getElementsByTagName('body')[0].clientWidth;
	sh = document.getElementsByTagName('body')[0].clientHeight;
    }
    return [ sw, sh ];
}
/* 画像ポップアップ表示
function show_image(){

function(e){
    var u = 0;
    var l = 0;
    var screen = getScreenSize();
    var offset = getScreenPosition();
    u = ie ? event.clientY + offset[1] : e.pageY;
    l = ie ? event.clientX + offset[0] : e.pageX;
    var isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
    if ( (u - offset[1]) >= (screen[1]/3) * 2 ) {
	tt.style.top = '';
	tt.style.bottom = (screen[1] - u) - 10 + 'px';
    } else {
	tt.style.top = u + 'px';
	tt.style.bottom = '';
    }
    if (isIE6) {
	tt.style.top = u + 'px';
	tt.style.bottom = '';
    }
    if ( (l - offset[0]) > screen[0]/2 ) {
	tt.style.left = '';
	tt.style.right = ((screen[0] - l) + 3) + 'px';
    } else {
	tt.style.right = '';
	tt.style.left = (l + left) + 'px';
    }
}    
}
*/
