function inverse1(){ document.formulaire.orand2.value="ou";}
function inverse2(){ document.formulaire.orand2.value="et";}

function inverse3(){ document.formulaire.inf.value=">";}
function inverse4(){ document.formulaire.inf.value="<";}

function dept(val){ document.formulaire.orand1.value=val;}

var mess = "    -=< www.mediasenligne.fr vous souhaite la bienvenue >=-     ";
var i = 0;

function defile(){
window.status = mess.substring(i, mess.length) + mess.substring(0, i);
i++;
if (i > mess.length)
	i = 0;
window.setTimeout("defile()",200);
}

function maximise(){
  if (document.all) { // IE
   window.moveTo(0,0);
	if (  (window.height != screen.availHeight) 
	   || (window.width  != screen.availWidth) ){
	window.resizeTo(screen.availWidth, screen.availHeight);
	}
  }
  else { // NETSCAPE
   window.moveTo(1,1);
   if ( (window.outerHeight != screen.availHeight)
     || (window.outerWidth  != screen.availWidth) ) {
	window.outerHeight = screen.availHeight;
	window.outerWidth = screen.availWidth;
	}
  }
defile();
}

function commun(){
 if (document.all) {
  var hauteur = document.body.clientHeight - 20; //40 pour les barres de defilements
  var largeur = document.body.clientWidth - 20;}
 else {
  var hauteur = window.innerHeight - 20;
  var largeur = window.innerWidth - 20;}

 window.document.write('<div align="left" style="width:');
 window.document.write(largeur);
 window.document.write('px; height:');
 window.document.write(hauteur);
 window.document.write('px; position:absolute; overflow:auto; top:10px; left:10px;">');
 window.document.write('<table width="100%" height="100%" cellpadding="0" cellspacing="0" align="center">');
 window.document.write('<tr><td height="30"><p align="center"><a href="/cp/">www.mediasenligne.fr</a><p></td></tr>');
 window.document.write('<tr><td width="');
 window.document.write(largeur-80);
 window.document.write('" valign="top">');
 window.document.write('<table align="center" width="95%" class="none"><tr><td class="none" align="center">');
}

function popup(page){
window.open(page,'Facture','');
}

function popup1(){
window.open('./popup.html','MailPopup','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=300,height=200');
}

function GetCookie (){
 var cookValue = "" ;
 var cookName = "" ;
 var egal = document.cookie.indexOf( "$" ) ;
 cookName = document.cookie.substring ( 0, egal ) ;
 cookValue = document.cookie.substring ( egal + 1, egal + 4) ;
 //if (cookValue != "yes") popup1();
 }

function SetCookie (){
 var aujourdhui = new Date() ;
 var expdate = new Date() ;
 expdate.setTime( aujourdhui.getTime() + ( 365*24*60*60*1000*2 ) ) ;
 document.cookie = "registred$yes" + ";expires=" + expdate.toGMTString() ;
 }

function checkmail(){
 adresse = document.formulaire.email1.value;
 adresse2 = document.formulaire.email2.value;
 var place = adresse.indexOf("@",1);
 var point = adresse.indexOf(".",place+1);
 if ( adresse != adresse2 ){
  alert('Adresses e-mail differentes !');
  return(false);
  }
 else {
  if ((place > 0)&&(adresse.length > 5)&&(point > 2)){
   return(true);
   }
  else{
   alert('Adresses e-mail invalides !');
   return(false);
   }
  }
 }

function envoi(){
 haut=(screen.availHeight - 350)/ 2;
 gauche=(screen.availWidth - 450)/ 2;
 envoi=window.open('/envoi.html','envoi','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=450,height=350, top='+haut+', left='+gauche);
 }

function www(){
 //var site="www.mediasenligne."; // redirection si le visiteur ne vient du site
 //var ref = document.referrer;
 //if ( (ref.lastIndexOf(site))<0 )
 // document.location.href='http://www.mediasenligne.fr/index.php';
 popup('http://www.mediasenligne.fr');
 }

function getexpirydate( nodays){
 var UTCstring;
 Today = new Date();
 nomilli=Date.parse(Today);
 Today.setTime(nomilli+nodays*24*60*60*1000);
 UTCstring = Today.toUTCString();
 return UTCstring;
 }

function getcookie2(cookiename) {
 var cookiestring=""+document.cookie;
 var index1=cookiestring.indexOf(cookiename);
 if (index1==-1 || cookiename=="") return ""; 
 var index2=cookiestring.indexOf(';',index1);
 if (index2==-1) index2=cookiestring.length; 
 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}

function setcookie2(name,value,duration){
 cookiestring=name+"$"+escape(value)+";EXPIRES="+getexpirydate(duration);
 document.cookie=cookiestring;
 if(!getcookie(name)){
  return false;
  }
 else{
  return true;
  }
 }

