var $seccion;
var myrules = { 
	'#boton1' : function(el){
	  el.onclick = function(){
		$selected=getElementsByClass("selected");
		if($selected[0].id=='about'){return;}
		$selected[0].className='';
		t1 = new Tween($selected[0].style,'left',Tween.strongEaseOut,0,724,1.3,'px');
		t1.start();
		$about= document.getElementById('about');
		$watch= document.getElementById('watch');
		$about.className='selected'
		t2 = new Tween($about.style,'left',Tween.strongEaseOut,-724,0,1.3,'px');
		t2.start();
		t2.onMotionFinished = function(){$watch.innerHTML='';}
		//CargarContenido("escenario","about.php",null);
		$params=null;
		//CargarContenido('watch','watch.php',$params);
		$marcador= document.getElementById('marcador');
		$marcador.style.display="block";
		$marcador.style.left="154px";
		$activo=getElementsByClass("activo");
		if($activo.length>0){$activo[0].className='boton';}
		this.className='activo';
      } 
	  return false;
   },
    '#boton2' : function(el){ 
      el.onclick = function(){
		//$seccion='watch'; 
		CargarContenido("watch","watch.php",null)
		
		$selected=getElementsByClass("selected");
		if($selected[0].id=='watch'){return;}
		$selected[0].className='';
		t1 = new Tween($selected[0].style,'left',Tween.strongEaseOut,0,724,1.3,'px');
		$about= document.getElementById('watch');
		$about.className='selected'
		t2 = new Tween($about.style,'left',Tween.strongEaseOut,-724,0,1.3,'px');
		$params=null;
		t1.start();
		t2.start();
		
		$marcador= document.getElementById('marcador');
		$marcador.style.display="block";
		$marcador.style.left="236px";
		$activo=getElementsByClass("activo");
		if($activo.length>0){$activo[0].className='boton';}
		this.className='activo';
      } 
	  return false;
   },
    '#boton3' : function(el){ 
      el.onclick = function(){
		//$seccion='news'; 
		//CargarContenido("escenario","news.php",null)
		$selected=getElementsByClass("selected");
		if($selected[0].id=='news'){return;}
		$selected[0].className='';
		t1 = new Tween($selected[0].style,'left',Tween.strongEaseOut,0,724,1.3,'px');
		t1.start();
		$about= document.getElementById('news');
		$about.className='selected'
		t2 = new Tween($about.style,'left',Tween.strongEaseOut,-724,0,1.3,'px');
		t2.start();
		$watch= document.getElementById('watch');
		t2.onMotionFinished = function(){$watch.innerHTML='';}
		$params=null;
		//CargarContenido('watch','watch.php',$params);
		
		$marcador= document.getElementById('marcador');
		$marcador.style.display="block";
		$marcador.style.left="317px";
		$activo=getElementsByClass("activo");
		if($activo.length>0){$activo[0].className='boton';}
		this.className='activo'
      } 
	  return false;
   },
    '#boton4' : function(el){ 
      el.onclick = function(){
		//$seccion='invest'; 
		//CargarContenido("escenario","invest.php",null)
		$selected=getElementsByClass("selected");
		if($selected[0].id=='invest'){return;}
		$selected[0].className='';
		t1 = new Tween($selected[0].style,'left',Tween.strongEaseOut,0,724,1.3,'px');
		t1.start();
		$about= document.getElementById('invest');
		$about.className='selected'
		t2 = new Tween($about.style,'left',Tween.strongEaseOut,-724,0,1.3,'px');
		t2.start();
		$watch= document.getElementById('watch');
		t2.onMotionFinished = function(){$watch.innerHTML='';}
		$params=null;
		//CargarContenido('watch','watch.php',$params);
		
		$marcador= document.getElementById('marcador');
		$marcador.style.display="block";
		$marcador.style.left="399px";
		$activo=getElementsByClass("activo");
		if($activo.length>0){$activo[0].className='boton';}
		this.className='activo'
      }
	  return false;
   },
    '#boton5' : function(el){ 
      el.onclick = function(){
		//$seccion='speak'; 
		//CargarContenido("escenario","speak.php",null)
		$selected=getElementsByClass("selected");
		if($selected[0].id=='speak'){return;}
		$selected[0].className='';
		t1 = new Tween($selected[0].style,'left',Tween.strongEaseOut,0,724,1.3,'px');
		t1.start();
		$about= document.getElementById('speak');
		$about.className='selected'
		t2 = new Tween($about.style,'left',Tween.strongEaseOut,-724,0,1.3,'px');
		t2.start();
		$watch= document.getElementById('watch');
		t2.onMotionFinished = function(){$watch.innerHTML='';}
		$params=null;
		//CargarContenido('watch','watch.php',$params);
		
		$marcador= document.getElementById('marcador');
		$marcador.style.display="block";
		$marcador.style.left="480px";
		$activo=getElementsByClass("activo");
		if($activo.length>0){$activo[0].className='boton';}
		this.className='activo'
      }
	  return false;
   },
    '#boton6' : function(el){ 
      el.onclick = function(){
		//$seccion='live'; 
		//CargarContenido("escenario","live.php",null)
		$selected=getElementsByClass("selected");
		if($selected[0].id=='live'){return;}
		$selected[0].className='';
		t1 = new Tween($selected[0].style,'left',Tween.strongEaseOut,0,724,1.3,'px');
		t1.start();
		$about= document.getElementById('live');
		$about.className='selected'
		t2 = new Tween($about.style,'left',Tween.strongEaseOut,-724,0,1.3,'px');
		t2.start();
		$watch= document.getElementById('watch');
		t2.onMotionFinished = function(){$watch.innerHTML='';}
		$params=null;
		//CargarContenido('watch','watch.php',$params);
		$marcador= document.getElementById('marcador');
		$marcador.style.display="block";
		$marcador.style.left="560px";
		$activo=getElementsByClass("activo");
		if($activo.length>0){$activo[0].className='boton';}
		this.className='activo'
      }
	  return false;
   },
    '#boton7' : function(el){ 
      el.onclick = function(){
		$seccion='food'; 
		CargarContenido("escenario","food.php",null);
		//CargarContenido('watch','watch.php',$params);
      }
	  return false;
   },
    '#boton_casa' : function(el){ 
      el.onclick = function(){
		
		$selected=getElementsByClass("selected");
		//if($selected[0].id=='news'){return;}
		$selected[0].className='';
		t1 = new Tween($selected[0].style,'left',Tween.strongEaseOut,0,724,1.3,'px');
		t1.start();
		$home= document.getElementById('home');
		$home.className='selected'
		t2 = new Tween($home.style,'left',Tween.strongEaseOut,-724,0,1.3,'px');
		t2.start();
		$watch= document.getElementById('watch');
		t2.onMotionFinished = function(){$watch.innerHTML='';}
		$params=null;
		$marcador= document.getElementById('marcador');
		
		$marcador.style.display="none";
		$marcador.style.left="702px";
		return;
		$activo=getElementsByClass("activo");
		if($activo.length>0){$activo[0].className='boton';}
		this.className='activo'
		//$seccion='food'; 
		//CargarContenido("escenario","food.php",null);
		//CargarContenido('watch','watch.php',$params);
      }
	  return false;
   },
    '#mensajes_speak' : function(el){ 
	  scroll('mensajes_speak',300);
	  return false;
   },
    '#listado_news' : function(el){ 
	  scroll('listado_news',300);
	  return false;
   },
   '#campo_boton' : function(el){
	   el.onclick = function(el){
		   $name= document.getElementById('name');
		   $email= document.getElementById('e_mail');
		   $country= document.getElementById('country');
		   $message= document.getElementById('message');
		   $params= 'nombre='+$name.value+'&email='+$email.value+'&pais='+$country.value+'&mensaje='+$message.value;
		   CargarContenido('speak','insert_comentario.php',$params);
		}
   },
   '#boton_volver_comentarios' : function(el){
	   el.onclick = function(el){
		   CargarContenido('speak','speak.php',null);
		  // CargarContenido('speak','insert_comentario.php',null);
		}
   },
    '.enlace_comentarios' : function(el){
	   el.onclick = function(el){
		  this.href='#';
		  //alert(this.id);
		  CargarContenido('news','comentarios_noticia.php','id='+this.id);
		  return false;
		}
   },
    '#listado_comentarios' : function(el){ 
	  scroll('listado_comentarios',300);
	  return false;
   },
    '#campo_boton_volver_comment' : function(el){ 
	   el.onclick = function(el){
	   	CargarContenido('news','news.php',null);
		return false;
	   }
   },
    '#campo_boton_comment' : function(el){ 
	   el.onclick = function(el){
	   		 $name= document.getElementById('name_comment');
			 $message= document.getElementById('message_comment');
			 $id_noticia = document.getElementById('id_noticia');
			 $params= 'nombre='+$name.value+'&mensaje='+$message.value+'&id_noticia='+$id_noticia.value;
			 CargarContenido('news','insert_comentario_news.php',$params);
		//CargarContenido('news','news.php',null);
		return false;
	   }
   },
   '#enviar_newsletter' : function(el){
		el.onclick =function(el){
			//comprobar si el email es valido
			var email= document.getElementById('email');
			$params='email='+email.value;
			 CargarContenido('contenedor_newletter','insert_newsletter.php',$params);
		}
	}
}; 

Behaviour.register(myrules);