window.addEvent('domready', function() {
	
	//--------------------------------------------------------- AJAX CONTACTO
	
	  elementoFormulario = $("contacto");
	  elementoFormulario.addEvent('submit', function(e) {			
	  e.stop();
	  
	  if ($('nombre').value==""){
	  	alert('<b>Error --></b><br><br>Ingrese su Nombre!');
	  	return false
	  }
	  if ($('apellido').value==""){
		  alert('<b>Error --></b><br><br> Ingrese su Apellido!');
		  return false
	  }
	  if ($('pais').value==""){
		  alert('<b>Error --></b><br><br> Seleccione su Pais!');
		  return false
	  }
	  if ($('email').value==""){
		  alert('<b>Error --></b><br><br> Ingrese su email!');
		  return false
	  }
	  if (!emailCheck($('email').value)){
		  return false
	  }	
		
	  $('ajaxloader').style.display="block";
	  
	  this.set('send', {
		 onComplete: function() {
			//alert("<b>Mensaje --></b><br><br> Su consulta ha sido enviada con exito!") 
			window.location="?seccion=msn-contacto";
		 }
	  });
	  this.send();
	});
	  
	//--------------------------------------------------------- AJAX SUSCRIPCION
	
	  elementoFormulario = $("suscripcion");
	  elementoFormulario.addEvent('submit', function(e) {			
	  e.stop();
	  
	  if ($('nombre_s').value==""){
	  	alert('<b>Error --></b><br><br> Ingrese su Nombre!');
	  	return false
	  }
	  if ($('apellido_s').value==""){
		  alert('<b>Error --></b><br><br> Ingrese su Apellido!');
		  return false
	  }
	  if ($('email_s').value==""){
		  alert('<b>Error --></b><br><br> Ingrese su email!');
		  return false
	  }
	  if (!emailCheck($('email_s').value)){
		  return false
	  }	
		
	  $('ajaxloader_s').style.display="block";
	  
	  this.set('send', {
		 onComplete: function() {
			//alert("<b>Mensaje --></b><br><br> Su Suscripción ha sido enviada con exito!") 
			window.location="?seccion=msn-suscripcion";
		 }
	  });
	  this.send();
	});								 
});

		//--------------------------------------------------------- VIDEO SLIDER
	
	function prev(){
		maxPos=375;		
		var currentPos = $('videoPos').value;
		currentPos =currentPos *1;
		var fixPos = Math.abs(currentPos);
		if (fixPos > 0){
			var postPos=fixPos+119;
			$('myList').tween('margin-left', [currentPos+"px", postPos+"px"]);
			$('videoPos').value=postPos;
		}
	};
	
	function next(){		
		maxPos=375;	
		var currentPos = $('videoPos').value;
		currentPos =currentPos *1;
		var fixPos = Math.abs(currentPos);
		if (fixPos < maxPos){
;			var postPos=currentPos-119;
			$('myList').tween('margin-left', [currentPos+'px', postPos+'px']);
			$('videoPos').value=postPos;
		}else{
			$('myList').tween('margin-left', [currentPos+'px', '0px']);
			$('videoPos').value=0;
		}
	}

// Campo lote llave
function loteIn(){
	$('lote').style.background = "url(img/blank.png)";
}
function loteOut(){
	if ($('lote').value == ""){
		$('lote').style.background = "url(img/lote.png)";
		$('lote').style.backgroundPosition = "center center";
	}
}

function serieIn(){
	$('serie').style.background = "url(img/blank.png)";	
}
function serieOut(){
	if ($('serie').value == ""){
		$('serie').style.background = "url(img/serie.png)";
		$('serie').style.backgroundPosition = "center center";
	}
}

function valorSelect(id,valor){
 $(id).value=valor;	
}

function cambiarImagenToggle(id,signo){
	actual=$(id).src;
	var actual_s = actual.split("/");
	var actual_l = actual.length;	
	var file = actual_s[actual_s.length-1];
	var file_l=file.length;
	var path= actual.substring(0,(actual_l-file_l))
	
	if (file == "desplegar.png"){
		$(id).src=path+'contraer.png'
		$(signo).src=path+'menos.png'		
	}else{
		$(id).src=path+'desplegar.png'
		$(signo).src=path+'mas.png'
	}

}

function controlLogin(){
	  if ($('lote').value=="" || $('lote').value=="lote llave" || $('lote').value=="lote"){
		  alert('<b>Error --></b><br><br> Ingrese Lote llave!');
		  return false
	  }	
	  if ($('serie').value=="" || $('serie').value=="serie llave" || $('serie').value=="serie" ){
		  alert('<b>Error --></b><br><br> Ingrese Serie llave!');
		  return false
	  }	
}