  
// %%%-KRUST-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% last modified 00/00/98 %%%%%%%%
//
//             This Javascript is used on KRUST's Home Page. 
//           it's a collection of background fading functions
//
//              (c) 1998 Thomas Robert de Massy - KRUST
//                krust@axess.com or tomasd@axess.com
//        You cannot use any of these codes without permission
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-KRUST-%%%
//  Site Functions Javascript
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


<!--

 // This function is used by FADE, it's used to convert an HEX to a decimal
 function hextodec(hex)
 {
  hexv    = new Array (2)
  hexv[0] = hex.charAt (0)
  hexv[1] = hex.charAt (1)
  decv    = new Array (2)
  decv[0] = 0
  decv[1] = 0

  for (var fois = 0; fois <= 1; fois++)
  {
   if (hexv[fois] == "0") { decv[fois] = 0 }
   if (hexv[fois] == "1") { decv[fois] = 1 }
   if (hexv[fois] == "2") { decv[fois] = 2 }
   if (hexv[fois] == "3") { decv[fois] = 3 }
   if (hexv[fois] == "4") { decv[fois] = 4 }
   if (hexv[fois] == "5") { decv[fois] = 5 }
   if (hexv[fois] == "6") { decv[fois] = 6 }
   if (hexv[fois] == "7") { decv[fois] = 7 }
   if (hexv[fois] == "8") { decv[fois] = 8 }
   if (hexv[fois] == "9") { decv[fois] = 9 }
   if (hexv[fois] == "A") { decv[fois] = 10 }
   if (hexv[fois] == "B") { decv[fois] = 11 }
   if (hexv[fois] == "C") { decv[fois] = 12 }
   if (hexv[fois] == "D") { decv[fois] = 13 }
   if (hexv[fois] == "E") { decv[fois] = 14 }
   if (hexv[fois] == "F") { decv[fois] = 15 }
  }
  return ((16*decv[0])+decv[1])
 }

 
 // This function is used by FADE, it's used to convert a decimal to an HEX
 function dectohex(dec)
 {
  hexv    = new Array (2)
  decv    = new Array (2)
  decv[0] = Math.floor(dec/16)
  decv[1] = (dec%16)

  for (var fois = 0; fois <= 1; fois++)
  {
   if (decv[fois] == 0)   { hexv[fois] = "0" }
   if (decv[fois] == 1)   { hexv[fois] = "1" }
   if (decv[fois] == 2)   { hexv[fois] = "2" }
   if (decv[fois] == 3)   { hexv[fois] = "3" }
   if (decv[fois] == 4)   { hexv[fois] = "4" }
   if (decv[fois] == 5)   { hexv[fois] = "5" }
   if (decv[fois] == 6)   { hexv[fois] = "6" }
   if (decv[fois] == 7)   { hexv[fois] = "7" }
   if (decv[fois] == 8)   { hexv[fois] = "8" }
   if (decv[fois] == 9)   { hexv[fois] = "9" }
   if (decv[fois] == 10)  { hexv[fois] = "A" }
   if (decv[fois] == 11)  { hexv[fois] = "B" }
   if (decv[fois] == 12)  { hexv[fois] = "C" }
   if (decv[fois] == 13)  { hexv[fois] = "D" }
   if (decv[fois] == 14)  { hexv[fois] = "E" }
   if (decv[fois] == 15)  { hexv[fois] = "F" }
  }
 
  return (hexv[0]+hexv[1])

 }






 // FadeIn the background to black & fade it out to a given color
 function fade(incolor,fadein,fadeout,speed,delay)
 {

  curentcolordecv = new Array (3)
  incolordecv     = new Array (3)

  // convert the IN HEX & dec data
  incolordecv[0] = hextodec (incolor.charAt (1)  + incolor.charAt (2))
  incolordecv[1] = hextodec (incolor.charAt (3)  + incolor.charAt (4))
  incolordecv[2] = hextodec (incolor.charAt (5)  + incolor.charAt (6))

  if (fadein)
  {
   for (var fois = 100; fois >= 0; fois = fois - speed)
   {
    curentcolordecv[0] = Math.floor((incolordecv[0] * fois)/100)
    curentcolordecv[1] = Math.floor((incolordecv[1] * fois)/100)
    curentcolordecv[2] = Math.floor((incolordecv[2] * fois)/100)

    for (var fois2 = 0; fois2 <= (delay*100); fois2++) {}

    document.bgColor   = '#'+dectohex(curentcolordecv[0])+dectohex(curentcolordecv[1])+dectohex(curentcolordecv[2])
   }
  }

  if (fadeout)
  {
   for (var fois = 0; fois <= 100; fois = fois + speed)
   {
    curentcolordecv[0] = Math.floor((incolordecv[0] * fois)/100)
    curentcolordecv[1] = Math.floor((incolordecv[1] * fois)/100)
    curentcolordecv[2] = Math.floor((incolordecv[2] * fois)/100)

    for (var fois2 = 0; fois2 <= (delay*100); fois2++) {}
 
    document.bgColor   = '#'+dectohex(curentcolordecv[0])+dectohex(curentcolordecv[1])+dectohex(curentcolordecv[2])  
   }
  }

 }





 // Predefined FadeIN OUT
 function dobackfade ()
 {  
  if (window.top.dofade == 1)
  {  
   // Netscape is very slow, so set a faster speed if it's detected.
   if (window.top.browsername == "Netscape")
    { fade(window.top.pagebackground,1,1,10,1) }
   else
    { fade(window.top.pagebackground,1,1,2,5) }
  }
 }

 // Predefined FadeIN OUT
 function domenufade ()
 {
  fade(window.top.backgroundcolor,0,1,9,30)
 }


// -->

/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                             
                             all Images,Java Applets,Music,Logos,Textures,
                             Javascript codes found on the site :
                             (c) 1997-1998 Thomas Robert de Massy (KRUST)
                             all rights reserved
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-KRUST-%%%
*/
