/* global valiables */
var prev_subject_id    = '';
var prev_subject_color = '';
var close_color        = '#555';
var open_color         = '#005CC5';

/* Switch display 3rd edition */
function visibleBranchContent(id) {
    doc = document.getElementById(id);
    for(tmp_i in branch_array) {
        if(branch_array[tmp_i] != id && id != "all") {
            tmp_doc = document.getElementById(branch_array[tmp_i]);
            tmp_doc.style.display = "none";
        } else {
            tmp_doc = document.getElementById(branch_array[tmp_i]);
            tmp_doc.style.display = "block";
        }
    }
	if(id=="local_honsya"){
    	doc.style.display = "block";
	}else{
    	honsyaDoc = document.getElementById("local_honsya")
    	honsyaDoc.style.display = "none";
	}
	if(id=="all"){
    	honsyaDoc = document.getElementById("local_honsya")
    	honsyaDoc.style.display = "block";
	}
}

/* Switch display localarea */
function switchVisibleContentsTop(id, subject_id, flag) {
	doc = document.getElementById(id);
	if(doc.style.display == 'none' || flag){
		subject_doc = document.getElementById(subject_id);
		subject_doc.style.color = open_color;
		doc.style.display = 'block';
		
		if(url != null){
			document.location = url;
		}
	} else {
		if(prev_subject_id != ''){
			subject_doc = document.getElementById(prev_subject_id);
			subject_doc.style.color = prev_subject_color;
			prev_subject_id = '';
		}
		doc.style.display = 'none';
	}
}

/*
function switchVisible(id, subject_id, url) {
	doc = document.getElementById(id);
	if(doc.style.display == 'none'){
		subject_doc = document.getElementById(subject_id);
		subject_doc.style.color = open_color;		
		doc.style.display = 'block';
		
		if(url != null){
			document.location = url;
		}
	} else {
		subject_doc = document.getElementById(subject_id);
		subject_doc.style.color = close_color;
		doc.style.display = 'none';
	}
}
*/

/* Open New Window width:500 height:430 */
function winopn500(winName,url) {
    Win_op500 = window.open(url, winName,"width=516,height=430,toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
    Win_op500.focus();
}


/* Open New Window width:500 height:530 for Map */
function winopn500h(winName,url) {
    Win_op500h = window.open(url, winName,"width=516,height=640,toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
    Win_op500h.focus();
}

/* Open New Window width:600 height:530 for Map */
function winopn600h(winName,url) {
    Win_op600h = window.open(url, winName,"width=660,height=700,toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
    Win_op600h.focus();
}


/* preload images */
function PreLoading(){
	var PreLoading;
	PreLoading = new Array();
	for(i = 0; i < PreImages.length; i++){
		PreLoading[i] = new Image();
		PreLoading[i].src =  PreImages[i];
	}
}


/* preload Directory images */
function PreLoadingD(){
	var PreLoadingD;
	PreLoadingD = new Array();
	for(i = 0; i < PreImagesD.length; i++){
		PreLoadingD[i] = new Image();
		PreLoadingD[i].src =  PreImagesD[i];
	}
}


/* rollover */
function Change_Img(filename,target){
	document.images[target].src = filename;
}