//	POPUP --------------------------------------------------
function irA(cadena){
	window.document.flash.SetVariable("seccion", cadena);
	window.document.flash.TCallLabel("/","cambiar");
}

function pop(a,w,h,t){ 
	l=(screen.width-w)/2; 
	t=(screen.height-h)/2;
	if (t==undefined) t="_blank";
	property="width="+w+",height="+h+",top="+t+",left="+l; 
	var vPopup = window.open(a,t,property);
	if (vPopup == undefined) alert("No se pudo abrir la ventana. Asegrate de no tener un bloqueador de ventanas habilitado.");
	vPopup.focus();
}

//	REDIMENSIONAR VENTANA AL CENTRO --------------------------
function resizeWin(w, h) {
	window.resizeTo(w, h);
	window.moveTo((screen.width - w) / 2, (screen.height - (h + 28)) / 2);
}

//	FULLSCREEN ------------------------------------------------
function launchFull(url,name) {
	//alert(name);
	var str = "scrollbars=no,left=0,screenX=0,top=0,screenY=0";

	var ah = (window.screen)?(window.screen.availHeight - 30):770;
	var aw = (window.screen)?(window.screen.availWidth - 10):590;
	str += ",height=" + ah;
	str += ",innerHeight=" + ah;
	str += ",width=" + aw;
	str += ",innerWidth=" + aw;
	str += ",location";
	str += ",resizable";

	ventanaFull = window.open(url, name, str);
	ventanaFull.focus();		
}

//	ABRE POPUP EN EL OPENER -----------------------------------
function popupOpener(URLtoOpen,ancho,alto) {
	var popup = window.open(URLtoOpen, "popup", "resizeable=0,status=0,width=" + ancho + ",height=" + alto + ",scrollbars=no");
	popup.focus();
	popup.moveTo((screen.width - ancho) / 2, (screen.height - (alto + 50)) / 2);
}

function ampliarIframe(bSentido) {
	var vIframe = document.getElementById("detector");
	vIframe.style.display = bSentido?"":"none";
	vIframe.style.height = bSentido?"30px":"1px";
}

function detectarFlash() {
	var vIframe = document.getElementById("detector");
	var vLocation = vIframe.contentWindow.document.location;
	if (String(vLocation).indexOf("flash_no.htm") != -1){
		vIframe.style.height="0px";
		vIframe.src = "htm/detector.htm";
	}
}


// parametros
function traerParametro(nombre){
	var strURL = String(document.location);
	var listaSplit = strURL.split("?")
	if(listaSplit.length > 1) {
		var params = listaSplit[1];
		var buscamos = nombre + "=";
		if (params.length > 0) {
			if (nombre == undefined) return(params);
			i = params.indexOf(buscamos);
			if (i != -1) {
				i += buscamos.length;
				j = params.indexOf("&", i);
				if (j == -1)
				j = params.length;
				return (params.substring(i,j));
			}else{
				return -1
			}
		}else{
			return -1
		}
	}else{
		return -1
	}
}


function cargarFoto(){
	var vUrlFoto = traerParametro("urlFoto");	
	document.getElementById("div_foto").innerHTML = "<img id='img_foto' onLoad='dimensionarAFoto(this);' >";
	var vFoto = document.getElementById("img_foto");
	vFoto.src = vUrlFoto;
}

function cargarWallpaper(){
	var vUrlFoto = traerParametro("urlFoto");
	document.getElementById("div_foto").innerHTML = "<img id='img_foto' >"; 
	var vFoto = document.getElementById("img_foto");
	vFoto.src = vUrlFoto;
}

function dimensionarAFoto(vFoto){
	vAncho = vFoto.width+60;
	vAlto = vFoto.height+150;
	this.resizeWin(vAncho, vAlto);
}

function startup(sNombre){
	if (sNombre == undefined) sNombre = "home.swf";
	var vParams = traerParametro();
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%" id="objectFlash" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + sNombre + '" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="BGCOLOR" value="#FFFFFF"><param name="scale" value="noscale" /><param name="flashvars" value="' +  ((vParams == -1)?'':('&'+vParams)) + '" /><param name="align" value="middle" /><param name="salign" value="m" /><embed src="' + sNombre + '" width="100%" height="100%" loop="false" align="middle" quality="high" scale="noscale" salign="m" name="home" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="' + ((vParams == -1)?'':('&'+vParams)) + '" bgcolor="#FFFFFF" /></object>');
}

function randomImage (cantidadFotos) {
	var nElegida = Math.floor(Math.random() * cantidadFotos) + 1;
	document.getElementById('imagen').src = ('images/entrar_0' + nElegida + '.gif');
	
	var aCoordsMapa = [
					   ["524,111,739,217" , "554,250,611,269" , "611,250,658,269" , "656,250,726,269" , "561,318,661,335" , "561,334,704,352"],
					   ["173,156,388,262" , "201,287,258,306" , "257,287,305,306" , "304,287,374,306" , "208,358,308,375" , "208,374,351,392"],
					   ["340,142,555,248" , "371,276,428,295" , "427,276,475,295" , "474,276,544,295" , "374,338,474,355" , "374,354,517,372"],
					   ["340,162,555,269" , "371,296,428,315" , "427,296,475,315" , "474,296,544,315" , "374,362,474,379" , "374,378,517,396"],
					   
					   ];
	var aCoordsElegidas = aCoordsMapa[nElegida-1];
	document.getElementById('mapa').coords = aCoordsElegidas[0];
	document.getElementById('mapa_es').coords = aCoordsElegidas[1];
	document.getElementById('mapa_en').coords = aCoordsElegidas[2];
	document.getElementById('mapa_pt').coords = aCoordsElegidas[3];
	document.getElementById('mapa_flash').coords = aCoordsElegidas[4];
	document.getElementById('mapa_kbz').coords = aCoordsElegidas[5];
	
}

// roll over de imagenes escrito por dreamweaver

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
