﻿$(document).ready(function(event) {

	var rollover = new Array(4);
	var name = '';

	//cache the images to make it load faster
	function init(i, first, second) {
		rollover[i] = new Array(2);
		rollover[i][0] = new Image();		
		rollover[i][0].src = first;
		rollover[i][1] = new Image();
		rollover[i][1].src = second;
	}	
	
	for (i = 0; i < 7; i++) {		
		switch(i) {
			case 0: 
				name = 'about';
			break;
			case 1: 
				name = 'contact';
			break;
			case 2: 
				name = 'quotation';
			break;
			case 3: 
				name = 'tracking';
			break;
			case 4: 
				name = 'air';
			break;
			case 5: 
				name = 'sea';
			break;
			case 6: 
				name = 'road';
			break;
		}
		init(i,'images/menu/' + name + '.gif', 'images/menu/' + name  + '2.gif');		
	}
	
	$("img.replaced").mouseover(function() {
		var id = $(this).attr('id').substr(8);
		$(this).attr('src', rollover[id][1].src);
	});
	$("img.replaced").mouseout(function() {
		var id = $(this).attr('id').substr(8);
		$(this).attr('src', rollover[id][0].src);		
	});
	
});