function estado(what){
    var type;
	if (document.all) type="IE"; 
	//For Opera 
	if (navigator.userAgent.indexOf("Opera")!=-1
	    && document.getElementById) type="OP"; 
	//For Netscape version 4
	if (document.layers) type="NN"; 
	//Mozila e.g. Netscape 6 upwards
	if (!document.all && document.getElementById) type="MO"; 
		
	if (type=="IE"){		
		return eval("document.all." + what + ".style.visibility");
	}
	if (type=="NN"){
		return eval("document." + what + ".visibility");
	}
	if (type=="MO" || type=="OP"){
		return eval("document.getElementById('" + what + "').style.visibility");
	}
	
}

function cambiarVisibilidad(what_orig, dejarPosicion, actionForced){
	//for (i=0;i<num_filas;i++){
		what = what_orig ;//+ '_campos';//_' + i;
		if (actionForced==undefined)
			if (estado(what)=='hidden')
				action = 'visible';
			else
				action = 'hidden';
		else
			action = actionForced;
			
		if (!dejarPosicion)
			cambiarPosicion (what,action);	
		
	    var type;
		if (document.all) type="IE"; 
		//For Opera 
		if (navigator.userAgent.indexOf("Opera")!=-1
		    && document.getElementById) type="OP"; 
		//For Netscape version 4
		if (document.layers) type="NN"; 
		//Mozila e.g. Netscape 6 upwards
		if (!document.all && document.getElementById) type="MO"; 
			
		if (type=="IE"){		
			eval("document.all." + what + ".style.visibility='" + action + "'");
		}
		if (type=="NN"){
			eval("document." + what + ".visibility='" + action + "'");
		}
		if (type=="MO" || type=="OP"){
			eval("document.getElementById('" + what + "').style.visibility='" + action + "'");
		}
	//}
	
}

function cambiarPosicion(what, action){
	if (action=='visible')
		action = 'relative';
	else
		action = 'absolute';
		
    var type;
	if (document.all) type="IE"; 
	//For Opera 
	if (navigator.userAgent.indexOf("Opera")!=-1
	    && document.getElementById) type="OP"; 
	//For Netscape version 4
	if (document.layers) type="NN"; 
	//Mozila e.g. Netscape 6 upwards
	if (!document.all && document.getElementById) type="MO"; 
		
	if (type=="IE"){		
		eval("document.all." + what + ".style.position='" + action + "'");
	}
	if (type=="NN"){
		eval("document." + what + ".position='" + action + "'");
	}
	if (type=="MO" || type=="OP"){
		eval("document.getElementById('" + what + "').style.position='" + action + "'");
	}
	
}

//Centramos el div cargando

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
} // changeObjectVisibility

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	styleObject.top = newYCoordinate;
	return true;
    } else {
	// we couldn't find the object, so we can't very well move it
	return false;
    }
} // moveObject

function centrar(what){
	
	estilo = getStyleObject(what);

	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}	
	estilo.top = (y-250) /2;
	estilo.left = (x-250) /2;

}

function moverA(what,Xpos,Ypos){	
	estilo = getStyleObject(what);
	estilo.top = Ypos;
	estilo.left = Xpos;

}
