

function getFrameResolution()
{
 if(self.innerWidth)
 {
   frameWidth = self.innerWidth;
   frameHeight = self.innerHeight;
 }
 else
 {
   if(document.documentElement && document.documentElement.clientWidth)
   {
     frameWidth = document.documentElement.clientWidth;
     frameHeight = document.documentElement.clientHeight;
   }
   else
   {
     if(document.body)
     {
       frameWidth = document.body.clientWidth;
       frameHeight = document.body.clientHeight;
     }
     else
     { 
        var sreenWidth = 800 ;
        var sreenHeight = 600 ;
        if(screen.width)
        {
          screenWidth= screen.width ;
          
        }
        if(screen.height)
        {
          screenHeight= screen.Height ;
        }  
        
        screenWidthRatio = screenWidth/800 ;
        screenHeightRatio = screenHeight/600 ;
       
        if(!window.name.indexOf("FrameLogo")|| !window.name.indexOf("FrameLogo2"))
        {
          frameWidth =  101 * screenWidthRatio ; //Ces valeurs font que le site s'affiche pas trop laid 
          frameHeight = 52 * screenHeightRatio;
        }
        else
        {
          if(!window.name.indexOf("FrameEntete"))
          {
            frameWidth =  582 * screenWidthRatio; //Ces valeurs font que le site s'affiche pas trop laid 
            frameHeight = 52 * screenHeightRatio;
          }
          else
          {
            if(!window.name.indexOf("FrameTableDesMatieres"))
            {
              frameWidth =  82 * screenWidthRatio; //Ces valeurs font que le site s'affiche pas trop laid 
              frameHeight = 341 * screenHeightRatio ;  
            }
            else
            {
              if(!window.name.indexOf("FramePrincipal"))
              {
                frameWidth =  710 * screenWidthRatio; //Ces valeurs font que le site s'affiche pas trop laid 
                frameHeight = 341 * screenHeightRatio ;  
              }
              else
              {
                frameWidth =  200  ;//Ces valeurs font que le site s'affiche pas trop laid
                frameHeight = 100 

              }
            }  
          }
        }
      }  
    }    
  }

  var frameResolution = new Array(Math.round(frameWidth), Math.round(frameHeight));
  return frameResolution;
}  

function getFrameWidth()
{
  return getFrameResolution()[0] ;
}

function getFrameHeight()
{
  return getFrameResolution()[1] ;
}

function ReloadWindowOriginal(){

   
  var PageName = new String(window.document.location) ;
  
     //alert("Reloading window " + PageName) ;


  PageName = PageName.substring(PageName.lastIndexOf("/")+1,PageName.length) ;
  PageName = PageName.substring(0,PageName.lastIndexOf(".")) ;
  //alert("onResize:ResizeWindow for" + PageName + " width=" + getFrameWidth() + " Height=" + getFrameHeight()) ; 

  var  ReloadAlreadyCalled = GetCookie(PageName + "ReloadAlreadyCalled") ;
  
  SetCookie(PageName + "ReloadAlreadyCalled", "Yes") ;
  OldFrameWidth = GetCookie(PageName + "FrameWidth") ;
  OldFrameHeight = GetCookie(PageName + "FrameHeight") ;
  
  NewFrameWidth = getFrameWidth() ; 
  NewFrameHeight = getFrameHeight() ; 
  
  DiffFrameWidth = Math.abs(OldFrameWidth - NewFrameWidth) ;       
  DiffFrameHeight = Math.abs(OldFrameHeight - NewFrameHeight) ;
  
     
  if(ReloadAlreadyCalled && 
    (DiffFrameWidth >= 4 || DiffFrameHeight >= 4)){   // 2 is to low and an infinite loop occurs sometimes
    
    //var ExpDate= new Date() ;
    //FixCookieDate(ExpDate) ;
    //ExpDate.setTime(ExpDate.getTime() + (24 * 60 * 60 * 1000)) ;
  
    SetCookie(PageName + "FrameWidth", NewFrameWidth) ;
    SetCookie(PageName + "FrameHeight", NewFrameHeight) ;
    //alert("Resizing " + PageName + " OldFrameWidth=" + OldFrameWidth + " OldFrameHeight=" + OldFrameHeight ) ;
    window.location.href= PageName + ".html" ;
  }
  return(true) ;
}  

function ReloadWindow(){

   
  var PageName = new String(window.document.location) ;
  
     //alert("Reloading window " + PageName) ;


  PageName = PageName.substring(PageName.lastIndexOf("/")+1,PageName.length) ;
  PageName = PageName.substring(0,PageName.lastIndexOf(".")) ;
  window.location.href= PageName + ".html" ;

  return(true) ;
}  

function ReloadWindowTest(){

   
  var PageName = new String(window.document.location) ;
  
     //alert("Reloading window from Onload: " + PageName) ;


  PageName = PageName.substring(PageName.lastIndexOf("/")+1,PageName.length) ;
  PageName = PageName.substring(0,PageName.lastIndexOf(".")) ;
  //alert("onResize:ResizeWindow for" + PageName + " width=" + getFrameWidth() + " Height=" + getFrameHeight()) ; 

  var  ReloadAlreadyCalled = GetCookie(PageName + "ReloadAlreadyCalled") ;
  
  SetCookie(PageName + "ReloadAlreadyCalled", "Yes") ;
  OldFrameWidth = GetCookie(PageName + "FrameWidth") ;
  OldFrameHeight = GetCookie(PageName + "FrameHeight") ;
  
  NewFrameWidth = getFrameWidth() ; 
  NewFrameHeight = getFrameHeight() ; 
  
  DiffFrameWidth = Math.abs(OldFrameWidth - NewFrameWidth) ;       
  DiffFrameHeight = Math.abs(OldFrameHeight - NewFrameHeight) ;
  
     
  if(ReloadAlreadyCalled && 
    (DiffFrameWidth >= 4 || DiffFrameHeight >= 4)){   // 2 is to low and an infinite loop occurs sometimes
    
    //var ExpDate= new Date() ;
    //FixCookieDate(ExpDate) ;
    //ExpDate.setTime(ExpDate.getTime() + (24 * 60 * 60 * 1000)) ;
  
    SetCookie(PageName + "FrameWidth", NewFrameWidth) ;
    SetCookie(PageName + "FrameHeight", NewFrameHeight) ;
    //alert("Resizing " + PageName + " OldFrameWidth=" + OldFrameWidth + " OldFrameHeight=" + OldFrameHeight ) ;
    window.location.href= PageName + ".html" ;
  }
  return(true) ;
}  
  
  

function LoadInNewWindow(URLName)
{
  newwin = window.open(URLName, "_TOP") ;
  newwin.focus() ;
}



function CreateButtonToGoBackOnePage(ButtonString)
{
  document.write("<CENTER><FORM>") ; 
  if(top.location.href != window.location.href)
  {
    document.write("<INPUT Type='button' Value='" + ButtonString + "' onClick='history.back()'>") ;
  }
  else
  {  
    document.write("<INPUT Type='button' Value='Acceuil du site du Club v&eacute;lo randonneurs de Montr&eacute;al' onClick='GoToCVRMIndex()'>") ;
  }
  document.write("</FORM></CENTER>") ; 
}


function SetCVRMFrameOnTop()
{
//  if(top.length != 6 ||
//     top.location.href.toLowerCase().indexOf("cvrm") == -1)
//  {
//     window.location.href= "index.html" ;
    // Ne marche pas avec ie et win98 (Loop)
    //var IsNN4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 4) ;
    //if(!IsNN4)
    //{
    //  LoadInNewWindow("index.html") ;
    //  history.back() ;   
    //}
//    
//      
//    if(IsNN4)
//    {
//      if(window.innerWidth != 0)
//      {
//        top.location.href = "index.html" ;
//      } 
//    }    
//    else
//    { 
//    
//        top.location.href = "index.html" ;
//    }
//  } 
}


function GoToCVRMIndex()
{
	top.location.href = "index.html" ;
}