// JavaScript Document
// Función necesaria para generar el objeto para AJAX
function objetus() {
	// declaramos la variable a false para que todo lo demas funcione
	var objetus=false;
	try {
			// Probamos a crear objeto para IE
			objetus= new ActiveXObject("Microsoft.XMLHTTP");
		}
	catch (e)
	{
		try {
			// probamos a crear objeto para no IE
			objetus = new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch (E)
			{
				objetus= false;
			}
		}
		if (!objetus && typeof XMLHttpRequest!='undefined')
		{
			objetus = new XMLHttpRequest();
		}
	return objetus
}

// Función que carga el desplegable de subcategorias de lo que cambias
function CargaImagen(op){
	//creamos el objeto
	_objetus=objetus();
	//document.getElementById('imagen').innerHTML="<div id='imagen'><p class='texto'>Cargando</p></div>";
	//cargamos una varible con las variables que vamos a enviar
	_URL_="cargarimagen.php?codigo="+op;
	
	// Lanzamos la ejecución para recuperar las subcategorias
	_objetus.open("GET",_URL_,true);
	//una vez enviado los valores inmediatamente llamamos a la propiedad onreadystatechange
	_objetus.onreadystatechange=function()
	{
		//dentro de la funcion comprobamos el estado del proceso
		//si es 4 (terminado) pedimos lo que nos han mandado
		if (_objetus.readyState==4)
		{                
			//usamos la propiedad responseText para recibir el campo select con las subcategorias
			document.getElementById('imagen').innerHTML=_objetus.responseText;
		}
	}
	//obligatorio .... luego explicarč el porque
	_objetus.send(null);
}





function color1(celda){ 
   celda.style.backgroundColor="#e6ddd1" 
} 
function color2(celda){ 
   celda.style.backgroundColor="#a28156" 
} 

var isNav, isIE, isNav2;
var coll = "";
var coy = "";
var styleObj = "";


if (navigator.appVersion.charAt(0) == "5")
 { if (navigator.appName == "Netscape") { 
    isNav2 = true
	coy = "getElementById('"; styleObj = "').style";
   } 
}
else
{ if (navigator.appName == "Netscape") { 
    isNav = true 
	coy = "layers['";styleObj = "']"; 
   } 
else 
	{isIE = true; coll = "all['"; styleObj = "'].style";}
}

function getObject(obj) {
	var theObj;
    if( typeof obj == "string" )
	{theObj = eval("document." + coll + coy  + obj +  styleObj);}
    else {theObj = obj;}return theObj;}

function show(obj) {
   var theObj = getObject(obj);
   if( isNav2 || isNav ) {theObj.visibility = "";}
   else {theObj.visibility = "";}
}

function hide(obj) {
	var theObj = getObject(obj);
   if( isNav2 ) theObj.visibility = "hidden";
   else if ( isNav) theObj.visibility = "hide";
   else theObj.visibility = "hidden";
}
