function toggleSub(submenu) {
    if (document.getElementById(submenu).style.display == 'none') {
        document.getElementById(submenu).style.display = 'block'
    } else {
        document.getElementById(submenu).style.display = 'none'
    }
}

var menu_status = new Array();
var menu_height_start = 470;
var main_total_menu = 6;
var standard_image_height = 26;
var new_total_height = (main_total_menu * standard_image_height);
var previous_total_height = 0;

function showHide(theid, num){
	var div_tag = document.getElementById('menu');
	// Close all the main menu DIVs
	// Loop through 
	num = 10000;
	for (i=1; i<=num; i++){
    	var switch_id = document.getElementById('gallery_' + i);
    	if ( switch_id ){
			if (i!=theid){
				switch_id.className = 'hide';
				menu_status['-1' + i] = 'hide';
			}
		}
	}
	
    if (document.getElementById(theid)) {
    var switch_id = document.getElementById(theid);
        if(menu_status[theid] != 'show') {
           switch_id.className = 'show';
           menu_status[theid] = 'show';
        }else{
           switch_id.className = 'hide';
           menu_status[theid] = 'hide';
        }
        
    }

}

function showHideSub(theid, subid, num){
	var div_tag = document.getElementById('menu');
	// Close all the main menu DIVs
	// Loop through 
	num = 10000;
	for (i=1;i<num;i++){
    	var switch_id = document.getElementById(theid + i);
		if ( switch_id ){
			if (i!=theid){
				switch_id.className = 'hide';
				menu_status[i] = 'hide';
			}
		}
	}
	
	theid = theid + subid;
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);
        if(menu_status[theid] != 'show') {
        	switch_id.className = 'show';
            menu_status[theid] = 'show';
        }else{
        	switch_id.className = 'hide';
        	menu_status[theid] = 'hide';
        }
        
    }
}

function showMenu(catid, subid){

	var div_tag = document.getElementById('menu');
    var mainid = document.getElementById('gallery');
    
    
   	mainid.className = 'show';
   	menu_status['gallery'] = 'show';
   	   	
    if (document.getElementById(catid)) {
    var switch_id = document.getElementById(catid);
        if(menu_status[catid] != 'show') {
           switch_id.className = 'show';
           menu_status[catid] = 'show';
        }
    }

    if (document.getElementById) {
    var switch_id = document.getElementById(subid);
        if(menu_status[subid] != 'show') {
           switch_id.className = 'show';
           menu_status[subid] = 'show';
        }
        
    }
}
