// Created with MAX's HTML Beauty++ ME

// Might want to improve this stuff.
// TODO:
// + sitemap doesn't work with opera. document.location ???

var NS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
var IE4 = (document.all)? true : false;
var NS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;

function add_sitemap() {
	docpath = new String(document.location);
	docfile = docpath.slice((docpath.lastIndexOf('/')+1));
	txt = ' | '
	// 2D array of links: href, text
	var links = [	['/index.html',					'Home'],
					// Duplicate a line from below to add new entries to site map
					['/tongariro_crossing.html',	'Tongariro&nbsp;Crossing'],
					['/vertical_assault.html',		'Vertical&nbsp;Assault'],
					['/accommodation.html',			'Accommodation'],
					['/other_activities.html',		'Other&nbsp;Activities'],
					['/gallery_tong_cross.html',	'Photo&nbsp;Gallery'],
					//['/cgi/my_guestbook.cgi',		'Guest&nbsp;Book'],
					// ['refferer.html',			'Tell&nbsp;a&nbsp;Friend'],
					['/contact_us.html',			'Contact&nbsp;Us'],
					//
					];
	
	
	for (entry in links) {
		if (links[entry][0].slice(1) != docfile) {
			txt += '<A HREF="' + links[entry][0] + '">' + links[entry][1] +'</A> | '
		} else {
			txt += links[entry][1] +' | '
		}		
	}
	
	document.write(txt);
}

function add_popup() {
	// Add optional params for pop width and height.
	//	imgName, imgPos, w, h, desc, [pw, ph]
	if (arguments.length>=5) {
		imgName = arguments[0];
		imgPos = arguments[1];
		w = arguments[2];
		h = arguments[3];
		desc = arguments[4];
		if (arguments.length==7) {
			pw = arguments[5];
			ph = arguments[6];
		} else {	
			pw = 640;
			ph = 480;
		}
	} else {
		return;
	}
	
	pw += 33
	ph += 30
	dw = (NS6||NS4) ? w : w+2
	txt  = '<DIV CLASS="img-f'+imgPos+'" style="width: '+dw+';"><A HREF="javascript:myVoid()"';
	txt += ' onClick="showpic(\'images/'+imgName+'.jpg\',\''+imgName+'\','+pw+','+ph+')"';
	txt += ' ONMOUSEOVER="window.status=\'Popup Picture Window\'; return true;"';
	txt += ' ONMOUSEOUT="window.status=\'\'; return true;">';
	txt += ' <IMG SRC="images/'+imgName+'_thumb.jpg" WIDTH="'+w+'" HEIGHT="'+h+'"';
	txt += ' ALT="'+desc+'"><DIV CLASS="imgtitle">'+desc;
	txt += '</DIV></A></DIV>';
	re = new RegExp("<", "g");
	//txt = txt.replace(re, "-");
	document.write(txt);
}

// pop up code
function myVoid(){;}

function showpic(theUrl, name, w, h) {
	window.open(theUrl,name,'toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,status=no,width='+w+',height='+h);
}
