// section created by David De Neef

//********************
//* GLOBAL VARIABLES *
//********************
var msgWindow;
var countus = true;
today = new Date;
sec = today.getTime();
var url_php = "http://www.belrail.be/common/";
//var url_php = "http://localhost/belrail/common/";

//************
//* COUNT US *
//************
if(countus)
{
	document.write('<SCRIPT LANGUAGE="javascript" SRC="http://www.belrail.be/applets/scripts/visites.php"></SCRIPT>')
}
function CountUs()
{
	document.write('<SCRIPT LANGUAGE="javascript" SRC="http://www.belrail.be/applets/scripts/visites.php?display=1"></SCRIPT>')
}

//***************
//* REDIREcTION *
//***************
function presse(langue,annee,signet)
{
  var url;
  if(annee==02)
  {
    if(langue=='fr')
      url="http://users.pandora.be/deneef/F/informations/presse.html";
    else if(langue=='nl')
      url="http://users.pandora.be/deneef/F/informatie/pers.html";
  }
  else
  {
    if(annee<10)
      url="http://www.sncb.online.fr/archives/presse0"+annee+".html";
    else
      url="http://www.sncb.online.fr/archives/presse"+annee+".html";
  }
  location.href = url+"#"+signet;
} 
function archives(url)
{
  location.href = "http://www.sncb.online.fr/archives/"+url;
} 
function contact(id)
{
  var chemin = url_php + "misc/contacts.php?id=" + id;
  window.open(chemin,'contact','menubar=no,width=500,height=300,status=yes,resizable=no,location=no,directories=no,scrollbars=yes')
} 

function annuaire(id)
{
  if (id == 0)
    result = url_php + "links/attente.html";
  else
    result = url_php + "links/goto.php?id="+id;
  return result;
}
function linkEngine(lang,cat_id)
{
  location.href = url_php + "links/index.php?lang="+lang+"&cat_id="+cat_id ;
}

//******************
//* WINDOWS OPENER *
//******************
function lien(url)
{
 var largeur=780;
 var hauteur=550;
 if(screen)
 {
 	largeur = screen.width-30;
	hauteur = screen.height-200;
 }
 var url2 = url_php + "redirections/redirect.php?"+url;
 msgWindow=window.open(url2,"_blank","menubar=yes,width="+largeur+",height="+hauteur+",left=10,top=5,status=yes,resizable=yes,toolbar=yes,location=no,directories=no,scrollbars=yes");
} 
function windowOpener(url) 
{
  windowOpener(url,"_blank");
}
function windowOpener(url,nom) 
{ 
 var posLeft=0;
 var posTop=0;
 if(screen)
 {
 	posLeft=((screen.width)/2-400);
 	posTop=((screen.height)/2-300);
 }
 msgWindow=window.open(url,nom,"menubar=no,width=800,height=560,left="+posLeft+",top="+posTop+",status=no,resizable=no,location=no,directories=no,scrollbars=yes");
}
function closewin()
{
  msgWindow.close();
} 

//************
//* PICTURES *
//************
// version temporaire
function alerte()
{
  if ( confirm("Cette image n\'est momentanément pas disponible sur ce site. Vous pouvez néanmoins toujours y accéder via le site http://www.rail-pictures.be.tf \n\n Cliquez sur OK pour atteindre ce site, ou sur Annuler pour revenir à la page initiale.") )
     location.href="http://www.rail-pictures.be.tf";
}

function agranditImage(categorie,nom)
{
  cheminImage = 'http://www.belrail.be/media/images/' + categorie + '/' + nom;
  head = '<HTML><HEAD><TITLE>Image</TITLE></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0 ONLOAD="cacheOff()">';
  chargement ='<STYLE TYPE="text/css">#cache { position:absolute; top:20px; z-index:10; visibility:hidden;}</STYLE><DIV ID="cache"><P ALIGN="LEFT"><TABLE WIDTH=300 BGCOLOR=#000000 BORDER=0 CELLPADDING=2 CELLSPACING=0><TR><TD ALIGN=center VALIGN=middle><TABLE WIDTH=100% BGCOLOR=#FFFFFF BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN=center VALIGN=middle bgcolor="#E3EEFC"><FONT FACE="Verdana" SIZE=3 COLOR=#003399><B><BR>Veuillez patienter pendant le chargement de la page ...<BR><BR></B></FONT></TD>  </TR></TABLE></TD>  </TR></TABLE></DIV></P>';
  script = '<SCRIPT>var nava = (document.layers);var dom = (document.getElementById);var iex = (document.all);if (nava) { cach = document.cache } else if (dom) { cach = document.getElementById("cache").style } else if (iex) { cach = cache.style } cach.left = 10;cach.visibility = "visible";function cacheOff(){cach.visibility = "hidden";}</SCRIPT>';
  body = '<CENTER><a href="javascript:window.close()"><IMG SRC="'+cheminImage+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(Math.min(document.imageTest.width+10,screen.width),Math.min(document.imageTest.height+28,screen.height-20))" ALT="Cliquez sur la photo pour fermer la fenêtre"></a></CENTER></BODY></HTML>';
  if (categorie == 'schemas' || categorie == 'cartes')
    popupImage = window.open('','_blank','toolbar=0,left=0,top=0,location=0,directories=0,menuBar=0,resizable=1,scrollbars=1');
  else
    popupImage = window.open('','_blank','toolbar=0,left=0,top=0,location=0,directories=0,menuBar=0,resizable=1,scrollbars=0');
  popupImage.document.open();
  popupImage.document.write(head);
  popupImage.document.write(chargement);
  popupImage.document.write(script);
  popupImage.document.write(body);
  popupImage.document.close()
}

function afficheImage(chemin)
{
  index1 = chemin.indexOf("/",0);
  index2 = chemin.indexOf(".",0);
  if (index1 > 0)
  {
    categorie = chemin.substring(0,index1);
    nomSmall = chemin.substring(0,index2)+'_small'+chemin.substring(index2);
    nomLarge = chemin.substring(index1+1);
    cheminPreview = 'http://www.belrail.be/media/previews/'+nomSmall ;
    document.write('<A HREF="javascript:agranditImage(\''+categorie+'\',\''+nomLarge+'\')"><IMG SRC="'+cheminPreview+'" ALIGN=LEFT ALT="Cliquez ici pour agrandir cette image"></A>');
  }
}

function schema(nom)
{
   agranditImage('schemas',nom);
}

function joueVideo(fichier)
{
  url = 'http://www.belrail.be/F/multimedia/play.php?fichier=videos/' + fichier;
  playWindow=window.open(url,'Lecture',"menubar=no,width=600,height=550,left=10,top=10,status=no,resizable=yes,location=no,directories=no,scrollbars=yes");
}

function joueSon(fichier)
{
  url = 'http://www.belrail.be/F/multimedia/play.php?fichier=sons/' + fichier;
  playWindow=window.open(url,'Lecture',"menubar=no,width=600,height=400,left=10,top=10,status=no,resizable=no,location=no,directories=no,scrollbars=yes");
}

function afficheVideo(fichierVideo)
{
  index1 = fichierVideo.indexOf(".",0);
  if (index1 > 0)
  {
    nomVideo = fichierVideo.substring(0,index1);
    extVideo = fichierVideo.substring(index1);
    cheminPreview = 'http://www.belrail.be/media/previews/videos/'+nomVideo+'.jpg' ;
    document.write('<A HREF="javascript:joueVideo(\''+fichierVideo+'\')"><IMG SRC="'+cheminPreview+'" ALIGN=LEFT ALT="Cliquez ici pour voir la vidéo"></A>');
  }
}

function afficheSon(fichierSon)
{
    cheminPreview = 'http://www.belrail.be/media/previews/sons/son.jpg' ;
    document.write('<A HREF="javascript:joueSon(\''+fichierSon+'\')"><IMG SRC="'+cheminPreview+'" ALIGN=LEFT ALT="Cliquez ici pour écouter le son"></A>');
}

