function Mostrar(elem)
{
        var obj=document.getElementById(elem);
        if (obj!=null)
                obj.style.display='block';
}

function Ocultar(elem)
{
        var obj=document.getElementById(elem);
        if (obj!=null)
                obj.style.display='none';
}

function Rellena(campo,destino)
{
  var td=document.getElementById(destino);
	td.innerHTML=campo;
}

function obri()
{
	Mostrar('menu');
	Mostrar('tanca');
	Ocultar('obri');
}

function tanca()
{
	Ocultar('menu');
	Ocultar('tanca');
	Mostrar('obri');
}



function setSize(elem,alto,ancho){
       var obj=document.getElementById(elem);
       if (obj==undefined)
       {
   	       alert("no existe el elemento "+elem);
               return;
        }
        obj.style.height=alto+'px';
//	obj.style.width=ancho+'px';
}

function setHeight(elem,alto){
       var obj=document.getElementById(elem);
       if (obj==undefined)
       {
   	       alert("no existe el elemento "+elem);
               return;
        }
        obj.style.height=alto+'px';
}

function setWidth(elem,ancho){
       var obj=document.getElementById(elem);
       if (obj==undefined)
       {
   	       alert("no existe el elemento "+elem);
               return;
        }
        obj.style.width=ancho+'px';
}

function alertSize() 
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || 
document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}

var alto0=0;
function Resize()
{
	var alto=0;
	var ancho=0;
	if( typeof( window.innerWidth ) == 'number' ) {
    		//Non-IE
		alto = window.innerHeight+12;
		ancho= window.innerWidth+12;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		alto = document.documentElement.clientHeight;
		ancho = document.documentElement.clientWidth;
 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		alto = document.body.clientHeight;
		ancho=document.body.clientWidth;
  	}

	if (alto>100)
		alto=alto-100;

	// Comprobar el tipo de navegador, en función de eso hay que restar mas o menos
	ancho = ancho-243;
	if (alto!=alto0 || ancho!=ancho0)
	{
                setHeight('container',alto);
                //setHeight('menu',alto);
                //setHeight('obri_tanca',alto);
		//setWidth('cos',ancho);
		alto0=alto;
		ancho0=ancho;
	}
}
