// JavaScript Document


function DesplegarSeccion(id) {
    //var elem = document.getElementById('d' + id);
    var elem = eval('document.getElementById("' + id + '")');
    if (elem) {
        if (elem.style.display != 'block') {
            elem.style.display = 'block';
            elem.style.visibility = 'visible';
        }
        else {
            elem.style.display = 'none';
            elem.style.visibility = 'hidden';
        }
    }
}

function getAlturaPantalla()
{
	var alturaPantalla=600;
	if (window.innerHeight){
   //navegadores basados en mozilla
     alturaPantalla= window.innerHeight ;
   
	}
	else{
   		if (document.body.clientHeight){
       		//Navegadores basados en IExplorer, es que no tengo innerheight
	       alturaPantalla = document.body.clientHeight 
   		}
	}
	return alturaPantalla;
}

function getAnchoPantalla()
{
	var anchoPantalla=800;
	if (window.innerWidth){
   //navegadores basados en mozilla
     anchoPantalla= window.innerWidth ;
   
	}
	else{
   		if (document.body.clientWidth){
       		//Navegadores basados en IExplorer, es que no tengo innerheight
	       anchoPantalla = document.body.clientWidth
   		}
	}
	return anchoPantalla;
}

function setAlturaContenedor(sNombreContenedor,vAlturaElemento,vAlturaResto)
{
	var contenedor=document.getElementById(sNombreContenedor)
	var alturaContenedor=0;
	if (vAlturaElemento>0)
	{
		alturaContenedor=vAlturaElemento;
	}
	else
	{
		var alturaRestoElementos=180; //Capçalera + espai + peu
		if (vAlturaResto>0)	{alturaRestoElementos=vAlturaResto;}
		var alturaPantalla=getAlturaPantalla();
		//alert(alturaRestoElementos);
		alturaContenedor = alturaPantalla - alturaRestoElementos;
		//alert(alturaContenedor);
	}
	contenedor.style.height=alturaContenedor + 'px';
}
function setAnchoContenedor(sNombreContenedor,vAnchoElemento,vAnchoResto)
{
	var contenedor=document.getElementById(sNombreContenedor)
	var anchoContenedor=0;
	if (vAnchoElemento>0)
	{
		anchoContenedor=vAnchoElemento;
	}
	else
	{
		var anchoRestoElementos=180; //Capçalera + espai + peu
		if (vAnchoResto>0)	{anchoRestoElementos=vAnchoResto;}
		var anchoPantalla=getAnchoPantalla();
		//alert(alturaRestoElementos);
		anchoContenedor = anchoPantalla - anchoRestoElementos;
		//alert(alturaContenedor);
	}
	contenedor.style.width=anchoContenedor + 'px';
}
//Redimensiona alçada
function resizeID(id, restar,sWidthHeight) {
    var viewportwidth;
    var viewportheight;

    // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

    if (typeof window.innerWidth != 'undefined') {
        viewportwidth = window.innerWidth;
        viewportheight = window.innerHeight;
    }

    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

    else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
        viewportwidth = document.documentElement.clientWidth;
        viewportheight = document.documentElement.clientHeight;
    }

    // older versions of IE

    else {
        viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
        viewportheight = document.getElementsByTagName('body')[0].clientHeight;
    }
    if (sWidthHeight == "H") {
        document.getElementById(id).style.height = viewportheight - restar + "px";
    }
    else {
        document.getElementById(id).style.width = viewportwidth - restar + "px";
    }
}
