var hexChars = "0123456789ABCDEF";

function Dec2Hex (Dec) {
  if ( Dec > 255 ) {
    Dec = Dec/2;
    hex = "ff";
  }
  if ( Dec > 255 ) {
    Dec = Dec/2;
  }
  if ( Dec > 255 ) {
    hex = "ff";
  }
  else {
    var a = Dec % 16;
    var b = (Dec - a)/16;
    hex = "" + hexChars.charAt(b) + hexChars.charAt(a);
  }
  return hex;
}

function handleBereichMove(ereignis) {  
  posx = document.all ? window.event.clientX : ereignis.pageX;
  posy = document.all ? window.event.clientY : ereignis.pageY;
  document.getElementById("linie").style.backgroundColor =  "#" + Dec2Hex(posx/2) + Dec2Hex(posy/2) + Dec2Hex((window.innerWidth - posx - posy));
  document.getElementById("ginger").style.backgroundColor =  "#" + Dec2Hex(posx/2) + Dec2Hex(posy/2) + Dec2Hex((window.innerWidth - posx - posy));
}

document.onmousemove = handleBereichMove;

/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

function initRollovers() {

	if (!document.getElementById) return

	var aPreLoad = new Array();

	var sTempSrc;

	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'imgover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_h'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_h'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

function openWindow(page2open) {
  popupWin = window.open(page2open, 'ginger', 'width=670,height=600,left=200,top=20,menubar=no,status=no,scrollbars,resizable,toolbar=no,hotkeys,location=no')
}

window.onload = function ()
{
  // fillup();
  initRollovers();
}
