/*	
	*******************************************************************************
	@Powered by PERU3D
	@Copyright(c) 2007	
	@Todos los Derechos Reservados	
	@Author Jhon Rhoos <j_hinojosa43@yahoo.es>
	@JavaScript - JSP
	*******************************************************************************	
*/

	var slideCache = new Array();
	function RunSlideShow(pictureName,imageFiles,displaySecs)
	{
		var imageSeparator = imageFiles.indexOf(";");
		var nextImage = imageFiles.substring(0,imageSeparator);
		if (document.all)
		{
			document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
			document.getElementById(pictureName).filters.blendTrans.Apply();
		}
		document.getElementById(pictureName).src = nextImage;
		if (document.all)
		{
			document.getElementById(pictureName).filters.blendTrans.Play();
		}
		var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)
		+ ';' + nextImage;
		setTimeout("RunSlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")",
		displaySecs*1000);
		// Cache the next image to improve performance.
		imageSeparator = futureImages.indexOf(";");
		nextImage = futureImages.substring(0,imageSeparator);
		if (slideCache[nextImage] == null) 
		{
			slideCache[nextImage] = new Image;
			slideCache[nextImage].src = nextImage;
		}
	}

/********************************************************************************************/

	function ValidLoginClub()
	{
		if (trim(document.forms[0].txt_usuario.value) == "")
		{
			alert("Ingrese Usuario Valido");
			document.forms[0].txt_usuario.focus();
			return false;
		}
		
		if (trim(document.forms[0].txt_pwd.value) == "")
		{
			alert("Ingrese Password");
			document.forms[0].txt_pwd.focus();
			return false;
		}
		return true;
	}
	
/********************************************************************************************/

	function ValidUpdateSocio()
	{	
		if (trim(document.forms[0].txt__pwd.value) == "")
		{
			alert("Ingrese Contraseña");
			document.forms[0].txt__pwd.focus();
			return false;
		}
		
		if (trim(document.forms[0].txt__pwd.value) != trim(document.forms[0].txt_pwd_.value))
		{
			alert("Confirmación de Contraseña no Coincide");
			document.forms[0].txt_pwd_.focus();
			return false;
		}
		return true;
	}

/********************************************************************************************/

	function msg_box(msg)
	{
		alert(msg);
	}
	
/********************************************************************************************/	

   var currentDiv = -1;
   var currentDay = 4;
   function getDayNameObject (id){}	
	
   function UpdateDayName ()
	{
		var yri = document.Compose.StartYear.selectedIndex;
		var dyi = document.Compose.StartDay.selectedIndex;
		var mn = document.Compose.StartMon.selectedIndex;
		var dy = document.Compose.StartDay.options[dyi].value;
		var yr = document.Compose.StartYear.options[yri].value;
		var dt = new Date (yr, mn, dy);
		if (mn != dt.getMonth())
		{
			document.Compose.StartMon.selectedIndex = dt.getMonth();
			document.Compose.StartDay.selectedIndex = dt.getDate() - 1;
		}
		var newDay = dt.getDay();
		if (currentDay != newDay)
		{
			if (currentDay >= 0 && currentDay < 7)
			{
				if (currentDiv == -1)
					currentDiv = getDayNameObject(currentDay);				
			}
		}
	}
	
	function SyncSeriesStartDate( )
	{
		UpdateDayName();
		if ( document.Compose.ED_act == null )
			return;
		if ( document.Compose.ED_act[ 0 ].checked )
		{
			document.Compose.SeriesStartMon.selectedIndex = document.Compose.StartMon.selectedIndex;
			document.Compose.SeriesStartDay.selectedIndex = document.Compose.StartDay.selectedIndex;
			document.Compose.SeriesStartYear.selectedIndex = document.Compose.StartYear.selectedIndex;
		}
	}
	
/********************************************************************************************/
	function ValidEventos()
	{		
		if (trim(document.forms[0].txt_evento.value) == "")
		{
			alert("Ingrese Nombre del Evento");
			document.forms[0].txt_evento.focus();
			return false;
		}
		
		if (trim(document.forms[0].tipo_evento.value) == "Seleccionar")
		{
			alert("Seleccione Tipo de Evento");
			document.forms[0].tipo_evento.focus();
			return false;
		}
		
		if (trim(document.forms[0].txt_nota.value) == "")
		{
			alert("Ingrese Nota ");
			document.forms[0].txt_nota.focus();
			return false;
		}
		return true;
	}
	
	function Alert_DeleteEvento(Msgbox, IdPach, theURL, cadena)
	{
		if(confirm(Msgbox))
		{			
			window.location.href=theURL+"?ac="+ cadena +"&src="+IdPach;
		} 		
	}
	
	/***************************************************************************/
	
	function load_imajes(img, ancho, alto)
	{
		var ventana;
		derecha=(screen.width-ancho)/2;
		arriba=(screen.height-alto)/2;	
		string="toolbar=0,scrollbars=1,location=0,scroll=1,statusbar=1,menubar=0,resizable=1,width="+ancho+",height="+alto+",left="+derecha+",top="+arriba+"";		
		ventana=window.open(img,"",string);		
		ventana.document.write('<html><head><title>CLUB TERRAZAS .:: Imagen</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" toolbar=1 scroll="1" onUnload="opener.cont=0"><img src="' + img + '" onLoad="opener.redimensionar(this.width, this.height)">'); 
		ventana.document.close() ;
		
		function redimensionar(ancho,alto) 
		{ 
			ventana.resizeTo(ancho+12,alto+28) 
			ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2)
		} 
	}