var addthis_config = {
    ui_click: true
}

var WindowObjectReference;
function openCGV(strUrl, strWindowName){
	WindowObjectReference = window.open(strUrl, strWindowName,"menubar=no, status=no, scrollbars=yes, menubar=no, width=500");
}


function isValidEmailAddress(emailAddress) {
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}

function isValidCP(cp) {
	var pattern = new RegExp(/[0-9]{5}/i);
	return pattern.test(cp);
}

function selectLi(event){
	var rel = event.data.rel;
	var cl1 = event.data.cl1;
	var cl2 = event.data.cl2;
	$(cl1 + " li").each(
		function(){
				if($(this).text() == rel){
					$(this).addClass("selectedBoxLi");
				} else {
					$(this).removeClass("selectedBoxLi");
				}
			}
	);
	$(cl2 + " li").each(
		function(){
				if(parseInt($(this).attr("rel")) == parseInt(rel)){
					$(this).removeClass("hide");
					$(this).addClass("showB");
				} else {
					$(this).removeClass("showB");
					$(this).addClass("hide");
				}
			}
	);
}

function photoOver(el){
	$("#galeryPhotoMap").attr("src", el);
}

function photoOut(){
	var src = $("#galeryPhotoMap").attr("rel");
	$("#galeryPhotoMap").attr("src", src);
}

function initialize() {
	
}

function createMarker(map, latLon, content, context, html){
	
	var restoIcon = new GIcon(G_DEFAULT_ICON);
    restoIcon.image = "assets/map_resto.gif";
    restoIcon.iconSize = new GSize(25, 25);
    markerOptions = { icon:restoIcon };
	
	if(context == "ville"){
		var villeIcon = new GIcon(G_DEFAULT_ICON);
        villeIcon.image = "assets/map_ville.gif";
        villeIcon.iconSize = new GSize(25, 25);
        markerOptions = { icon:villeIcon };
	} 
	if (context == "resto") {
		var restoIcon = new GIcon(G_DEFAULT_ICON);
        restoIcon.image = "assets/map_resto.gif";
        restoIcon.iconSize = new GSize(25, 25);
        markerOptions = { icon:restoIcon };
	}
	if (context == "adresse") {
		var restoIcon = new GIcon(G_DEFAULT_ICON);
        restoIcon.image = "assets/map_resto.gif";
        restoIcon.iconSize = new GSize(25, 25);
        markerOptions = { icon:restoIcon };
	} 
	if (context == "region") {
		var regionIcon = new GIcon(G_DEFAULT_ICON);
        regionIcon.image = "assets/map_region.gif";
        regionIcon.iconSize = new GSize(25, 25);
        markerOptions = { icon:regionIcon };
	}
	
	var marker = new GMarker(latLon, markerOptions);
	marker.tooltip = new Tooltip(marker,content,5);
	marker.isInfoWindowOpen = false;
	
	var ttmover = GEvent.callbackArgs(marker,tooltipMouseover);
	var ttmout = GEvent.callbackArgs(marker,tooltipMouseout);

		if (context == "region"){
			
			GEvent.addListener(marker,'mouseover',ttmover);
			GEvent.addListener(marker,'mouseout',ttmout);
			
			map.addOverlay(marker);	
			map.addOverlay(marker.tooltip);
			
			GEvent.addListener(marker, "click", function() {
				map.setCenter(latLon, 9);
			});
			
		}
	
		else if (context == "ville"){
			
			GEvent.addListener(marker,'mouseover',ttmover);
			GEvent.addListener(marker,'mouseout',ttmout);
			
			map.addOverlay(marker);	
			map.addOverlay(marker.tooltip);
			
			GEvent.addListener(marker, "click", function() {
				map.setCenter(latLon, 12);
			});
			
		} 
		
		else if (context == "resto"){
			
			GEvent.addListener(marker,'mouseover',ttmover);
			GEvent.addListener(marker,'mouseout',ttmout);
			
			map.addOverlay(marker);
			map.addOverlay(marker.tooltip);
			
			GEvent.addListener(marker, "infowindowopen", function() {
				  $("#mapLegendContainer").hide();
			});
			
			GEvent.addListener(marker, "infowindowclose", function() {
				 $("#mapLegendContainer").show();
			});
			
			GEvent.addListener(marker, "click", function() {
			  marker.openInfoWindowHtml(html);
			});
		}
		
		else if (context == "adresse"){
			
			GEvent.addListener(marker,'mouseover',ttmover);
			GEvent.addListener(marker,'mouseout',ttmout);
			
			map.addOverlay(marker);
			map.addOverlay(marker.tooltip);
			
			GEvent.addListener(marker, "infowindowopen", function() {
				  $("#mapLegendContainer").hide();
			});
			
			GEvent.addListener(marker, "infowindowclose", function() {
				 $("#mapLegendContainer").show();
			});
			
			GEvent.addListener(marker, "click", function() {
			  marker.openInfoWindowHtml(html);
			});
		}
		
		else {
			
			GEvent.addListener(marker,'mouseover',ttmover);
			GEvent.addListener(marker,'mouseout',ttmout);
			
			map.addOverlay(marker);
			map.addOverlay(marker.tooltip);
		}
		
	return marker;

}

function tooltipMouseover(){
	if(!(this.isInfoWindowOpen) && !(this.isHidden())){
		this.tooltip.show();
	}
}

function tooltipMouseout(){
	this.tooltip.hide();
}

function showMap(el,context){
	var latLon = $(el).attr("rel");
	var offset = $(el).offset();

	
	if (latLon != ","){
		$("#dialogMap").draggable();
		$("#dialogMap").center({vertical:false,horizontal:true});
		$("#dialogMap").show();
		
		$("#dialogMap").css('left', parseInt(offset.left+100));
		$("#dialogMap").css('top', offset.top);
		
		var lat = parseFloat(latLon.split(",")[0]);
		var lon = parseFloat(latLon.split(",")[1]);
		var zoom = 15;
        map = new GMap2(document.getElementById("mapRestaurant"));
        map.setUIToDefault();
        var center = new GLatLng(lat, lon);
        
        var restoIcon = new GIcon(G_DEFAULT_ICON);
        restoIcon.image = "assets/map_resto.gif";
        restoIcon.iconSize = new GSize(25, 25);
        markerOptions = { icon:restoIcon };
        
        var marker = new GMarker(center, markerOptions);
        map.addOverlay(marker);
        map.setCenter(center,zoom);
	}
	
}


function showMapAll(el){
	
	var latLonTab = $(el).attr("rel").split(";");
	var offset = $(el).offset();

		$("#dialogMapIndex").draggable();
		$("#dialogMapIndex").center({vertical:false,horizontal:true});
		$("#dialogMapIndex").show();
		
		map = new GMap2(document.getElementById("mapIndex"));
        map.setUIToDefault();
        
        var bounds = new GLatLngBounds();
        
        
        for (var i=0; i < latLonTab.length - 1; i++){
		        var lat = parseFloat(latLonTab[i].split(",")[0]);
				var lon = parseFloat(latLonTab[i].split(",")[1]);
				var legend = $('<div style="padding:3px;">'+latLonTab[i].split(",")[2]+'</div>').get(0);
				//alert(legend);
		        var center = new GLatLng(lat, lon);
		    	var marker = createMarker(map, center, legend, '', '');
		        bounds.extend(center);
        }
        
        var zoom=Math.min(map.getBoundsZoomLevel(bounds));
        var mapCenter = bounds.getCenter();
        map.setCenter(mapCenter,zoom);
	
}

function rotateLiOne(){$(".carOneControl li").each(function(i,item){$(item).delay(10000*(i+1), function(){ $(item).click();});});}
function rotateLiTwo(){$(".carTwoControl li").each(function(i,item){var tim = 10000*(i+1); $(item).delay(tim, function(){$(item).click();});});}
function rotateLiTree(){$(".carTreeControl li").each(function(i,item){$(item).delay(10000*(i+1), function(){$(item).click();});});}
function rotateLiFour(){$(".carFourControl li").each(function(i,item){$(item).delay(10000*(i+1), function(){$(item).click();});});}
//function rotateLiFive(){$(".carFiveControl li").each(function(i,item){$(item).delay(5000*(i+1), function(){$(item).click();});});}
//function rotateLiSix(){$(".carSixControl li").each(function(i,item){$(item).delay(5000*(i+1), function(){$(item).click();});});}
function rotateLiSeven(){$(".carSevenControl li").each(function(i,item){var tim = 10000*(i+1);$(item).delay(tim, function(){$(item).click();});});}

$.fn.delay = function(time, callback){
                jQuery.fx.step.delay = function(){};
                return this.animate({delay:1}, time, callback);
}



$(document).ready(function(){

$(".googlePhone").click(function(){
	$(".googlePhone").hide();
	$(this).parent("p").hide();
	$.ajax({
		   type: "GET",
		   async: true,
		   url: "control.php?action=registerGoogle",
		   success: function(msg){
				if (msg != ""){
					$(".phoneGoogle").show();
		     	}
		   }
	  });
});
	
$(".press2").hide();
	
$(".pressgal").click(function(){
	var rel = $(this).attr("rel");
	$(".press2").hide();
	$(".press1").hide();
	$("."+rel).show();
});
	
if ($('#theme_header').length > 0){
	
	var th = $('#theme_header');
	
	if (th.length <= 0){
		return;
	}

	$(".title").hide();
	$(".seltitle").show();

	$('.selector li', th).hover(function() {
			var kind = $(this).attr('kind');
			if ($(this).hasClass('selected')) {
				$('#theme_header .'+kind).show();
			} else {
				$('#theme_header .'+kind).hide();
			}
	}, function() {
			var kind = $(this).attr('kind');
			if (!$(this).hasClass('selected')) {
				$('#theme_header .'+kind).hide();
			}
	});

	$('.showdesc').hover(function() {
		var el = $('#theme_header li.selected').attr("kind");
		$('#theme_header .'+el).show();
	}, function() {
		var el = $('#theme_header li.selected').attr("kind");
		$('#theme_header .'+el).hide();
	});

	$('.selector li', th).click(function() {
		$('#theme_header .selector li').removeClass('selected');
		$(this).addClass('selected');
		var kind = $(this).attr('kind');
		$(".desc").hide();
		$(".title").hide();
		$('#theme_header .'+kind).show();
	
		if (kind == 'rparis'){ var pos = '0px'; }
		if (kind == 'rgroupe'){ var pos = '-220px'; }
		if (kind == 'rgastro'){ var pos = '-440px'; }
		if (kind == 'raffaire'){ var pos = '-660px'; }
		if (kind == 'rromantique'){ var pos = '-880px'; }
		if (kind == 'rfestif'){ var pos = '-1100px'; }
		if (kind == 'rterrasse'){ var pos = '-1320px'; }
		if (kind == 'rsalon'){ var pos = '-1540px'; }
		if (kind == 'rlyon'){ var pos = '-1760px'; }
		if (kind == 'rmarseille'){ var pos = '-1980px'; }
		if (kind == 'rnantes'){ var pos = '-2200px'; }
		
		var currentPos = $('#theme_header').attr('pos');
		$('#theme_header').attr('pos', pos);
		$('#theme_header .bg_placeholderA')
			.css('background-position', '0px ' + currentPos)
			.show()
			.fadeOut(300, function() { $('#theme_header .bg_placeholderA').hide()});
	
		$('#theme_header').css('background-position', "0px " + pos);
	
		return false;
	});

	$(".prevPage").hide();

	$(".nextPage").click(function(){
		$(".prevPage").show();
		/*if ($(".selector").offset().left < -350) { $(".nextPage").hide(); }*/
		
		if ($(".selector").offset().left < 360 && $(".selector").offset().left > -400 ) { $(".nextPage").hide(); }
			$(".selector").animate({
			    left: '-=751'
			  }, 1500);
	});

	$(".prevPage").click(function(){
		$(".nextPage").show();
		if ($(".selector").offset().left > -390 ) { $(".prevPage").hide(); }
			$(".selector").animate({
			    left: '+=751'
			  }, 1500);
	});
}
	
	$(function() {
	    $("div.scrollable").scrollable({ 
	        vertical:true,  
	        size: 3
	    }).autoscroll(5000).circular();
	}); 

$(".doemp").click(function(){
	$(".emploi").hide();
	var el = $(this).attr("rel");
	$("#"+el).toggle();
});
	
$("#formDestSearch #lieuimg").tooltip({ 
		position: "top left",
	    offset: [-65, 290],
	    effect: "fade", 
	    opacity: 1, 
	    tip: '.tiphelp'
});

$("#formDestSearch1 #lieuimg").tooltip({ 
	position: "top left",
    offset: [-90, 290],
    effect: "fade", 
    opacity: 1, 
    tip: '.tiphelp1'
});

$("#formDestSearch #lieuimg").click(function(){
	if($.browser.msie){
		$(".fixZ").css({'z-index' : '-1'});
		$(".colright").css({'z-index' : '-1'});
	}
});
	
$("#formLoginResto").submit(function(){
	alert(_L1);
	return false;
});

$("#formLoginTourisme").submit(function(){
	alert(_L1);
	return false;
});

$("#formLoginAff").submit(function(){
	alert(_L1);
	return false;
});
	
$(".msgtoggle").click(function(){
	$("#msgdiv").hide();
});
	
$("ul#ticker1").liScroll(); 
$("ul#ticker2").liScroll();

$("#rssLink").click(function(){
	
	if($.browser.msie){ 
		$("#ticker1").hide();
		$("#ticker2").hide();
		/*$(".ent_menuBot").css({'z-index' : '-1'});
		$(".menuBot").css({'z-index' : '-1'});
		$(".brdmenu").css({'z-index' : '-1'});
		$(".ent_visuel").css({'z-index' : '-1'});
		$(".innerwrapper").css({'z-index' : '-1'});
		$(".innerwrapperhome").css({'z-index' : '-1'});*/
		$("#dialogRss").show();
		
		$("#dialogRss").css({'z-index' : '1000'});
		$("#dialogRss").css({'margin-top' : '15px'});
	} else {
		$("#dialogRss").show();
	}
});

$("#rssBox").bind("mouseleave", function(){
	$("#dialogRss").hide();
	if($.browser.msie){ 
		$("#ticker1").show();
		$("#ticker2").show();
		/*$(".ent_menuBot").css({'z-index' : '1'});
		$(".menuBot").css({'z-index' : '1'});
		$(".brdmenu").css({'z-index' : '1'});
		$(".ent_visuel").css({'z-index' : '1'});
		$(".innerwrapper").css({'z-index' : '1'});
		$(".innerwrapperhome").css({'z-index' : '1'});*/
	}
});
	
$("#affinerGrp").click(function(){
	$(".plusGrpPar").toggle();
});

$("#statutGrp").change(function(){
	if ($(this).val() != "-1"){
		$(".part").hide();
		$(".pro").hide();
		
		if($("#isSetGrp").val() != "1"){
				$.ajax({
					   type: "GET",
					   async: true,
					   url: "control.php?action=getTypGrp&grp="+$(this).val(),
					   success: function(msg){
							if (msg != ""){
								$("#grp_manif").html(msg);
					     	}
					   }
				  });
		}
		
		$("."+$(this).val()).show();
		
	}
});
	
$(".grpLink").hover(function(){
	$(this).css({'list-style' : 'square'});
},function(){
	$(this).css({'list-style' : 'none'});
});

$("#printLink").click(function(){
	 		window.open('control.php?action=printResa&id_resa='+$(this).attr("rel")+'&per_id_per='+$("#per_id_per").val(), "Imprimer","menubar=no, status=no, scrollbars=no, menubar=no, width=500");
            return false;
});


$("#btnInvitationAmis").click(function(){
	
	var arrayEmail = new Array();
	var i=0;
	
	$(".invitationEmail").each(function(){
		var email = $(this).val();
		if (email.length > 0 && isValidEmailAddress(email) == true){
			arrayEmail[i] = $(this).val();
			i++;
		}
	});

	$.ajax({
		   type: "GET",
		   async: true,
		   url: "control.php?action=sendInvitation&id_per="+$("#id_per").val()+"&id_resa="+$("#id_resa").val()+"&per_id_per="+$("#per_id_per").val()+"&email="+arrayEmail+"&message="+$("#resa_invite_message").val(),
		   success: function(msg){
				if (msg != ""){
					$("#resa_invite_message").val("");
					$(".invitationEmail").each(function(){
						$(this).val("");
					});
					$("#formInviterAmis").toggle();
		     		alert(msg);
		     	}
		   }
	  });
	
});

$("#inviterAmis").click(function(){
	$("#formInviterAmis").toggle();
});


$("#searchListe").click(function(){
	$(".boxFormLiteAbs").toggle();
	if($.browser.msie){ 
		$(".colright").css({'z-index' : '-1'});
		$(".fixZ").css({'z-index' : '-1'});
	}
});
	
$("#tablePays").tablesorter();
$("#resaTable").tablesorter(); 
$("#tableChefs").tablesorter();
$("#tableEmploi").tablesorter();
$("#tableRecette").tablesorter();

$("#tableActus").tablesorter({ headers: { 0: {  
    sorter: false 
} }});

$("#con_dem").change(function(){
	if ($(this).val() == "2"){
		$("#resaChp").show();
		$("#resaDat").show();
	} else {
		$("#resaChp").hide();
		$("#resaDat").hide();
	}

	
	if ($(this).val() == "8"){
		$("#restoNom").show();
		$("#restoDate").show();
		$("#restoPax").show();
	} else {
		$("#restoNom").hide();
		$("#restoDate").hide();
		$("#restoPax").hide();
	}
	
});
	
$(".promoLink").click(function(){
	var el = $(this).attr("rel");
	$("#"+el).toggle();
});
	
$(".affextrait").click(function(){
	$(".extrait").toggle();
});

$(".offresResto").hover(function(){
		var offset = $(this).offset();
		$("#dialogOffres").draggable();
		$("#dialogOffres").center({vertical:false,horizontal:true});
		$("#dialogOffres").show();
		$("#dialogOffres").css('left', parseInt(offset.left-150));
		$("#dialogOffres").css('top', parseInt(offset.top-20));
},function(){});

$(".listItemOfferOn").hover(function(){
	var offset = $(this).offset();
	var dia = $(this).attr("rel");
	$("#"+dia).draggable();
	$("#"+dia).center({vertical:false,horizontal:true});
	$("#"+dia).show();
	$("#"+dia).css('text-align', 'left');
	$("#"+dia).css('left', parseInt(offset.left-150));
	$("#"+dia).css('top', parseInt(offset.top-20));
	$("#"+dia).css({zIndex:"10000"});
	$(".footer").css({zIndex:"-1"});
	
	if($.browser.msie) {
			$(".listContainer").css({zIndex:"-1"});
			$(".listItem").css({zIndex:"-1"});
			$(".listItemButton").css({zIndex:"-1"});
		}
	return false;
	
},function(){return false;});

$("ul#resaIndivDia").newsticker(5000);
$("ul#resaGrpDia").newsticker(5000);
$("ul#confianceDia").newsticker(6000);

$(".ent_button").hover(function(){
	   		$(this).addClass("ent_button_hover");
		},function(){
			$(this).removeClass("ent_button_hover");
});

$(".menuPageLi").hover(function(){
		$(this).addClass("menuPageLiHover");
	},function(){
		$(this).removeClass("menuPageLiHover");
});

$("#login_now").click(function(){
   $("#login_now_form").toggle(); 
});

$("#signup_pro").click(function(){
	   $("#signup_pro_form").toggle(); 
});

$(".qItem").click(function(){
	$(".qItemLi").hide();
	var el = $(this).attr("rel");
	$("#"+el).toggle(); 
});

$(".showGalerie").click(function(){
		var id_per = $(this).attr("rel");
		var offset = $(this).offset();
		
		$.ajax({
			   type: "GET",
			   async: true,
			   url: "control.php?action=getGalery&id_per="+id_per,
			   success: function(msg){
					if (msg != ""){
			     		$("#dialogGalery").draggable();
			    		$("#dialogGalery").center({vertical:false,horizontal:true});
			    		$("#dialogGalery").show();
			    		$("#dialogGalery").css('left', parseInt(offset.left+150));
			    		$("#dialogGalery").css('top', parseInt(offset.top-100));
			    		$("#galeryContent").html(msg);
			    		
			    		$(".overGalery").hover(function(){
				    			var src = $(this).attr("rel");
				    			var caption = $(this).attr("alt");
				    			$("#galeryPhoto").attr("src", src);
				    			$("#galeryComment").html(caption);
			    		},function(){
			    				var src = $("#galeryPhoto").attr("rel");
			    				var caption = $(this).attr("alt");
			    				$("#galeryPhoto").attr("src", src);
			    				$("#galeryComment").html(caption);
			    		});
			     	}
			   }
	 	  	});
});



$("#conDia").dialog({autoOpen: false, position: 'top', width: 220});
$('#conLink').click(function() {
		$('#conDia').dialog('open');
})

$('#ent_conLink').click(function() {
		$('#conDia').dialog('open');
})

$("#newsDia").dialog({autoOpen: false, position: 'top', width: 220});
$('#newsLink').click(function() {
		$('#newsDia').dialog('open');
})

$("#sendDia").dialog({autoOpen: false, position: 'top', width: 220});
$('#sendLink').click(function() {
		$('#sendDia').dialog('open');
})


$("#gallery").galleryView({
		panel_width: 635,
		panel_height: 265,
		frame_width: 148,
		frame_height: 70,
		border: 'none',
		nav_theme:'dark',
		filmstrip_position: 'right',
  		transition_speed: 350,
 		easing: 'easeInOutQuad',
		transition_interval: 4000
	});

$(".panel").each(function(){
	$(this).css({top:"0px"});
	$(this).css({left:"0px"});
});

$("#gallery").css({marginLeft:"-5px"});
	
$(".changeLang").click(function () {$(".dropMenu").toggle();});
	    
$("#nav-bot li").each(function(){
			$(this).mouseover(function(){
				$(this).children(".dropm").slideDown("fast");
						if($.browser.msie) { 
							var hauteur = $(this).width();
							$(this).children(".dropm").css({marginLeft:"-"+ (hauteur + 8) +"px"});
							$(this).css({zindex:"100000"});
							$(".innerwrapperhome").css({zIndex:"-1"});
							$(".innerwrapper").css({zIndex:"-1"});
							$(".brdmenu").css({zIndex:"-1"});
							$(".footer").css({zIndex:"-1"});
						}
				$(this).prev().children(".dropm").fadeOut("fast");
				$(this).siblings().children(".dropm").fadeOut("fast");
			});
});

$(".menuItem").each(function(){
	$(this).mouseover(function(){
		if ($(this).hasClass("lastMenuBot")){
			
			$(this).removeClass("menuItem");
			$(this).addClass("menuItemOverO");
			
		} else if ( $(this).hasClass("isEnt") ) {
			
			$(this).removeClass("menuItem");
			$(this).addClass("menuItemOverE");
			
		} else {
			
			$(this).addClass("menuItemOver");
		}
	});
	
	$(this).mouseout(function(){
		if ($(this).hasClass("lastMenuBot")){
			
			$(this).removeClass("menuItemOverO");
			$(this).addClass("menuItem");
			
		} else if ( $(this).hasClass("isEnt") ) {
			
			$(this).removeClass("menuItemOverE");
			$(this).addClass("menuItem");
			
		} else {
			$(this).removeClass("menuItemOver");
		}
	});
});

$(".ent_menuItem").each(function(){
	$(this).mouseover(function(){
		$(this).addClass("ent_menuItemOver");
	});
	
	$(this).mouseout(function(){
		$(this).removeClass("ent_menuItemOver");
	});
});

$("body").click(function(){
			$("#nav-bot li .dropm").fadeOut("fast");
			if($.browser.msie) {
				$(".innerwrapperhome").css({zIndex:"1"});
				$(".innerwrapper").css({zIndex:"1"});
				$(".brdmenu").css({zIndex:"1"});
				$(".footer").css({zIndex:"1"});
			}
});
		
$("#formDestSearch").submit(function(){
			if($("#lieu").val() == ""){
				alert(_L27);
				$("#lieu").focus();
				return false;
			}
			
			/*if($("#dater").val() == ""){
				alert("Merci de s\351lectionner une date");
				$("#dater").focus();
				return false;
			}
			
			if($("#pax").val() == ""){
				alert("Merci d'indiquer le nombre de personnes");
				$("#pax").focus();
				return false;
			}
			*/
});

$("#formAdresseSearch").submit(function(){
			if($("#adresse").val() == "" && $("#cp").val() == ""){
				alert(_L28);
				$("#adresse").focus();
				return false;
			}
});

$("#formNews").submit(function(){

			
			if($("#news_email").val() == ""){
				alert(_L5);
				$("#news_email").focus();
				return false;
			}
			
			if(!isValidEmailAddress($("#news_email").val())){
				alert(_L5);
				$("#news_email").attr("value", "");
				$("#news_email").focus();
				return false;
			}
});

$("#newsForm").submit(function(){

	
	if($("#news_h_email").val() == ""){
		alert(_L5);
		$("#news_h_email").focus();
		return false;
	}
	
	if(!isValidEmailAddress($("#news_h_email").val())){
		alert(_L5);
		$("#news_h_email").attr("value", "");
		$("#news_h_email").focus();
		return false;
	}
});

$("#signupForm").submit(function(){
	
	if ($("input[type=radio][name=civ]:checked").length < 1) {
		alert(_L9);
		return false;
	}
	
	if ($("#signup_prenom").val() == ""){
		alert(_L2);
		return false;
	}
	
	if ($("#signup_nom").val() == ""){
		alert(_L3);
		return false;
	}

	if ($("#signup_email").val() == "" || isValidEmailAddress($("#signup_email").val()) == false ){
		alert(_L5);
		return false;
	}
	
	
});


$("#grpForm").submit(function(){
	
	if ( $("#grp_lieu").val() == "-1" && $("#grp_dep").val() == "-1" ){
		alert(_L34);
		return false;
	}
	
	if ($("#con_date").val() == ""){
		alert(_L33);
		$("#con_date").focus();
		return false;
	}
	
	if ($("#grp_heure").val() == "-1"){
		alert(_L32);
		$("#grp_heure").focus();
		return false;
	}
	
	if ($("#grp_num").val() == ""){
		alert(_L31);
		$("#grp_num").focus();
		return false;
	}
	
	if($("#grp_motif")){
		if ($("#grp_motif").hasClass("show")){
			if ($("#grp_motif").val() == ""){
				alert(_L30);
				$("#grp_motif").focus();
				return false;
			}
		}
	}
	
	if ($("input[type=radio][name=civ]:checked").length < 1) {
		alert(_L9);
		return false;
	}
	
	if ($("#grp_prenom").val() == ""){
		alert(_L2);
		$("#grp_prenom").focus();
		return false;
	}
	
	if ($("#grp_nom").val() == ""){
		alert(_L3);
		$("#grp_nom").focus();
		return false;
	}
	
	if ($("#grp_email").val() == "" || isValidEmailAddress($("#grp_email").val()) == false ){
		alert(_L5);
		$("#grp_email").focus();
		return false;
	}
	
	if ($("#grp_tel").val() == ""){
		alert(_L11);
		$("#grp_tel").focus();
		return false;
	}
	
	var countTel = $("#grp_tel").val();
	
	if (countTel.length > 10){
		alert(_L29);
		$("#grp_tel").focus();
		return false;
	}
	
	if ($("#grp_societe").hasClass("show")){
		if ($("#grp_societe").val() == ""){
			alert(_L12);
			$("#grp_societe").focus();
			return false;
		}
	}
	
});

$("#grp_detail").click(function(){
	$(this).val("");
});

$("#dater").datepicker({ dateFormat: 'dd/mm/yy',
		 firstDay: 1,
		 minDate: new Date(),
		 changeMonth: true,
		 changeYear: true,
		 showButtonPanel: true,
		 showOn: 'button',
		 buttonImage: 'assets/calendar.gif',
		 buttonImageOnly: true
});


$("#datere").datepicker({ dateFormat: 'dd/mm/yy',
		 firstDay: 1,
		 minDate: new Date(),
		 changeMonth: true,
		 changeYear: true,
		 showButtonPanel: true,
		 showOn: 'button',
		 buttonImage: 'assets/calendar.gif',
		 buttonImageOnly: true
});

$("#con_date").datepicker({ dateFormat: 'dd/mm/yy',
	 firstDay: 1,
	 minDate: new Date(),
	 changeMonth: true,
	 changeYear: true,
	 showButtonPanel: true,
	 showOn: 'button',
	 buttonImage: 'assets/calendar.gif',
	 buttonImageOnly: true
});

$("#con_date1").datepicker({ dateFormat: 'dd/mm/yy',
	 firstDay: 1,
	 minDate: new Date(),
	 changeMonth: true,
	 changeYear: true,
	 showButtonPanel: true,
	 showOn: 'button',
	 buttonImage: 'assets/calendar.gif',
	 buttonImageOnly: true
});


$(".carOneControl li").each(
	function(){
		var index = $(this).text();
		$(this).hover(
			function(){
				$(this).addClass("hoverBoxLi");
			},function(){
				$(this).removeClass("hoverBoxLi");
 			}
 		);
 		
		$(this).bind("click", {rel:index,cl1:".carOneControl",cl2:".carOneItems"}, selectLi);
	}
);

$(".carTwoControl li").each(
	function(){
		var index = $(this).text();
		$(this).hover(
			function(){
				$(this).addClass("hoverBoxLi");
			},function(){
				$(this).removeClass("hoverBoxLi");
 			}
 		);
		$(this).bind("click", {rel:index,cl1:".carTwoControl",cl2:".carTwoItems"}, selectLi);
	}
);

$(".carTreeControl li").each(
	function(){
		var index = $(this).text();
		$(this).hover(
			function(){
				$(this).addClass("hoverBoxLi");
			},function(){
				$(this).removeClass("hoverBoxLi");
 			}
 		);
		$(this).bind("click", {rel:index,cl1:".carTreeControl",cl2:".carTreeItems"}, selectLi);
	}
);

$(".carFourControl li").each(
	function(){
		var index = $(this).text();
		$(this).hover(
			function(){
				$(this).addClass("hoverBoxLi");
			},function(){
				$(this).removeClass("hoverBoxLi");
 			}
 		);
		$(this).bind("click", {rel:index,cl1:".carFourControl",cl2:".carFourItems"}, selectLi);
	}
);

$(".carFiveControl li").each(
	function(){
		var index = $(this).text();
		$(this).hover(
			function(){
				$(this).addClass("hoverBoxLi");
			},function(){
				$(this).removeClass("hoverBoxLi");
 			}
 		);
		$(this).bind("click", {rel:index,cl1:".carFiveControl",cl2:".carFiveItems"}, selectLi);
	}
);

$(".carSixControl li").each(
	function(){
		var index = $(this).text();
		$(this).hover(
			function(){
				$(this).addClass("hoverBoxLi");
			},function(){
				$(this).removeClass("hoverBoxLi");
 			}
 		);
		$(this).bind("click", {rel:index,cl1:".carSixControl",cl2:".carSixItems"}, selectLi);
	}
);

$(".carSevenControl li").each(
	function(){
		var index = $(this).text();
		$(this).hover(
			function(){
				$(this).addClass("hoverBoxLi");
			},function(){
				$(this).removeClass("hoverBoxLi");
 			}
 		);
		$(this).bind("click", {rel:index,cl1:".carSevenControl",cl2:".carSevenItems"}, selectLi);
	}
);


//$(document).everyTime(15000,rotateLiFour);
//$(document).everyTime(15000,rotateLiFive);
//$(document).everyTime(15000,rotateLiSix);
$(document).oneTime(1,rotateLiOne);
$(document).everyTime(30000,rotateLiOne);
//$(document).oneTime(1,rotateLiTree);
//$(document).everyTime(30000,rotateLiTree);
//$(document).oneTime(1,rotateLiFour);
//$(document).everyTime(30000,rotateLiFour);
$(document).oneTime(1,rotateLiSeven);
$(document).everyTime(30000,rotateLiSeven);
$(document).oneTime(1,rotateLiTwo);
$(document).everyTime(30000,rotateLiTwo);

$('#lieu').autocomplete('control.php?action=getVille', {
	matchContains: true,
	minChars: 2,
	mustMatch:true,
	autoFill: false,
	selectFirst: false,
	formatItem: function(data, i, n, value) {
		return data[0] + " <small>(" + data[3] +")</small>";
	},
	formatResult: function(data, value) {
		return data[0];
	}
});

$("#lieu").result(function(event, data, formatted) {
	if (data){
		$('#lieu_id').attr("value", data[1]);
		$('#lieu').flushCache();
	}
});

$('#nom').autocomplete('control.php?action=getRestoByNom', {
	matchContains: true,
	minChars: 2,
	mustMatch:true,
	autoFill: false,
	selectFirst: false,
	formatItem: function(data, i, n, value) {
		return data[0];
	},
	formatResult: function(data, value) {
		return data[0];
	}
});

$("#nom").result(function(event, data, formatted) {
	if (data)
		$('#nom').flushCache();
		location.href = data[1];
});


$('#news_pays').autocomplete('control.php?action=getPays', {
	matchContains: true,
	minChars: 2,
	mustMatch:true,
	autoFill: true,
	selectFirst: false,
	formatItem: function(data, i, n, value) {
		return data[0];
	},
	formatResult: function(data, value) {
		return data[0];
	}
});

$('#signup_soc_pays').autocomplete('control.php?action=getPays', {
	matchContains: true,
	minChars: 2,
	mustMatch:true,
	autoFill: true,
	selectFirst: false,
	formatItem: function(data, i, n, value) {
		return data[0];
	},
	formatResult: function(data, value) {
		return data[0];
	}
});


$("#signup_soc_pays").result(function(event, data, formatted) {
	if (data)
		$('#signup_soc_pays').attr("value", data[0]);
		$('#signup_soc_code').attr("value", data[1]);
		$('#signup_soc_pays').flushCache();
});

$('#presse_pays').autocomplete('control.php?action=getPays', {
	matchContains: true,
	minChars: 2,
	mustMatch:true,
	autoFill: true,
	selectFirst: false,
	formatItem: function(data, i, n, value) {
		return data[0];
	},
	formatResult: function(data, value) {
		return data[0];
	}
});

$("#presse_pays").result(function(event, data, formatted) {
	if (data)
		$('#presse_pays').attr("value", data[0]);
		$('#presse_pays_code').attr("value", data[1]);
		$('#presse_pays').flushCache();
});

$(".showMore a").each(function(){
	$(this).click(function(){
		$(this).parent("li").parent("ul.sizesection").children("li.hide").toggle();
	});
});

$(".smenuRef").each(function(){
	$(this).click(function(){
		$(this).next("ul").addClass("click-target");
		$(".smenuCarteUl").each(function(){
			if (!$(this).hasClass("click-target")){
				$(this).hide();
			}
		});
		$(this).next("ul").removeClass("click-target");
		$(this).next("ul").toggle();
	});
});


$(".dialogContainerClose").click(function(){
	var el = $(this).attr("rel");
	$("#"+el).hide();
	if($.browser.msie) {
			$(".listContainer").css({zIndex:"1"});
			$(".listItem").css({zIndex:"1"});
			$(".listItemButton").css({zIndex:"1"});
			$(".footer").css({zIndex:"0"});
		}
});

$(".menuDetail").click(function(){
	var el = $(this).attr("rel");
	$("#"+el).toggle();
});

$("#updateProfil").submit(function(){
	
	if($("#per_prenom_per").val() == ""){
		alert(_L2);
		$("#per_prenom_per").focus();
		return false;
	}
	
	if($("#per_nom_per").val() == ""){
		alert(_L3);
		$("#per_nom_per").focus();
		return false;
	}
	
	if($("#per_tel").val() == ""){
		alert(_L4);
		$("#per_tel").focus();
		return false;
	}
	
	if($("#per_email").val() == ""){
		alert(_L5);
		$("#per_email").focus();
		return false;
	}
	
	if(!isValidEmailAddress($("#per_email").val())){
		alert(_L5);
		$("#per_email").attr("value", "");
		$("#per_email").focus();
		return false;
	}
	
	var pass =  $("#per_pass").val();
	if($("#per_pass").val() == "" || pass.length < 4){
		alert(_L6);
		$("#per_pass").focus();
		return false;
	}
	
});

$("#entLoginForm").submit(function(){
	
	if ( $("#ent_email").val() == "" ){
		alert(_L7);
		$("#ent_email").focus();
		return false;
	}
	
	if ( $("#ent_pass").val() == "" ){
		alert(_L8);
		$("#ent_pass").focus();
		return false;
	}
	
});

$("#signupSocForm").submit(function(){
	
	if ($("input[type=radio][name=civ]:checked").length < 1) {
		alert(_L9);
		return false;
	}
	
	if ($("#signup_prenom").val() == ""){
		alert(_L2);
		$("#signup_prenom").focus();
		return false;
	}
	
	if ($("#signup_nom").val() == ""){
		alert(_L3);
		$("#signup_nom").focus();
		return false;
	}
	
	if ($("#signup_soc_fonction").val() == ""){
		alert(_L10);
		$("#signup_soc_fonction").focus();
		return false;
	}
	
	if ($("#signup_email").val() == "" || isValidEmailAddress($("#signup_email").val()) == false ){
		alert(_L5);
		$("#signup_email").focus();
		return false;
	}
	
	if ($("#signup_tel").val() == ""){
		alert(_L11);
		$("#signup_tel").focus();
		return false;
	}
	
	if ( $("#signup_soc_societe").val() == "" ){
		alert(_L12);
		$("#signup_soc_societe").focus();
		return false;
	}
	
	if ( $("#signup_soc_cp").val() == "" ){
		alert(_L13);
		$("#signup_soc_cp").focus();
		return false;
	}
	
});



$("#signupLoginForm").submit(function(){
	
	if ( $("#signup_login_email").val() == "" ){
		alert(_L7);
		$("#signup_login_email").focus();
		return false;
	}
	
	if ( $("#signup_login_pass").val() == "" ){
		alert(_L8);
		$("#signup_login_pass").focus();
		return false;
	}
	
});


$("#carteSendForm").submit(function(){
	
	if ($("input[type=radio][name=civ]:checked").length < 1) {
		alert(_L9);
		return false;
	}
	
	if ($("#carte_prenom").val() == ""){
		alert(_L2);
		$("#carte_prenom").focus();
		return false;
	}
	
	if ($("#carte_nom").val() == ""){
		alert(_L3);
		$("#carte_nom").focus();
		return false;
	}
	
	if ($("#carte_email").val() == "" || isValidEmailAddress($("#carte_email").val()) == false ){
		alert(_L5);
		$("#carte_email").focus();
		return false;
	}
	
	if ($("#carte_day")){
		if ($("#carte_day").val() == "-1"){
			alert(_L14);
			$("#carte_day").focus();
			return false;
		}
	}
	
	if ($("#carte_month")){
		if ($("#carte_month").val() == "-1"){
			alert(_L15);
			$("#carte_month").focus();
			return false;
		}
	}
	
	if ($("#carte_year")){
		if ($("#carte_year").val() == "-1"){
			alert(_L16);
			$("#carte_year").focus();
			return false;
		}
	}
	
	
	if ($("#carte_societe")){
		if ($("#carte_societe").val() == ""){
			alert(_L12);
			$("#carte_societe").focus();
			return false;
		}
	}
	
	if ($("#carte_fonction")){
		if ($("#carte_fonction").val() == ""){
			alert(_L10);
			$("#carte_fonction").focus();
			return false;
		}
	}
	
	if ($("#carte_tel").val() == "" && $("#carte_gsm").val() == ""){
		alert(_L11);
		$("#carte_tel").focus();
		return false;
	}
	
	
	if ($("#carte_adresse").val() == ""){
		alert(_L17);
		$("#carte_adresse").focus();
		return false;
	}
	
	if ($("#carte_cp").val() == ""){
		alert(_L13);
		$("#carte_cp").focus();
		return false;
	}
	
	if ($("#carte_ville").val() == ""){
		alert(_L18);
		$("#carte_ville").focus();
		return false;
	}
	
	if (!$("#carte_cgv").is(':checked')){
		alert(_L19);
		$("#carte_cgv").focus();
		return false;
	}
	
	
});

$("#affSendForm").submit(function(){
	
	if ($("input[type=radio][name=civ]:checked").length < 1) {
		alert(_L9);
		return false;
	}
	
	if ($("#aff_prenom").val() == ""){
		alert(_L2);
		$("#aff_prenom").focus();
		return false;
	}
	
	if ($("#aff_nom").val() == ""){
		alert(_L3);
		$("#aff_nom").focus();
		return false;
	}
	
	if ($("#aff_fonction").val() == ""){
		alert(_L10);
		$("#aff_fonction").focus();
		return false;
	}
	
	if ($("#aff_raison").val() == ""){
		alert(_L20);
		$("#aff_raison").focus();
		return false;
	}
	
	if ($("#aff_enseigne").val() == ""){
		alert(_L21);
		$("#aff_enseigne").focus();
		return false;
	}
	
	if ($("#aff_adresse").val() == ""){
		alert(_L17);
		$("#aff_adresse").focus();
		return false;
	}
	
	if ($("#aff_tel").val() == ""){
		alert(_L11);
		$("#aff_tel").focus();
		return false;
	}
	
	if ($("#aff_email").val() == "" || isValidEmailAddress($("#aff_email").val()) == false ){
		alert(_L5);
		$("#aff_email").focus();
		return false;
	}
	
	if ($("#aff_web").val() == ""){
		alert(_L22);
		$("#aff_web").focus();
		return false;
	}
	
	if ($("#aff_pv").val() == ""){
		alert(_L23);
		$("#aff_pv").focus();
		return false;
	}
	
});

$("#contactSendForm").submit(function(){
	
	if ($("input[type=radio][name=civ]:checked").length < 1) {
		alert(_L9);
		return false;
	}
	
	if ($("#con_prenom").val() == ""){
		alert(_L2);
		$("#con_prenom").focus();
		return false;
	}
	
	if ($("#con_nom").val() == ""){
		alert(_L3);
		$("#con_nom").focus();
		return false;
	}
	
	if ($("#con_email").val() == "" || isValidEmailAddress($("#con_email").val()) == false ){
		alert(_L5);
		$("#con_email").focus();
		return false;
	}
	
	if ($("#con_dem").val() == "-1"){
		alert(_L24);
		$("#con_dem").focus();
		return false;
	}
	
	if ($("#con_message").val() == ""){
		alert(_L25);
		$("#con_message").focus();
		return false;
	}
	
});

$("#restoSendForm").submit(function(){
	
	if ($("#resto_enseigne").val() == ""){
		alert(_L26);
		$("#resto_enseigne").focus();
		return false;
	}
	
	if ($("input[type=radio][name=civ]:checked").length < 1) {
		alert(_L9);
		return false;
	}
	
	if ($("#resto_prenom").val() == ""){
		alert(_L2);
		$("#resto_prenom").focus();
		return false;
	}
	
	if ($("#resto_nom").val() == ""){
		alert(_L3);
		$("#resto_nom").focus();
		return false;
	}
	
	if ($("#resto_fonction").val() == ""){
		alert(_L10);
		$("#resto_fonction").focus();
		return false;
	}
	
	if ($("#resto_tel").val() == ""){
		alert(_L11);
		$("#resto_tel").focus();
		return false;
	}
	
	if ($("#resto_email").val() == "" || isValidEmailAddress($("#resto_email").val()) == false ){
		alert(_L5);
		$("#resto_email").focus();
		return false;
	}
	
});

$("#tourSendForm").submit(function(){
	
	if ($("input[type=radio][name=civ]:checked").length < 1) {
		alert(_L9);
		return false;
	}
	
	if ($("#tour_prenom").val() == ""){
		alert(_L2);
		$("#tour_prenom").focus();
		return false;
	}
	
	if ($("#tour_nom").val() == ""){
		alert(_L3);
		$("#tour_nom").focus();
		return false;
	}
	
	if ($("#tour_fonction").val() == ""){
		alert(_L10);
		$("#tour_fonction").focus();
		return false;
	}
	
	if ($("#tour_raison").val() == ""){
		alert(_L20);
		$("#tour_raison").focus();
		return false;
	}
	
	if ($("#tour_enseigne").val() == ""){
		alert(_L21);
		$("#tour_enseigne").focus();
		return false;
	}
	
	if ($("#tour_adresse").val() == ""){
		alert(_L17);
		$("#tour_adresse").focus();
		return false;
	}
	
	if ($("#tour_tel").val() == ""){
		alert(_L11);
		$("#tour_tel").focus();
		return false;
	}
	
	if ($("#tour_email").val() == "" || isValidEmailAddress($("#tour_email").val()) == false ){
		alert(_L5);
		$("#tour_email").focus();
		return false;
	}
	
});

$("#mapButton").click(function(){
	var adresse = $("#map_search_address").val();
	var pays = $("#map_search_pays").val();
	mapEngine.getAdresse(adresse, pays);
});

$("#presseSendForm").submit(function(){

	if ($("input[type=radio][name=civ]:checked").length < 1) {
		alert(_L9);
		return false;
	}
	
	if ($("#presse_prenom").val() == ""){
		alert(_L2);
		$("#presse_prenom").focus();
		return false;
	}
	
	if ($("#presse_nom").val() == ""){
		alert(_L3);
		$("#presse_nom").focus();
		return false;
	}
	
	if ($("#presse_email").val() == "" || isValidEmailAddress($("#presse_email").val()) == false ){
		alert(_L5);
		$("#presse_email").focus();
		return false;
	}
	
	if ($("#presse_texte").val() == ""){
		alert(_L25);
		$("#presse_texte").focus();
		return false;
	}
	
});


});

function searchAdv(cuisine,thema,service,budget,s){
	
	$("#loading").ajaxStart(function(){
		   $(this).show();
	});
	
	$("#loading").ajaxStop(function(){
		  $(this).hide();
	}); 
	
	$.ajax({
		   type: "GET",
		   async: true,
		   url: "control.php?action=searchAdv&cuisine="+cuisine+"&thema="+thema+"&service="+service+"&budget="+budget+"&s="+s,
		   success: function(msg){
				if (msg != ""){
		     		$("#searchAdv").html(msg);
		     	
				     		$(".showGalerie").click(function(){
				     			var id_per = $(this).attr("rel");
				     			var offset = $(this).offset();
				     			
				     			$.ajax({
				     				   type: "GET",
				     				   async: true,
				     				   url: "control.php?action=getGalery&id_per="+id_per,
				     				   success: function(msg){
				     						if (msg != ""){
				     				     		$("#dialogGalery").draggable();
				     				    		$("#dialogGalery").center({vertical:false,horizontal:true});
				     				    		$("#dialogGalery").show();
				     				    		$("#dialogGalery").css('left', parseInt(offset.left+150));
				     				    		$("#dialogGalery").css('top', parseInt(offset.top-100));
				     				    		$("#galeryContent").html(msg);
				     				    		
				     				    		$(".overGalery").hover(function(){
				 					    			var src = $(this).attr("rel");
				 					    			$("#galeryPhoto").attr("src", src);
				 				    		},function(){
				 				    				var src = $("#galeryPhoto").attr("rel");
				 				    				$("#galeryPhoto").attr("src", src);
				 				    		});
				 				    		
				 				    		
				     				     	}
				     				   }
				     		 	  	});
				     			
				     			
				     	});
				     		
				     		$(".listItemOfferOn").each(function(){
 				    			$(this).hover(function(){
 				    			var offset = $(this).offset();
 				    			var dia = $(this).attr("rel");
 				    			$("#"+dia).draggable();
 				    			$("#"+dia).center({vertical:false,horizontal:true});
 				    			$("#"+dia).show();
 				    			$("#"+dia).css('text-align', 'left');
 				    			
 				    			$("#"+dia).css({zIndex:"10000"});
 				    			
 				    			if($.browser.msie) {
 				    				$("#"+dia).css({position:"relative"});
 				    			}
 				    			
 				    			return false;
 				    			
 				    		},function(){ return false;});
				    		});
				     		
				     		$(".dialogContainerClose").click(function(){
				     			var el = $(this).attr("rel");
				     			$("#"+el).hide();
				     			if($.browser.msie) {
				     				
 				    			}
				     		});
				     		
				     		$(".promoLink").click(function(){
				     			var el = $(this).attr("rel");
				     			$("#"+el).toggle();
				     		});
				     		
				     		$("#filterSpecial").change(function(){
				     			var sty = $(this).val();
				     			if (sty != "-1"){
				     				
				     				$(".listItem").show();
				     				
				     				$(".listItem").each(function(){
				     					if($(this).find("li ."+sty).length == 0){
				     						$(this).hide();
				     					}
				     				});
				     			} else {
				     				$(".listItem").show();
				     			}
				     		});
				     		
				     		$("#filterVille").change(function(){
				     			var vil = $(this).val();
				     			if (vil != "-1"){
				     				
				     				$(".listItem").show();
				     				
				     				$(".listItem").each(function(){
				     					if($(this).find("li ."+vil).length == 0){
				     						$(this).hide();
				     					}
				     				});
				     			} else {
				     				$(".listItem").show();
				     			}
				     		});
		     	
		     	}
		   }
	  	});
	
}
