function img_preload() {
	if (document.images) {
		if (!document.img_array) {
			document.img_normal_array = new Array();
			document.img_over_array = new Array();
			document.img_focus_array = new Array();
		}
		for (i = 0; i < img_preload.arguments.length; i++) {
			name = img_preload.arguments[i];
			document.img_normal_array[name] = new Image;
			document.img_normal_array[name].src = "images/" + name + "1.gif";
			document.img_over_array[name] = new Image;
			document.img_over_array[name].src = "images/" + name + "2.gif";
			document.img_focus_array[name] = new Image;
			document.img_focus_array[name].src = "images/" + name + "3.gif";
		}
	}
}
function img_normal(name) {
	document.images[name].src = document.img_normal_array[name].src;
}
function img_over(name) {
	document.images[name].src = document.img_over_array[name].src;
}
function img_focus(name) {
	document.images[name] = document.img_focus_array[name];
}
function navbar() {
    main = new Array("index", "products", "services", "forums", "links", "contact", "about");
    products = new Array("magpiepro");

	i = document.URL.lastIndexOf('/');
	j = document.URL.lastIndexOf('\\');
	if (i < j)
		i = j;
	j = document.URL.indexOf('_', i);
	if (j == -1)
		j = document.URL.indexOf('.', i);
	o = document.URL.substring(i + 1, j);

	mn = -1;
	pn = -1;
	for (i = 0; i < main.length; i++) {
		if (main[i] == o) {
			mn = i;
			break;
		}
	}
	if (mn == -1) {
		for (i = 0; i < products.length; i++) {
			if (products[i] == o) {
				pn = i;
				break;
			}
		}
		if (pn != -1)
			mn = 1; // products
	}

	document.write('<a href="index.html" target="_top"><img src="images/thirdwish.gif" border="0"></a><br>');
    document.write('<table><tr>');

	for (i = 0; i < main.length; i++) {
		if (mn != i) {
			document.write('<td><a href="' + main[i] + '.html" target="_top" onMouseOver=\'img_over("' + main[i] + '");\' onMouseOut=\'img_normal("' + main[i] + '");\'><img src="images/' + main[i] + '1.gif" name="' + main[i] + '" border="0"></a></td>');
		}
		else {
			document.write('<td><a href="' + main[i] + '.html" target="_top"><img src="images/' + main[i] + '3.gif" name="' + main[i] + '" border="0"></a></td>');
		}
	}

	document.write('</tr><tr>');
	document.write('<td></td>');
	document.write('<td colspan="5">');

	line = "product_line";
	for (i = 0; i < products.length; i++) {
		if (i == products.length - 1)
			line = "product_last_line";

		if (pn != i) {
			if (mn != 1) {
      			document.write('<img src="images/' + line + '.gif"><a href="' + products[i] + '.html" target="_top" onMouseOver=\'img_over("' + products[i] + '"); img_over("products");\' onMouseOut=\'img_normal("' + products[i] + '"); img_normal("products");\'><img src="images/' + products[i] + '1.gif" name="' + products[i] + '" border="0"></a><br>');
      		}
      		else {
      			document.write('<img src="images/' + line + '.gif"><a href="' + products[i] + '.html" target="_top" onMouseOver=\'img_over("' + products[i] + '");\' onMouseOut=\'img_normal("' + products[i] + '");\'><img src="images/' + products[i] + '1.gif" name="' + products[i] + '" border="0"></a><br>');
      		}
		}
		else {
      		document.write('<img src="images/' + line + '.gif"><a href="' + products[i] + '.html" target="_top"><img src="images/' + products[i] + '3.gif" name="' + products[i] + '" border="0"></a><br>');
		}
	}

	document.write('</td>');
    document.write('</tr></table>');
}

