var str = {
	'fr' : {
		'bad_email' : 'Votre courriel n’est pas valide.'
	},
	'en' : {
		'bad_email' : 'Your email is not valid.'
	}
}

$(document).ready(function() {
	$('#query').focus(function() { $(this).val('') });

	$(".video a").click(function() {
		popWin($(this).attr("href"), 600, 453);
		return false;
	});

	// menu roll-over for IE
	$('#nav>ul>li').bind('mouseenter focus', function() {
		$(this).addClass('over');
	}).bind('mouseleave blur', function() {
		$(this).removeClass('over');
	});

	$('#subscribe form').submit(function() {
		if (!isValidEmail($('#query').val())) {
			alert(str[lang].bad_email);
			return false;
		}
	});

	if ($('.bio').length > 0) {
		$('.bio').addClass('hide');
		$('#content h3').css('cursor','pointer').click(function() {
			var parent = $(this).attr('id');
			$('.'+parent).toggleClass('hide');
  		});
	}


});

function popWin(url, width, height)
{
	var top = (screen.height-(height + 110))/2;
	var left = (screen.width-width)/2;
	window.open(url, "win", "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+width+",height="+height+",left="+left+",screenX="+left+",top="+top+",screenY="+top).focus();
}

function isValidEmail(email) {
	var regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if ( email.match(regex) ) return true;
	return false;
}