function lanzarBusqueda() {
	str = document.formaBuscar.formulario.value;
	var r1 = new RegExp('^[\"]{1}[a-zA-Z0-9\\á\\é\\í\\ó\\ú\\-\\.\\ \\+]{1}[a-zA-Z0-9\\á\\é\\í\\ó\\ú\\-\\.\\ \\+]+[\"]{1}$')
	var r2 = new RegExp('^([\"]{1}[a-zA-Z0-9\\á\\é\\í\\ó\\ú\\-\\.\\ \\+]{1}[a-zA-Z0-9\\á\\é\\í\\ó\\ú\\-\\.\\ \\+]+[\"][\+]?)?[a-zA-Z0-9\\á\\é\\í\\ó\\ú\\-\\.\\ \\+]{1}[a-zA-Z0-9\\á\\é\\í\\ó\\ú\\-\\.\\ \\+]+$')
	var r3 = new RegExp('^([a-zA-Z0-9\\á\\é\\í\\ó\\ú\\-\\.\\ \\+]{1}[a-zA-Z0-9\\á\\é\\í\\ó\\ú\\-\\.\\ \\+]+[\+]?)?[\"]{1}[a-zA-Z0-9\\á\\é\\í\\ó\\ú\\-\\.\\ \\+]{1}[a-zA-Z0-9\\á\\é\\í\\ó\\ú\\-\\.\\ \\+]+[\"]{1}$');

	if (document.formaBuscar.texto.value != "") {
		if(r3.test(str) || r2.test(str)){
			document.formaBuscar.submit();
			//return true;
		} else {
			alert("Por favor redefina su búsqueda");
			//return false;
		}
	} else {
		alert("Debe ingresar un texto para la búsqueda");
		//return false;
	}

}
function irHome(enlace){
	var myCookie = Cookie.write('pestana', enlace, {path:'/'});
}
window.addEvent('domready', function() {

	var estadoAccesos = 0;
	
	var myVerticalSlide = new Fx.Slide('accesos',{
		duration:1000
	});
	
	var estadoConstruyendo = 0;
	
	var slideConstruyendo = new Fx.Slide('contenedorTuFuturo',{
		duration:1000
	});	
	
	$('accesos').addEvent('mouseleave',function(e){
		e.stop();
		myVerticalSlide.slideOut();
		estadoAccesos=0;
		$('show_accesos').setStyle('background-position','0px -389px');
	}) 	
	
	$('contenedor_herramientas').setStyle('display','block')
	myVerticalSlide.hide();

	$('show_accesos').addEvent('click', function(e){
		e.stop();
		if(estadoAccesos==1){
			myVerticalSlide.slideOut();
			$('show_accesos').setStyle('background-position','0px -389px');
			estadoAccesos=0;
		}else{
			myVerticalSlide.slideIn();
			$('show_accesos').setStyle('background-position','-144px -389px');
			estadoAccesos=1;
			if(estadoConstruyendo==1){
				slideConstruyendo.slideOut();
				$('construyendoFuturo').setStyle('background-position','-457px -390px');
				estadoConstruyendo=0;			
			}
		}
		
	});

	$('cerrar').addEvent('click', function(e){
		e.stop();
		myVerticalSlide.slideOut();
		estadoAccesos=0;
		$('show_accesos').setStyle('background-position','0px -389px');
	});
	
	
	$('contenedorTuFuturo').addEvent('mouseleave',function(e){
		e.stop();
		slideConstruyendo.slideOut();
		estadoConstruyendo=0;
		$('construyendoFuturo').setStyle('background-position','-457px -390px');
	}) 	
	
	$('maskConstruyendo').setStyle('display','block')
	slideConstruyendo.hide();

	$('construyendoFuturo').addEvent('click', function(e){
		e.stop();
		if(estadoConstruyendo==1){
			slideConstruyendo.slideOut();
			$('construyendoFuturo').setStyle('background-position','-457px -390px');
			estadoConstruyendo=0;
		}else{
			slideConstruyendo.slideIn();
			$('construyendoFuturo').setStyle('background-position','-457px -415px');
			estadoConstruyendo=1;
			if(estadoAccesos==1){
				myVerticalSlide.slideOut();
				$('show_accesos').setStyle('background-position','0px -389px');
				estadoAccesos=0;			
			}			
		}
		
	});

	$('cerrarConstruyendo').addEvent('click', function(e){
		e.stop();
		slideConstruyendo.slideOut();
		estadoConstruyendo=0;
		$('construyendoFuturo').setStyle('background-position','-457px -390px');
	});

});

function getFlashMovieObject(movieName){
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function SendDataToFlashMovie(estado){
	var flashMovie=getFlashMovieObject("cont_banners");
	flashMovie.SetVariable("/:flag", estado);
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
