// load www.pcdr.fr/filename.html if hostname is pcdr.fr or filename omits ".html"

var strHost_i = window.location.hostname ;
var strHost_f = strHost_i.toLowerCase() ;
var strPN_i = window.location.pathname ;  // directory + filename
var strPN_f = strPN_i.toLowerCase() ;
var intLenPN = strPN_f.length ;  // pathname length
var strPNLastChr = strPN_f.charAt(intLenPN-1) ;  // last chr of pathname

// if "www." missing from pcdr.fr hostname, add it
if (strHost_f.indexOf("pcdr.fr") >= 0 && strHost_f.indexOf("www.") == -1) { strHost_f = "www.pcdr.fr" }

// if ".html" missing from pathname, add it
if (strPNLastChr == "/")  // add "index.html" if missing for directory default page
 {
 strPN_f = strPN_f + "index.html" ;
 } 
else if (strPN_f.indexOf(".html") == -1)  // add ".html" if missing on any other page
 {
 strPN_f = strPN_f + ".html" ;
 }

// if hostname Or pathname reformed, reload page
if (strHost_i != strHost_f || strPN_i != strPN_f)
 {
 self.location.href= "http://" + strHost_f + strPN_f ;
 }

