/*
	/////////  GPL Licence - LISTE DE MARIAGE

	Copyright (c) 2011, Syméon Chardonnens, http://wapiti.ch
 
	This file is part of LISTE DE MARIAGE.

	LISTE DE MARIAGE is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
	
	Date: Mar 31 08:25 pm 2011 GMT+1
	Version : Liste de mariage, version 1.03
	Author : Syméon Chardonnens, Switzerland, symeon.chardonnens@wapiti.ch
	Information site : http://liste-de-mariage.wapiti.ch
	///////////
	
	Include : jQuery JavaScript Library v1.4.2 
	Copyright 2010, John Resig, http://jquery.com/
	Dual licensed under the MIT or GPL Version 2 licenses.
	
	Include : Gallerax 0.2: A flexible gallery plugin for jQuery
	Copyright (c) 2010 nodethirtythree design, http://nodethirtythree.com/
	Dual licensed under the MIT or GPL license.

	Include : jQuery Alert Dialogs Plugin, Version 1.1
	Copyright (c) 2008, Cory S.N. LaViska, A Beautiful Site (http://abeautifulsite.net/)
	This plugin is dual-licensed under the GNU General Public License and the MIT License
	*/
	
function lancer_alerte(message) {
if(message!='') {
jAlert(message,'Message');
}
}

function partie_admin() {
$('#fond_vert').fadeIn('slow');
$('#div_form_admin').fadeIn('slow');
$('#input_password').focus();
	$('#fond_vert').click(function () {
		$('#div_form_admin').hide('fast');
		$('#fond_vert').fadeOut('slow');
	});
}
	
	
function confirmation(form)
		{
		if(document.getElementById('form_'+form).nom.value == '')
			{
			jAlert('Le champ "Nom" n\'est pas bien rempli', 'Une information manque');
			$('#input_'+form).focus(); 
			}
		else {
			if(document.getElementById('form_'+form).prenom.value == '')
			{
			jAlert('Le champ "Prenom" n\'est pas bien rempli', 'Une information manque');
			$('#input_'+form).focus(); 
			}
		else {
			if(document.getElementById('form_'+form).mail.value == '')
				{
				jAlert('Le champ "Mail" n\'est pas bien rempli', 'Une information manque');
				$('#input_'+form).focus(); 
				}
		else {
			if(!document.getElementById('form_'+form).livraison[0].checked && !document.getElementById('form_'+form).livraison[1].checked && !document.getElementById('form_'+form).livraison[2].checked)
				{
				jAlert('Le champ "Livraison" n\'est pas bien rempli', 'Une information manque');
				$('#input_'+form).focus(); 
				}
				else  {
							jConfirm('Un <b>immense merci</b> pour votre soutien ! \n Du fond du coeur ! \n\nVoulez-vous terminer la démarche ?', 'Confirmation', function(w)  {
													if (w == true)
														{
														$('#fond_noir').fadeIn('slow');
														document.getElementById('form_'+form).submit();
															
														}
											});
					}
			}
		}
		}
	}
	
	
function confirm_part(form)
		{
		if(document.getElementById('form_'+form).nom.value == '')
			{
			jAlert('Le champ "Nom" n\'est pas bien rempli', 'Une information manque');
			$('#input_'+form).focus(); 
			}
		else {
			if(document.getElementById('form_'+form).prenom.value == '')
			{
			jAlert('Le champ "Prenom" n\'est pas bien rempli', 'Une information manque');
			$('#input_'+form).focus(); 
			}
		else {
			if(document.getElementById('form_'+form).mail.value == '')
				{
				jAlert('Le champ "Mail" n\'est pas bien rempli', 'Une information manque');
				$('#input_'+form).focus(); 
				}
		else {
		var valeur = document.getElementById('form_'+form).francs.value;
		 if (valeur.search(/^[0-9]/) != -1) 
			{
			var valeur2 = document.getElementById('form_'+form).centimes.value;
			
				if(valeur2.search(/^[0-9]*$/) != -1)
					{
						jConfirm('Un <b>immense merci</b> pour votre soutien ! \n Du fond du coeur ! \n\nVoulez-vous terminer la démarche ?', 'Confirmation', function(w)  {
													if (w == true)
														{
														$('#fond_noir').fadeIn('slow');
														document.getElementById('form_'+form).submit();
														}
											});
					}
					else {
				
						jAlert('Le champ "Centimes" doit contenir uniquement des chiffres', 'Une information manque');
					$('#input_'+form).focus(); 
					
					}
			}
				else  {
						jAlert('Le champ "Francs" doit contenir uniquement des chiffres', 'Une information manque');
				$('#input_'+form).focus(); 	
					}
			}
		}
		}
	}
	
function cancel2(url)
	{
	jConfirm('Vous êtes sur le point d\'annuler votre inscription. \n Un mail de confirmation vous sera envoyé avec une copie aux futurs mariés.', 'Confirmation', function(d)  {
													if (d == true)
														{
														window.location.href=url;	
														}
											});					
	}
	
