function ListaParticipantes(){
		document.getElementById('parte1').style.display='none';
		document.getElementById('parte2').style.display='none';
		document.getElementById('parte3').style.display='none';

		document.getElementById('participantes').style.display='inline';
}

function OcultarTodo(){
		document.getElementById('parte1').style.display='none';
		document.getElementById('parte2').style.display='none';
		document.getElementById('parte3').style.display='none';

		document.getElementById('participantes').style.display='none';
}

function Paso1(){
		OcultarTodo();	
		document.getElementById('parte1').style.display='inline';
}

function Paso2(){
	if(document.getElementById('form-contactar-numero_documento').value!='' && document.getElementById('form-contactar-acepto').checked==1){
		document.getElementById('parte1').style.display='none';
		document.getElementById('parte2').style.display='inline';
	}else{
		alert('Debe aceptar las Bases y Condiciones e Ingresando su número de cédula correcto está firmando digitalmente.');
	}
}

function Images(action,group,file,amount){
	if(action=="show"){
		document.getElementById('div-body-background').style.display='none';
		document.getElementById('div-photos-background').style.display='inline';
		
		if(file<10){
			aux="0";
		}else{
			aux="";
		}
		
		document.getElementById("div-photos").innerHTML='<img src="images/photos-'+group+'-'+aux+file+'.jpg" border="0" width="700" height="364" alt=""/>';

		next=file+1;
		prev=file-1;
		
		if(file>1){
			document.getElementById("div-photos-navigation").innerHTML='<div style="width: 120px; float: left;"><img src="images/logo-vilux2.gif" width="120" height="35" alt="Vilux"/></div><div style="float: left; width: 220px; padding: 14px 0px 0px 12px; text-align: left"><a href="JavaScript:Images(\''+action+'\',\''+group+'\','+prev+','+amount+');">Anterior</a> - <a href="JavaScript:Images(\'null\',\'null\',0,0);">Cerrar</a></div><div style="float: left; width: 248px; padding: 14px 0px 0px 0px; text-align: right">Siguiente</div>';
		}
		if(file<amount){
			document.getElementById("div-photos-navigation").innerHTML='<div style="width: 120px; float: left;"><img src="images/logo-vilux2.gif" width="120" height="35" alt="Vilux"/></div><div style="float: left; width: 220px; padding: 14px 0px 0px 12px; text-align: left">Anterior - <a href="JavaScript:Images(\'null\',\'null\',0,0);">Cerrar</a></div><div style="float: left; width: 248px; padding: 14px 0px 0px 0px; text-align: right"><a href="JavaScript:Images(\''+action+'\',\''+group+'\','+next+','+amount+');">Siguiente</a></div>';
		}
		if( (file>1) && (file<amount) ){
			document.getElementById("div-photos-navigation").innerHTML='<div style="width: 120px; float: left;"><img src="images/logo-vilux2.gif" width="120" height="35" alt="Vilux"/></div><div style="float: left; width: 220px; padding: 14px 0px 0px 12px; text-align: left"><a href="JavaScript:Images(\''+action+'\',\''+group+'\','+prev+','+amount+');">Anterior</a> - <a href="JavaScript:Images(\'null\',\'null\',0,0);">Cerrar</a></div><div style="float: left; width: 248px; padding: 14px 0px 0px 0px; text-align: right"><a href="JavaScript:Images(\''+action+'\',\''+group+'\','+next+','+amount+');">Siguiente</a></div>';
		}

	}else{
		document.getElementById('div-photos-background').style.display='none';
		document.getElementById('div-body-background').style.display='inline';
	}
}

function Verify(){
	string=document.getElementById('form-contactar-form_string_test').value;

	if(string.length==4){
		document.getElementById('form-contactar-form_string_test').disabled=true;
		document.getElementById("span-form-contactar-checking").innerHTML='<img src="images/checking.gif" border="0" width="12" height="12" alt="Checking..."/>';

		var url="system-image-verify.php";
		parameters="?sid="+Math.random()+"&form_string="+string;
		Ajax(url,parameters,VerifyResult);
	}
}

function VerifyResult(){
	if(http_request.readyState==4){
		if(http_request.status==200){
			result=http_request.responseText;
			if(result==1){
				document.getElementById('form-contactar-form_string').value=document.getElementById('form-contactar-form_string_test').value;
				document.getElementById('span-form-contactar-checking').innerHTML='Ok';
				document.getElementById('form-contactar-submit').disabled=false;
			}else{
				document.getElementById('span-form-contactar-checking').innerHTML='Reintente...';
				document.getElementById('form-contactar-form_string_test').disabled=false;
				document.getElementById('form-contactar-form_string_test').value="";
				SetFocus('form-contactar-form_string_test');
			}
		}else{
			alert('No se puede conectar... Por favor reintente...');
		}
	}
}

function Send(url){
	document.getElementById('form-contactar-submit').disabled=true;
	document.getElementById("span-form-contactar-result").innerHTML='<img src="images/checking.gif" border="0" width="12" height="12" alt="Checking..."/>';

	form=document.getElementById('form-contactar'); 
	parameters="?sid="+Math.random();

	for(i=1;i<form.elements.length;i++){
		element=form.elements[i];
		if(element.type=="checkbox"){
			if(element.checked==true){
				parameters+="&"+element.name+"="+escape(element.value);
			}
		}else{
			parameters+="&"+element.name+"="+escape(element.value);
		}
	}

	Ajax(url,parameters,SendResult);
}

function SendResult(){
	if(http_request.readyState==4){
		if(http_request.status==200){
			result=http_request.responseText;
			if(result==1){
				//document.getElementById('span-form-contactar-result').innerHTML='Muchas gracias.';
				document.getElementById('parte2').style.display='none';
				document.getElementById('parte3').style.display='inline';
			}else{
				document.getElementById('span-form-contactar-result').innerHTML='No se ha enviado, por favor reintente...';
				document.getElementById('form-contactar-submit').disabled=false;
			}
		}else{
			alert('No se puede conectar... Por favor reintente... ');
		}
	}
}

function Ajax(url,parameters,after){
	http_request=false;
	if(window.XMLHttpRequest){
		http_request=new XMLHttpRequest();
		if(http_request.overrideMimeType){
			http_request.overrideMimeType('text/xml');
		}
	}else{
		if(window.ActiveXObject){
			try{
				http_request=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){
				try{
					http_request=new ActiveXObject("Microsoft.XMLHTTP");
            			}
				catch(e){}
			}
		}
	}

	if(!http_request){
		alert('Cannot create XMLHTTP instance');
		return false;
	}
      
	http_request.onreadystatechange=after;
	http_request.open('POST',url,true);
	http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length",parameters.length);
	http_request.setRequestHeader("Connection","close");
	http_request.send(parameters);
}
