 var isIE = ((document.all)?(true):(false));

 var _childnode = (isIE) ? "0" : "1";
 var kep_effekt = 1;
 var kep_effekt_eng = 1;
 var menu_open = '';
 var menu_working = 0;
 var popup_on = 0;

  function getElementHeight(Elem) {
	if(document.getElementById) {
		var elem = document.getElementById(Elem);
	} else if (document.all){
		var elem = document.all[Elem];
	}
	yPos = elem.offsetHeight;
	return yPos;
  }

  function getElementWidth(Elem) {
	if(document.getElementById) {
		var elem = document.getElementById(Elem);
	} else if (document.all){
		var elem = document.all[Elem];
	}
	yPos = elem.offsetWidth;
	return yPos;
  }
  
  function $(id) {
  	return document.getElementById(id);
  }
  
  function d2h(d) {
  	var prefix = '';
  	if(d<16) prefix = '0';
  	return prefix+d.toString(16);
  }

  function h2d(h) {
  	return parseInt(h,16);
  } 

  function a2s(a) {
  	var temp = '';
  	for(i=0;i<a.length;i++) {
  		temp += a[i]+';';
  	}
  	return temp;
  }
  
  function s2a(s) {
  	var tmp = s.split(";");
  	tmp.pop();
  	return tmp;
  }


  var WrongInputs = {

	Init: function() {
		this.inputs = new Array();
		this.defbg = new Array();
		this.aktbg = new Array();
	},

	Add: function(obj, defbg, aktbg) {
		this.inputs.push(obj);
		this.defbg.push(this.CreateIntRGB(defbg));
		this.aktbg.push(this.CreateIntRGB(aktbg));
	},
	
	Check: function() {
		alert(this.inputs.length);
		alert(this.defbg[0][0]);
	},
		
	CreateIntRGB: function(rgb) {
		var tmp = new Array();
		tmp[0] = h2d(rgb.substr(1,2));
		tmp[1] = h2d(rgb.substr(3,2));
		tmp[2] = h2d(rgb.substr(5,2));
		return tmp;
	},
		
	AnimBg: function () {
		var mehet = 0;
		var szorzo = 1;
		var absz, dif, j, tmp;
		for(var i=0; i<this.inputs.length; i++) {
		  	var input = eval(this.inputs[i]);
			szorzo = 1;
			for(j=0; j<3; j++) {
				if(this.defbg[i][j] != this.aktbg[i][j]) {
					mehet = 1;
					absz = Math.abs(this.defbg[i][j]-this.aktbg[i][j]);
					dif=Math.round(absz/20);
					if(dif<=2) dif=Math.ceil(absz/5);
					if(this.aktbg[i][j]>this.defbg[i][j]) szorzo = -1;
					this.aktbg[i][j]+=(dif*szorzo);
				}
			}
			input.style.backgroundColor = '#'+d2h(this.aktbg[i][0])+d2h(this.aktbg[i][1])+d2h(this.aktbg[i][2]);
		}
		if(mehet) setTimeout("WrongInputs.AnimBg()",25);
	}
  }

