// JavaScript Document

function preCarga() {
	if (!document.images) return;
		var ar = new Array();
		var argumentos = preload.argumentos;
		for (var i = 0; i < argumentos.length; i++) {
		ar[i] = new Image();
		ar[i].src = argumentos[i];
	}
}

function change(obj, img, id){
	obj.src=img;

	/*	La capa es el objeto imagen que cambiara a blanco */	
	var capa = getObject(id);
	if(capa){
		/**
		* Separo la url por medio de las 	
		* barras y busco el directorio img
		*/
		var coll 		= null;
		var fichero 	= null;
		var extencion 	= null;	
		var tempFile 	= null;
		var tipo 		= null;
		var collection	= capa.src.split("/");
		
		for(var i=0;i<collection.length; i++){
			if(collection[i] == "img"){
				var j =parseInt(i+1);
				/*	separo del fichero la extencion	*/
				coll 		= collection[j].split(".");
				fichero 	= "img/"+coll[0];
				extencion 	= coll[1];	
				break;
			}
		}
		/**
		* dado que el fichero y el id son iguales 
		* salvo por la terminacion 2 de dicho fichero
		*/
		tipo = fichero.substring(fichero.length -1,fichero.length);	
		if(tipo != "2")	tempFile = fichero.substring(0,fichero.length)+"2."+extencion;	
		else tempFile = fichero.substring(0,fichero.length-1)+"."+extencion;	
		
		capa.src = tempFile;
	}
	
}
	

/**
* Si existe el objeto lo 
* retorno, en su defecto false
*/
function getObject(id){
	try{
		var obj = document.getElementById(id);
		return obj;
	}catch(e){
		return false;	
	}	
}

function showLayer(id){
	var capa = getObject(id);
	capa.style.display = "block";
}

function showDimensiones(id){
	var navegador = navigator.appName 
	var capa = getObject(id);
	if (navegador != "Microsoft Internet Explorer"){
		capa.style.top	="0px";
		capa.style.left	="0px";
	}
	capa.style.display = "block";
}


function showLayerHidden(show,hidden){
	var img = Array("dimension1","dimension2")
	
	var navegador = navigator.appName 
	var capa = getObject("dim");
	if (navegador == "Microsoft Internet Explorer"){
		capa.style.top	="0px";
		capa.style.left	="0px";
		capa.style.position = "absolute";
	}
	
	obj = getObject(img[show]);
	obj.style.display = "block"
	
	obj = getObject(img[hidden]);
	obj.style.display = "none"
}


function hidden(id){
	
	var capa = getObject(id);
	capa.style.display = "none";
}


/*	Cargo las imagenes que quiero y las inicializo */
window.onload=" preCarga('img/empresaSectionMenu.jpg', 'img/empresaSectionMenu2.jpg', 'img/catalogoSectionMenu.jpg', 'img/catalogoSectionMenu2.jpg','img/contactoSectionMenu.jpg', 'img/contactoSectionMenu2.jpg','img/enlacesSectionMenu.jpg',  'img/enlacesSectionMenu2.jpg','img/empresaSection.jpg', 'img/empresaSection2.jpg', 'img/catalogoSection.jpg', 'img/catalogoSection2.jpg', 'img/contactoSection.jpg', 'img/contactoSection2.jpg', 'img/enlacesSection.jpg', 'img/enlacesSection2.jpg');" ;