/***************************************************************
    SYSTEM   : 岩崎工業
    TITLE    : ダイナミックHTMLの定義
    SCRIPT   : script.js
    VERSION  : Ver1.1.2
    LANGUAGE : JavaScript1.3
    CODESET  : UTF-8
    EXPLAIN  : クライアント画面共通の動きを定義する。
    AUTHOR   : yap
    CREATED  : 2004/12/15  //as Ver1.0.1
    UPDATED  : 2006/09/25  //as Ver1.0.8
    UPDATED  : 2008/10/16  //as Ver1.1.1
    UPDATED  : 2008/10/20  //as Ver1.1.2
***************************************************************/

//写真表示位置の定義(Y座標)
var framepos = 0;

/***************************************************************
    写真の移動関数
***************************************************************/
function _move()
{
    //スクロール位置(Y座標)の検出
    if (window.scrollY) {  //Mozilla, Safari
        var ypos = window.scrollY;
    } else if (window.pageYOffset) {  //Opera, NN4
        var ypos = window.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {  //IE 標準モード
        var ypos = document.documentElement.scrollTop;
    } else if (document.body && document.body.scrollTop) {  //IE 互換モード
        var ypos = document.body.scrollTop;
    } else {  //etc.
        var ypos = 0;
    }

    //ドキュメント高さの検出
    if (document.layers) {  //Mozilla, NN4
        var docY = document.height;
    } else if (document.documentElement && document.documentElement.scrollHeight) {  //IE 標準モード
        var docY = document.documentElement.scrollHeight;
    } else if (document.body && document.body.scrollHeight) {  //IE, Opera 互換モード
        var docY = document.body.scrollHeight;
    } else {  //etc.
        var docY = 0;
    }

    //最大スクロール位置(Y座標)の設定
    var maxpos = docY - 504;

    //スクロールナビの移動
    if (ypos > maxpos) {ypos = maxpos;}
    if (typeof document.getElementById('snavi').style.top != "undefined") {  //IE5+, Mozilla, Opera7+
        document.getElementById('snavi').style.top = ypos + 'px';
        document.getElementById('frame').style.top = ypos + 'px';
    } else if (typeof snavi.style.pixelTop != "undefined") {  //IE4, Opera6
        snavi.style.pixelTop = ypos;
        frame.style.pixelTop = ypos;
    } else if (typeof document.layers['snavi'].clip.top != 'undefined') {  //NN4
        document.layers['snavi'].clip.top = ypos;
        document.layers['frame'].clip.top = ypos;
    }
}

/***************************************************************
    アクセスカウンタ関数
***************************************************************/
function _count(url)
{
    document.write('<img src="', url, '&amp;img=1&amp;scr=', screen.width, 'x', screen.height, 'x', screen.colorDepth, '&amp;ref=', escape(document.referrer), '" width="1" height="1" alt="">');
}

/***************************************************************
    ページのロード時に実行される関数
***************************************************************/
window.onload = function()
{
    //スクロールの検出
    if (window.navigator.userAgent.indexOf('MSIE') >= 0 && document.compatMode == 'BackCompat') {  //IE互換モード
        document.body.onscroll = _move;
    } else {  //その他
        window.onscroll = _move;
    }
}
