//jQuery.noConflict();
jQuery(document).ready(function($) {
	/*
	$('a.parrainer_link').click(function(){
		$.ajax({
				type: "POST",
				timeout: 7000,
				data: {
				parrainageInit: 1
				},
				url: '/fr/todays/parrainage',
				success: function(result) {
					if(result == "true") {
						tb_show("Invitez vos amis<br /> et gagnez des bons d'achats de 8 &euro; !", "/fr/todays/parrainage?keepThis=true&TB_iframe=true&height=420&width=380", "");
						$('#TB_closeWindowButton').html('');
						$('#TB_closeWindowButton').prepend('<img>').find(':first-child').attr('src','http://www.1jour1vin.com/fr/img/generique/popup_close2.gif').attr('title','Fermer');	
					}					
				}
			});
		return false;
	});
	
	$('a#BAshow').click(function(){
		
		tb_show("Vos bons d'achats", "/fr/comptes/getbonsdachat?keepThis=true&TB_iframe=true&height=220&width=380", "");
		$('#TB_closeWindowButton').html('');
		$('#TB_closeWindowButton').prepend('<img>').find(':first-child').attr('src','http://www.1jour1vin.com/fr/img/generique/popup_close2.gif').attr('title','Fermer');	
		
		return false;
	});
	*/
	// popup parrainage
	$('a#close').click(function(){
		$('#UI_windowP').hide();
		$('div#TB_overlayP').hide();
	 });
	 
	$('#TB_overlayP').click(function(){
		$('#UI_windowP').hide();
		$(this).hide(); 
	});
	$('a.parrainer_link').click(function(){
		$('html').animate({scrollTop:0}, 'slow');
		$('div#TB_overlayP').show();
		 $('div#UI_windowP').show();
		setWindow();
		//tb_show("Invitez vos amis<br /> et gagnez des bons d'achats de 8 &euro; !", "/fr/todays/parrainage?keepThis=true&TB_iframe=true&height=420&width=380", "");
		//$('#TB_closeWindowButton').html('');
		//$('#TB_closeWindowButton').prepend('<img>').find(':first-child').attr('src','http://www.1jour1vin.com/fr/img/generique/popup_close2.gif').attr('title','Fermer');		
		
	    return false;
	});
	
	$('div#UI_appellations').next('div').hide();
	$('div#UI_domaines2').next('div').hide();
	
	$('a.showseoLinks').click(function(){		
		$(this).parent().parent().next('div').toggle();
		var texte = $(this).html();
		
		if (texte == 'Afficher'){
			$(this).html('Masquer') ;
		}
		else if(texte == 'Masquer') {
			$(this).html('Afficher')  ;
		}
		return false;
	});
	
});

function setWindow(){
	var newX = $(window).width()/2 - $("#UI_windowP .window").width()/2;
	var newY = $(window).height()/2 - $("#UI_windowP .window").height()/2;
	$("#UI_windowP .window").css({left: newX, top: newY});
	$("#UI_windowP").width($(document).width());
	$("#UI_windowP").height($(document).height());
	$("#UI_windowP .window").show();
}
