
/*
 * SimpleModal OSX Style Modal Dialog
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2010 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: osx.js 238 2010-03-11 05:56:57Z emartin24 $
 */

jQuery(function ($) {
	var OSX = {
		container: null,
		init: function () {
			$("input.osx, a.osx").click(function (e) {
				e.preventDefault();

				$("#osx-modal-content").modal({
					overlayId: 'osx-overlay',
					containerId: 'osx-container',
					closeHTML: null,
					minHeight: 80,
					opacity: 65,
					position: ['0',],
					overlayClose: true,
					onOpen: OSX.open,
					onClose: OSX.close
				});
			});
		},
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#osx-modal-content", self.container).show();
				var title = $("#osx-modal-title", self.container);
				title.show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = $("#osx-modal-data", self.container).height()
							+ title.height()
							+ 20; // padding
						d.container.animate(
							{height: h},
							200,
							function () {
								$("div.close", self.container).show();
								$("#osx-modal-data", self.container).show();
							}
						);
					}, 300);
				});
			})
		},
		close: function (d) {
			var self = this; // this = SimpleModal object
			d.container.animate(
				{top:"-" + (d.container.height() + 20)},
				500,
				function () {

                                    $.validationEngine.closePrompt('.formError',true);//close jquery validation
					self.close(); // or $.modal.close();


				}
			);
		}
	};

	OSX.init();

});

jQuery(function ($) {
	var OSX = {
		container: null,
		init: function () {
			$("input.osx, a.osx").click(function (e) {

         <!-- Ensure the DOM is loaded -->
                $(document).ready(function() {
          <!-- Set the plugin options (see plug in documentation for more) -->
              var options = {
              <!-- A function to be used if submit is successful -->
                      success:  processXml,
              <!-- Type of data the plugin can expect to get back from the server ie XML in this case -->
                   dataType: 'xml',
              <!-- A function to do before submitting the for -->
              beforeSubmit:  hideForm
                  };
          <!-- Initialize the plugin on the form with the options var from above  -->
                       $('.loginform').ajaxForm(options);
        });
        <!-- Before submitting, hide the form so it looks like something is happening for the user. You could also perform some simple validation at this step -->
                function hideForm(){
                  //$('.loginform').hide();
                };
                <!-- What to do with the XML (response XML is a built in variable of the plugin) response from the server -->
                function processXml(responseXML) {
              //alert("login-testing");
                <!-- get the text from our Message node in the response XML -->
                    var message = $('message', responseXML).text();
                   // alert(message);
                <!-- Create a div to stash our result in -->
                //var $result = $('<div id="result1" class="test" style="background: #E5E4D7; width: 100%; float: left; font-weight: bold; color: #ff0000; padding-top: 7px; padding-bottom: 7px;" />')

                <!-- If the result is an error show the form again, put some appropriate text in the #result and show the result div -->
                  if (message == 'email-empty') {
                      alert(message);
                   $('.loginform').show();
                   document.getElementById("error_login").style.display = 'block';
                   document.getElementById("error_login").innerHTML = 'Veuillez saisir votre adresse email';
                    //$result.html('Not a Valid User');
                   $('.test').remove();
                    $('#sign-up').append($result);
                      <!-- If it's not an error then just show some success text -->
                    }

              else  if (message == 'email-format') {
             $('.loginform').show();
              document.getElementById("error_login").style.display = 'block';
             document.getElementById("error_login").innerHTML = 'Veuillez saisir une adresse email valide';

        $('.test').remove();
        $('#sign-up').append($result);
    <!-- If it's not an error then just show some success text -->
    }
        else  if (message == 'pass-empty') {
             $('.loginform').show();
             document.getElementById("error_login").style.display = 'block';
             document.getElementById("error_login").innerHTML = 'Veuillez saisir le mot de passe';
              //$result.html('Enter the Valid Email');
        $('.test').remove();
        $('#sign-up').append($result);
    <!-- If it's not an error then just show some success text -->
    }

   if (message == 'Match') {
             $('.loginform').show();
               document.getElementById("error_login").style.display = 'block';
               document.getElementById("error_login").innerHTML = "L'adresse Email ou le mot de passe n'existe pas";
        $('.test').remove();
        $('#sign-up').append($result);
    <!-- If it's not an error then just show some success text -->
    }
         else {
           $('.loginform').hide();
            // return true;
             // $('.test').remove();
              //document.getElementById("error_login").style.display = 'none';
              document.getElementById("error_login").style.display = 'block';
               document.getElementById("error_login").innerHTML = 'Login Successfull';
              window.location =  window.location.href;
              //document.getElementById("error_login").innerHTML = 'Login Successfull';
                       // $result.html('Error in Registration, Try After Sometime');$('#sign-up').append($result);
                    };
                };

			});
		}

	};

	OSX.init();

});



jQuery(function ($) {
	var OSX_REG = {
		container: null,
		init: function () {
			$("input.osx_reg, a.osx_reg").click(function (e) {
				e.preventDefault();

				$("#osx_reg-modal-content").modal({
					overlayId: 'osx_reg-overlay',
					containerId: 'osx_reg-container',
					closeHTML: null,
					minHeight: 80,
					opacity: 65,
					position: ['0',],
					overlayClose: true,
					onOpen: OSX_REG.open,
					onClose: OSX_REG.close
				});
			});
		},
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#osx_reg-modal-content", self.container).show();
				var title = $("#osx_reg-modal-title", self.container);
				title.show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = $("#osx_reg-modal-data", self.container).height()
							+ title.height()
							+ 20; // padding
						d.container.animate(
							{height: h},
							200,
							function () {
								$("div.close", self.container).show();
								$("#osx_reg-modal-data", self.container).show();
							}
						);
					}, 300);
				});
			})
		},
		close: function (d) {
			var self = this; // this = SimpleModal object
			d.container.animate(
				{top:"-" + (d.container.height() + 20)},
				500,
				function () {
					self.close(); // or $.modal.close();
				}
			);
		}
	};

	OSX_REG.init();

});


jQuery(function ($) {
	var OSX_TC = {
		container: null,
		init: function () {
			$("input.osx_tc, a.osx_tc").click(function (e) {
				e.preventDefault();

				$("#osx_tc-modal-content").modal({
					overlayId: 'osx_tc-overlay',
					containerId: 'osx_tc-container',
					closeHTML: null,
					minHeight: 80,
					opacity: 65,
					position: ['0',],
					overlayClose: true,
					onOpen: OSX_TC.open,
					onClose: OSX_TC.close
				});
			});
		},
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#osx_tc-modal-content", self.container).show();
				var title = $("#osx_tc-modal-title", self.container);
				title.show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = $("#osx_tc-modal-data", self.container).height()
							+ title.height()
							+ 20; // padding
						d.container.animate(
							{height: h},
							200,
							function () {
								$("div.close", self.container).show();
								$("#osx_tc-modal-data", self.container).show();
							}
						);
					}, 300);
				});
			})
		},
		close: function (d) {
			var self = this; // this = SimpleModal object
			d.container.animate(
				{top:"-" + (d.container.height() + 20)},
				500,
				function () {
					self.close(); // or $.modal.close();
				}
			);
		}
	};

	OSX_TC.init();

});


jQuery(function ($) {
	var OSX_DATE = {
		container: null,
		init: function () {
			$("input.osx_date, a.osx_date").click(function (e) {
				e.preventDefault();

				$("#osx_date-modal-content").modal({
					overlayId: 'osx_date-overlay',
					containerId: 'osx_date-container',
					closeHTML: null,
					minHeight: 80,
					opacity: 65,
					position: ['0',],
					overlayClose: true,
					onOpen: OSX_DATE.open,
					onClose: OSX_DATE.close
				});
			});
		},
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#osx_date-modal-content", self.container).show();
				var title = $("#osx_date-modal-title", self.container);
				title.show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = $("#osx_date-modal-data", self.container).height()
							+ title.height()
							+ 20; // padding
						d.container.animate(
							{height: h},
							200,
							function () {
								$("div.close", self.container).show();
								$("#osx_date-modal-data", self.container).show();
							}
						);
					}, 300);
				});
			})
		},
		close: function (d) {
			var self = this; // this = SimpleModal object
			d.container.animate(
				{top:"-" + (d.container.height() + 20)},
				500,
				function () {
					self.close(); // or $.modal.close();
				}
			);
		}
	};

	OSX_DATE.init();

});


jQuery(function ($) {
	var OSX_DATE_ADMIN = {
		container: null,
		init: function () {
			$("input.osx_date_admin, a.osx_date_admin").click(function (e) {
				e.preventDefault();

				$("#osx_date_admin-modal-content").modal({
					overlayId: 'osx_date_admin-overlay',
					containerId: 'osx_date_admin-container',
					closeHTML: null,
					minHeight: 80,
					opacity: 65,
					position: ['0',],
					overlayClose: true,
					onOpen: OSX_DATE_ADMIN.open,
					onClose: OSX_DATE_ADMIN.close
				});
			});
		},
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#osx_date_admin-modal-content", self.container).show();
				var title = $("#osx_date_admin-modal-title", self.container);
				title.show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = $("#osx_date_admin-modal-data", self.container).height()
							+ title.height()
							+ 20; // padding
						d.container.animate(
							{height: h},
							200,
							function () {
								$("div.close", self.container).show();
								$("#osx_date_admin-modal-data", self.container).show();
							}
						);
					}, 300);
				});
			})
		},
		close: function (d) {
			var self = this; // this = SimpleModal object
			d.container.animate(
				{top:"-" + (d.container.height() + 20)},
				500,
				function () {
					self.close(); // or $.modal.close();
				}
			);
		}
	};

	OSX_DATE_ADMIN.init();

});


jQuery(function ($) {
	var OSX_REG = {
		container: null,
		init: function () {
			$("input.osx_reg, a.osx_reg").click(function (e) {



         <!-- Ensure the DOM is loaded -->
                $(document).ready(function() {
          <!-- Set the plugin options (see plug in documentation for more) -->
              var options = {
              <!-- A function to be used if submit is successful -->
                      success:  processXml,
              <!-- Type of data the plugin can expect to get back from the server ie XML in this case -->
                   dataType: 'xml',
              <!-- A function to do before submitting the for -->
              beforeSubmit:  hideForm
                  };
          <!-- Initialize the plugin on the form with the options var from above  -->
                     //$('#myForm').ajaxForm(options);
                       $("#myForm").ajaxForm(options);


        });
        <!-- Before submitting, hide the form so it looks like something is happening for the user. You could also perform some simple validation at this step -->
                function hideForm(){
                 // $('#myForm').hide();
                };
                <!-- What to do with the XML (response XML is a built in variable of the plugin) response from the server -->
                function processXml(responseXML) {
                <!-- get the text from our Message node in the response XML -->
                    var message = $('message', responseXML).text();
                <!-- Create a div to stash our result in -->
                var $result = $('<div id="result" class="test" style="background: #E5E4D7; width: 100%; margin-top: -10px; float: left; font-weight: bold; color:#FF0000; padding-top: 7px; padding-bottom: 7px;"  />')

                <!-- If the result is an error show the form again, put some appropriate text in the #result and show the result div -->
                  if (message == 'rerror') {
                   $('#myForm').show();
                    $result.html('Un compte a déjà été créé avec la même adresse email');
                   $('.test').remove();
                    $('#sign').append($result);
                      <!-- If it's not an error then just show some success text -->
                    }

                         else  if (message == 'all-data') {
             $('#myForm').show();
              $result.html('* Vous devez renseigner tous les champs obligatoires. ');
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }


   else  if (message == 'civilite') {
             $('.my').show();
              $result.html('Veuillez choisir votre civilité');
        $('.test').remove();
        $('#sign-up').append($result);
    <!-- If it's not an error then just show some success text -->
    }

        else  if (message == 'Email') {
             $('#myForm').show();
              $result.html('Veuillez saisir une adresse email valide');
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }


           else  if (message == 'pseudo') {
             $('#myForm').show();
              $result.html('Veuillez saisir votre Pseudo');
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }






    else  if (message == 'nom') {
             $('#myForm').show();
              $result.html('Veuillez saisir votre nom');
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }


    else  if (message == 'nom') {
             $('#myForm').show();
              $result.html('Veuillez saisir votre nom');
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }


        else  if (message == 'prenom') {
             $('#myForm').show();
              $result.html('Veuillez saisir votre prénom');
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }


     else  if (message == 'password') {
             $('#myForm').show();
              $result.html('Veuillez saisir votre mot de passe');
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }



   else  if (message == 'confirm-password') {
             $('#myForm').show();
              $result.html('Veuillez confirmer le mot de passe');
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }


  else  if (message == 'pass-length') {
             $('#myForm').show();
              $result.html('Votre Mot de Passe doit contenir entre 6 et 11 caractères');
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }



   else  if (message == 'password-match') {
             $('#myForm').show();
              $result.html('La confirmation de votre mot de passe ne correspond pas au mot de passe que vous avez choisi');
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }



   else  if (message == 'terms') {
             $('#myForm').show();
              $result.html("Consulter les Conditions générales d'utilisation");
        $('.test').remove();
        $('#sign').append($result);
    <!-- If it's not an error then just show some success text -->
    }




    else  if (message == 'success') {
              $('#myForm').hide();
              $result.html("Un mail d'Activation de votre compte vous a été envoyé.");
        $('.test').remove();
        $('#sign').append($result);
       window.location = window.location.href;
    <!-- If it's not an error then just show some success text -->
    }
         else {
              $('.test').remove();
                        $result.html('Une erreur est survenue lors de votre inscription. Merci de réessayer');$('#sign').append($result);
                    };
                };


			});
		}

	};

	OSX_REG.init();

});



jQuery(function ($) {
	var OSX_URL = {
		container: null,
		init: function () {
			$("input.osx_url, a.osx_url").click(function (e) {
				e.preventDefault();

				$("#osx_url-modal-content").modal({
					overlayId: 'osx_url-overlay',
					containerId: 'osx_url-container',
					closeHTML: null,
					minHeight: 80,
					opacity: 65,
					position: ['0',],
					overlayClose: true,
					onOpen: OSX_URL.open,
					onClose: OSX_URL.close
				});
			});
		},
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#osx_url-modal-content", self.container).show();
				var title = $("#osx_url-modal-title", self.container);
				title.show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = $("#osx_url-modal-data", self.container).height()
							+ title.height()
							+ 20; // padding
						d.container.animate(
							{height: h},
							200,
							function () {
								$("div.close", self.container).show();
								$("#osx_url-modal-data", self.container).show();
							}
						);
					}, 300);
				});
			})
		},
		close: function (d) {
			var self = this; // this = SimpleModal object
			d.container.animate(
				{top:"-" + (d.container.height() + 20)},
				500,
				function () {
					self.close(); // or $.modal.close();
				}
			);
		}
	};

	OSX_URL.init();

});


jQuery(function ($) {
	var OSX_NOTES = {
		container: null,
		init: function () {
			$("input.osx_notes, a.osx_notes").click(function (e) {
				e.preventDefault();

				$("#osx_notes-modal-content").modal({
					overlayId: 'osx_notes-overlay',
					containerId: 'osx_notes-container',
					closeHTML: null,
					minHeight: 80,
					opacity: 65,
					position: ['0',],
					overlayClose: true,
					onOpen: OSX_NOTES.open,
					onClose: OSX_NOTES.close
				});
			});
		},
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#osx_notes-modal-content", self.container).show();
				var title = $("#osx_notes-modal-title", self.container);
				title.show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = $("#osx_notes-modal-data", self.container).height()
							+ title.height()
							+ 20; // padding
						d.container.animate(
							{height: h},
							200,
							function () {
								$("div.close", self.container).show();
								$("#osx_notes-modal-data", self.container).show();
							}
						);
					}, 300);
				});
			})
		},
		close: function (d) {
			var self = this; // this = SimpleModal object
			d.container.animate(
				{top:"-" + (d.container.height() + 20)},
				500,
				function () {
					self.close(); // or $.modal.close();
				}
			);
		}
	};

	OSX_NOTES.init();

});


jQuery(function ($) {
	var OSX_FAIR = {
		container: null,
		init: function () {
			$("input.osx_fair, a.osx_fair").click(function (e) {
				e.preventDefault();

				$("#osx_fair-modal-content").modal({
					overlayId: 'osx_fair-overlay',
					containerId: 'osx_fair-container',
					closeHTML: null,
					minHeight: 80,
					opacity: 65,
					position: ['0',],
					overlayClose: true,
					onOpen: OSX_FAIR.open,
					onClose: OSX_FAIR.close
				});
			});
		},
		open: function (d) {
			var self = this;
			self.container = d.container[0];
			d.overlay.fadeIn('slow', function () {
				$("#osx_fair-modal-content", self.container).show();
				var title = $("#osx_fair-modal-title", self.container);
				title.show();
				d.container.slideDown('slow', function () {
					setTimeout(function () {
						var h = $("#osx_fair-modal-data", self.container).height()
							+ title.height()
							+ 20; // padding
						d.container.animate(
							{height: h},
							200,
							function () {
								$("div.close", self.container).show();
								$("#osx_fair-modal-data", self.container).show();
							}
						);
					}, 300);
				});
			})
		},
		close: function (d) {
			var self = this; // this = SimpleModal object
			d.container.animate(
				{top:"-" + (d.container.height() + 20)},
				500,
				function () {
					self.close(); // or $.modal.close();
				}
			);
		}
	};

	OSX_FAIR.init();

});
