// JavaScript Document
var RelojID = null
var RelojEjecutandose = false

function DetenerReloj (){
   if (RelojEjecutandose)
     clearTimeout(RelojID)
   RelojEjecutandose = false
}

function Mostrar () {
   var dato = new Date()
   var horas = dato.getHours()
   var minutos = dato.getMinutes()
   var segundos = dato.getSeconds()
   var dia = dato.getDate()
   var year = dato.getYear()
   mes=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
    
   //establece las horas
   if (horas < 10)
      valordato = "Bogotá D.C.,  Latitud= 4º36'43¨ Norte,  Longitud= 74º04'07¨ Oeste, "+" "+dia+" "+"de"+" "+mes[dato.getMonth()]+" "+"de"+" "+"2008,"+" "+" " + horas
   else
      valordato = "Bogotá D.C.,  Latitud= 4º36'43¨ Norte, Longitud= 74º04'07¨ Oeste, "+" "+dia+" "+"de"+" "+mes[dato.getMonth()]+" "+"de"+" "+"2008,"+" "+" " + horas

   //establece los minutos
   if (minutos < 10)
      valordato += ":0" + minutos
   else
      valordato += ":" + minutos

   //establece los segundos
   if (segundos < 10)
      valordato += ":0" + segundos
   else
      valordato += ":" + segundos 
      
	horas = horas+5 
	if (horas > 23)
	  horas = horas - 24
	else
	  horas = horas
	if (minutos < 10)
	  minutos = ":0" + minutos 
	else
	  minutos = ":" + minutos
	if(segundos < 10)
	  segundos = ":0" + segundos
	else 
	  segundos = ":" + segundos   
	    
	          
   valordato += " "+"( " + horas + minutos + " GMT"+")" 

   //aqui seleccionas donde se muestra
   //en el TextBox
   document.reloj.digitos.value=valordato 
   //en la barra de estado
   //window.status = valordato

   RelojID = setTimeout("Mostrar()",1000)
   RelojEjecutandose=true
}

function IniciarReloj () {
   DetenerReloj()
   Mostrar()
}

/*******************************************************
FLASH DETECT 2.5
All code by Ryan Parman and mjac, unless otherwise noted.
(c) 1997-2004 Ryan Parman and mjac
http://www.skyzyx.com
*******************************************************/

// This script will test up to the following version.
flash_versions = 8;

// Initialize variables and arrays
var flash = new Object();
flash.installed=false;
flash.version='0.0';

// Dig through Netscape-compatible plug-ins first.
if (navigator.plugins && navigator.plugins.length) {
	for (x=0; x < navigator.plugins.length; x++) {
		if (navigator.plugins[x].name.indexOf('Shockwave Flash') != -1) {
			flash.version = navigator.plugins[x].description.split('Shockwave Flash ')[1];
			flash.installed = true;
			break;
		}
	}
}

// Then, dig through ActiveX-style plug-ins afterwords
else if (window.ActiveXObject) {
	for (x = 2; x <= flash_versions; x++) {
		try {
			oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
			if(oFlash) {
				flash.installed = true;
				flash.version = x + '.0';
			}
		}
		catch(e) {}
	}
}

// Create sniffing variables in the following style: flash.ver[x]
// Modified by mjac
flash.ver = Array();
for(i = 4; i <= flash_versions; i++) {
	eval("flash.ver[" + i + "] = (flash.installed && parseInt(flash.version) >= " + i + ") ? true : false;");
}


function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no'
win = window.open(mypage,myname,settings)
}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Email inválido")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Email inválido")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Email inválido")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Email inválido")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Email inválido")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Email inválido")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Email inválido")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.frmSample.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Por favor ingrese su email")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }