function popUp(url) {
	var newwindow = window.open(url,'afiche','scrollbars=yes,width=860,screenX=200,screenY=200');
	if (window.focus) {
		newwindow.focus()
	}
}

function validEmail(email) {
	var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (email.match(emailRegEx)) {
		return true;
	}
	else {
		return false;
	}
}
function anterior() {
	activate("prev");
}
function siguiente() {
	activate("next");
}
function activate(direction, img) {
	var $img = $(img);
	if(((direction == "next") || (direction == "prev")) && !$img.hasClass("arrowInactive")) {
		var $divs = $("#subDiv .breadParts");
		var ids = Array();
		$divs.each(function(i){ ids.push(this.id); });
		var $activo = $("#subDiv .active");
		var id = $activo.attr("id");
		var index = $.inArray(id, ids);
		switch(direction) {
			case "next":
				if((index >= 0) && (index < ($divs.length - 1))) {
					$activo.toggleClass("active");
					$next = $activo.next(".breadParts");
					$next.toggleClass("active");
					var idNext = $next.attr("id");
					if($.inArray(idNext, ids) == ($divs.length - 1)) {
						$img.toggleClass("arrowInactive");
					}
					if(index == 0) {
						$("#subDiv img.arrows").not(img).toggleClass("arrowInactive");
					}
				}
			break;
			case "prev":
				if((index > 0) && (index < $divs.length)) {
					$activo.toggleClass("active");
					$prev = $activo.prev(".breadParts");
					$prev.toggleClass("active");
					var idPrev = $prev.attr("id");
					if($.inArray(idPrev, ids) == 0) {
						$img.toggleClass("arrowInactive");
					}
					if(index == ($divs.length - 1)) {
						$("#subDiv img.arrows").not(img).toggleClass("arrowInactive");
					}
				}
			break;
		}
	}
}
