instantiateScroller(0, "scroll0", 7, 0, 545, 337, 150);
instantiateScroller(1, "scroll1", 7, 0, 545, 337, 30);
instantiateScroller(2, "scroll2", 7, 0, 545, 337, 150);
instantiateScroller(3, "scroll3", 7, 0, 545, 337, 150);
instantiateScroller(4, "scroll4", 7, 0, 545, 337, 30);
instantiateScroller(5, "scroll5", 7, 0, 545, 337, 150);
var fx = true;
var actual = "#root2";

/*function ho()
{
	if(fx)
	{
		fx=false;
		$(actual).fadeOut("slow",function(){
			actual ="#root0";
			var este = document.getElementById("root1");
			este.style.display="none";
			este.style.visibility="visible";
			document.getElementById("t").innerHTML="HOME";		
			$(actual).fadeIn("slow");
			fx=true;	
		});
		
	}
}*/

function bio()
{
	if(fx)
	{
		fx=false;
		$(actual).fadeOut("slow",function(){
			actual ="#root1";
			var este = document.getElementById("root1");
			este.style.display="none";
			este.style.visibility="visible";
			document.getElementById("t").innerHTML="BIOGRAPHY";		
			$(actual).fadeIn("slow");
			fx=true;	
		});
		
	}
}

function obra()
{
	if(fx)
	{
		fx=false;
		$(actual).fadeOut("slow",function(){
			actual ="#root2";
			var este = document.getElementById("root2");
			este.style.display="none";
			este.style.visibility="visible";
			document.getElementById("t").innerHTML='<span style="cursor: pointer;color:#296382;">BOOKS</span> / <span onClick="ensayo();" style="cursor: pointer">ESSAYS</span> / <span onClick="confer();" style="cursor: pointer">INTERVIEWS AND CONFERENCES</span>';
			$(actual).fadeIn("slow");	
			fx=true;
		});
		
	}
}

function ensayo()
{
	if(fx)
	{
		fx=false;
		$(actual).fadeOut("slow",function(){
			actual ="#root4";
			var este = document.getElementById("root4");
			este.style.display="none";
			este.style.visibility="visible";
			document.getElementById("t").innerHTML='<span style="cursor: pointer" onClick="obra();">BOOKS</span> / <span style="cursor: pointer;color:#296382">ESSAYS</span> / <span onClick="confer();" style="cursor: pointer">INTERVIEWS AND CONFERENCES</span>';
			$(actual).fadeIn("slow");	
			fx=true;
		});
		
	}
}

function confer()
{
	if(fx)
	{
		fx=false;
		$(actual).fadeOut("slow",function(){
			actual ="#root5";
			var este = document.getElementById("root5");
			este.style.display="none";
			este.style.visibility="visible";
			document.getElementById("t").innerHTML='<span style="cursor: pointer" onClick="obra();">BOOKS</span> / <span style="cursor: pointer;" onClick="ensayo();">ESSAYS</span> / <span style="cursor: pointer;color:#296382">INTERVIEWS AND CONFERENCES</span>';
			$(actual).fadeIn("slow");	
			fx=true;
		});
		
	}
}

function link()
{
	if(fx)
	{
		fx=false;
		$(actual).fadeOut("slow",function(){
			actual ="#root3";
			var este = document.getElementById("root3");
			este.style.display="none";
			este.style.visibility="visible";
			document.getElementById("t").innerHTML="LYNKS";		
			$(actual).fadeIn("slow");	
			fx=true;
		});
	}
}

function contacto()
{
	if(fx)
	{
		fx=false;
		$(actual).fadeOut("slow",function(){
			actual ="#contacto";
			var este = document.getElementById("contacto");
			este.style.display="none";
			este.style.visibility="visible";
			document.getElementById("t").innerHTML="CONTACT";
			$(actual).fadeIn("slow");	
			fx=true;
		});
		
	}
}

function validar()
{

	var nombre = document.getElementById("nombre"); 
	var email = document.getElementById("email");
	var consulta = document.getElementById("consulta");
	var cont = document.getElementById("contacto");
	
	var bool = false;
	
	if(nombre.value=="" || nombre.value=="Complete esta informacion")
	{
		bool = true;	
		
	/*	var enombre = document.createElement("div");
		cont.appendChild(enombre);
		enombre.id="errorNombre";		
		enombre.syle.width="443px";
		enombre.syle.height="28px";
		alert(enombre.id);
		
		enombre.syle.border="1px solid red";
		enombre.syle.top="34px";
		enombre.syle.left="80px";
		*/		
		nombre.value="Complete this information";
	}
	
		
	if(consulta.value=="" || consulta.value=="Complete this information")
	{
		bool = true;
	
		consulta.value="Complete this information";
	}
	
	if(email.value=="" || email.value=="Complete this information")
	{
		email.value="Complete this information";
		bool = true;	
	
	}
	else if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.value)))
	{
	
		email.value="Email wrong";
		bool = true;	
	}
		
	if(!bool)
	{
	
		function respuesta(){
		
			if(peticion.readyState == 1 && !bool) {
				bool=true;
				estadopeticion = document.createElement("span");
				estadopeticion.innerHTML = "SEND MESSAGE";
				estadopeticion.id="avisoenvio";
				estadopeticion.style.fontFamily = "Arial"; 
				estadopeticion.style.position="absolute";
				estadopeticion.style.top="100px";
				estadopeticion.style.left="180px";
				estadopeticion.style.zIndex="10";
				estadopeticion.style.width="200px";
				estadopeticion.style.height="55px";
				estadopeticion.style.backgroundColor="#555";
				estadopeticion.style.color="black";
				estadopeticion.style.textAlign="center";
				estadopeticion.style.paddingTop="30px";
				estadopeticion.style.fontWeight="600";
				estadopeticion.style.opacity="0.6";
				estadopeticion.style.filter="alpha(opacity=60)";
				estadopeticion.style.border="8px solid #222";
				document.getElementById("contacto").appendChild(estadopeticion);
			}
						
			if(peticion.readyState == 4) {
				if (peticion.status == 200) {					
					estadopeticion.innerHTML="MESSAGE SENT";	
					function sacar(){estadopeticion.parentNode.removeChild(estadopeticion);}
					setTimeout(sacar,2000);
			}}}
	
		
		var fono = document.getElementById("telefono").value;
		var info = "nombre="+nombre.value+"&email="+email.value+"&telefono="+fono+"&consulta="+consulta.value+"&nocache=" + Math.random();
		
		if (window.XMLHttpRequest) {
			var peticion = new XMLHttpRequest();} 
		else if (window.ActiveXObject) {
			var peticion =  new ActiveXObject("Microsoft.XMLHTTP");}
		
		if(peticion){
			
			peticion.onreadystatechange = respuesta;
			
			peticion.open("POST","http://www.max-neef.cl/form.php", true);
			peticion.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			
			peticion.send(info);
		}
	}
}
