/* Header Navigation */

var load = false;
var img;

var time=0;
var timer;
var active_id    = null;
var active_nam   = null;
var active_num   = null;
var inactive_num = null;

function OnMouseOver(id,nav_nam,nav_num,out_num){
    ClearTimer();
    if(active_id != null) CloseMenu();
    document.getElementById(id).style.display = 'block';
    active_id = id;
    active_nam = nav_nam;
    active_num = nav_num;
    inactive_num = out_num;
    ImageChange(active_nam,active_num);
}

function OnMouseOut(){
    timer = setTimeout("CloseMenu()",time);
}

function ClearTimer(){
    if (typeof timer != "undefined"){
        clearTimeout(timer);
    }
}

function CloseMenu(){
    document.getElementById(active_id).style.display = 'none';
    ImageChange(active_nam,inactive_num);
}

function ChangeProductsText(text){
    document.getElementById('prod_nav_text').innerHTML = text;
    return;
}


function ImagePreload(url){
    /* Navigation 画像プリロード */
    var max = 6;
    img = new Array();
    img[0]     = new Image();
    img[0].src = url + "/common/header/nav_n.gif";
    for(var i = 1; i <= max; i++){
        img[i]     = new Image();
        img[i].src = url + "/common/header/nav_a" + i + ".gif";
    }
    
    load = true;
    return;
}

function ImageChange(name,num){
    if(load == true){
        name.src = img[num].src;
    }
    return;
}
