function fechaelemento(pai, filho){
	pai = document.getElementById(pai);
	filho = document.getElementById(filho);
	//elm.style.visibility = "hidden";
	pai.removeChild(filho);
}

function ocultaelemento(elemento){
	elemento = document.getElementById(elemento);
	elemento.style.visibility = "hidden";
}

function retiraelemento(elemento){
	elemento = document.getElementById(elemento);
	elemento.style.display = "none";
}


function mostraelemento(elemento){
	el = document.getElementById(elemento);
	if(el.style.display != "block"){
	el.style.display = "block";
	}else{
	el.style.display = "none";
	}
}

function trocaelemento(elemento1, elemento2, elemento3, elemento4){
	elemento1 = document.getElementById(elemento1);
	elemento2 = document.getElementById(elemento2);
	elemento3 = document.getElementById(elemento3);
	elemento4 = document.getElementById(elemento4);
	elemento1.style.display = "block";
	elemento2.style.display = "none";
	elemento3.style.display = "none";
	elemento4.style.display = "none";
}

function overlayon(mostradiv){
	xoverlay = document.getElementById("overlay");
	mdiv = document.getElementById(mostradiv);
	xoverlay.style.display = "block";
	mdiv.style.display = "block";
}


function overlayoff(ocultadiv){
	xoverlay = document.getElementById("overlay");
	mdiv = document.getElementById(ocultadiv);
	xoverlay.style.display = "none";
	mdiv.style.display = "none";

	
}

function rand( min, max ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Leslie Hoare
    // +   bugfixed by: Onno Marsman
    // *     example 1: rand(1, 1);
    // *     returns 1: 1
    var argc = arguments.length;
    if (argc == 0) {
        min = 0;
        max = 2147483647;
    } else if (argc == 1) {
        throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');
    }
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
