// JavaScript Document
var css_block = 15;
var URL_VAR = 'auxiliary';
var elem_pref = 'menus';
var by_default = 'menus1';
var num_elems = 4;

function final(){

	var URL = location.search; 
	var _search =/auxiliary/;
	var result = _search.test(URL);
	var param = new Array();
	//alert(result);
	if ( result == true ) {
		tmp = (URL.substr(1)).split('&');
		for(var i=0; i < tmp.length; i++) {
			tmp2 = tmp[i].split('=');
			param[tmp2[0]] = tmp2[1];
		}
		
		for (var key in param){
		
			if (key == URL_VAR) {
				menu_in(elem_pref+param[key]);
			}
		}
	}
	else {
		menu_in(by_default);
	}
}
 
function menu_in(id){ 
    id_ = id;
	height = child_nodes(id_);
    height_ = height;
	arr(id_);
    he = parseInt(document.getElementById(id_).style.height); 
    if(he < height){ 
        show_in(); 
    } 
} 
function show_in(){ 
    he += 5; 
    document.getElementById(id_).style.height = he + 'px'; 
    if(he < height_ + 5){ 
        setTimeout('show_in()', 15); 
    } 
} 

function arr(x) {
    var param = new Array();
	for (i=1; i<num_elems+1; i++){
	  param[i] = i;
	}
	//param[1] = 1;
	//param[2] = 2;
	//param[3] = 3;
	//param[4] = 4;
	delete param[x];
	for (var key in param)  {
		document.getElementById(elem_pref+key).style.height = '0px';
	}
}
function child_nodes(id) {
	var elems = document.getElementById(id);
	var num_link = elems.childNodes.length*css_block;
	//alert(num_link);
	return num_link;
}
