var strx = screen.availWidth;
var stry = screen.availHeight;
setTam();
function setTam () {
	var Top=0;
	var Left=0;
	if(Top <0) Top = 0;
	if(Left <0)Left = 0;
	window.resizeTo(strx,stry)
	window.moveTo(Left,Top)
	window.focus ();
	return;
}

var elementsLoadList = new Array();
function initImages() {
	for(var i = 0; i < elementsLoadList.length; i++) {
		if(elementsLoadList[i][0] == 1 || elementsLoadList[i][0] == 2) {
			var imageLoad = new Image();
			imageLoad.src = elementsLoadList[i][2];
		}
	}
	for(var i = 0; i < elementsLoadList.length; i++) {
		switch(elementsLoadList[i][0]) {
			case 1:
				var imageId = elementsLoadList[i][1];
				var image = document.getElementById(imageId);
				image.src = elementsLoadList[i][2];
				if(elementsLoadList[i][3] && elementsLoadList[i][4]) {
					recargarImagen(image, elementsLoadList[i][3], elementsLoadList[i][4]);
				}
				break;
			case 2:
				var table = document.getElementById(elementsLoadList[i][1]);
				table.style.backgroundImage = "url(" + elementsLoadList[i][2] + ")";
				break;
			case 3:
				var td = document.getElementById(elementsLoadList[i][1]);
				td.innerHTML = elementsLoadList[i][2];
				break;
			default:
				break;
		}
	}
}
function recargarImagen(imagen, width, height){
	var isModif = false;
	var realcion = -1;
	if(imagen.width != 0 && imagen.height != 0) {
		relacion = imagen.width/imagen.height;
	}

	if(imagen.width > width || imagen.width == 0) {
		imagen.width = width;
		isMofif = true;
	}
	//if(imagen.height > height || imagen.height == 0) {
		//imagen.height = height;
	//}
	if(isModif && relacion != -1){
		imagen.height = imagen.width*relacion;
	}
    /*
	if(imagen.height > height || imagen.height == 0) {
		imagen.height = height;
		isMofif = true;
	}
	if(isModif && relacion != -1){
		imagen.width = imagen.height/relacion;
	}
	*/
}

function cambioIdiomaDelegado() {
	if(!formPrincipal) alert('No se ha definido el formulario para el cambio de idioma.');
	var formRecarga;
	for(var i = 0; i < document.forms.length; i++) {
		if(formPrincipal == document.forms[i].name) {
			formRecarga = document.forms[i];
		}
	}
	formRecarga.accion.value = CabeceraConstantes.cambioIdioma;
	formRecarga.codIdioma.value = CabeceraConstantes.codIdiomaCambio;
	formRecarga.submit();
}