subsel=0;

function ver(n,ocultar){
  var paso= 10;
  var ocultar= ocultar || false;
  if (document.getElementById('submenu_'+n)){
    var alto= parseInt(document.getElementById('submenu_'+n).style.height);
    if (ocultar) {
      if (alto > (2+paso)) {
        document.getElementById('submenu_'+n).style.height= (alto-paso) + 'px';
        document.getElementById('submenu_base_'+n).style.height= (alto-paso) + 'px';
        document.getElementById('submenu_base_img_'+n).style.height= (alto-paso) + 'px';
        setTimeout('ver('+n+',true)',1);
      } else {
        document.getElementById('submenu_'+n).style.height= '2px';
        document.getElementById('submenu_base_'+n).style.height= '2px';
        document.getElementById('submenu_base_img_'+n).style.height= '2px';
      }
    } else {
      var maximos= new Array(0,96,0,0,54,117);
      var maximo= maximos[parseInt(n)];
      if (alto < (maximo-paso)) {
        document.getElementById('submenu_'+n).style.height= (alto+paso) + 'px';
        document.getElementById('submenu_base_'+n).style.height= (alto+paso) + 'px';
        document.getElementById('submenu_base_img_'+n).style.height= (alto+paso) + 'px';
        setTimeout('ver('+n+',false)',1);
      } else {
        document.getElementById('submenu_'+n).style.height= maximo + 'px';
        document.getElementById('submenu_base_'+n).style.height= maximo + 'px';
        document.getElementById('submenu_base_img_'+n).style.height= maximo + 'px';
      }
    }
  }
}

function verSubmenu(n){
  var n= n || 0;
  if (n == subsel){
    ver(n,true);
    subsel=0;
  } else {
    ver(subsel,true);
    ver(n,false);
    subsel= n;
  }
}


function createReqObj() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer") {
		ro = new ActiveXObject("Microsoft.XMLHTTP");	
	} else {
		ro = new XMLHttpRequest();	
	}
	return ro;
}
http_sound= createReqObj();

function  sonido (off) {
  var rnd= Math.floor(Math.random()*100000);
	var url_envio = 'activarSonido.php?rnd='+rnd+'&off='+off;
	http_sound.open('get',url_envio, true);
	http_sound.onreadystatechange = handleSonido;
	http_sound.send(null);
}
function handleSonido () {
}
