﻿var ids=new Array('menu1');

function switchid(id){	
	hideallids(id);
	if (document.getElementById) 
	    { 
    	if (document.getElementById(id).style.display == 'none') 
    	    {
	    	    for (var i=0;i<ids.length;i++)
	    	        {		
		    	        showdiv(id);
			        }
		   }
    	else    
    	    {
	    	    hidediv(id);
	        }
	   }
    else 
        {
	        if (document.id.display == 'none') 
	            {
	                for (var i=0;i<ids.length;i++) 
	                    {
	                        showdiv(id);
	                    }
	            }
	        else 
	        {
	            hidediv(id);
	        }
	    }
}

function hideallids(id){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
	    if (id != ids[i]) {
		    hidediv(ids[i]);
		}
		
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
	    if (document.getElementById(id) != null) {
		    document.getElementById(id).style.display = 'none';
		  }
	}
	else {
		if (document.layers) { // Netscape 4
		    if (document.id != null) {
			document.id.display = 'none';
			}
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = '';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = '';
		}
		else { // IE 4
			document.all.id.style.display = '';
		}
	}
}