//***********************************************//
// JavaScript for changing images on mouse over  //
// You can distribute and modify this script any //
// way you want.                                 //
// Author: Maksim Luzik, Date: 6.8.2008          //
//***********************************************//

// Checking whether or not current browser supports DOM.
if (document.images) {

	// Variables needed by script.
	var normal = new Array();
	var selected = new Array();
	var def_names = new Array('fin', 'eng', 'rus');
	var sel_names = new Array('fin_s', 'eng_s', 'rus_s');
	var image_path;
	var image_extension = ".gif";
	
	// This function is called when
	// intro page is loaded. The function
	// initializes path to images and
	// populates needed arrays with elements.
	function initialize(path) {
		image_path = path;
		
		// Population of default image elements.
		for(i=0; i < def_names.length; i++) {
    normal[i] = new Image();
    normal[i].src = image_path+def_names[i]+image_extension;
		}
		
		// Population of selected image elements.
		for(i=0; i < sel_names.length; i++) {
			selected[i] = new Image();
			selected[i].src = image_path+sel_names[i]+image_extension;
		}
	}

	// This function highlights the images.
	function highlightImage(element) {
		for (i=0; i < def_names.length; i++) {
			if (element.id == def_names[i]) {
				element.src=selected[i].src;
				break;
			}
		}
	}
	
	// This function resets images back to their default view.
	function restoreImage(element) {
		for (i=0; i < def_names.length; i++) {
			if (element.id == def_names[i]) {
				element.src=normal[i].src;
				break;
			}
		}
	}
}