function NavegadorBarraInicio(varid,numimg) {
	document.getElementById(varid).style.cursor="pointer";
	if(numimg=='1'){
		document.getElementById(varid).style.backgroundImage=""
	}
	if(numimg=='2'){
		document.getElementById(varid).style.backgroundImage="url('images/fondobotones.jpg')"
	}
}

function NavegadorOpciones(varid,numimg) {
	document.getElementById(varid).style.cursor="pointer";
	if(numimg=='1'){
		document.getElementById(varid).style.color="#000000";
	}
	if(numimg=='2'){
		document.getElementById(varid).style.color="#FF6600";
	}
}
function NavegadorBanderas(varid,numimg) {
	document.getElementById(varid).style.cursor="pointer";
	if(numimg=='1'){
		//document.getElementById(varid).style.color="#000000";
	}
	if(numimg=='2'){
		//document.getElementById(varid).style.color="#FF6600";
	}
}

function NavegarInteres(vid) {
	document.getElementById(vid).style.cursor="pointer";
}

function NavegadorTodasNoticias(varid,numimg) {
	document.getElementById(varid).style.cursor="pointer";
	if(numimg=='1'){
		document.getElementById(varid).style.color="#000000";
		document.getElementById(varid).style.backgroundColor="#CCC";
	}
	if(numimg=='2'){
		document.getElementById(varid).style.color="#FFFFFF";
		document.getElementById(varid).style.backgroundColor="#0099CC";
	}
}

function NavegadorNoticias(varid,numimg) {
	document.getElementById(varid).style.cursor="pointer";
	if(numimg=='1'){
		document.getElementById(varid).style.backgroundImage="url('images/ContadorNoticiaNormal.png')";
		document.getElementById(varid).style.color="#0066ff";
		document.getElementById('BotNot'+contnoti).style.backgroundImage="url('images/ContadorNoticiaSobre.png')";
		document.getElementById('BotNot'+contnoti).style.color="#FFFFFF";
	}
	if(numimg=='2'){
		document.getElementById(varid).style.color="#FFFFFF";
		document.getElementById(varid).style.backgroundImage="url('images/ContadorNoticiaSobre.png')";
	}
}

function muestraFecHorBon(idlang)   
  {   
	//alert('Entro a hora');
	//Asignar fecha y hora actual al documento	
	if(idlang==1){
		//Ingles
		var diaarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
		var mesarray=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
		var sepde="of";
		var sephor="Time";
	}else if(idlang==2){
		var diaarray=new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
		var mesarray=new Array("Janvier", "Fevrier", "Mars", "Avril", "Mai", "Juin","Juillet", "Août", "Septembre", "Octobre","Novembre","Decembre");
		var sepde="de";
		var sephor="Heure";
	}else{
		var diaarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado");
		var mesarray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
		var sepde="de";
		var sephor="Hora";
	}
	var FecActGen=new Date();
	dia  = FecActGen.getDate();
	ndia = FecActGen.getDay();
	mes  = FecActGen.getMonth();
   	ano  = FecActGen.getFullYear();
	hor  = FecActGen.getHours();
	min  = FecActGen.getMinutes();
	seg  = FecActGen.getSeconds();
  	if (dia < 10)   
        	dia = '0' + dia;
	if (hor < 10)   
        	hor = '0' + hor;
	if (min < 10)   
        	min = '0' + min;
	if (seg < 10)   
        	seg = '0' + seg;
	
	FecAct = diaarray[ndia]+', '+dia+' '+sepde+' '+mesarray[mes]+' '+sepde+' '+ano+' '+sephor+' '+hor+':'+min+':'+seg;
	/*FecAct=diaarray[ndia]+','+dia+' de '+mesarray[mes]+' de '+ano;
	HorAct='Hora: 'hor+':'+min+':'+seg;*/
	colfec = document.getElementById('Hora');
	colfec.innerHTML = FecAct;
	setTimeout("muestraFecHorBon('"+idlang+"')",1000); 
  } 

var ArrTit = new Array();
var ArrDes1 = new Array();
var ArrDes2 = new Array();
var ArrImg = new Array();
var ArrCod = new Array();
var ArrMas = new Array();
function asignarNoticias(vtitu,vdesc1,vdesc2,vimag,vcodi,vmas,vcont){
	//alert('Entra a Asignar');
	ArrTit[vcont]=vtitu;
	ArrDes1[vcont]=vdesc1;
	ArrDes2[vcont]=vdesc2;
	ArrImg[vcont]=vimag;
	ArrCod[vcont]=vcodi;
	ArrMas[vcont]=vmas;
	//alert('Corta Parte 1: '+ArrDes1[vcont]+' - Parte 2: '+ArrDes2[vcont]);
}

contnoti=0;
var repeteciones;
function visualizaNoticias()   
  {   		
	contnoti++;
	if(contnoti<=7){	
		if(document.getElementById('ImgNoticia')){			
			divResulTitNoticia = document.getElementById('TituloNoticia');
			divResulConNoticia = document.getElementById('ContenidoNoticia');
			divResulImgNoticia = document.getElementById('ImgNoticia');
			divResulCodNoticia = document.getElementById('VerNoticia');
			divResulTitNoticia.innerHTML = ArrTit[contnoti];
			divResulConNoticia.innerHTML = ArrDes1[contnoti]+ArrDes2[contnoti];		
			divResulImgNoticia.innerHTML = '<img src='+ArrImg[contnoti]+' width=220 height=235>';	
			divResulCodNoticia.innerHTML = '<a href=noticiacompleta.php?id='+ArrCod[contnoti]+'>'+ArrMas[contnoti]+'</a>';	
			for(r=1;r<=7;r++){
				if(r!=contnoti){
					BotNav2 = 'BotNot'+r;
					NavegadorNoticias(BotNav2,1);
				}else{
					BotNav2 = 'BotNot'+r;
					NavegadorNoticias(BotNav2,2);
				}
			}				
			NavegadorNoticias(BotNav2,1);
			BotNav = 'BotNot'+contnoti;
			NavegadorNoticias(BotNav,2);			
			repeteciones = setTimeout("visualizaNoticias()",10000); 
		}
	}else{
		contnoti=0;		
		visualizaNoticias();
	}
}

function CambiarNoticia(vnumnoti){
	contnoti=vnumnoti-1;
	clearTimeout(repeteciones);
	visualizaNoticias();
  }













function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function EvaluarCampos(formulario) {	
	camposTexto = document.getElementById(formulario).elements;	
	switch(formulario){		
		case 'frmboletin':
			nfoconom=0;
			nfocoema=0;
			errbole = new Array("Los Siguientes Errores se Presentaron\n");
			nerr=0;
			//nombre obligatorio
			if(ValidarVacio(camposTexto[0].value)==false){				
				nerr++;
				nfoconom=1;
				errbole[nerr]="- Nombre es un campo obligatorio\n";
			}
			if(ValidarVacio(camposTexto[1].value)==false){				
				nerr++;
				nfocoema=1;
				errbole[nerr]="- Correo es un campo obligatorio\n";
			}else{
				//El valor debe ser mayor a 0
				if(ValidarEmail(camposTexto[1].value)==false){
					nerr++;
					nfocoema=1;
					errbole[nerr]="- Correo tiene formato incorrecto\n";
				}
				
			}
			if(nerr>0){				
				ManejoErrores(errbole);
				if(nfoconom==1){
					TomarFoco(camposTexto[0].name);
				}else if(nfocoema==1){					
					TomarFoco(camposTexto[1].name);					
				}
			}else{
				//alert('Correcto todo y envia');
				enviarDatosBoletin(); return false
			}
		break;
		case 'frmbuscar':
			nfocobus=0;
			errbusc = new Array("Los Siguientes Errores se Presentaron\n");
			nerr=0;
			//nombre obligatorio
			if(ValidarVacio(camposTexto[0].value)==false){				
				nerr++;
				nfocobus=1;
				errbusc[nerr]="- Buscar es un campo obligatorio\n";
			}
			if(nerr>0){				
				ManejoErrores(errbusc);
				if(nfocobus==1){
					TomarFoco(camposTexto[0].name);
				}
			}else{
				//alert('Correcto todo Buscar y hace el submit. Existe formulario: '+document.getElementById('frmbuscar'));
				document.getElementById('frmbuscar').action="buscar.php";
				document.getElementById('frmbuscar').submit();
			}
		break;
		case 'frmcontact':
		
			nfoconom=0;
			nfocoema1=0;
			nfocotel=0;
			nfocociu=0;
			nfocodep=0;
			nfocomen=0;
			nfococel=0;
			
			errcont = new Array("Los Siguientes Errores se Presentaron\n");
			nerr=0;
			//nombre obligatorio
			if(ValidarVacio(camposTexto[0].value)==false){				
				nerr++;
				nfoconom=1;
				errcont[nerr]="- Nombre es un campo obligatorio\n";
			}
			if(ValidarVacio(camposTexto[2].value)==false){				
				nerr++;
				nfocoema1=1;
				errcont[nerr]="- Correo es un campo obligatorio\n";
			}else{
				//El valor debe ser mayor a 0
				if(ValidarEmail(camposTexto[2].value)==false){
					nerr++;
					nfocoema1=1;
					errcont[nerr]="- Correo tiene formato incorrecto\n";
				}
				
			}
			if(ValidarVacio(camposTexto[3].value)==false){				
				nerr++;
				nfocotel=1;
				errcont[nerr]="- Telefono es un campo obligatorio\n";
			}else{
				//El valor debe ser mayor a 0
				if(ValidarTipo(camposTexto[3].value)==false){
					nerr++;
					nfocotel=1;
					errcont[nerr]="- Telefono tiene formato incorrecto\n";
				}
				
			}
			if(ValidarVacio(camposTexto[4].value)==false){				
				nerr++;
				nfocociu=1;
				errcont[nerr]="- Ciudad es un campo obligatorio\n";
			}
			if(ValidarTipo(camposTexto[5].value)==false){				
				nerr++;
				nfococel=1;
				errcont[nerr]="- Celular tiene formato incorrecto\n";
			}
			if(ValidarVacio(camposTexto[7].value)==false){				
				nerr++;
				nfocomen=1;
				errcont[nerr]="- Mensaje es un campo obligatorio\n";
			}
			
			if(nerr>0){				
				ManejoErrores(errcont);
				if(nfoconom==1){
					TomarFoco(camposTexto[0].name);
				}else if(nfocoema1==1){					
					TomarFoco(camposTexto[2].name);					
				}else if(nfocotel==1){					
					TomarFoco(camposTexto[3].name);					
				}else if(nfocociu==1){					
					TomarFoco(camposTexto[4].name);					
				}else if(nfocomen==1){					
					TomarFoco(camposTexto[7].name);					
				}else if(nfococel==1){					
					TomarFoco(camposTexto[5].name);					
				}
			}else{
				//alert('Correcto todo y envia Contactenos');
				enviarDatosContactenos(); return false
			}
		break;
		case 'frmregpregunta':
			nfoconom=0;
			nfocoema1=0;			
			nfocomen=0;
			
			errcont = new Array("Los Siguientes Errores se Presentaron\n");
			nerr=0;
			//nombre obligatorio
			if(ValidarVacio(camposTexto[0].value)==false){				
				nerr++;
				nfoconom=1;
				errcont[nerr]="- Nombre es un campo obligatorio\n";
			}
			if(ValidarVacio(camposTexto[1].value)==false){				
				nerr++;
				nfocoema1=1;
				errcont[nerr]="- Correo es un campo obligatorio\n";
			}else{
				if(ValidarEmail(camposTexto[1].value)==false){
					nerr++;
					nfocoema1=1;
					errcont[nerr]="- Correo tiene formato incorrecto\n";
				}
				
			}
			if(ValidarVacio(camposTexto[2].value)==false){				
				nerr++;
				nfocomen=1;
				errcont[nerr]="- Mensaje es un campo obligatorio\n";
			}
			
			if(nerr>0){				
				ManejoErrores(errcont);
				if(nfoconom==1){
					TomarFoco(camposTexto[0].name);
				}else if(nfocoema1==1){					
					TomarFoco(camposTexto[1].name);					
				}else if(nfocomen==1){					
					TomarFoco(camposTexto[2].name);					
				}
			}else{
				enviarDatosRegistroPregunta(); return false
			}
		break;
		case 'pyf':
			//alert('Entra a Evaluar campos');
			nfoconum=0;			
			errcont = new Array("Los Siguientes Errores se Presentaron\n");
			nerr=0;
			//numero obligatorio
			
			if(ValidarVacio(camposTexto[0].value)==false){				
				nerr++;
				nfoconum=1;
				errcont[nerr]="- Debe digitar el Numero\n";
			}else{
				//El valor debe numerico
				if(ValidarTipo(camposTexto[0].value)==false){
					nerr++;
					nfoconum=1;
					errcont[nerr]="- Debe digitar solo numeros\n";
				}else{
					if(camposTexto[0].value.length<4){
						nerr++;
						nfoconum=1;
						errcont[nerr]="- Debe digitar un Numero de 4 Cifras\n";
					}
				}
				
			}			
			
			if(nerr>0){				
				ManejoErrores(errcont);
				if(nfoconum==1){
					TomarFoco(camposTexto[0].name);
				}
			}else{
				DescomponerNumero(camposTexto[0].value);
			}
		break;
		case 'registrowin':
			//alert('Entra a Evaluar campos'+document.getElementById('regnombre'));
			nfoconum=0;			
			errcont = new Array("Los Siguientes Errores se Presentaron\n");
			nerr=0;
			//numero obligatorio
			
			if(ValidarVacio(document.getElementById('regnombre').value)==false){				
				nerr++;
				nfoconum=1;
				errcont[nerr]="- Debe digitar el Nombre\n";
			}			
			
			if(nerr>0){				
				ManejoErrores(errcont);
				if(nfoconum==1){
					TomarFoco('regnombre');
				}
			}else{
				//alert('Esta bien el registro')
				document.getElementById('btnregistrar').disabled=true;
				enviarDatosRegistroGanador();
			}
		break;
	}
		
}





var ArrTit = new Array();
var ArrDes = new Array();
function asignarEventos(vtitu,vdesc,vcont){
	ArrTit[vcont]=vtitu;
	ArrDes[vcont]=vdesc;
}
conteven=0;
function visualizaEventos(canteven)   
  {   
	//alert('Total Eventos: '+canteven+ ' Encabezado: '+encab+' - Existe Result: '+document.getElementById('ResultadoEventos')+ 'Existe Titulo: '+document.getElementById('TituloEven'));
	mw=220;
	mh=160;
	ms=6;
	
	conteven++;
	if(conteven<=canteven){		
		if(document.getElementById('TitNota')){			
			divResulTit = document.getElementById('TitNota');
			divResulEve = document.getElementById('DesNota');
			divResulTit.innerHTML = ArrTit[conteven];
			divResulEve.innerHTML = ArrDes[conteven];		
			
			setTimeout("visualizaEventos("+canteven+")",10000); 
		}
	}else{
		conteven=0;
		visualizaEventos(canteven);
	}
}

contnoti=0;
function muestNotic()   
  {   
	//alert('Entro al menu de mostrar las Noticias: '+num+ 'Existe: '+document.getElementById('ModuloNoticias'));
	contnoti++;
	if(contnoti<=7){
		if(document.getElementById('ModNotic')){
			divNotic = document.getElementById('ModNotic');
		
			//instanciamos el objetoAjax
			ajax=objetoAjax();
			//usando del medoto POST
			ajax.open("POST", "scripts/consultadatosnoticias.php",true);	
			ajax.onreadystatechange=function() {
				if (ajax.readyState==4) {
					divNotic.innerHTML = ajax.responseText
					document.getElementById('b'+contnoti).style.backgroundColor="#B1C651";
					document.getElementById('b'+contnoti).style.color="#FFFF00";
					document.getElementById('b'+contnoti).style.borderColor="#FFFFFF";
					setTimeout("muestNotic()",6000); 
				}
			}
			//muy importante este encabezado ya que hacemos uso de un formulario
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			//enviando los valores
			ajax.send("cod="+contnoti)
		}
	}else{
		contnoti=0;
		//setTimeout("muestraNoticias()",3000); 
		muestNotic();
	}
  }
 
 
 function enviarDatosContactenos()   
  {   
	//alert('Entro Enviar contacte');
	if(document.getElementById('RespContac')){
			//alert('Entro Ecxiste respuesta correo'+document.getElementById('RespContac'));
			divResp = document.getElementById('RespContac');
			nom = document.frmcontact.txtnombre.value;			
			emp = document.frmcontact.txtempresa.value;
			ema = document.frmcontact.txtemail.value;
			tel = document.frmcontact.txttelefono.value;
			ciu = document.frmcontact.txtciudad.value;
			cel = document.frmcontact.txtcelular.value;
			//alert('PAso Asigno campos Antes entidad');
			ent = document.frmcontact.txtentidad.value;
			//alert('PAso Asigno campos Despues entidad');
			mens = document.frmcontact.txtmensaje.value;
			//alert('El mensaje no pasa: '+mens);
			//instanciamos el objetoAjax
			ajax=objetoAjax();
			//usando del medoto POST
			ajax.open("POST", "scripts/enviardatoscorreo.php",true);	
			ajax.onreadystatechange=function() {
				if (ajax.readyState==4) {
					divResp.innerHTML = ajax.responseText
				}
			}
			//muy importante este encabezado ya que hacemos uso de un formulario
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			//enviando los valores
			cadenv="nombre="+nom+'&empresa='+emp+'&email='+ema+'&telefono='+tel+'&ciudad='+ciu+'&celular='+cel+'&entidad='+ent+'&mensaje='+mens;
			//alert('Envia Cadena: '+cadenv);
			ajax.send(cadenv)
	}
  } 
  
function enviarDatosRegistroPregunta()   
  {   
	if(document.getElementById('RespContac')){
			//alert('Entro Ecxiste respuesta correo'+document.getElementById('RespContac'));
			divResp = document.getElementById('RespContac');
			nom = document.frmregpregunta.txtnombre.value;			
			ema = document.frmregpregunta.txtemail.value;
			mens = document.frmregpregunta.txtmensaje.value;
			categ = document.frmregpregunta.txtcategoria.value;
			//instanciamos el objetoAjax
			ajax=objetoAjax();
			//usando del medoto POST
			ajax.open("POST", "scripts/enviardatosregpre.php",true);	
			ajax.onreadystatechange=function() {
				if (ajax.readyState==4) {
					divResp.innerHTML = ajax.responseText
				}
			}
			//muy importante este encabezado ya que hacemos uso de un formulario
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			//enviando los valores
			cadenv="nombre="+nom+'&email='+ema+'&mensaje='+mens+'&categoria='+categ;
			//alert('Envia Cadena: '+cadenv);
			ajax.send(cadenv)
	}
  } 
  
  function FunTrad(vid,txt,sl,dl){	
	  // llamada al traductor
	//alert('Existe Resultado: '+document.getElementById(vid)+' - Nombre: '+vid+' - Texto: '+txt+' - Origen: '+sl+' - Destino: '+dl);
	google.language.translate(txt, sl, dl, function(result) 
		{
		  if (!result.error) 
		  {    
			var resultado = document.getElementById(vid); 
			//alert('Traduccion: '+result.translation);
			resultado.innerHTML = result.translation;  
		  }
		  else alert(result.error.message);
		}
	  );
	}

	
	function FunTradTxt(txt,sl,dl){	
		// llamada al traductor
		//alert('Entro - Texto: '+txt+' - Origen: '+sl+' - Destino: '+dl);
		google.language.translate(txt, sl, dl, function(result) 
			{
			  if (!result.error) 
			  { 
				return result.translation;				
			  }
			  else alert(result.error.message);
			}
		);
	}
	
  
 ContVec=0;
 CodVid=0;
 ConSigAnt=0;
 function muestraVideos(InSiAn,NumReg)   
  {   
  	//alert('Indicador: '+InSiAn+' - Registros: '+NumReg);
  	ContVec++;
	if(ContVec==1){
		//Muestro el ultimo video que es el mas reciente		
		ConSigAnt=NumReg;
		CodVid=1;
	}else{
		//Muestro segun el boton que haya oprimido
		if(InSiAn==1){
			//siguiente	
			ConSigAnt--;
			CodVid++;
			if(ConSigAnt==0){
				ConSigAnt=NumReg;
				CodVid=1;
			}
			
		}else{
			//Anterior
			ConSigAnt++;
			CodVid--;
			if(ConSigAnt>NumReg){
				ConSigAnt=1;
				CodVid=NumReg;
			}
		}
	}
  	//alert('Indicador: '+InSiAn+' - Existe o no: '+document.getElementById('TextoContenidoGen'));
	if(document.getElementById('TextoContenidoGen')){
			divResultado = document.getElementById('TextoContenidoGen');
	
			//instanciamos el objetoAjax
			ajax=objetoAjax();
			//usando del medoto POST
			ajax.open("POST", "scripts/consultadatosvideo.php",true);	
			ajax.onreadystatechange=function() {
				if (ajax.readyState==4) {
					divResultado.innerHTML = ajax.responseText
				}
			}
			//muy importante este encabezado ya que hacemos uso de un formulario
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			//enviando los valores
			//alert('Envia Codigo video: '+ConSigAnt+' - Veces: '+ContVec);
			ajax.send("codv="+ConSigAnt+"&convid="+CodVid)
	}
  }

var ArrCodGal= new Array();
var ArrNomGal= new Array();
var ArrDesGal= new Array();
var ArrUrlGal= new Array();
DatAsig=0;
function asignarDatosGaleria(vcodi,vnomb,vdesc,vurli){
	DatAsig++;
	ArrCodGal[DatAsig]=vcodi;
	ArrNomGal[DatAsig]=vnomb;
	ArrDesGal[DatAsig]=vdesc;
	ArrUrlGal[DatAsig]=vurli;
}

recArr=0;
function muestraGaleriaSig(IndSigAnt) 
  {   
	//alert('Indicador SigAnt: '+IndSigAnt+ ' Exuste recorrido: '+document.getElementById('textorecorrido'));
	if(IndSigAnt==1){
		recArr++;
		if(recArr==1){
			//alert('Recorrido es 1 : '+recArr);
			if(document.getElementById('textorecorrido')){
				//alert('Recorrido va en : '+recArr+' - Arreglo 1: '+ArrUrlGal[recArr]);
				document.getElementById('textorecorrido').innerHTML= '<b>Foto '+recArr+' de '+DatAsig+'</b>';
				document.getElementById('titulofoto').innerHTML= '<b>'+ArrNomGal[recArr]+'</b>';				
				document.getElementById('fotopropia').src=ArrUrlGal[recArr];
				document.getElementById('textoimg').style.visibility="visible";
			}
		}else{
			if(recArr>DatAsig){
				recArr=1;
			}
			document.getElementById('textorecorrido').innerHTML= '<b>Foto '+recArr+' de '+DatAsig+'</b>';
			document.getElementById('titulofoto').innerHTML= '<b>'+ArrNomGal[recArr]+'</b>';	
			document.getElementById('fotopropia').src=ArrUrlGal[recArr];
		}
	}else{
		recArr--;
		if(recArr<1){
			recArr=DatAsig;
		}
		document.getElementById('textorecorrido').innerHTML= '<b>Foto '+recArr+' de '+DatAsig+'</b>';
		document.getElementById('titulofoto').innerHTML= '<b>'+ArrNomGal[recArr]+'</b>';	
		document.getElementById('fotopropia').src=ArrUrlGal[recArr];		
	}//Corchete sino va en uno
}



function asignarTexto(vid,texto){
	//alert('Existe: '+document.getElementById(vid)+' - Titulo: '+vid+' - Texto: '+texto);
	//alert('Titulo: '+vtitu+' - Descripcion: '+vdesc+' - Va en: '+vcont);
	if(document.getElementById(vid)){
			document.getElementById(vid).innerHTML=texto;
	}
}

function asignarMensaje(texto){
	alert('Titulo: '+texto);
}

function CambNotic(numnoti) {
	//alert('Entro al menu de mostrar las Noticias: '+num+ 'Existe: '+document.getElementById('ModuloNoticias'));
		if(document.getElementById('ModNotic')){
			divResul = document.getElementById('ModNotic');
		
			//instanciamos el objetoAjax
			ajax=objetoAjax();
			//usando del medoto POST
			ajax.open("POST", "scripts/consultadatosnoticias.php",true);	
			ajax.onreadystatechange=function() {
				if (ajax.readyState==4) {
					divResul.innerHTML = ajax.responseText
					document.getElementById('b'+numnoti).style.backgroundColor="#B1C651";
					document.getElementById('b'+numnoti).style.color="#FFFF00";
					document.getElementById('b'+numnoti).style.borderColor="#FFFFFF";
					contnoti=numnoti;
				}
			}
			//muy importante este encabezado ya que hacemos uso de un formulario
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			//enviando los valores
			ajax.send("cod="+numnoti)
		}
}


function muestraFecHorAct(fecha,hora)   
  {   
	//Asignar fecha y hora actual al documento			
	var FecActGen=new Date();
	dia = FecActGen.getDate();
	mes = FecActGen.getMonth() + 1;
   	ano = FecActGen.getFullYear();
	hor = FecActGen.getHours();
	min = FecActGen.getMinutes();
	seg = FecActGen.getSeconds();
	if (mes < 10)   
  		mes = '0' + mes;
  	if (dia < 10)   
        	dia = '0' + dia;
	if (hor < 10)   
        	hor = '0' + hor;
	if (min < 10)   
        	min = '0' + min;
	if (seg < 10)   
        	seg = '0' + seg;
	
	FecAct=dia+'/'+mes+'/'+ano;
	HorAct=hor+':'+min+':'+seg;
	document.getElementById(fecha).value=FecAct;
	document.getElementById(hora).value=HorAct;
	cmpfecha=fecha;
	cmphora=hora;
	setTimeout("muestraFecHorAct(cmpfecha,cmphora)",1000);   
  }

function ValidarVacio(valcampo) {
	for(i=0;i<valcampo.length;i++){   
        	if(valcampo.charAt(i)!=" "){   
                	return true   
                }   
        }   
        return false
}

function ValidarTipo(valcampo) {	
	if(valcampo!=''){
		if(!isNaN(valcampo)){
	              	return true
        	}
        	return false
	}else{
        	return false
	}
}
//Validar Email
function ValidarEmail(Cadena) {   
  
    Punto = Cadena.substring(Cadena.lastIndexOf('.') + 1, Cadena.length) 
    Dominio = Cadena.substring(Cadena.lastIndexOf('@') + 1, Cadena.lastIndexOf('.'))
    Usuario = Cadena.substring(0, Cadena.lastIndexOf('@'))                  
    Reserv = "@/º\"\'+*{}\\<>?¿[]áéíóú#·¡!^*;,:"                      
       
    valido = true   
       
    for (var Cont=0; Cont<Usuario.length; Cont++) {   
        X = Usuario.substring(Cont,Cont+1)   
        if (Reserv.indexOf(X)!=-1)   
                    valido = false   
    }   
  
    for (var Cont=0; Cont<Punto.length; Cont++) {   
        X=Punto.substring(Cont,Cont+1)   
        if (Reserv.indexOf(X)!=-1)   
            valido = false   
    }   
                           
    for (var Cont=0; Cont<Dominio.length; Cont++) {   
        X=Dominio.substring(Cont,Cont+1)   
        if (Reserv.indexOf(X)!=-1)   
            valido = false   
        }   
  
    if (Punto.length<2 || Dominio <1 || Cadena.lastIndexOf('.')<0 || Cadena.lastIndexOf('@')<0 || Usuario<1) {   
        valido = false   
    }   
       
    if (valido) {   
        //alert('Email válido.')   
        return true   
    } else {   
        //alert('Email no válido.')   
        return false   
    }   
}   



function ManejoErrores(arerr) {
	var Errores='';	
	for(i=0;i<=arerr.length-1;i++){		
		Errores+=arerr[i];
	}
	alert(Errores);
}

//Dela forma de sires
function Cambia(varid,numimg) {
	if(numimg=='1'){
		document.getElementById(varid).style.backgroundImage="url('images/secciones.gif')";
		document.getElementById(varid).style.backgroundColor="#B1C651";
		document.getElementById(varid).style.color="#FFFF00";
	}
	if(numimg=='2'){
		//document.getElementById(varid).style.backgroundImage="url('imagenes/imgA.gif')";
		document.getElementById(varid).style.cursor="pointer";
		document.getElementById(varid).style.backgroundColor="#669933";
		document.getElementById(varid).style.color="#FFFFFF";
	}
	if(numimg=='3'){
		document.getElementById(varid).style.backgroundImage="url('')";
	}
}

function AsignarImagen(varid,urlimg) {
	//alert('Entra asigna img: '+varid+' - Url: '+urlimg+' - Existe: '+document.getElementById(varid));
	//document.getElementById(varid).style.backgroundImage="url("+urlimg+")";
	document.getElementById('mostrarfoto').style.display='block'
	document.getElementById('mostrarfoto').style.visibility="visible";
	document.getElementById(varid).src=urlimg;
	document.getElementById(varid).style.display='block'
	document.getElementById('textoimg').style.visibility="hidden";
	//.style.visibility="visible"
	//document.getElementById(varid).width=656;
	//document.getElementById(varid).height=400;
	//document.getElementById(varid).style.backgroundImage="url('images/secciones.gif')";
}

function NavegadorBtn(varid,numimg) {
	document.getElementById(varid).style.cursor="pointer";
	if(numimg=='1'){
		document.getElementById(varid).style.backgroundColor="#669933";
		document.getElementById(varid).style.color="#FFFFFF";
	}
	if(numimg=='2'){
		document.getElementById(varid).style.backgroundColor="#B1C651";
		document.getElementById(varid).style.color="#FFFF00";
		document.getElementById(varid).style.borderColor="#FFFFFF";
	}
}

function VerUrl(vid,mispag) {
	//alert(document.getElementById(varid));	
	//window.location=varid;
	window.open(vid,mispag); 

}

function NavegadorMenu(varid,numimg) {
	document.getElementById(varid).style.cursor="pointer";
	if(numimg=='1'){
		document.getElementById(varid).style.backgroundColor="#E9ECD7";
		document.getElementById(varid).style.color="#000000";
	}
	if(numimg=='2'){
		document.getElementById(varid).style.backgroundColor="#B1C651";
		document.getElementById(varid).style.color="#FFFF00";
		document.getElementById(varid).style.borderColor="#FFFFFF";
	}
}
function NavegadorAlbum(varid,numimg) {
	document.getElementById(varid).style.cursor="pointer";
	if(numimg=='1'){
		document.getElementById(varid).style.backgroundColor="#FFFFFF";
	}
	if(numimg=='2'){
		document.getElementById(varid).style.backgroundColor="#CCCCCC";
		document.getElementById(varid).style.color="#117700";
	}
}
function NavegadorGaleria(varid,numimg) {
	document.getElementById(varid).style.cursor="pointer";
	if(numimg=='1'){
		document.getElementById(varid).style.backgroundColor="#006699";
		document.getElementById(varid).style.color="#FFFFFF";
	}
	if(numimg=='2'){
		document.getElementById(varid).style.backgroundColor="#CCCCCC";
		document.getElementById(varid).style.color="#000000";
	}
}
function NavegadorRegAlb(varid,numimg) {
	document.getElementById(varid).style.cursor="pointer";
	if(numimg=='1'){
		document.getElementById(varid).style.color="#ffffff";
	}
	if(numimg=='2'){
		document.getElementById(varid).style.backgroundColor="#CCCCCC";
		document.getElementById(varid).style.color="#000000";
	}
}

function CreSubMenPag(nom,sec,vid){
	//alert('Entro Nom: '+nom+' - Seccion: '+sec+' Identificador: '+vid);
	if(document.getElementById(nom+sec).style.display == 'none'){
		divRespMen = document.getElementById(nom+sec);
		//alert('Existe Respuesta MEnsaje: '+divRespMen);
		//instanciamos el objetoAjax
		ajax=objetoAjax();
		//alert('Ajax: '+ajax);
		//usando del medoto POST
		ajax.open("POST", "scripts/consultadatossubmenu.php",true);	
		//alert('Abrio el archivo');
		ajax.onreadystatechange=function() {
			//alert('Entro a function...');
			if (ajax.readyState==4) {
				//alert('CArgo....: ');
				document.getElementById(vid).style.backgroundImage="url('images/csecciones.png')";
				//alert('Respondio: '+ajax.responseText);
				divRespMen.innerHTML = ajax.responseText
				document.getElementById(nom+sec).style.display = 'block';
			}
		}
		//muy importante este encabezado ya que hacemos uso de un formulario
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		//enviando los valores
		cadenv="codsecc="+sec;
		//alert('Envia Cadena: '+cadenv);
		//ajax.send("seccion="+sec)
		ajax.send(cadenv)


  		//document.getElementById(divid).style.display = 'block';
    	}else{
			document.getElementById(vid).style.backgroundImage="url('images/secciones.png')";
      		document.getElementById(nom+sec).style.display = 'none';
 	}
}

function TomarFoco(campo){
	if(campo!=''){
		document.getElementById(campo).focus();
		document.getElementById(campo).select();
	}
	/*else{
		alert('Campo Vacio');
	}*/
}
function Errores(mensaje){
	alert(Mensaje);
}

//********** MODULO DE BOLETINES *********//
function enviarDatosBoletin(){
	//donde se mostrará lo resultados
	//divResultado = document.getElementById('resboletin');
	divResultado = document.getElementById('TxtBoletin');
	divFormulario = document.getElementById('frmboletin');

	//valores de los cajas de texto
	nom=document.frmboletin.nombre.value;
	ema=document.frmboletin.email.value;
	
	//instanciamos el objetoAjax
	ajax=objetoAjax();
	//usando del medoto POST
	ajax.open("POST", "scripts/creacionboletin.php",true);
	
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//alert('Respondio ajax:'+ajax.responseText);
			//mostrar los nuevos registros en esta capa			
			//una vez actualizacion ocultamos formulario
			if(ValidarVacio(ajax.responseText)==false)
				alert('Error: '+ajax.responseText);
			else{
				if(ajax.responseText=='NO'){
					alert('Email ya se encuentra registrado. Gracias');
				}else{
					alert('Gracias por registrarse en el boletin de la Gobernacion del Vichada\npronto recibira un mensaje');					
				}
				document.frmboletin.nombre.value="";
				document.frmboletin.email.value="";
			}
			//divResultado.style.display="none";
		}
	}
	//muy importante este encabezado ya que hacemos uso de un formulario
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("nombre="+nom+"&email="+ema)
}
//********** FINAL MODULO DE BOLETINES *********//


//********** MODULO DEL JUEGO TRIQUI **********//
var jugando = true // con esta empieza ajugar //

// FUNCION COMPRUEBA JUGADA
function CompruebaJugada(tablero, ficha) {
   //comprueba que hay posibilidad de hacer 3 en raya en una fila, columna o diagonal
   //devuelve la posicion donde hay que colocar la ficha para hacerlo y -1 si no hay jugada
   var x, y
   for(x = 0; x < 9; x += 3) {
      //comprueba las filas
      if ((tablero.elements[x].value == ficha) && (tablero.elements[x + 1].value == ficha))
      if (tablero.elements[x + 2].value == "")
         return (x + 2)
      if ((tablero.elements[x].value == ficha) && (tablero.elements[x + 2].value == ficha))
      if (tablero.elements[x + 1].value == "")
         return (x + 1)
      if ((tablero.elements[x + 1].value == ficha) && (tablero.elements[x + 2].value == ficha))
      if (tablero.elements[x].value == "")
      return (x)
   }
   for(x = 0; x < 3; x++) {
      //comprueba las columnas
      if ((tablero.elements[x].value == ficha) && (tablero.elements[x + 3].value == ficha))
      if (tablero.elements[x + 6].value == "")
      return (x + 6)
      if ((tablero.elements[x].value == ficha) && (tablero.elements[x + 6].value == ficha))
      if (tablero.elements[x + 3].value == "")
      return (x + 3)
      if ((tablero.elements[x + 3].value == ficha) && (tablero.elements[x + 6].value == ficha))
      if (tablero.elements[x].value == "")
      return (x)
   }
   //comprueba las diagonales
   if ((tablero.elements[2].value == ficha) && (tablero.elements[4].value == ficha) && (tablero.elements[6].value == ""))
   return (6)
   if ((tablero.elements[2].value == ficha) && (tablero.elements[4].value == "") && (tablero.elements[6].value == ficha))
   return (4)
   if ((tablero.elements[2].value == "") && (tablero.elements[4].value == ficha) && (tablero.elements[6].value == ficha))
   return (2)
   if ((tablero.elements[0].value == ficha) && (tablero.elements[4].value == ficha) && (tablero.elements[8].value == ""))
   return (8)
   if ((tablero.elements[0].value == ficha) && (tablero.elements[4].value == "") && (tablero.elements[8].value == ficha))
   return (4)
   if ((tablero.elements[0].value == "") && (tablero.elements[4].value == ficha) && (tablero.elements[8].value == ficha))
   return (0)
   return -1
}


//FUNCION PAREJA HORIZONTAL
function ParejaHorizontal(tablero, ficha) {
   //comprueba si es posible poner 2 en una fila, estando vacia la otra posicion...
   //...de esa misma fila
   //devuelve la fila que permite hacerlo, o -1 en caso contrario
   var x, y
   for(x = 0; x < 9; x += 3) {
      //comprueba las filas
      if ((tablero.elements[x].value == ficha) && (tablero.elements[x + 1].value == "") && (tablero.elements[x + 2].value == ""))
      return (x)
      if ((tablero.elements[x].value == "") && (tablero.elements[x + 1].value == ficha) && (tablero.elements[x + 2].value == ""))
      return (x + 1)
      if ((tablero.elements[x].value == "") && (tablero.elements[x + 1].value == "") && (tablero.elements[x + 2].value == ficha))
      return (x + 2)
   }
   return -1
}


//FUNCION PAREJA VERTICAL
function ParejaVertical(tablero, ficha, jugadaHtal) {
   //comprueba si es posible poner 2 en una columna, estando vacia la otra posicion...
   //...de esa misma columna y teniendo en cuenta si esa posicion ya es pareja horizontal
   //devuelve la columna que permite hacerlo si no es pareja horizontal, o -1 en caso contrario
   var x, y
   for(x = 0; x < 3; x++) {
      //comprueba las columnas
      if ((tablero.elements[x].value == ficha) && (tablero.elements[x + 3].value == "") && (tablero.elements[x + 6].value == ""))
      if (x != jugadaHtal)
         //si es pareja horizontal no interesa como vertical
         return (x)
      if ((tablero.elements[x].value == "") && (tablero.elements[x + 3].value == ficha) && (tablero.elements[x + 6].value == ""))
      if ((x + 3) != jugadaHtal)
      return (x + 3)
      if ((tablero.elements[x].value == "") && (tablero.elements[x + 3].value == "") && (tablero.elements[x + 6].value == ficha))
      if ((x + 6) != jugadaHtal)
      return (x + 6)
   }
   return -1
}


//FUNCION OBTEN POSICION
function ObtenPosicion(jugadaHtal, jugadaVcal) {
   //busca la posicion que permite hacer jugada vertical y jugada horizontal a la vez
   //conocidas la fila y la columna donde pueden hacerse parejas
   var x, y, fila, columna;
   var posicion = 0;
   matriz = new Array(3)
   for (x = 0; x < 3; x++) {
      //crea un matriz que asigna posicion a fila y columna
      matriz[x] = new Array(3)
      for (y = 0; y < 3; y++) {
         matriz[x][y] = posicion
         posicion ++
      }
   }
   for (x = 0; x < 3; x++) {
      //busca la fila y la columna
      for (y = 0; y < 3; y++) {
         if (matriz[x][y] == jugadaHtal)
            //encontro la fila
         fila = x
         if (matriz[x][y] == jugadaVcal)
            //encontro la columna
            columna = y
      }
   }
   return (matriz[fila][columna])
   //devuelve posicion jugada
}


//FUNCION PONER REDONDEL
function PonerRedondel(tablero) {
   //juega el ordanador
   var jugada, jugadaHtal, jugadaVcal
   //ataca y gana
   jugada = CompruebaJugada(tablero, "O")
   if (jugada != -1) {
      tablero.elements[jugada].value = "O"
      alert('Perdiste, Intentalo Nuevamente')
      document.marcador.perdidas.value++
      jugando = false
      return 1
   }
   //defiende evitando que gane el rival
   jugada = CompruebaJugada(tablero, "X")
   if (jugada != -1) {
      tablero.elements[jugada].value = "O"
      return 1
   }
   //ataca y gana a la siguiente
   jugadaHtal = ParejaHorizontal(tablero, "O")
   jugadaVcal = ParejaVertical(tablero, "O", jugadaHtal)
   if ((jugadaHtal != -1) && (jugadaVcal != -1)) {
      //puede poner 2 en fila y 2 en columna
      if ((jugadaHtal != 4) || (jugadaVcal != 4)) {
         //no es el centro
         jugada = ObtenPosicion(jugadaHtal, jugadaVcal)
         //obtiene donde debe poner
         tablero.elements[jugada].value = "O"
         return 1
      }
   }
   //ataca y pone dos en fila
   if ((jugadaHtal != -1) && (jugadaVcal == -1)) {
      if ((jugadaHtal != 2) && (jugadaHtal != 5) && (jugadaHtal != 8))
         //esto es arbitrario
         tablero.elements[jugadaHtal + 1].value = "O"
      //pone a la derecha
      else
         tablero.elements[jugadaHtal - 1].value = "O"
         //pone a la izquierda
         return 1
      }
      //ataca y pone dos en columna
      if ((jugadaHtal == -1) && (jugadaVcal != -1)) {
         if ((jugadaVcal != 6) && (jugadaVcal != 7) && (jugadaVcal != 8))
            tablero.elements[jugadaVcal + 3].value = "O"
         //pone abajo
         else
            tablero.elements[jugadaVcal - 3].value = "O"
         //pone arriba
         return 1
   }
   //ocupa el centro
   if (tablero.elements[4].value == "") {
      tablero.elements[4].value = "O"
      return 1
   }
   //ocupa la primera que este libre
   for (x = 0; x < 9; x++)
   if (tablero.elements[x].value == "") {
      tablero.elements[x].value = "O"
      return 1
   }
   alert('Juego termina en Tablas')
   document.marcador.tablas.value++
   jugando = false
   return -1
}


//FUNCION PONER ASPA
function PonerAspa(tablero, posicion) {
   //comprueba primero que se esta jugando
   if (jugando) {
      if (tablero.elements[posicion].value != "")
         //casilla no vacia
         alert('Esa casilla ya está ocupada.')
      else {
         //casilla vacia, puede poner
         tablero.elements[posicion].value = "X"
         //comprueba si ha ganado (AÑADIDO EN LA VERSION 2)
         if ( CompruebaVictoria(tablero, "X") ) {
            alert('Felicidades - Usted gana.')
            document.marcador.ganadas.value++
            jugando = false
         } else
            PonerRedondel(tablero)
      }
   } else {
      alert('Para comenzar una nueva partida\npulsa Juego nuevo.')
   }
}


//FUNCION COMPRUEBA VICTORIA
function CompruebaVictoria(tablero, ficha) {
   //AÑADIDA EN LA VERSION 2
   //comprueba si ha ganado el jugador que juega con ficha
   var x
   for(x = 0; x < 9; x += 3) {
      //comprueba las filas
      if ((tablero.elements[x].value == ficha) && (tablero.elements[x + 1].value == ficha) && (tablero.elements[x + 2].value == ficha))
      return true
   }
   for(x = 0; x < 3; x++) {
      //comprueba las columnas
      if ((tablero.elements[x].value == ficha) && (tablero.elements[x + 3].value == ficha) && (tablero.elements[x + 6].value == ficha))
      return true
   }
   //comprueba las diagonales
   if ((tablero.elements[2].value == ficha) && (tablero.elements[4].value == ficha) && (tablero.elements[6].value == ficha))
      return true
   if ((tablero.elements[0].value == ficha) && (tablero.elements[4].value == ficha) && (tablero.elements[8].value == ficha))
      return true
   return false
}

  var jugando = true ;

   function PintarX(whois) {
      whois.value="X";     //formulario forma objeto num propiedad objeto//

   }

function ponermarca(tablero, posicion) {
   //comprueba primero que se esta jugando
   if (jugando) {
      if (tablero.elements[posicion].value != "")
         //casilla no vacia
         alert('Esa casilla ya está ocupada.')
         //casilla vacia, puede poner
         else {
         tablero.elements[posicion].value = "X";
        }
    } else {
      alert('Para comenzar una nueva partida\npulsa Iniciar Juego nuevo.')
   }
}

   //ayuda sobre el juego//
   function apareceayuda(){
    ayuda.style.visibility="visible";
    return true;
  }

   function desapareceayuda(){
     ayuda.style.visibility="hidden";
     return true;
    }
	
//***************** FINAL MODULO DEL JUEGO TRIQUI **************************//

//***************** MODULO DEL JUEGO PICAS Y FIJAS **************************//
//Definicion de Variables
var cont=0;
var fijas;
var picas;
var ArrGen= new Array();
var ArrDig= new Array();
var NumFinal;

function GenerarNumero(){
	do{
		do{
			NumAle = parseInt(Math.random()*10000);		
		}while(NumAle<1000)
		M = parseInt(NumAle / 1000);
		C = parseInt(parseInt(NumAle - 1000 * M )/ 100);
		D = parseInt(parseInt((NumAle - 1000 * M) - (100 * C))/10);
		U = parseInt(NumAle - 1000 * M) - (100 * C) - (10 * D);
		//alert('Numero: '+NumAle+' - Miles: '+M+' - Centenas: '+C+' - Decenas: '+D+' - Unidades: '+U)
	}while(M==C || M==D || M==U || C==D || C==U || D==U)
	ArrGen[0]=M;
	ArrGen[1]=C;
	ArrGen[2]=D;
	ArrGen[3]=U;
	document.getElementById('txtnumeroale').value = NumAle;
}

function DescomponerNumero(NumDig){
	//alert('Entra a Descomponer NUm digitado')
	MDig = parseInt(NumDig / 1000);
	CDig = parseInt(parseInt(NumDig - 1000 * MDig )/ 100);
	DDig = parseInt(parseInt((NumDig - 1000 * MDig) - (100 * CDig))/10);
	UDig = parseInt(NumDig - 1000 * MDig) - (100 * CDig) - (10 * DDig);
	
	ArrDig[0]=MDig;
	ArrDig[1]=CDig;
	ArrDig[2]=DDig;
	ArrDig[3]=UDig;
	//alert('Va a Comparar')
	Comparar();
}

function Comparar(){
	fijas=0
	picas=0
	cont=cont+1;
	for(i=0;i<=3;i++){
		for(j=0;j<=3;j++){
			if(ArrDig[i]==ArrGen[j]){
   				if(i==j){
     				fijas++;
      				if(fijas==4){
						MostrarNumero();
						if(cont==1)
							Palab="jugada";
						else
							Palab="jugadas";
						regsi=confirm('Felicitaciones... ,  Ha ganado en ' + cont + ' '+Palab +' , Desea Registrarse?');
						if(regsi==1){
							MostrarRegistro();
						}
					}
				}else{
      				picas++;
				}
			}
		}
	}
	MuestraDatos(cont);
}

function MuestraDatos(Oport){
	if(Oport<10){
		document.getElementById('result'+Oport).value = document.getElementById('txtnumerodig').value;
		document.getElementById('picas'+Oport).value = picas;
		document.getElementById('fijas'+Oport).value = fijas;
		document.getElementById('opor'+Oport).value = cont;
		//Limpio para que digite nuevo numero
		document.getElementById('txtnumerodig').value="";
		TomarFoco('txtnumerodig');
		if(Oport==9){
			if(fijas!=4)
				alert('Perdiste, Para comenzar una nueva partida presiona el boton Nuevo');
			//Limpia
			MostrarNumero();
		}
	}
}
function LimpiarCampos(){
	for(i=1;i<=9;i++){
		document.getElementById('result'+i).value = "";
		document.getElementById('picas'+i).value = "";
		document.getElementById('fijas'+i).value = "";
		document.getElementById('opor'+i).value = "";
	}
	OcultarNumero();
	GenerarNumero();
	document.getElementById('txtnumerodig').value="";
	TomarFoco('txtnumerodig');
	cont=0;
	picas=0;
	fijas=0;
	OcultarRegistro();
}

function MostrarNumero(){
	//document.getElementById('txtnumeroale').style.visibility=true;
	//document.getElementById('lblnumeroale').style.visibility=true;
	document.getElementById('txtnumeroale').style.display= "block";
	document.getElementById('lblnumeroale').style.display= "block";
	document.getElementById('btnvalidar').disabled=true;

}
function OcultarNumero(){
	//document.getElementById('txtnumeroale').style.visibility=false;
	//document.getElementById('lblnumeroale').style.visibility=false;
	document.getElementById('txtnumeroale').style.display= "none";
	document.getElementById('lblnumeroale').style.display= "none";
	document.getElementById('btnvalidar').disabled=false;
}

function AbrirAyuda(Pagina){ 
	window.open(Pagina, null, "height=400,width=400,status=yes,toolbar=no,menubar=no,location=no,resizable=no"); 
	return true; 
}
function AbrirPuntajes(Pagina){ 
	window.open(Pagina, null, "height=450,width=450,status=yes,toolbar=no,menubar=no,location=no,resizable=no"); 
	return true; 
}


 function enviarDatosRegistroGanador()   
  {   
	//alert('Entro Enviar contacte');
	if(document.getElementById('RegistroGanador')){
			//alert('Entro Ecxiste respuesta correo'+document.getElementById('RespContac'));
			divResp = document.getElementById('RespuestaRegistro');
			
			nom = document.registrowin.regnombre.value;			
			pun = document.registrowin.regoportunidades.value;
			
			//instanciamos el objetoAjax
			ajax=objetoAjax();
			//usando del medoto POST
			ajax.open("POST", "scripts/enviardatosregistroganador.php",true);	
			ajax.onreadystatechange=function() {
				if (ajax.readyState==4) {
					divResp.innerHTML = ajax.responseText
				}
			}
			//muy importante este encabezado ya que hacemos uso de un formulario
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			//enviando los valores
			cadenv="nombre="+nom+'&puntaje='+pun;
			//alert('Envia Cadena: '+cadenv);
			ajax.send(cadenv)
	}
  } 
  
function MostrarRegistro(){
	document.getElementById('RegistroGanador').style.display= "block";
	document.getElementById('regnombre').value="";
	document.getElementById('regoportunidades').value=cont;
	document.getElementById('btnregistrar').disabled=false;
	document.getElementById('RespuestaRegistro').innerHTML="";
	TomarFoco('regnombre');
}
function OcultarRegistro(){
	//document.getElementById('txtnumeroale').style.visibility=false;
	//document.getElementById('lblnumeroale').style.visibility=false;
	document.getElementById('RegistroGanador').style.display= "none";
}
//***************** FINAL MODULO DEL JUEGO PICAS Y FIJAS **************************//



