// JavaScript Document

var time = '';

function showexpand()
		{
			document.getElementById('exp-banniere').style.visibility = "hidden";
			document.getElementById('exp-image').style.visibility = "visible";
			time = setTimeout("hideexpand()",4000);
		}
		

function hideexpand()
		{
			document.getElementById('exp-banniere').style.visibility = "visible";
			document.getElementById('exp-image').style.visibility = "hidden";
			clearTimeout(time);
		}
		

function testerconfig()
		{
			var quelSyst = 1;
		
			if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Mac") != -1 )
			{
				quelSyst = 0; //si le navigateur est explorer sous Mac
			}
			else 
			{
				if (navigator.appName == "Netscape" && navigator.appVersion.indexOf("Safari") == -1)
				{
					quelSyst = 0; //si le navigateur est un netscape ou mozilla ou firefox
				}
			}
		
			if(quelSyst == 1) return true;
			else return false;
		}
		
function ouvrirpopup(page,param)
		{
			void(window.open(page,'',param));
		}
		
function ouvrirpopupakryls()
		{
			void(window.open('http://www.futuroscope.com/mini-sites/peril-akryls/index.php','','width=685,height=400,scrollbars=0'));
		}
function ouvrirpopupvcm()
		{
			void(window.open('http://www.voyageurs-du-ciel-et-de-la-mer.fr/esp/','','width=640,height=400,scrollbars=0'));
		}		

function ouvrirpopupfutur()
		{
			void(window.open('http://www.stardufutur.com','','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=no,resizable=yes,width=760, height=520'));
		}		

function pleinecran(page)
		{
			ie4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ));
			
			if(ie4)
				void(window.open(page,'','fullscreen=yes,scrollbars=no,resizable=no'));
			else
				void(window.open(page,'','width='+screen.width+',height='+screen.height+',top=0,left=0'));
		}

function xt_clic(typecl,section,page,url,nvlle)
		{
		Xt_r = document.referrer;
		Xt_h = new Date();
		xt_img = new Image();
		Xt_i = 'http://logi6.xiti.com/hit.xiti?s=137527&s2='+section;
		Xt_i += '&p='+page+'&clic='+typecl+'&hl=' + Xt_h.getHours() + 'x' + Xt_h.getMinutes() + 'x' + Xt_h.getSeconds();
		if(parseFloat(navigator.appVersion)>=4)
		{Xiti_s=screen;Xt_i += '&r=' + Xiti_s.width + 'x' + Xiti_s.height + 'x' + Xiti_s.pixelDepth + 'x' + Xiti_s.colorDepth;}
		Xt_i += '&ref=' + Xt_r.replace(/[<>"]/g, '').replace(/&/g, '$');
		xt_img.src = Xt_i;
		if ((url != null)&&(url!=undefined))
		{ if ((nvlle=='')||(nvlle==null)) { document.location = url;} else {xfen = window.open(url,'xfen',''); xfen.focus();}}
		else
		{return;}
		}
		
function champnonvide(champ)
	{
		var regx = /\w/;
		var erreur = 0 ;
		
		if(!champ) erreur++;
		else
		{
			if(champ == "") erreur++;
			else
			{
				if(!regx.test(new String(champ))) erreur++;
			}
		}
		
		if(erreur == 0) return true;
		else return false;
	}
		
function effacercontenunews()
	{
		if(document.newslettertop.email.value == 'tu e-mail')
		{
			document.newslettertop.email.value = '';
		}
		else return false;
	}
	
function verifemail(adresse)
{
	var str = new String(adresse);
	var point = str.lastIndexOf('.');
	var arobase = str.lastIndexOf('@');
	var espace = str.indexOf(' ');
	var lgtotal = str.length;
	
	if( (lgtotal-point <3) || point == -1 || arobase == -1 || espace != -1 || point < arobase || (point-arobase <=1)) return false;
	else return true;
}

function validemailnews()
{
	var adresse = document.newslettertop.email.value;
	
	if(!champnonvide(adresse) || !verifemail(adresse))
	{
		alert("La dirección email introducida no tiene un formato correcto.");
		return false;
	}
	else return true;
}

function validemailimgnews()
	{
		var adresse = document.newslettertop.email.value;
		
		if(!champnonvide(adresse) || !verifemail(adresse))
		{
			alert("La dirección email introducida no tiene un formato correcto.");
		}
		else document.newslettertop.submit();
	}