W_contenu = 780;
border_width = 0;
Y_min = 0;

x = Math.max(0, ((document.body.clientWidth - W_contenu) / 2));
y = Y_min; //Math.max(0, ((document.body.clientHeight - H_contenu) / 2));

ns4 = (document.layers)? true:false
ns6 = (document.getElementById && !document.all);
if (!ns4)
{
	document.write('<div id=blanco style="position: absolute;  width: 0; height: 0; border-style: solid; border-width: '+ border_width +'; border-color: #c0c0c0; visibility: hidden"></div>');

	document.write('<div onresize=cadre_ext_on_resize() id=cadre_ext style="position: absolute; left: '+ x +'; top: '+ y +';">');
}

if (ns6)
{
	cadre = document.getElementById("cadre_ext");
	cadre_blanc = document.getElementById("blanco");
}
else
{
	cadre = document.all.cadre_ext
	cadre_blanc = document.all.blanco
}

window.onresize = recadrer;

function visionner_intro(add_lg)
{
	wt = 700
	ht = 476
	leftPos = (screen.width-wt)/2 
	topPos = (screen.height-ht-60)/2 
	popWin1 = window.open('intro'+add_lg+'.php','_blank','toolbars=no,resizable=no,scrollbars=no,left='+leftPos+',top='+topPos+',width='+wt+',height='+ht) 
}

function recadrer()
{
	cadre.style.left = Math.max(0, ((document.body.clientWidth - W_contenu) / 2));
	cadre.style.top = Y_min; //Math.max(0, ((document.body.clientHeight - H_contenu) / 2));
	cadre_ext_on_resize();
	//recadrer_table();
}

cadre_ext_on_resize()

function cadre_ext_on_resize()
{
	if (ns6)
		add = 0;
	else
		add = border_width * 2;
	x = parseInt(cadre.style.left);
	y = Y_min; //parseInt(cadre.style.top);
	if (Math.min(x, y) > border_width)
	{
		cadre_blanc.style.left = x - border_width;
		cadre_blanc.style.top =  Y_min; //y - border_width;
		cadre_blanc.style.width =  W_contenu + add;
		cadre_blanc.style.height =  H_contenu + add;
		cadre_blanc.style.visibility = "visible";
	}
	else 
	{
		cadre_blanc.style.left = 0;
		cadre_blanc.style.top =  Y_min;
		cadre_blanc.style.width =  0;
		cadre_blanc.style.height =  0;
		cadre_blanc.style.visibility = "hidden";
	}
}

function check_fields() 
{
var test=""+document.formulaire.mail.value ;
a=true;
if (document.formulaire.message.value.length == 0){ a= false;} 
else if (document.formulaire.ville.value.length == 0){ a= false;} 
else if (document.formulaire.mail.value.length == 0){ a= false;} 
else if (document.formulaire.mail.value.length > 0)
{ isthere = false;
  for(var k = 0; k < test.length;k++) 
  { var c = test.substring(k,k+1); if(c == "@") { isthere = true;} }
if (isthere != true) {alert("Veuillez vérifier votre e-mail !"); a= false; result = false;}
}
if (a==false){alert("Vous devez remplir tous les champs suivis par : *"); result = false;} else {result = true}

	if (result)
		document.formulaire.submit();
}


function check_mail()
{
	var test = "" + document.formulaire2.mail_mailing.value;
	a = true;
	if (document.formulaire2.mail_mailing.value.length == 0)
		a = false; 
	else if (document.formulaire2.mail_mailing.value.length > 0)
	{ 
		isthere = false;
		for(var k = 0; k < test.length;k++) 
		{ 
			if (test.substring(k,k+1) == "@")
				isthere = true;
		}
		if (!isthere)
			a = false;
	}
	
	if (!a)
		alert("Veuillez vérifier votre e-mail");
	else 
		maFonctionAjax(document.formulaire2.mail_mailing.value);
}


function maFonctionAjax(mail_sent)
{ 
  var OAjax;
  if (window.XMLHttpRequest)
	  OAjax = new XMLHttpRequest();
  else if (window.ActiveXObject)
	  OAjax = new ActiveXObject('Microsoft.XMLHTTP');


  OAjax.onreadystatechange = function()
  {
      if (OAjax.readyState == 4 && OAjax.status==200)
	  {
			//hide();
			$.prettyPhoto.close();
			alert(OAjax.responseText);
	  }
  }
/*
  OAjax.open('POST',"http://nws.naltis.com/ajouter_NWM.php",true);
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send('email='+mail_sent+'&id=148');  
*/
  OAjax.open('GET',"ajouter_abonne.php?email="+mail_sent+"&id=148",true);
  OAjax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
  OAjax.send(null);     

} 

