/**
  @author: oe
  @date:   19.01.2009
  Javascript Functions for www.afv.de
*/

// Indicates whether all images are preloaded.
var isPreloaded = false;

/**
  Returns a new Image Object with src of given argument.
*/
function newImage(arg) {
	if (document.images) {
		temp = new Image();
		temp.src = arg;
		return temp;
	}
}

/**
  Changes Images of the Header area by changing image arguments. 
  Must be called like:
  changeImages('nameOfImage1', 'SrcOfImage1', 'nameOfImage2', 'SrcOfImage2')
*/
function changeImages() {
	if (document.images && (isPreloaded == true)) {
		for (var i = 0; i < changeImages.arguments.length; i += 2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i + 1];
		}
	}
}

/**
  Preloads Images.
*/
function preloadImages() {
	if (document.images) {
		isPreloaded = true;
	}
}