/*DialogPopup(id, title, message, width)*/
function DialogPopup(id, title, message, vwidth, top){
	jQuery(function() {	
		$(document).ready(function(){
			$("#"+id).dialog( 'destroy' );	
			jQuery("#"+id).dialog({
					width : vwidth, 
					modal: true, 
					buttons: {
						Ok: function() {
							$(this).dialog('close');
						}
					},
					resizable : false
			});
			jQuery(".ui-dialog").css("top", top);
			jQuery(".ui-dialog").css("text-align", "left");
			jQuery("#"+id).dialog('option', 'title', title);
			jQuery("#dmess").html(message);
		});
	});
}
	
function DesignDialogSuccess(){
	jQuery(function() {	
		$(document).ready(function(){ 
			jQuery(".ui-widget-header").css("background-image", "none");
			jQuery(".ui-widget-header").css("background-color", "#b1ca33");
			jQuery(".ui-widget-header").css("border", "#b1ca33");
		});
	});
}

function DesignDialogSuccessBack(url){
	jQuery(function() {	
		$(document).ready(function(){ 
			jQuery(".ui-widget-header").css("background-image", "none");
			jQuery(".ui-widget-header").css("background-color", "#b1ca33");
			jQuery(".ui-widget-header").css("border", "#b1ca33");
			jQuery(".ui-state-default").click(function(){ $(location).attr("href", url); });
		});
	});
}

function DesignDialogCarousel(){
	jQuery(function() {	
		$(document).ready(function(){ 
			jQuery(".ui-dialog-titlebar").hide();
			jQuery(".ui-dialog-buttonpane").hide();
			jQuery(".ui-widget-header").css("border", 0);
			jQuery(".ui-dialog").css("background", "transparent");
			jQuery(".ui-dialog").css("border", 0);
		});
	});
}
			
function EraseFormContact(){
	jQuery("#nom").val("");
	jQuery("#email").val("");
	jQuery("#sujet").val("");
	jQuery("#message").val("");
}

function EraseFormLivredor(){
	jQuery("#titre").val("");
	jQuery("#pseudo").val("");
	jQuery("#message").val("");
}

function EraseFormPartenaire(){
	jQuery("#titre").val("");
	jQuery("#lien").val("");
	jQuery("#message").val("");
}

function EraseFormNews(){
	jQuery("#titre").val("");
	jQuery("#message").val("");
}

function ShowCarousel(){
	if(jQuery('#slide_holder_inner').val() == undefined) {
		jQuery(function() {	
			$('#slide_holder').agile_carousel({
				php_doc_location: "make_slides.php",
				path_to_slides: "photos/resto",
				first_last_buttons: "no",
				hover_next_prev_buttons: "no",
				next_prev_buttons: "no",
				pause_button: "no",
				slide_buttons: "no",
				slide_captions: "", 
				slide_directory: "photos/resto",
				slide_links: "",
				slide_number_display: "yes",
				timer_length: "7000",
				transition_duration: 1000,
				transition_easing: "easeOutBack",	
				transition_type: "carousel",
				water_mark: "yes",
				number_slides_visible: "1"
			 });
			/*-----------------------------*/			
		});
	}
}

function ShowNews(){
		jQuery(function() {	
			$('#slide_holder').agile_carousel({
				php_doc_location: "make_slides.php",
				path_to_slides: "photos/news",
				first_last_buttons: "no",
				hover_next_prev_buttons: "no",
				next_prev_buttons: "no",
				pause_button: "no",
				slide_buttons: "no", 
				slide_directory: "photos/news",
				slide_links: "",
				timer_length: "7000",
				transition_duration: 1000,
				transition_easing: "easeOutBack",	
				transition_type: "carousel",
				water_mark: "yes",
				number_slides_visible: "1"
			 });
			/*-----------------------------*/			
		});
}

function AjaxLivredor(id){
	jQuery(function() {	
		$(document).ready(function(){
			/*requete ajax pour afficher le message en entier*/
			$.ajax({
				type: "post",
				url: "livredor_ajax.php",
				data: "id="+id,
				success: function(msg){
					DialogPopup('dialog-modal-livredor', 'Vos avis et r&eacute;actions', '', 500, 50);
					jQuery("#dmess").html(msg);
				}
			});
			/*-------------*/
		});
	});
}

function AjaxPartenaire(id){
	jQuery(function() {	
		$(document).ready(function(){
			/*requete ajax pour afficher le message en entier*/
			$.ajax({
				type: "post",
				url: "partenaire_ajax.php",
				data: "id="+id,
				success: function(msg){
					DialogPopup('dialog-modal-livredor', 'Nos partenaires', '', 500, 50);
					jQuery("#dmess").html(msg);
				}
			});
			/*-------------*/
		});
	});
}

function AjaxNews(id){
	jQuery(function() {	
		$(document).ready(function(){
			/*requete ajax pour afficher le message en entier*/
			$.ajax({
				type: "post",
				url: "news_ajax.php",
				data: "id="+id,
				success: function(msg){
					DialogPopup('dialog-modal-news', 'News / Actus', '', 500, 50);
					jQuery("#dmess").html(msg);
				}
			});
			/*-------------*/
		});
	});
}

function SupLivredor(iddiv, title, message, vwidth, top, id){
	jQuery(function() {	
		$(document).ready(function(){
			$("#"+iddiv).dialog( 'destroy' );	
			jQuery("#"+iddiv).dialog({
					width : vwidth, 
					modal: true, 
					buttons: {
						'Supprimer': function() {
							/*requete ajax pour afficher le message en entier*/
							$.ajax({
								type: "post",
								url: "sup_livredor.php",
								data: "id="+id,
								success: function(msg){
									jQuery("#dmess").html(msg);
								}
							});
							/*-------------*/
						},
						'Annuler': function() {
							$(this).dialog('close');
						}
					},
					resizable : false
			});
			jQuery(".ui-dialog").css("top", top);
			jQuery(".ui-dialog").css("text-align", "left");
			jQuery("#"+iddiv).dialog('option', 'title', title);
			jQuery("#dmess").html(message);
		});
	});
}

function SupPartenaire(iddiv, title, message, vwidth, top, id){
	jQuery(function() {	
		$(document).ready(function(){
			$("#"+iddiv).dialog( 'destroy' );	
			jQuery("#"+iddiv).dialog({
					width : vwidth, 
					modal: true, 
					buttons: {
						'Supprimer': function() {
							/*requete ajax pour afficher le message en entier*/
							$.ajax({
								type: "post",
								url: "sup_partenaire.php",
								data: "id="+id,
								success: function(msg){
									jQuery("#dmess").html(msg);
								}
							});
							/*-------------*/
						},
						'Annuler': function() {
							$(this).dialog('close');
						}
					},
					resizable : false
			});
			jQuery(".ui-dialog").css("top", top);
			jQuery(".ui-dialog").css("text-align", "left");
			jQuery("#"+iddiv).dialog('option', 'title', title);
			jQuery("#dmess").html(message);
		});
	});
}

function SupNews(iddiv, title, message, vwidth, top, id){
	jQuery(function() {	
		$(document).ready(function(){
			$("#"+iddiv).dialog( 'destroy' );	
			jQuery("#"+iddiv).dialog({
					width : vwidth, 
					modal: true, 
					buttons: {
						'Supprimer': function() {
							/*requete ajax pour afficher le message en entier*/
							$.ajax({
								type: "post",
								url: "sup_news.php",
								data: "id="+id,
								success: function(msg){
									jQuery("#dmess").html(msg);
								}
							});
							/*-------------*/
						},
						'Annuler': function() {
							$(this).dialog('close');
						}
					},
					resizable : false
			});
			jQuery(".ui-dialog").css("top", top);
			jQuery(".ui-dialog").css("text-align", "left");
			jQuery("#"+iddiv).dialog('option', 'title', title);
			jQuery("#dmess").html(message);
		});
	});
}