<!-- // Hide

var imageDir = "/images/meny/";
var preloadFlag = false;   // whether or not preloading was successful 
var thisPicture			= 'blank'; // used to store picture name (from the arguments collection)
var selectedPicture = 'blank'; // used to store last picture name (from the arguments collection)

// preload images into image collection
function preloadImages() {
  if (document.images) {	// check for support for image collection
    blank = newImage("/images/blank.gif");
    dot_top = newImage("/images/meny/dot.gif");
    dot_over_red = newImage("/images/meny/dot_over_red.gif");
    dot_over_blue = newImage("/images/meny/dot_over_blue.gif");
    preloadFlag = true; // set preload flag to success!
  }
}

// make a new image object
function newImage(arg) {
  if (document.images) {// make sure we support image.collection
    rslt = new Image(); // allocate image object
    rslt.src = arg;			// init source
    return rslt;				// retunr image object
  }
}

// change picture (on event)
function changeImages() {
//	alert("changeImages");
  if (document.images && (preloadFlag == true) ) { // if images collection is supported and images are preloaded
    for (var i=0; i<changeImages.arguments.length; i+=2) {	// loop through arguments collection
      thisPicture = changeImages.arguments[i];							// extract string of picture name
    }
    if(selectedPicture!=thisPicture)												// is it the same as the selected picture
    {
	    for (var i=0; i<changeImages.arguments.length; i+=2) {// loop through arguments and 
		    document[changeImages.arguments[i]].src = changeImages.arguments[i+1]; // change .src of object(s)
			}
		}
  }
}

// change picture on click and make the clicked picture selected
// so it wont go away on other events
function clickImage() {
	var tmpSrc = 'blank';
  if (document.images && (preloadFlag == true)  ) {			// if images collection is supported and images are preloaded
    for (var i=0; i<clickImage.arguments.length; i+=2) {// loop through argument collection
      thisPicture = clickImage.arguments[i];						// store this pictures name
      tmpSrc = clickImage.arguments[i+1];								// store this pictures source
    }
    if(selectedPicture!=thisPicture)												// is it was clicked last time don't do shit
    {
			if(selectedPicture!='blank')													// if it is the first click skip unselecting
			{																											// else set selected picture to its previous state.
				eval("document.images['" + selectedPicture + "']" + ".src='" + imageDir + "dot.gif'");
			}
			selectedPicture = thisPicture;												// update selected 'picture'	
    }
  }
}
// unhide -->
