//Funciones de Dreamwaver generales y compatibilidad con navegadores y OS

//Variables Globales
var miFecha = new Date();
var intDiaDeSemana;
var DiaDeSemana = new Array(7);
	DiaDeSemana[0] = "Domingo";
	DiaDeSemana[1] = "Lunes";
	DiaDeSemana[2] = "Martes";
	DiaDeSemana[3] = "Miércoles";
	DiaDeSemana[4] = "Jueves";
	DiaDeSemana[5] = "Viernes";
	DiaDeSemana[6] = "Sábado";

var MesDelAno = new Array(12);
	MesDelAno[0] = "Enero";
	MesDelAno[1] = "Febrero";
	MesDelAno[2] = "Marzo";
	MesDelAno[3] = "Abril";
	MesDelAno[4] = "Mayo";
	MesDelAno[5] = "Junio";
	MesDelAno[6] = "Julio";
	MesDelAno[7] = "Agosto";
	MesDelAno[8] = "Septiembre";
	MesDelAno[9] = "Octubre";
	MesDelAno[10] = "Noviembre";
	MesDelAno[11] = "Diciembre";



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;
}

//Cambiar contenido de layer, sea texto o cualquier otro contenido
function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}


//Mostrar o esconder layer... por parametro se pasa N cantidad de layers a esconder o a mostrar
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

//abrir ventanas PopUps
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//Precarga las imagenes
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];}}
}

//Restora las imagenes
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;
}

//Cambia imagenes entre ellas
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];}
}

// Para el JUMP menu
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

//Muestra un mensaje
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}


function mostrarFecha (intDia, intMes, intAno, intHora,intMinuto,intSecond,intNoDia)
{
	otraFecha = new Date();		
	miFecha.setFullYear (intAno, intMes-1, intDia);
	//miFecha.setFullYear (otraFecha.getFullYear(), otraFecha.getMonth(), otraFecha.getDate());
	//alert ('ano: ' +miFecha.getFullYear() + ', mes:' + miFecha.getMonth() + ', dia:'+ intDia + '\n' + miFecha );

	
	miFecha.setHours(intHora, intMinuto);
	miFecha.setSeconds(intSecond); 
	//miFecha.setHours(otraFecha.getHours(),otraFecha.getMinutes());
	intDiaDeSemana = intNoDia-1;
	/*if (intNoDia)
		//intDiaDeSemana = intNoDia;
		intDiaDeSemana = otraFecha.getDay()+1;
	else
		intDiaDeSemana = otraFecha.getDay()+1;
	*/
	UR_Start();
	
}
function UR_Start() 
{
	var mFecha = new Date();
	//alert(miFecha.getSeconds());
	//if (mFecha.getSeconds() != miFecha.getSeconds())
	//{
		
		miFecha.setSeconds(miFecha.getSeconds()+1);
		UR_Indhold = showFilled(miFecha.getHours()) + ":" + showFilled(miFecha.getMinutes()) + ":" + showFilled (miFecha.getSeconds()) + " | " + DiaDeSemana[intDiaDeSemana] + " " + miFecha.getDate() + " de " + MesDelAno[miFecha.getMonth()] + " de " + miFecha.getFullYear();
		MM_setTextOfLayer('time','', UR_Indhold);
	//}
	setTimeout("UR_Start()",1000);
}
function showFilled(Value) 
{
	return (Value > 9) ? "" + Value : "0" + Value;
}

function galeriaAtras( strNombreImagen, strNombreLayer, arrFoto, arrTexto)
{
			intFotoActual--;
		
			if (intFotoActual < 0)
				intFotoActual = (arrFoto.length - 1);
		
			MM_swapImage(strNombreImagen,'',arrFoto[intFotoActual],0);
			MM_setTextOfLayer(strNombreLayer,'', intFotoActual + ' ' + arrTexto[intFotoActual] );
}	
	
function galeriaAdelante (strNombreImagen, strNombreLayer, arrFoto, arrTexto)
{
		intFotoActual++;
		
		if (intFotoActual >= arrFoto.length)
			intFotoActual = 0;
		
		MM_swapImage(strNombreImagen,'',arrFoto[intFotoActual],0);
		MM_setTextOfLayer(strNombreLayer,'', intFotoActual + ' ' + arrTexto[intFotoActual] );
}
	
function galeriaSetFoto (strNombreImagen, strNombreLayer, arrFoto, arrTexto)
{
		MM_swapImage(strNombreImagen,'',arrFoto[intFotoActual],0);
		MM_setTextOfLayer(strNombreLayer,'', intFotoActual + ' ' + arrTexto[intFotoActual] );
}

/**************************************************************************************
* Funcion para cambiar las solapas del horoscopo en ENTRETENIMIENTO -> Estilos
*****************************************************************************************/
function cambiarHoroscopo (intIndex){
	var miTexto;
	
	miTexto = '<div class="tituloHoroscopo"><img src="' + imgHoroscopo[intIndex] + '" align="absmiddle" />' + tituloHoroscopo[intIndex] + '</div>' + textoHoroscopo[intIndex] +  ' ';

	MM_setTextOfLayer('contenidoHoroscopo','',miTexto);

}

/**************************************************************************************
* Funcion para cambiar las solapas del horoscopo en ENTRETENIMIENTO -> Estilos
*****************************************************************************************/
function cambiarEventos(intIndex){
	var miTexto;
	
	miTexto = '<table width="100%" border="0" cellspacing="0" cellpadding="0">' +
			  '<tr><td width="39%" align="left" valign="middle"><img src="' + imgEventos[intIndex] + '" width="50" hspace="2" vspace="0" border="0"></td>' + 
			  '<td width="61%" align="center" valign="middle" class="tituloEventos">' + tituloEventos[intIndex] + '</td>' +
			  '</tr></table>' + textoEventos[intIndex] ;
			 
	MM_setTextOfLayer('contenidoEventos','',miTexto);

}