$(document).ready(function() {
						   
	$("#wrap").stop().animate({
		opacity: 1
	}, "0");
	
	$("#float-menu").stop().animate({
		opacity: 1
	}, "0");
										   
	$('#a-phases').click(function () {
		$("#a-technologies").removeClass("selected");
		$("#a-processes").removeClass("selected");
		$('#technologies').hide();
		$('#processes').hide();
		$('#phases').show();
		$(this).addClass("selected");
	});
	
	$('#a-technologies').click(function () {
		$("#a-processes").removeClass("selected");
		$("#a-phases").removeClass("selected");
		$('#phases').hide();
		$('#processes').hide();
		$('#technologies').show();
		$(this).addClass("selected");
	});
	
	$('#a-processes').click(function () {
		$("#a-technologies").removeClass("selected");
		$("#a-phases").removeClass("selected");
		$('#phases').hide();
		$('#technologies').hide();
		$('#processes').show();
		$(this).addClass("selected");
	});
	   					  
	$(function() {
		$("#menu ul li h2 a").css("opacity","0.5");
		$(".current").css("opacity","1");
		$("#menu ul li h2 a").hover(function () {
			$(this).stop().animate({
				opacity: 1.0
			}, "900");
		},
		function () {
			$(this).stop().animate({
				opacity: 0.5
			}, "0");
			$(".current").stop().animate({
				opacity: 1
			}, "0");
		});
	});
	
	$(function() {
		$(".soluciones-infinito").css("opacity","0.5");
		$(".soluciones-infinito").hover(function () {
			$(this).stop().animate({
				opacity: 1.0
			}, "900");
		},
		function () {
			$(this).stop().animate({
				opacity: 0.5
			}, "0");
		});
	});
	
	$(function() {
		$("#language .l-text").css("opacity","0");
		$("#language .l-button").hover(function () {
			$("#language .l-text").stop().animate({
				opacity: 1.0
			}, "900");
		},
		function () {
			$("#language .l-text").stop().animate({
				opacity: 0
			}, "0");
		});
	});
	
	
	var menu = null;
	menu = parseInt($("#float-menu").css("top").substring(0,$("#float-menu").css("top").indexOf("px")))
	$(window).scroll(function () { 
		offset = menu+$(document).scrollTop()+"px";
		$("#float-menu").animate({top:offset},{duration:500,queue:false});
	});
	
	$(function() {
		$("#float-menu ul li a").css("opacity","0.5");
		$("#float-menu ul li a").hover(function () {
			$(this).stop().animate({
				opacity: 1.0
			}, "1");
		},
		function () {
			$(this).stop().animate({
				opacity: 0.5
			}, "0");
		});
	});
	
	$("#error").hide();
	$("#error-email").hide();
	$("#ok").hide();
	
	$("#submit-form").click(function(){
	var hasError = false;
	var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
	var formName = $("#name").val();
	var formEmail = $("#email").val();
	var formCompany = $("#company").val();
	var formMessage = $("#message").val();
	if(formName == '') {
		$("#error").show();
		hasError = true;
	}
	if(formEmail == '') {
		$("#error").show();
		hasError = true;
	}
	if(formMessage == '') {
		$("#error").show();
		hasError = true;
	}
	if( !emailReg.test(formEmail) ) {
		$("#error-email").show();
		hasError = true;
	} else {
		$("#error-email").hide();
	}
	if(hasError == false) {
		$("#error").hide();
		$("#error-email").hide();
		$("#contact-form").hide();
		$("#ok").show();
		$.post("http://projects.solucionesinfinito.com/bhpglobal/contact-us/script.php",
   			{	name: formName,
   				email: formEmail,
				company: formCompany,
   				message: formMessage
   			}
				);
		}
	return false;
});
	
});
