/*JS*/

$(document).ready(function() {	
	
	if($('#wrapperHome').length) {
	
		$('#wrapperHome a.popinLink , #footer a.popinLink').click(function() {	
	 
			if($(this).hasClass('staticModal')) {				
				var modalToShow = $(this).attr('href').split('#');			
				$("#"+modalToShow[1]).show('fast' , function() {
					if ($.browser.msie) {
						this.style.removeAttribute("filter");
					 }
				});					
				return false;

			} else {				
				//$('.modalWindow').hide('fast'); //safe
				$('.modalWindow').not($('#selectionForm')).hide('fast'); 
			var modalToShow = $(this).attr('href').split('#');			
			$("#"+modalToShow[1]).show('fast' , function() {
				if ($.browser.msie) {
					this.style.removeAttribute("filter");
				 }
			});	
			return false;	
			}
		});
		
		$('#wrapperHome div.modalWindow > a.closeModalWindow').click(function() {
			$(this).parent('div.modalWindow').hide('fast');
			return false;
		});	
	}
	
	if($('#wrapperJeu').length) {

		$('#wrapperJeu a.popinLink , #footer a.popinLink').click(function() {
			$('.modalWindow').not($('#bravo')).not($('#perdu')).hide('fast'); //safe
			var modalToShow = $(this).attr('href').split('#');			
			$("#"+modalToShow[1]).show('fast' , function() {
				if ($.browser.msie) {
					this.style.removeAttribute("filter");
				 }
			});	
			return false;	
		});
		
		$('#wrapperJeu div.modalWindow > a.closeModalWindow').click(function() {
			$(this).parent('div.modalWindow').hide('fast');
			return false;
		});	
	}



/*functions for IE 6*/
if ($.browser.msie && $.browser.version <= 6 ) {
	try {
	document.execCommand('BackgroundImageCache', false, true);
	} catch(e) {}		
}	
/*end functions for IE 6*/
});

function gagne() {
	
	cacher_felicitations();
	
	$('.modalWindow').hide('fast'); //safe		
		
	$("#bravo").show('fast' , function() {
		if ($.browser.msie) {
			this.style.removeAttribute("filter");
		 }
		
	});	
}

function perdu() {
	$('.modalWindow').hide('fast'); //safe		
	$("#perdu").show('fast' , function() {
		if ($.browser.msie) {
			this.style.removeAttribute("filter");
		 }
	});	
}

function deja_joue() {
	$('.modalWindow').hide('fast'); //safe		
	$("#deja_joue").show('fast' , function() {
		if ($.browser.msie) {
			this.style.removeAttribute("filter");
		 }
	});	
}

function jeu_termine() {
	$('.modalWindow').hide('fast'); //safe		
	$("#jeu_termine").show('fast' , function() {
		if ($.browser.msie) {
			this.style.removeAttribute("filter");
		 }
	});	
}

function jeu_termine_resultats() {
	//$('.modalWindow').hide('fast'); //safe			
}

function selection() {
	$('.modalWindow').hide('fast'); //safe		
	$("#selectionForm").show('fast' , function() {
		if ($.browser.msie) {
			this.style.removeAttribute("filter");
		 }
	});	
}

function parrainage() {
	$('.modalWindow').hide('fast'); //safe		
	$("#parrainForm").show('fast' , function() {
		if ($.browser.msie) {
			this.style.removeAttribute("filter");
		 }
	});	
}

function warning() {
	$('.modalWindow').hide('fast'); //safe		
	$("#warningPopin").show('fast' , function() {
		if ($.browser.msie) {
			this.style.removeAttribute("filter");
		 }
	});	
}

function dommage() {
	$('.modalWindow').hide('fast'); //safe		
	$("#dommagePopin").show('fast' , function() {
		if ($.browser.msie) {
			this.style.removeAttribute("filter");
		 }
	});	
}

function resultats() {
	$('.modalWindow').hide('fast'); //safe		
	$("#resultatsPopin").show('fast' , function() {
		if ($.browser.msie) {
			this.style.removeAttribute("filter");
		 }
	});	
}

function congrats() {
	$('.modalWindow').hide('fast'); //safe		
	$("#congratsPopin").show('fast' , function() {
		if ($.browser.msie) {
			this.style.removeAttribute("filter");
		 }
	});	
}
