var busy = false;
function formSubmit(){
    var form = document.forms["TargetFrom"];
    if (!busy)
    {
        form.submit();
        busy = true;
    }
}


// // Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
///////////////////////////////////////////////////////////////////////////////////////////
//  ロールオーバースクリプト
//　Standards Compliant Rollover Script
//　Author : Daniel Nolan
//　http://www.bleedingego.co.uk/webdev.php

function initRollovers() {
    if (!document.getElementById) return
	
    var aPreLoad = new Array();
    var sTempSrc;
    var aImages = document.getElementsByTagName('img');

    for (var i = 0; i < aImages.length; i++) {		
        if (aImages[i].className == 'imgover') {
            var src = aImages[i].getAttribute('src');
            var ftype = src.substring(src.lastIndexOf('.'), src.length);
            var hsrc = src.replace(ftype, '_o'+ftype);

            aImages[i].setAttribute('hsrc', hsrc);
			
            aPreLoad[i] = new Image();
            aPreLoad[i].src = hsrc;
			
            aImages[i].onmouseover = function() {
                sTempSrc = this.getAttribute('src');
                this.setAttribute('src', this.getAttribute('hsrc'));
            }	
			
            aImages[i].onmouseout = function() {
                if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
                this.setAttribute('src', sTempSrc);
            }
        }
    }
}

            
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Konstantin Jagello | http://javascript-array.com/ */

var TimeOut         = 300;
var currentLayer    = null;
var currentitem     = null;
var currentLayerNum = 0;
var noClose         = 0;
var closeTimer      = null;

function mopen(n) {
    var l  = document.getElementById("menu"+n);
    var mm = document.getElementById("mmenu"+n);
	
    if(l) {
        mcancelclosetime();
        l.style.visibility='visible';
        if(currentLayer && (currentLayerNum != n))
            currentLayer.style.visibility='hidden';
        currentLayer = l;
        currentitem = mm;
        currentLayerNum = n;			
    } else if(currentLayer) {
        currentLayer.style.visibility='hidden';
        currentLayerNum = 0;
        currentitem = null;
        currentLayer = null;
    }
}

function mclosetime() {
    closeTimer = window.setTimeout(mclose, TimeOut);
}

function mcancelclosetime() {
    if(closeTimer) {
        window.clearTimeout(closeTimer);
        closeTimer = null;
    }
}

function mclose() {
    if(currentLayer && noClose!=1)   {
        currentLayer.style.visibility='hidden';
        currentLayerNum = 0;
        currentLayer = null;
        currentitem = null;
    } else {
        noClose = 0;
    }
    currentLayer = null;
    currentitem = null;
}

document.onclick = mclose; 

// BCN用
function bcn_all_tab_select() {
    bcn_all_display(true);
    bcn_review_display(false);
    bcn_utility_display(false);
    bcn_maintenance_display(false);
    bcn_security_display(false);
}

function bcn_review_tab_select() {
    bcn_all_display(false);
    bcn_review_display(true);
    bcn_utility_display(false);
    bcn_maintenance_display(false);
    bcn_security_display(false);
}

function bcn_utility_tab_select() {
    bcn_all_display(false);
    bcn_review_display(false);
    bcn_utility_display(true);
    bcn_maintenance_display(false);
    bcn_security_display(false);
}

function bcn_maintenance_tab_select() {
    bcn_all_display(false);
    bcn_review_display(false);
    bcn_utility_display(false);
    bcn_maintenance_display(true);
    bcn_security_display(false);
}

function bcn_security_tab_select() {
    bcn_all_display(false);
    bcn_review_display(false);
    bcn_utility_display(false);
    bcn_maintenance_display(false);
    bcn_security_display(true);
}

function bcn_all_display(display) {
    document.getElementById("bcn_all").style.display=display ? 'block' : 'none';
    document.getElementById("bcn_tab_all_select").style.display=display ? 'block' : 'none';
    document.getElementById("bcn_tab_all_unselect").style.display=display ? 'none' : 'block';
}

function bcn_review_display(display) {
    document.getElementById("bcn_review").style.display=display ? 'block' : 'none';
    document.getElementById("bcn_tab_review_select").style.display=display ? 'block' : 'none';
    document.getElementById("bcn_tab_review_unselect").style.display=display ? 'none' : 'block';
}

function bcn_utility_display(display) {
    document.getElementById("bcn_utility").style.display=display ? 'block' : 'none';
    document.getElementById("bcn_tab_utility_select").style.display=display ? 'block' : 'none';
    document.getElementById("bcn_tab_utility_unselect").style.display=display ? 'none' : 'block';
}

function bcn_maintenance_display(display) {
    document.getElementById("bcn_maintenance").style.display=display ? 'block' : 'none';
    document.getElementById("bcn_tab_maintenance_select").style.display=display ? 'block' : 'none';
    document.getElementById("bcn_tab_maintenance_unselect").style.display=display ? 'none' : 'block';
}

function bcn_security_display(display) {
    document.getElementById("bcn_security").style.display=display ? 'block' : 'none';
    document.getElementById("bcn_tab_security_select").style.display=display ? 'block' : 'none';
    document.getElementById("bcn_tab_security_unselect").style.display=display ? 'none' : 'block';
}

