window.onresize = centerIt;

function fjernstandard(form) {
  for(i=0; i < form.elements.length; i++) {
    for(y=0; y < fields.length; y++) {
      if(form.elements[i].value == fields[y]) {
        form.elements[i].value = '';
      }
    }
  }
}

function getScreenWidth() {
	if(document.all && !document.getElementById) {
		return window.innerWidth;
	}
	else {
		return document.body.offsetWidth;
	}
}

function getScreenHalfWidth() {
	if(document.all && !document.getElementById) {
		return Math.round(window.innerWidth/2);
	}
	else {
		return Math.round(document.body.offsetWidth/2);
	}
}

function makeDIVStartOnIE() {
	if(isIE()) {
		document.write('<div>');
	}
}

function makeDIVEndOnIE() {
	if(isIE()) {
		document.write('</div>');
	}
}

function isIE() {
	var version=0;
	var ret = false;
	if (navigator.appVersion.indexOf("MSIE")!=-1) {
		temp=navigator.appVersion.split("MSIE")
		version=parseFloat(temp[1])
	}

	if (version>=5.5) {
		ret = true;	
	}
	
	return ret;
}


// Example:
// simplePreload( '01.gif', '02.gif' ); 
function simplePreload() { 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++) {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

function switchImage(imgName, imgSrc) {
 	if (document.images) {
    	if (imgSrc != "none") {
	    	document.images[imgName].src = imgSrc;
   		}
  	}
}

function changeColor(id,fromC,toC) {
	var element;
	
	if(document.all && !document.getElementById) {
		element = document.all[id];
	}
	else {
		element = document.getElementById(id);
	}
	
	colorTween = new ColorTween(element.style, 'backgroundColor', Tween.regularEaseInOut, fromC, toC, 0.1);
	colorTween.start()
}