/*
 * 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 div_src ="";		 
	var OSX = {
		
		container: null,
		init: function () {
			
			
			$("input.osx, a.osx").click(function (e) {
												  
		div_src =this.getAttribute("div_src") ;										  
		e.preventDefault();	
      // charger_ajax_url ("index2.php?option=com_jumi&fileid=123&city");
	  /*$("#osx-modal-content").modal({	*/
		$("#" + div_src).modal({							  
					overlayId: 'osx-overlay',
					containerId: 'osx-container',
					closeHTML: null,
					minHeight: 100,
					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 () {
				$("#" + div_src, self.container).show();
				$("#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}, 
							500,
							function () {
								$("div.close", self.container).show();
								$("#osx-modal-data", self.container).show();
							}
						);
					}, 0);
				});
			})
		},
		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.init();

});
			
		 function envoyermailajax_2( url ,b) {
			 
			//alert(b.form.id);
	b.form.id ="form_activ" ;
	text =jQuery("#form_activ").serialize()
	// alert(text);
	  b.form.id ="form" ;
	
	var XHR = null;

	if(window.XMLHttpRequest){ // Firefox

		XHR = new XMLHttpRequest();
	//alert('ok');	
	}
	else if(window.ActiveXObject){ // Internet Explorer
		XHR = new ActiveXObject("Microsoft.XMLHTTP");
		//alert('ok');
	}
	else { // XMLHttpRequest non supporte par le navigateur
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
		return;
	}
	//a++;
		// envoie de la requete, methode GET et de l'url
	
		a= Math.random() ;
	
	XHR.open("GET", url +  "&no_html=1&" + text  +"&truc=" + a, true);
	
//alert(  url +  "&no_html=1&" + text  +"&truc="+a ) ;
		// on guette les changements d'etat de l'objet
	XHR.onreadystatechange = function attente() {

		// l'etat est e 4, requete reeu !
	if(XHR.readyState == 4)     {

		// ecriture de la reponse
	r= XHR.responseText;
   	if(r.length >1)alert(r);
	else if(r==1) {
	//alert("OK");
		jq('#message_dialog_valid').dialog('open') ;
		}else if(r==2) {
		
//alert("You must identify");
			
			
			}
			else if(r==3) {
		
//alert("Vous devez abonner");
			
			
			}
	
	
/*	div_contenet_cadi*/
	
   }
	}
	XHR.send(null);		// le travail est termin?
	return;
	
	 
	 }
