function validerAbo(){
	
	//On vérifie que toutes les cases ne sont pas a non
	var cases = document.getElementsByTagName('input');   
  	var nbNewsletter=0;
	var nbNewsNotAbonne=0;
   	for(var i=0; i<cases.length; i++)   {
   	  var iden=cases[i].id+"";
   	 
   	  if(cases[i].type == 'radio' && iden.indexOf("Choice",0)!=-1){
		
       nbNewsletter++;
		if(cases[i].value == 'non' && cases[i].checked){
			//alert(iden);
		nbNewsNotAbonne++;
		
		}
	  }
	  
	}   
	//alert(nbNewsletter/2+"  "+nbNewsNotAbonne);
	if(nbNewsNotAbonne==nbNewsletter/2){
		
		return true;
	}else{
		return false;
	}
}


/* Popin appeler par un Flash */
function openPopin(id){
	displayPopin(id);
}

function showPopin(){
	$("a.popinLink").click(function(){
		displayPopin(this.href);
		return false;
	});
}

/*DIGITAS 22/07/08 : ajouts*/

//Load the popin by any event precised in the html page
var loadPopin = function(url){
	displayPopin(url);
}


function miseEnFormePopin(){
	tmp = $("#popinLift .popinContent").clone();
	$("#popinLift").empty();
	$("#popinLift").append(tmp);
}

function intitClosePopin(){
	$('#popinLift a.btClose, #popinLift a.closePopin, #opacDivLift').click(function(){
		$("#popinLift").remove();
		$('#opacDivLift').remove();
		if (typeof document.body.style.maxHeight === "undefined") {
			$("#mainContainerLift select").css("visibility","visible");
		}
		return false;
	});
}

function displayPopin(url){
	showOpacDiv();
	$.ajax({
		type:"GET",
		url:url,
		success:function(msg) {
			
			$("body").append("<div id=\"popinLift\">"+msg+"</div>");
			$("#popinLift").css("top", $(window).scrollTop())
			miseEnFormePopin();
			if (typeof document.body.style.maxHeight === "undefined") {
				$("#mainContainerLift select").css("visibility","hidden");
			}
			intitClosePopin();
			
		}
	});
}

function showOpacDiv(){
	$("body").append("<div id=\"opacDivLift\"></div>");
	if (typeof document.body.style.maxHeight === "undefined") {
		$('#opacDivLift').css("height",$("body").height());
	}
}

/////////////////////////////////////////// INIT /

jQuery(window).load(function(){
	showPopin();
});

