// WebCT95 
//
// Copyright (C) 2003 Conseil Général du Val d'Oise. All Rights
// Reserved.
//
// Developed by IDEALX S.A.S. and Bull S.A. 
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.




function loadMenus(menuIds,widthName) {
    //alert("loadMenus() menuIds = " + menuIds);
    if (menuIds != null) {
	if (document.getElementById && document.styleSheets) {
	
	    //alert("menuIds.length = " + menuIds.length);
	    for (var i = 0; i < menuIds.length; i++) {
		//alert("i = " + i + " id = " + menuIds[i]);

		//alert("i = " + i + " id = " + menuIds[i] + " [ top = " + positionMatrix[i][0] + ", left = " + positionMatrix[i][1] + " ]");
		var div=document.getElementById(menuIds[i]);
		if (div != null) {
		    with (div.style) {
			visibility = "hidden";
			position = "absolute";
			left = positionMatrix[i][0];
			top = positionMatrix[i][1];
			switch (widthName) {
				case 'x-small':
				width = "10em";
				break;
			
        		case 'small':
			    width = "12em";
			    break;
	    		
	    		case 'medium':
			    width = "14em";
			    break;
	    		
	    		case 'large':
			    width = "28em";
			    break;
	    		
	    		default:
			    width = "12em";
			    break;
			}
			
			margin = "0";
			padding = "0";
			zIndex = "3";
		    }
		}

	    }
	}
    }
}

function hideMenus(menuIds) {
    //alert("hideMenus()");
    if (menuIds != null) {
	if (document.getElementById && document.styleSheets) {

	    for (var i = 0; i < menuIds.length; i++) {

		var div=document.getElementById(menuIds[i]);
		if (div != null) {
			if(window.hideSelectBoxes) hideSelectBoxes(div,false);
		    with (div.style) {
			visibility = "hidden";
		    }
		}

	    }
	}
    }
}

function showMenu(subMenuId, menuIds) {  
    

    // The following line seems to be understood not too well by MSIE (at least versions < 5.5)
    //if ((subMenuId != null) && (menuIds != null)) {
    if (subMenuId != null) {
	if (menuIds != null) {
	    if (document.getElementById && document.styleSheets) {
		
		hideMenus(menuIds);

		var div=document.getElementById(subMenuId);
		if (div != null) {
			if(window.hideSelectBoxes) hideSelectBoxes(div,true);
		    with (div.style) {
			visibility = "visible";
		    }
		}
		
	    }
	}
    }
}


    
