//	POPUP --------------------------------------------------
function irA(cadena){
	window.document.flash.SetVariable("seccion", cadena);
	window.document.flash.TCallLabel("/","cambiar");
}

function pop(a,w,h){ 
	l=(screen.width-w)/2; 
	t=(screen.height-h)/2; 
	property="scrollbars=no,width="+w+",height="+h+",top="+t+",left="+l; 
	window.open(a,"_blank",property); 
}

//	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);
	shake_xy(10,popup)
}

//	SHAKES DE VENTANA -----------------------------------------
function shake_xy(n,quien) {
	if (quien==null) quien = window;
	if (quien.moveBy) {
		for (i = n; i> 0; i--) {
			quien.moveBy(0,i);
			quien.moveBy(i,0);
			quien.moveBy(0,-i);
			quien.moveBy(-i,0);
		}
	}
}

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 enfocarFlash(){
	if (document.all || navigator.userAgent.indexOf("Safari")!= -1 ){
		var oFlash = document.getElementById('flash');
		if (oFlash != undefined) oFlash.focus();
	}
}


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 dimensionarAFoto(vFoto){
	vAncho = vFoto.width+30;
	vAlto = vFoto.height+60;
	this.resizeWin(vAncho, vAlto);
}

// 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];}
}