function showHomeNews(el){
	$(el).children(".home-news-desc").show("fast");
}
function hideHomeNews(el){
	$(el).children(".home-news-desc").hide("fast");
}
function showTeamItem(el){
	$(el).children(".item-team-desc").show("fast");
}
function hideTeamItem(el){
	$(el).children(".item-team-desc").hide("fast");
}
function showJob(el){
	
	$('.job-desc').each( function(i) {
		if($(this).prev().hasClass("active")){
			$(this).hide("fast");
			$(this).prev().removeClass("active");
		}
	});
	
	$(el).next().show("fast");
	$(el).addClass("active");
}
function showJobFromHash(hash){
	$('.job-desc').each( function(i) {
		$(this).hide();
	});
	$('#job-'+hash.slice(1)).show();
}

function checkContactForm(t1, t2, t3, t4){
	
	var tempString = '';
	
	if($('#contact-mail').val() == t1 && $('#contact-phone').val() == t2){
		tempString += 'Wpisz e-mail lub telefon\n';
		$('#contact-mail').addClass('error');
		$('#contact-phone').addClass('error');
	}
	else{
		$('#contact-mail').removeClass('error');
		$('#contact-phone').removeClass('error');
	}
	if($('#contact-mail').val() != t1 && !validMail($('#contact-mail').val())){
		tempString += 'Wpisz poprawny adres e-mail\n';
		$('#contact-mail').addClass('error');
	}
	else if($('#contact-mail').val() != t1){
		$('#contact-mail').removeClass('error');
	}
	if($('#contact_textarea').val() == t3){
		tempString += 'Wpisz treść wiadomości\n';
		$('#contact_textarea').addClass('error');
	}
	else{
		$('#contact_textarea').removeClass('error');
	}
	if($('#contact-captcha').val() == t4){
		tempString += 'Wpisz kod z obrazka';
		$('#contact-captcha').addClass('error');
	}
	else{
		$('#contact-captcha').removeClass('error');
	}
	
	if(tempString == ''){
		$('#contact_form').submit();
	}
	else{
		alert(tempString);
	}
}

function validMail(mail){
	var emailReg = new RegExp(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/);
	if(!emailReg.test(mail)) {
		return false;
	}
	return true;
}
