//********************************************************************
// 定数・変数の定義
//********************************************************************
//日本語
var jhomeOn;
var jhomeOff;
var jnewOn;
var jnewOff;
var jcpnyOn;
var jcpnyOff;
var jpdctOn;
var jpdctOff;
var jrecOn;
var jrecOff;
var jkohoOn;
var jkohoOff;
var jctlgOn;
var jctlgOff;
var jdwldOn;
var jdwldOff;
var jlinkOn;
var jlinkOff;
//日本語(メニューファイル名)
jhomeOn = "menu_home_on.gif"
jhomeOff = "menu_home_off.gif"
jnewOn = "menu_new_on.gif"
jnewOff = "menu_new_off.gif"
jcpnyOn = "menu_company_on.gif"
jcpnyOff = "menu_company_off.gif"
jpdctOn = "menu_products_on.gif"
jpdctOff = "menu_products_off.gif"
jrecOn = "menu_recruit_on.gif"
jrecOff = "menu_recruit_off.gif"
jkohoOn = "menu_kouho_on.gif"
jkohoOff = "menu_kouho_off.gif"
jctlgOn = "menu_catalog_on.gif"
jctlgOff = "menu_catalog_off.gif"
jdwldOn = "menu_download_on.gif"
jdwldOff = "menu_download_off.gif"
jlinkOn = "menu_link_on.gif"
jlinkOff = "menu_link_off.gif"
//日本語(ログオンファイル名)
jlogOn = "btn_new_on.gif"
jlogOff = "btn_new_off.gif"
//日本語(ユーザページファイル名)
jcadOn = "btn_cad_on.gif"
jcadOff = "btn_cad_off.gif"
//日本語(ベルコンミニ３シリーズ機能紹介)
bm3f01On = "bm3_kinou01_on.gif"
bm3f01Off = "bm3_kinou01_off.gif"
bm3f02On = "bm3_kinou02_on.gif"
bm3f02Off = "bm3_kinou02_off.gif"
bm3f03On = "bm3_kinou03_on.gif"
bm3f03Off = "bm3_kinou03_off.gif"
bm3f04On = "bm3_kinou04_on.gif"
bm3f04Off = "bm3_kinou04_off.gif"
bm3f05On = "bm3_kinou05_on.gif"
bm3f05Off = "bm3_kinou05_off.gif"
bm3f06On = "bm3_kinou06_on.gif"
bm3f06Off = "bm3_kinou06_off.gif"
//日本語(ジャブコン２シリーズ機能紹介)
jub2f01On = "jub2_kinou01_on.gif"
jub2f01Off = "jub2_kinou01_off.gif"
jub2f02On = "jub2_kinou02_on.gif"
jub2f02Off = "jub2_kinou02_off.gif"
jub2f03On = "jub2_kinou03_on.gif"
jub2f03Off = "jub2_kinou03_off.gif"
jub2f04On = "jub2_kinou04_on.gif"
jub2f04Off = "jub2_kinou04_off.gif"
jub2f05On = "jub2_kinou05_on.gif"
jub2f05Off = "jub2_kinou05_off.gif"
jub2f06On = "jub2_kinou06_on.gif"
jub2f06Off = "jub2_kinou06_off.gif"
//************************************************
//ロールオーバーメニュー画像参照同階層の場合
//************************************************
function mOver0(id) {
	document.images[id].src = "jpn/image/" + eval(id + "On");
}

function mOut0(id) {
	document.images[id].src = "jpn/image/" + eval(id + "Off");
}

//************************************************
//ロールオーバーメニュー画像参照同階層の場合
//************************************************
function mOver(id) {
	document.images[id].src = "image/" + eval(id + "On");
}

function mOut(id) {
	document.images[id].src = "image/" + eval(id + "Off");
}

//************************************************
//ロールオーバーメニュー画像参照参照1階層下の場合
//************************************************
function mOver1(id) {
	document.images[id].src = "../image/" + eval(id + "On");
}

function mOut1(id) {
	document.images[id].src = "../image/" + eval(id + "Off");
}

//************************************************
//ロールオーバーメニュー画像参照参照2階層下の場合
//************************************************
function mOver2(id) {
	document.images[id].src = "../../image/" + eval(id + "On");
}

function mOut2(id) {
	document.images[id].src = "../../image/" + eval(id + "Off");
}

//************************************************
//住所検索画面起動
//************************************************
function openWin(zip1,zip2){
	var asp_path = '../add_search.aspx?'
	+ 'zip1=' + zip1
	+ '&zip2=' + zip2

	zipWin = window.open(asp_path, 'zipWin', 'directories=no, menubar=no, width=600, height=400, scrollbars=yes, status=no, toolbar=no, resizable=yes');
}

function openWin1(zip1,zip2){
	var asp_path = '../../add_search.aspx?'
	+ 'zip1=' + zip1
	+ '&zip2=' + zip2

	zipWin = window.open(asp_path, 'zipWin', 'directories=no, menubar=no, width=600, height=400, scrollbars=yes, status=no, toolbar=no, resizable=yes');
}

//************************************************
//トップ画像ランダム表示
//************************************************
function random(){

//img = new Array(url.length); 
img = new Array(3); 

i = Math.floor(Math.random( ) * img.length);

//img[x]="表示画像";
img[0]="jpn/image/top_img001.gif";
img[1]="jpn/image/top_img002.jpg";
img[2]="jpn/image/top_img003.gif";

document.write('<img src="'+img[i]+'" border="0">');

}

//************************************************
//トップ画像ランダム表示
//************************************************
function random1(){

//img = new Array(url.length); 
img = new Array(3); 

i = Math.floor(Math.random( ) * img.length);

//img[x]="表示画像";
img[0]="image/top_img001.gif";
img[1]="image/top_img002.jpg";
img[2]="image/top_img003.gif";

document.write('<img src="'+img[i]+'" border="0">');

}

//************************************************
//ページトップへゆっくりスクロール
//************************************************
function backToTop() {
  var x1 = x2 = x3 = 0;
  var y1 = y2 = y3 = 0;
  if (document.documentElement) {
      x1 = document.documentElement.scrollLeft || 0;
      y1 = document.documentElement.scrollTop || 0;
  }
  if (document.body) {
      x2 = document.body.scrollLeft || 0;
      y2 = document.body.scrollTop || 0;
  }
  x3 = window.scrollX || 0;
  y3 = window.scrollY || 0;
  var x = Math.max(x1, Math.max(x2, x3));
  var y = Math.max(y1, Math.max(y2, y3));
  window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
  if (x > 0 || y > 0) {
      window.setTimeout("backToTop()", 10);
  }
}
//************************************************
//ページ内リンクのスムーススクロール
//************************************************
Scroller = {
    // control the speed of the scroller.
    // dont change it here directly, please use Scroller.speed=50;
    speed: 5,

    // returns the Y position of the div
    gy: function(d) {
        gy = d.offsetTop
        if (d.offsetParent) while (d = d.offsetParent) gy += d.offsetTop
        return gy
    },

    // returns the current scroll position
    scrollTop: function() {
        body = document.body
        d = document.documentElement
        if (body && body.scrollTop) return body.scrollTop
        if (d && d.scrollTop) return d.scrollTop
        if (window.pageYOffset) return window.pageYOffset
        return 0
    },

    // attach an event for an element
    // (element, type, function)
    add: function(event, body, d) {
        if (event.addEventListener) return event.addEventListener(body, d, false)
        if (event.attachEvent) return event.attachEvent('on' + body, d)
    },

    // kill an event of an element
    end: function(e) {
        if (window.event) {
            window.event.cancelBubble = true
            window.event.returnValue = false
            return;
        }
        if (e.preventDefault && e.stopPropagation) {
            e.preventDefault()
            e.stopPropagation()
        }
    },

    // move the scroll bar to the particular div.
    scroll: function(d) {
        i = window.innerHeight || document.documentElement.clientHeight;
        h = document.body.scrollHeight;
        a = Scroller.scrollTop()
        if (d > a)
            if (h - d > i)
            a += Math.ceil((d - a) / Scroller.speed)
        else
            a += Math.ceil((d - a - (h - d)) / Scroller.speed)
        else
            a = a + (d - a) / Scroller.speed;
        window.scrollTo(0, a)
        if (a == d || Scroller.offsetTop == a) clearInterval(Scroller.interval)
        Scroller.offsetTop = a
    },
    // initializer that adds the renderer to the onload function of the window
    init: function() {
        Scroller.add(window, 'load', Scroller.render)
    },

    // this method extracts all the anchors and validates then as # and attaches the events.
    render: function() {
        a = document.getElementsByTagName('a');
        Scroller.end(this);
        window.onscroll
        for (i = 0; i < a.length; i++) {
            l = a[i];
            if (l.href && l.href.indexOf('#') != -1 && ((l.pathname == location.pathname) || ('/' + l.pathname == location.pathname))) {
                Scroller.add(l, 'click', Scroller.end)
                l.onclick = function() {
                    Scroller.end(this);
                    l = this.hash.substr(1);
                    a = document.getElementsByTagName('a');
                    for (i = 0; i < a.length; i++) {
                        if (a[i].name == l) {
                            clearInterval(Scroller.interval);
                            Scroller.interval = setInterval('Scroller.scroll(' + Scroller.gy(a[i]) + ')', 10);
                        }
                    }
                }
            }
        }
    }
}
// invoke the initializer of the scroller
Scroller.init();