


function gradient(id, level)
{
	var box = document.getElementById(id);
	box.style.opacity = level;
	box.style.MozOpacity = level;
	box.style.KhtmlOpacity = level;
	box.style.filter = "alpha(opacity=" + level * 100 + ")";
	box.style.display="block";
	return;
}


function fadein(id) 
{
	var level = 0;
	while(level <= 1)
	{
		setTimeout( "gradient('" + id + "'," + level + ")", (level* 1000) + 10);
		level += 0.01;
	}
}


// Open the lightbox

function openbox(formtitle, fadin)
{
  var box = document.getElementById('box'); 
  document.getElementById('filter').style.display='block';

//  var btitle = document.getElementById('boxtitle');
 // btitle.innerHTML = formtitle;
  
  if(fadin)
  {
	 gradient("box", 0);
	 fadein("box");
  }
  else
  { 	
    box.style.display='block';
  }  	
}


// Close the lightbox

function closebox()
{
   document.getElementById('box').style.display='none';
   document.getElementById('filter').style.display='none';
   document.form1.name.value="";
   document.form1.email.value="";
   document.form1.message.value="";
   document.form1.security_code.value="";
   //document.form1.privacidad[0].checked = true;

}


function gradient2(id, level)
{
	var box = document.getElementById(id);
	box.style.opacity = level;
	box.style.MozOpacity = level;
	box.style.KhtmlOpacity = level;
	box.style.filter = "alpha(opacity=" + level * 100 + ")";
	box.style.display="block";
	return;
}


function fadein2(id) 
{
	var level = 0;
	while(level <= 1)
	{
		setTimeout( "gradient('" + id + "'," + level + ")", (level* 1000) + 10);
		level += 0.01;
	}
}


// Open the lightbox


function openbox2(formtitle, fadin)
{
  var box = document.getElementById('box2'); 
  document.getElementById('filter2').style.display='block';

  //var btitle = document.getElementById('boxtitle2');
  //btitle.innerHTML = formtitle;
  
  if(fadin)
  {
	 gradient("box", 0);
	 fadein("box");
  }
  else
  { 	
    box.style.display='block';
  }  	
}


// Close the lightbox

function closebox2()
{
    document.getElementById('box2').style.display='none';
    document.getElementById('filter2').style.display='none';
   	document.form2.name2.value="";
	document.form2.email2.value="";
	document.form2.message2.value="";
	document.form2.security_code2.value="";
	//document.form2.privacidad2[0].checked = true;

}

function seguridad(seguro) {
var malaspalabras = [" pis ", "caca ", " puta", "weon", "idiota","to:","cc:","bcc:","content-type:", "mime-version:","multipart-mixed:","content-transfer-enconding:","&","/","\r","\n","%0a","%0d","?",";","=","$","%","#","<",">","script","@","*","[","]","{","}","^","http","//","www",".com",".ru","html","url","-","_","lyubovnaya","include","query","mysql","include","INCLUDE","Include",'"',"(",")"];
var contarTacos = 0;
var actual = 0;
var encontrada = ["hola"] ;
for (var i = 0; i < malaspalabras.length; i++){
	contarTacos+=seguro.split(malaspalabras[i]).length-1;
	if(contarTacos > actual){
		encontrada[actual] =  malaspalabras[i];
		actual+= 1;
		if(actual == 1)
			alert("Elimine las siguientes palabras : "+encontrada[0]);
	}
}
	for( i = 1; i < actual; i++)
		alert(encontrada[i]);
if (contarTacos > 0){
	//alert("Debes lavarte la lengua con jabón");
	document.form1.message.focus();
	return false;
}else 
	return true;
}

function ajax9(){

if(document.form1.name.value==""){
	if(document.form1.Idioma.value==1){
	alert("DEBE INGRESAR NOMBRE DE USUARIO");
	}else{
		alert("TO ENTER USERNAME");
	}
	document.form1.name.focus();
	return false;
}else{
if(!seguridad(document.form1.name.value)){
		return false;
		
		}
}

if(document.form1.pais.value==""){
	if(document.form1.Idioma.value==1){
	alert("DEBE INGRESAR SU PAIS DE ORIGEN");
	}else{
		alert("TO ENTER YOUR COUNTRY");
	}
	document.form1.pais.focus();
	return false;
}else{
if(!seguridad(document.form1.pais.value)){
		return false;
		
		}
}

if(document.form1.apellido.value==""){
	if(document.form1.Idioma.value==1){
	alert("DEBE INGRESAR SU PAIS DE ORIGEN");
	}else{
		alert("TO ENTER YOUR COUNTRY");
	}
	document.form1.apellido.focus();
	return false;
}else{
if(!seguridad(document.form1.apellido.value)){
		return false;
		
		}
}

if(document.form1.security_code.value==""){
	if(document.form1.Idioma.value==1){
		alert("DEBE INGRESAR EL VALOR DE LA SUMA");
	}else{
		alert("TO ENTER THE SUM");
	}
	document.form1.security_code.focus();
	return false;
}




if(document.form1.suma.value != document.form1.security_code.value){
	alert("INGRESE LA SUMA CORRECTAMENTE");
	document.form1.security_code.focus();
	return false;
}


var valor=document.form1.email.value;
if (!(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
.test(valor))){
	if(document.form1.Idioma.value==1){
		alert("LA DIRECCION DE MAIL ES INCORRECTA");
	}
	if(document.form1.Idioma.value==2){
		alert("THE DIRECTION OF MAIL IS INCORRECT");
	}
document.form1.email.focus();
return false;
}
if(document.form1.message.value==""){
	if(document.form1.Idioma.value==1){
		alert("DEBE INGRESAR EL MENSAJE");
	}else{
		alert("TO ENTER THE MESSAGE");
	}
	document.form1.message.focus();
	return false;
}else{
if(!seguridad(document.form1.message.value)){
		return false;
		
		}
}

/*if(document.form1.email.value.indexOf ('@', 0) == -1){
	alert("Ingrese con formato de email");
	document.form1.email.focus();
	return false;
}*/

//alert(cword[anum-1]);
/*var uword = hex_md5(document.getElementById('security_code').value) ;
if(uword == cword[anum-1]){
	alert("hola, esta mal");
	
}
*/

//var ver = document.form1.verificador.value;

	 privacidad=document.form1.privacidad.value;
	if(document.form1.privacidad.checked == true){
	privacidad=0;
	}else{
	privacidad=1;
	}
	doAjax('http://www.lanzarote-tour.com/archivos-aportes/guardar_usuario.php','name='+document.getElementById('name').value+'&privacidad='+privacidad+'&email='+document.getElementById('email').value+'&message='+document.getElementById('message').value+'&security_code='+document.getElementById('security_code').value+'&origen='+document.getElementById('origen').value+'&tipo='+document.getElementById('tipo').value+'&idTBL_Categoria='+document.getElementById('idTBL_Categoria').value+'&Idioma='+document.getElementById('Idioma').value+'&pais='+document.getElementById('pais').value+'&apellido='+document.getElementById('apellido').value,'mostrarResultado','post',0);
	closebox();
	document.form1.name.value="";
	document.form1.email.value="";
	document.form1.message.value="";
	document.form1.security_code.value="";
	//document.form1.privacidad[0].checked = true;

//document.form1.privacidad.checked=1;
}

function ajax10(){

if(document.form2.name2.value==""){
	if(document.form2.Idioma.value==1){
	alert("DEBE INGRESAR NOMBRE DE USUARIO");
	}else{
	alert("TO ENTER USERNAME");
	}
	document.form2.name2.focus();
	return false;
}else{

if(!seguridad(document.form2.name2.value)){
		return false;
		
		}
}

if(document.form2.pais2.value==""){
	if(document.form2.Idioma.value==1){
	alert("DEBE INGRESAR EL PASI DE ORIGEN");
	}else{
	alert("TO ENTER YOUR COUNTRY");
	}
	document.form2.pais2.focus();
	return false;
}else{

if(!seguridad(document.form2.pais2.value)){
		return false;
		
		}
}

if(document.form2.apellido2.value==""){
	if(document.form2.Idioma.value==1){
	alert("DEBE INGRESAR NOMBRE SU APELLIDO");
	}else{
	alert("TO ENTER USERNAME");
	}
	document.form2.apellido2.focus();
	return false;
}else{
if(!seguridad(document.form2.apellido2.value)){
		return false;
		
		}
}

var valor=document.form2.email2.value;
if (!(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
.test(valor))){
	if(document.form2.Idioma.value==1){
		alert("LA DIRECCION DE MAIL ES INCORRECTA");
	}
	if(document.form2.Idioma.value==2){
		alert("THE DIRECTION OF MAIL IS INCORRECT");
	}
	document.form2.email2.focus();
	return false;
}

if(document.form2.security_code2.value==""){
	if(document.form2.Idioma.value==1){
		alert("DEBE INGRESAR EL VALOR DE LA SUMA");
	}else{
		alert("TO ENTER THE SUM");
	}
	document.form2.security_code2.focus();
	return false;
}


if(document.form2.suma2.value != document.form2.security_code2.value){
	alert("INGRESE LA SUMA CORRECTAMENTE");
	document.form2.security_code2.focus();
	return false;
}

if(document.form2.message2.value==""){
	if(document.form2.Idioma.value==1){
		alert("DEBE INGRESAR EL MENSAJE");
	}else{
		alert("TO ENTER THE MESSAGE");
	}
	document.form2.message2.focus();
	return false;
}else{
if(!seguridad(document.form2.message2.value)){
		return false;
		
		}
}



if(document.form2.email2.value==""){
	if(document.form2.Idioma.value==1){
		alert("DEBE INGRESAR EL EMAIL");
	}else{
		alert("TO ENTER EMAIL");
	}
	document.form2.email2.focus();
	return false;
}


	 privacidad=document.form2.privacidad2.value;
	if(document.form2.privacidad2.checked){
	privacidad=0;
	}else{
	privacidad=1;
	}
	doAjax2('http://www.lanzarote-tour.com/archivos-aportes/guardar_usuario.php','name2='+document.getElementById('name2').value+'&privacidad2='+privacidad+'&email2='+document.getElementById('email2').value+'&message2='+document.getElementById('message2').value+'&security_code2='+document.getElementById('security_code2').value+'&origen='+document.getElementById('origen').value+'&tipo2='+document.getElementById('tipo2').value+'&idTBL_Categoria='+document.getElementById('idTBL_Categoria').value+'&Idioma='+document.getElementById('Idioma').value+'&pais2='+document.getElementById('pais2').value+'&apelldio2='+document.getElementById('apellido2').value,'mostrarResultado2','post',0);
	closebox2();
	document.form2.name2.value="";
	document.form2.email2.value="";
	document.form2.message2.value="";
	document.form2.security_code2.value="";
	//document.form2.privacidad2[0].checked = true;	

}




