// JavaScript Document
function createRequest()
{

try
  {
  // Firefox, Opera 8.0+, Safari
  return request=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    return request=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    return request=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return request;
}
function check_form1(){
	Murl="check_mail.php";
	var correo=document.getElementById('correo').value;
	Mrequest=createRequest();
	Mrequest.open("POST",Murl,true);
	Mrequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=utf-8');
	Mrequest.onreadystatechange=function(){
									if(Mrequest.readyState==4){
										var newtotal=Mrequest.responseText;
										if(newtotal=='ok'){
											registrar_correo();
										}else{
											alert("Este Correo Ya Existe en Nuestra Base de Datos");
										}
									}
								}
	Mrequest.send("correo="+escape(correo)+"&action=check");
}
function check_mail(){
	if(document.getElementById('correo').value=="" || !validarEmail(document.getElementById('correo').value)){
		alert("Existe un Error en el Campo Correo");
		return false;
	}
	check_form1();
}
function validarEmail(valor) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){return (true);}else{return (false);}
}
function registrar_correo(){
	Murl="check_mail.php";
	var correo=document.getElementById('correo').value;
	Mrequest=createRequest();
	Mrequest.open("POST",Murl,true);
	Mrequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=utf-8');
	Mrequest.onreadystatechange=function(){
									if(Mrequest.readyState==4){
										alert("Su Correo ha sido Registrado!");
									}
								}
	Mrequest.send("correo="+escape(correo)+"&action=register");
}
function changeClass(action,PrinSec,id){
	if(action=='over'){
		if(PrinSec=='hijos'){
			document.getElementById('td_'+id).className='BoxHijosOver HAND';
		}
	}
	if(action=='out'){
		if(PrinSec=='hijos'){
			document.getElementById('td_'+id).className='BoxHijos HAND';
		}
	}
}
function IrA(id){
	location='galerias.php?cat='+id;
}
function act_alto(alto){
	//alert(alto);
	//document.getElementById('arbol').height=alto+400;
}
function changeMenuClass(evento,id){
	//alert(id+" "+evento);
	if(evento=="over"){
		/*newImage = "url(images/image41.gif)";
        document.getElementById('Good').style.backgroundImage = newImage;*/
		document.getElementById(id).style.backgroundImage="url(webimgs/fondo_over.png)";
		document.getElementById("img_"+id).src='webimgs/menu_btn_over.png';
	}else{
		document.getElementById(id).style.backgroundImage="url('')";
		document.getElementById("img_"+id).src='webimgs/menu_btn_out.png';
	}
}
function changeSubMenuClass(evento,id){
	if(evento=="over"){
		document.getElementById("img_"+id).src='webimgs/menu_btn_over.png';
	}else{
		document.getElementById("img_"+id).src='webimgs/menu_btn_out.png';
	}
}
var i; 
var imagenes = new Array("webimgs/fondo_over.png","webimgs/menu_btn_over.png"); 
var lista_imagenes = new Array(); 
function cargarimagenes(){
	for(i in imagenes){ 
		lista_imagenes[i] = new Image(); 
		lista_imagenes[i].src = imagenes[i]; 
	} 
}
cargarimagenes();