var a_lignes = new Array ();
var hexa = "0123456789ABCDEF";   

function init () {
	hasIE_hideAndShow();
	if (!document.getElementById) return;
	n = 1;
	for (i = 0; i < 100; i++) {
		o = document.getElementById("ligne" + n);
		if (!o) break;
		a_lignes[n - 1] = o.style;
		n++;
	}
	init_copper_list ();	

}

function init_copper_list () {
	composante = 255;
	for (i = 0; i < a_lignes.length; i++) {
		a_lignes[i].color = rvb (composante, composante, 0);
		composante -= 8;
	}	
	//setTimeout ("boucle ()", 60);
}

function dh (n) {
	a = Math.floor (n / 16);
	b = Math.floor (n % 16);
	return (hexa.charAt (a) + hexa.charAt (b));
}


function rvb (r,v,b) {
	return "#"+dh(Math.floor(r))+dh(Math.floor(v))+dh(Math.floor(b));
}

var hasIE_phone_home = 0;


// This function does the actual browser detection
function hasIE_hasIE() {
  var ua = navigator.userAgent.toLowerCase();
  //return -1;
  return ((ua.indexOf('msie') != -1) && (ua.indexOf('opera') == -1) && 
          (ua.indexOf('webtv') == -1) &&
          (location.href.indexOf('seenIEPage') == -1));
}

function hasIE_showOnlyLayer(whichLayer)
{
  if (document.getElementById)
    {
      var style2 = document.getElementById(whichLayer);
    }
  else if (document.all)
    {
      var style2 = document.all[whichLayer];
    }
  else if (document.layers)
    {
      var style2 = document.layers[whichLayer];
    }
  var body = document.getElementsByTagName('body');
  body[0].innerHTML = style2.innerHTML;
}

function hasIE_showLayer(whichLayer)
{
  if (document.getElementById)
    {
      var style2 = document.getElementById(whichLayer).style;
      style2.display = "block";
    }
  else if (document.all)
    {
      var style2 = document.all[whichLayer].style;
      style2.display = "block";
    }
  else if (document.layers)
    {
      var style2 = document.layers[whichLayer].style;
      style2.display = "block";
    }
}

function hasIE_moveAd(adid) {
  if (document.getElementById)
    {
      var ad = document.getElementById('hasIE_ad');
      var adloc = document.getElementById(adid);
    }
  else if (document.all)
    {
      var ad = document.all['hasIE_ad'];
      var adloc = document.all[adid];
    }
  else if (document.layers)
    {
      var ad = document.layers['hasIE_ad'];
      var adloc = document.layers[adid];
    }
  adloc.innerHTML = ad.innerHTML;
}

// Hides and shows sections of the page based on whether or not it's
// running in IE
function hasIE_hideAndShow() {
  if (hasIE_hasIE()) {
    hasIE_showOnlyLayer("hasIE_level2");
          if (hasIE_phone_home == 1)
            hasIE_phoneHome('getIE_pingimage2');
  } else {
    if (hasIE_phone_home == 1)
      hasIE_phoneHome('getIE_pingimage0');
  }
}

function hasIE_phoneHome(image) {
  if (document.getElementById)
    {
      var img = document.getElementById(image);
    }
  else if (document.all)
    {
      var img = document.all[image];
    }
  else if (document.layers)
    {
      var img = document.layers[image];
    }
  img.setAttribute('src','http://getunder50.com/ping.php?host='+location.host);

}

function hasIE_ContinueWithoutFF() {
    if (location.href.indexOf('?') != -1)
        location.href += '&seenIEPage=1';
    else
        location.href += '?seenIEPage=1';
}

