function verif()
{
	if(document.getElementById('mail').value=='')
	{
		alert("Veuillez entrer votre adresse email");
		return(false);
	}
	else
	{
		if (document.getElementById('mail').value=='Entrez votre Email ici ..')
		{
			alert("Veuillez entrer votre adresse email");
			return(false);
		}
		else
		{
			var adresse = document.getElementById('mail').value;
			var place = adresse.indexOf("@",1);
			var point = adresse.indexOf(".",place+1);
			if ((place > -1)&&(adresse.length >2)&&(point > 1))
			{
				document.popup_newsletter.submit();
				return(true);
			}
			else
			{
				alert("Adresse invalide");
				return(false);
			}
		}
	}
}	


function shownews()
	{
	if(document.getElementById && ScanCookie("news")==0)
		{
		document.getElementById("pop_newsletter").style.width = '100%';
		document.getElementById("pop_newsletter").style.height = '100%';
		document.getElementById("pop_newsletter").innerHTML = html_milieu;
		//setTimeout("closeNewsletter()",30000);
		CreationCookie("news",false);
		}
	}

function closeNewsletter()
	{

		document.getElementById("pop_newsletter").style.width = '1px';
		document.getElementById("pop_newsletter").style.height = '1px';
		document.getElementById("pop_newsletter").innerHTML = '';
		
	}

function ScanCookie(variable)
	{
		place = document.cookie.indexOf(variable + "=")
		if(place>=0){
			return -1;
		}else{
			return 0;
		}
	}

function CreationCookie(name,val)
	{
		var expDate = new Date()
		expDate.setTime(expDate.getTime() + (1 * 24 * 3600 * 1000))
		ifperman = '; expires=' + expDate.toGMTString() + ';';
	
		document.cookie = name + '=' + escape(val) + ifperman + " path=/;";
	}


/* if(document.all)
	{
	larg = document.body.clientWidth;
	haut = document.body.clientHeight;
	}
else
	{
	larg = screen.width;
	haut = screen.height;
	} */
var urlCourant = document.location; 
	
html_milieu = "<div style=\"height:284px;width:500px;margin: 147px auto;\"><div style=\"background:url('http://78.153.240.38/~soerotic/images/entete_newsletter.jpg');width:500px;height:27px;\">";
html_milieu += "<a HREF=\""+urlCourant+"\" onClick=\"closeNewsletter();\">";
html_milieu += "<img src=\"http://78.153.240.38/~soerotic/images/fermer_newsletter.png\" BORDER=0 alt=\"\" style=\"margin-left:460px;margin-top:3px;\" /></a></div>";
html_milieu += "<div style=\"background:url('http://78.153.240.38/~soerotic/images/image_newsletter.jpg');width:500px;height:201px;\"></div>";
html_milieu += "<div style=\"background:url(\'http://78.153.240.38/~soerotic/images/pied_newsletter.jpg\');width:500px;height:56px;\">";
html_milieu += "<form method=\"post\" name=\"popup_newsletter\" action=\"newsletter.php\" onsubmit=\"return verif()\">";
html_milieu += "<div style=\"float:left;\">";
html_milieu += "<input type=\"text\" id=\"mail\" name=\"mail\" size=\"35\" onsubmit=\"return verif()\" onfocus=\"javascript:this.value='' \" value=\"Entrez votre Email ici ..\" style=\"margin-top:11px;margin-left:30px;\" /><input type=\"hidden\" name=\"popup\" value='1' /></div>";
html_milieu += "<div style=\"float:left;background:url('http://78.153.240.38/~soerotic/images/inscription_btn.png') no-repeat;width:89px;height:32px;margin-left:25px;margin-top:8px;padding-top:5px;padding-left:5px;\">";
html_milieu += "<a style=\"text-decoration: none; color: rgb(255, 255, 255);\" onclick=\"return verif()\" href=\"#\"><font style=\"font-style:italic;font-size:13px;font-family:verdana;font-weight:bold;\">Inscription</font></a></div>";
html_milieu += "</form></div></div>";
window.onload = shownews;
