
// Preload automatico de imagenes

function ImagePreload(imgArray) {
	for (i=0; i<document.images.length; i++) {
		if (document.images[i].onmouseover != null) {
			obj = document.images[i];
			var im = obj.src.substr(obj.src.length-5,1);
			(im==0) ? imo = 1 : imo = 0
			last = obj.src.lastIndexOf("/")+1;
			path = obj.src.substr(0,last)
			nimg = path + obj.src.substr(last,obj.src.length-5-last) + imo + obj.src.substr(obj.src.length-4,4);
			eval("var nimg_" + i + " = new Image();");
			eval("nimg_" + i + ".src = nimg;");
		}
	}
}

function roll(obj, id) {
	if (typeof(obj) == "string") obj = document.getElementById(obj);
	obj.style.cursor = "pointer";
	var im = obj.src.substr(obj.src.length-5,1);
	if (id==null) (im==0) ? id = 1 : id = 0
	last = obj.src.lastIndexOf("/")+1;
	path = obj.src.substr(0,last)
	nimg = path + obj.src.substr(last,obj.src.length-5-last) + id + obj.src.substr(obj.src.length-4,4);
	obj.src = nimg;
}


function _browser(str) {
	(navigator.userAgent.toLowerCase().indexOf(str)+1) ? ret = true : ret = false;
	return ret;
}


function _SWFZoom(d) {
	/*
	if (_browser("msie")==false) {
		alert("Para modificar el tamaņo del juego se necesita Internet Explorer :(");
		return;
	}
	*/
	//obj0 = document.getElementById("juego_flash");
	if (_browser("msie")==true) {
	 obj1 = document.getElementById("FlashGame");
	}
	else {
	 obj2 = document.getElementById("FlashGame2");
	}
	if (_browser("msie")==true) {
	 nw = obj1.width;
   nh = obj1.height;
	}
	else {
	 nw = obj2.width;
   nh = obj2.height;
	}
	
  porc = nh / nw;
  if (nw == 850 && d==1) {
		incw = 50;  // cambiar tamaņo - ver esto!!!
	}
	else if (nw == 900 && d==0){
    incw = 50;
  }
	else {
	  incw = 65;
  }
	inch = Math.round(incw * porc);
	if (d==0) {
	 if (nw > 350) {
		nw = nw*1 - incw;
		nh = nh*1 - inch;
	 }
	} else {
	 if (nw < 860) {
		nw = nw*1 + incw;
		nh = nh*1 + inch;
	 }
	}
	
	if (_browser("msie")==true) {
	 obj1.width = nw;
	 obj1.height = nh;
	}
	else {
	 obj2.width = nw;
	 obj2.height = nh;
	}

//	_WResize(nw, nh);
}


/*
function _WResize(resw, resh) {
	resw = resw+190;
	resh = resh+330;
	if (resw>screen.width) {
		resw=screen.width-50;
	} else if(resw<640) {
		resw = 640;
	}


	if ((resh+60)>screen.height) { 
	resh=(screen.height-80);
	} else if(resh<400) { 
	resh = 400;
	}


	if (_browser("opera")) {
		resh = resh-29;
	} else if(_browser("mozilla/5.0")) {
		resw = resw;
		resh = resh-7;
	}
	self.resizeTo(resw,resh);
}
*/




