// ----------------------------------------------------------------
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
// ----------------------------------------------------------------
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_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_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_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];}
}

// ----------------------------------------------------------------
function TellFriend() { 
var cgiRecomienda = '/cgi/recomienda.pl';
	cgiRecomienda = cgiRecomienda + "?url=" + document.URL;
	location.href = cgiRecomienda;
	return false;
} 
// ----------------------------------------------------------------
function showmp3flash(urlMp3Flash) {
	var newWin = window.open(urlMp3Flash,"","scrollbars=no,menubar=no,width=440,height=103,resizable=yes,toolbar=no,location=no,status=no");
	if (window.focus) { newWin.focus(); }
}
// ----------------------------------------------------------------
// Con esta rutina se logra crear un objeto del tipo CountDown

function GNCountDown(Prefix, fecha) {

	this.dgUrls = "/disenos/v2/images/digitos/";
	this.dgPrefix = Prefix;
	this.later = new Date(fecha);

	this.dg1 = new Image(); this.dg1.src = this.dgUrls + "dg1.gif";
	this.dg2 = new Image(); this.dg2.src = this.dgUrls + "dg2.gif";
	this.dg3 = new Image(); this.dg3.src = this.dgUrls + "dg3.gif";
	this.dg4 = new Image(); this.dg4.src = this.dgUrls + "dg4.gif";
	this.dg5 = new Image(); this.dg5.src = this.dgUrls + "dg5.gif";
	this.dg6 = new Image(); this.dg6.src = this.dgUrls + "dg6.gif";
	this.dg7 = new Image(); this.dg7.src = this.dgUrls + "dg7.gif";
	this.dg8 = new Image(); this.dg8.src = this.dgUrls + "dg8.gif";
	this.dg9 = new Image(); this.dg9.src = this.dgUrls + "dg9.gif";
	this.dg0 = new Image(); this.dg0.src = this.dgUrls + "dg0.gif";
	this.refreshCountDown = refreshCountDown;
	this.refreshCountDown();
}
// -----------------------------------------------------
// Esta rutina se encarga de refrescar el contador asociado

function refreshCountDown() {
var d1, d2, d3;

	now = new Date();

	if (now <= this.later) {
		days = (this.later - now) / 1000 / 60 / 60 / 24;
		daysRound = Math.floor(days);
		hours = (this.later - now) / 1000 / 60 / 60 - (24 * daysRound);
		hoursRound = Math.floor(hours);

		minutes = (this.later - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
		minutesRound = Math.floor(minutes);
		seconds = (this.later - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
		secondsRound = Math.round(seconds);
	} else {
		daysRound = 0;
		hoursRound = 0;
		minutesRound = 0;
		secondsRound = 0;
	}

	d1 = MM_findObj(this.dgPrefix + "g"); 
	d2 = MM_findObj(this.dgPrefix + "h"); 
	if (secondsRound <= 9) {
		if (d1) { d1.src = this.dg0.src; }
		if (d2) { d2.src = eval("this.dg"+secondsRound+".src"); }
	} else {
		if (d1) { d1.src = eval("this.dg"+Math.floor(secondsRound/10)+".src"); }
		if (d2) { d2.src = eval("this.dg"+(secondsRound%10)+".src"); }
	}

	d1 = MM_findObj(this.dgPrefix + "d"); 
	d2 = MM_findObj(this.dgPrefix + "e"); 
	if (minutesRound <= 9) {
		if (d1) { d1.src = this.dg0.src; }
		if (d2) { d2.src = eval("this.dg"+minutesRound+".src"); }
	} else {
		if (d1) { d1.src = eval("this.dg"+Math.floor(minutesRound/10)+".src"); }
		if (d2) { d2.src = eval("this.dg"+(minutesRound%10)+".src"); }
	}

	d1 = MM_findObj(this.dgPrefix + "y"); 
	d2 = MM_findObj(this.dgPrefix + "z"); 
	if (hoursRound <= 9) {
		if (d1) { d1.src = this.dg0.src; }
		if (d2) { d2.src = eval("this.dg"+hoursRound+".src"); }
	} else {
		if (d1) { d1.src = eval("this.dg"+Math.floor(hoursRound/10)+".src"); }
		if (d2) { d2.src = eval("this.dg"+(hoursRound%10)+".src"); }
	}

	d1 = MM_findObj(this.dgPrefix + "x"); 
	d2 = MM_findObj(this.dgPrefix + "a"); 
	d3 = MM_findObj(this.dgPrefix + "b"); 
	if (daysRound <= 9) {
		if (d1) { d1.src = this.dg0.src; }
		if (d2) { d2.src = this.dg0.src; }
		if (d3) { d3.src = eval("this.dg"+daysRound+".src"); }
	}
	if (daysRound <= 99) {
		if (d1) { d1.src = this.dg0.src; }
		if (d2) { d2.src = eval("this.dg"+Math.floor((daysRound/10)%10)+".src"); }
		if (d3) { d3.src = eval("this.dg"+Math.floor(daysRound%10)+".src"); }
	}

	if (daysRound <= 999){
		if (d1) { d1.src = eval("this.dg"+Math.floor(daysRound/100)+".src"); }
		if (d2) { d2.src = eval("this.dg"+Math.floor((daysRound/10)%10)+".src"); }
		if (d3) { d3.src = eval("this.dg"+Math.floor(daysRound%10)+".src"); }
	}

	// Si nos queda tiempo, entonces se marca para que siga refrescando el contador
	if (daysRound > 0 || hoursRound > 0 || minutesRound > 0 || secondsRound > 0) {
		var instance = this; 
		this.TimeoutID = window.setTimeout(function() { instance.refreshCountDown(); }, 1000);
	}
}
// -----------------------------------------------------
function SetIFrameHeight(o){
var h = 100;
var d = frames[o.name].document;

	if (d.body.scrollHeight != undefined)
		h = d.body.scrollHeight;
	else if (d.height != undefined)
		h = document.height;

	if (d.body.currentStyle) {
		var cS = d.body.currentStyle;
		h += parseInt(cS.marginTop, 10),
		h += parseInt(cS.marginBottom, 10);
	} else if (window.getComputedStyle) {
		h += parseInt(window.getComputedStyle(d.body,"").getPropertyValue("margin-top"),10);
		h += parseInt(window.getComputedStyle(d.body,"").getPropertyValue("margin-bottom"),10);
	}
	o.height = h + "px";
} 
// -----------------------------------------------------
function CargarFoto(img, ancho, alto){
  derecha=(screen.width-ancho)/2;
  arriba=(screen.height-alto)/2;
  string="toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+ancho+",height="+alto+",left="+derecha+",top="+arriba+"";
  fin=window.open(img,"",string);
}
// -----------------------------------------------------
