/* some javascript functions */

window.onerror=doh;
sSize="";
function doh(){
	return true;
}

function picScreen(theURL) {
	if (sSize=="bg") {
		window.open(theURL, '', 'fullscreen=no,toolbar=no,scrollbars=auto,status=no,menubar=no,resizable=no,directories=no,location=no,width=875,height=685,left=10,top=10');
	}
	if (sSize=="sm") {
		window.open(theURL, '', 'fullscreen=no,toolbar=no,scrollbars=yes,status=no,menubar=no,resizable=yes,directories=no,location=no,width=725,height=475,left=10,top=10');
	}
}

function p2(url) {
	document.write('&nbsp;<a href="\#" onClick="<script>openPicOnly(\'images/' + url + '\');</script>"><img border="0" align="center" src="images/tn_' + url + '"></a>');
}

function p(url) {
	document.write('&nbsp;<a href="images/' + url + '" target="' + url + '"><img border="0" align="center" src="images/tn_' + url + '"></a>');
}

function openPicOnly(url){
	window.open(url, '', 'fullscreen=no,toolbar=no,scrollbars=auto,status=no,menubar=no,resizable=yes,directories=no,location=no,width=800,height=600,left=10,top=10');
}

function fix() {
  FloatMenu();
  LoadCookies();
	var wide = window.screen.availWidth;
	var high = window.screen.availHeight;
	window.moveTo(0,0);
	window.resizeTo(wide, high);
	if ((wide<1000) || (high<700)) {
		sSize="sm";
		alert("Site has been optimized for 1024 * 768 or greater. If your operating system is capable, it is recommended you select these settings. If not, it looks like it's time to get that system upgrade you've been promising yourself for too long now ... ");
	} else {
		sSize="bg";
	}
}

/* Set Cookies */
function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	//((path == null) ? "" : ("; path=/" + path)) +
	"; path=/" +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}

/* Set Cookies via a Form */
function setC(form) {
	var expdate = new Date ();
	expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365 * 2)); // 2 years
	SetCookie (form.name, form.value, expdate);
}

/* Get Cookies */
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape (document.cookie.substring(offset, endstr));
}

/* Get Cookies */
function GetCookie(name) {
	var arg = name+"=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return '';
}

/* Load Cookies */
	function LoadCookies() {
	var loc = location.href.split("/");
	var x = navigator
	document.commentpage.email.value = GetCookie("email");
	document.commentpage.name.value = GetCookie("name");
	document.commentpage.web.value = GetCookie("web");
	document.commentpage.appCodeName.value = x.appCodeName;	
	document.commentpage.appMinorVersion.value = x.appMinorVersion;	
	document.commentpage.appName.value = x.appName;	
	document.commentpage.appVersion.value = x.appVersion;	
	document.commentpage.cookieEnabled.value = x.cookieEnabled;	
	document.commentpage.cpuClass.value = x.cpuClass;	
	document.commentpage.userAgent.value = x.userAgent;	
	document.commentpage.browserLanguage.value = x.browserLanguage;	
	document.commentpage.systemLanguage.value = x.systemLanguage;	
	document.commentpage.userLanguage.value = loc[loc.length-1];	
}


/* Date Display */
function date_mod() {
	var days = new Array(8);days[1] = "Sunday";days[2] = "Monday";days[3] = "Tuesday";days[4] = "Wednesday";days[5] = "Thursday";days[6] = "Friday";days[7] = "Saturday";
	var months = new Array(13);months[1] = "January";months[2] = "February";months[3] = "March";months[4] = "April";months[5] = "May";months[6] = "June";months[7] = "July";months[8] = "August";months[9] = "September";months[10] = "October";months[11] = "November";months[12] = "December";
	var dateObj = new Date(document.lastModified);
	var wday = days[dateObj.getDay() + 1];
	var lmonth = months[dateObj.getMonth() + 1];
	var time = document.lastModified.substring(22, (document.lastModified.length - 8));
	var date = dateObj.getDate();
	if (navigator.appName == 'Microsoft Internet Explorer') {
		var fyear = dateObj.getYear();
	} else {
		var fyear = dateObj.getYear() + 1900;
	}
	var size = Math.round((document.fileSize / 1024)*Math.pow(10,2))/Math.pow(10,2);
	var y = document.images;
	var imglength = 0;
	for (i=0;i<y.length;i++) {
		imglength += (y[i].fileSize)*1;
	}
	var images = Math.round((imglength / 1024)*Math.pow(10,2))/Math.pow(10,2);
	var average = Math.round((images / y.length)*Math.pow(10,2))/Math.pow(10,2);
	document.write('<span class="copyR">Name:</span><span class="copy"> ' + location.href + '</span><br />');	
	if (navigator.appName == 'Microsoft Internet Explorer') {
		document.write('<span class="copyR">Size:</span><span class="copy"> ' + size + ' kb</span><br />');
		document.write('<span class="copyR">' + y.length +'&nbsp;images:</span><span class="copy"> ' + images + ' kb (Avg: ' + average + ' kb)</span><br />');
	}		
	document.write('<span class="copyR">Local time:</span><span class="copy"> ' + wday + ', ' + lmonth + ' ' + date + ', ' + fyear + ' [' + time + ']</span><br />');
	document.write('<span class="copyR">Author:</span><span class="copy"> &copy; J. Richard Mortimer</span><br />');
}

/* Float the Menu */
function FloatMenu() {
  var startX = 10, startY = 15;
  var ns = (navigator.appName.indexOf("Netscape") != -1);
  var d = document;
  var px = document.layers ? "" : "px";
  function ml(id) {
    var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
    if(d.layers)el.style=el;
    el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};
    el.x = startX; el.y = startY;
    return el;
  }
  window.Floater=function() {
    var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
    var dY = (pY > startY) ? pY : startY;
    ftlObj.y += (dY - ftlObj.y)/8;
    ftlObj.sP(ftlObj.x, ftlObj.y);
    setTimeout("Floater()", 20);
  }
  ftlObj = ml("menu");
  Floater();
}
