// JavaScript Document
/*
Objeto Imagen:
Diseñado por Julian Garcia
Procalculo Prosis
Bogota
Colombia
2004
Objeto JavaScript que lleva los valores básicos de un mapa

Nota para newbies: En JavaScript la forma de crear nuevos objetos
es haciendo una funcion y agregando campos con this y una asignacion

*/
// Las funciones tienen que ser cargadas antes de crear el objeto en si
function cambiarTamano(anchoP, altoP)
{
		document.secondary.cuadroMenorX.value = anchoP;
		document.secondary.cuadroMenorY.value = altoP;
		if (validarEstado(document.secondary, 0, 0, 0, 0))
		{	
			this.imagenFija.width = anchoP;
			this.imagenFija.height = altoP;
			this.imagen.width = anchoP;
			this.imagen.height = altoP;
			this.eventos.width = anchoP;
			this.eventos.height = altoP;
			moverLayer("movible",0,0,"imagenFija");
			moverLayer("layerEventos",0,0,"imagenFija");
			moverLayer("recuadro",0,0,"imagenFija");
		}
}

function cambiarImagen(nuevaURL)
{
	this.imagen.src = nuevaURL;
	moverLayer("movible",0,0,"imagenFija");
	restaurarImagen("movible");
}

function ImagenMapa (imagen, imagenFija, eventos, ancho, alto)
{
	// Si imagen es nulo el constructor fue llamado unicamente para crear
	// el prototipo de objeto
	if (imagenFija)
	{
  	  //
      this.imagenFija = imagenFija;

	  // Para que funcione en el visor se debe definir una que se llame anchoMapa y otra altoMapa
      //initialize the styles for the rubberbanding box
      this.imagenFija.width = ancho ? ancho : anchoMapa;
      this.imagenFija.height = alto ? alto : altoMapa;
	}
	if (eventos)
	{
  	  //
      this.eventos = eventos;

	  // Para que funcione en el visor se debe definir una que se llame anchoMapa y otra altoMapa
      //initialize the styles for the rubberbanding box
      this.eventos.width = ancho ? ancho : anchoMapa;
      this.eventos.height = alto ? alto : altoMapa;
	}
	
   if (imagen)
   {
	  //
      this.imagen = imagen;

	  // Para que funcione en el visor se debe definir una que se llame anchoMapa y otra altoMapa
      //initialize the styles for the rubberbanding box
      this.imagen.width = ancho ? ancho : anchoMapa;
      this.imagen.height = alto ? alto : altoMapa;
   }
   
   this.contenido = "finder";
   this.cambiarTamano = cambiarTamano;
   this.cambiarImagen = cambiarImagen;
}