function openPopUp()
{
	$.fn.colorbox({width:"430", height: "550", inline:true, href:"#inline_content"});
}

function showSectionContent()
{
	seccion_info.style.display = "block";
		
	//pregunta si al que se le hizo click ya es el que está en pantalla y hace un return en caso positivo
	if(document.getElementById(this.className).style.display=="block")
	{
		return;
	}
		
	//recorre todos los divs de las secciones y al que está en pantalla lo oculta con fade
	for(i=0;i<links_info.length;i++)
	{
		if(links_info[i].style.display=="block")
		{
			$(links_info[i]).hide(function () {
			$(this).fadeOut("fast");	
			});	
		}
	}
	
	//oculta todos los divs dentro del bloque de secciones
	for(i=0;i<links_info.length;i++)
	{
		links_info[i].style.display="none";
	}
	
	//muestra la info correspondiente al link seleccionado
	$("#"+this.className).show(function () {
	$(this).show(1000);	
	});		
}

function applyFade()
{
	$(".fade").mouseover(function () {
	$(this).fadeTo("fast", 0.50);
	});
				
	$(".fade").mouseout(function () {
	$(this).fadeTo("medium", 1);
	});
}

function applyImgFade()
{	
	/*$('img').load(function () {
	$(this).css({opacity: 0.0});
    $(this).animate({opacity: 1.0}, 1000);
    });*/
}

function fecha()
{				
	var fecha="";
	var hoy = new Date();
	var semana, mes;				
				
	switch (hoy.getDay()) {
		case 0:
			semana = "Domingo";
			break;
		case 1:
			semana = "L&uacute;nes";
			break;
		case 2:
			semana = "Martes";
			break;
		case 3:
			semana = "Mi&eacute;rcoles";
			break;
		case 4:
			semana = "Jueves";
			break;
		case 5:
			semana = "Viernes";
			break;
		case 6:
			semana = "S&aacute;bado";
			break;
	}
					
	switch (hoy.getMonth()) {
		case 0:
			mes = "Enero";
			break;
		case 1:
			mes = "Febrero";
			break;
		case 2:
			mes = "Marzo";
			break;
		case 3:
			mes = "Abril";
			break;
		case 4:
			mes = "Mayo";
			break;
		case 5:
			mes = "Junio";
			break;
		case 6:
			mes = "Julio";
			break;
		case 7:
			mes = "Agosto";
			break;
		case 8:
			mes = "Septiembre";
			break;
		case 9:
			mes = "Octubre";
			break;
		case 10:
			mes = "Noviembre";
			break;
		case 11:
			mes = "Diciembre";
			break;
	}
				
	fecha=(semana + ", " + hoy.getDate() + "&nbsp;de&nbsp;" + mes + "&nbsp;de&nbsp;" + hoy.getUTCFullYear());
	$('#fecha').innerHTML=fecha;	
}

function setMenu(nombre) {
	swfobject.embedSWF(nombre, "menu", "920", "112", "9.0.0", "swf/expressInstall.swf", null, {wmode:"transparent"});
}

function validateForm(operacion) {	
	
	var oper = operacion;
	
	if (oper == 'contacto')
	{
		var name = $('#nombre').val();
		var ape = $('#apellido').val();
		var mail = $('#mail').val();
		var phone = $('#telefono').val();		
		var message = $('#mensaje').val();		
		
		var counter=0;	
		var expName = /^[a-zA-Z]{3}/;
		var expApe = /^[a-zA-Z]{2,}|^[A-Z][a-z]/;
		var expMail = /^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
		var expPhone = /^[0-9-]{7,15}$/;
		
		if ( (name == "") || (!expName.test(name)) ) {			
			$('#nameVal').html("nombre inv&aacute;lido");
			$('#nombre').focus();
			counter++;
		}
		else
		{
			$('#nameVal').html("");
		}
		
		if ( (ape == "") || (!expApe.test(ape)) ) {			
			$('#apeVal').html("apellido inv&aacute;lido");
			$('#apellido').focus();
			counter++;
		}
		else
		{
			$('#apeVal').innerHTML="";
		}
		
		if( (mail == "") || (!expMail.test(mail)) ) {
			$('#mailVal').html("e-mail inv&aacute;lido");
			$('#mail').focus();
			counter++;
		}
		else
		{
			$('#mailVal').html("");
		}
		
		if( (phone == "") || (!expPhone.test(phone)) ) {
			$('#phoneVal').html("tel&eacute;fono inv&aacute;lido");
			$('#telefono').focus();
			counter++;
		}
		else
		{
			$('#phoneVal').html("");
		}
		
		if ( message.length == 0 ) {
			$('#messageVal').html("campo vac&iacute;o");
			$('#mensaje').focus();
			counter++;	
		}
		else
		{
			$('#messageVal').html("");
		}
			
		if ( counter==0 ) {
			$('#output').html("");	
			$('#output').html("enviando formulario...");		
			return true;			
		} else {		
			$('#output').html("");	
			$('#output').html("el formulario no ha sido enviado");			
			return false;
		}
	}
	
}