<!-- 
/*
****************************************************************************************************************
*					General javascript routines used with permission
*	Author:		Adrian Jones, woodsgood.ca
*	Date:			April 2008
****************************************************************************************************************
*/

function printpage() {
	window.print();  
}

function doemail(name,service) {
	var em=""+name+"@"+service+""
	document.write('<a href="mailto:'+em+'">'+em+'</a>');
}

function getObject(name) {return (document.getElementById?document.getElementById(name):document.all?document.all[name]:document.layers?eval("document.layers[\"" + name + "\"]"):null);}

/*****************************************************************************************************************/
// "within-page" navigation; one <DIV> (of id "objid") is displayed while making previous DIV invisible.
var objDiv = null;										// old (or previous) DIV
function doShow(objid) {
	if (objDiv) objDiv.style.display="none";		// blank any DIV that is displayed
	objDiv=getObject(objid);							// get referenced object
	objDiv.style.display = "block";					// display it
}

var objDiv2 = null;										// old (or previous) DIV
function doShow2(objid2) {
	if (objDiv2) objDiv2.style.display="none";		// blank any DIV that is displayed
	objDiv2=getObject(objid2);							// get referenced object
	objDiv2.style.display = "block";					// display it
}

// fades colour (rgb) of object (o) to (enl) at speed (s)
function KW_fade(r,g,b,e,n,l,s,o){ for(i=0;i<s+1;i++) setTimeout("KW_s("+KW_c(r,e,s,i)+","+KW_c(g,n,s,i)+","+KW_c(b,l,s,i)+",'"+o+"');",i*s);}
function KW_s(r, g, b, el)	{ getObject(el).style.color="rgb("+r+","+g+","+b+")";}
function KW_c(a,b,s,i) 		{ return Math.floor(a+(b-a)*(i/s));}

// doCopy places the copyright on the page
function doCopy(full) {
	var msg='<div class="copy">';
	msg+='Copyright &copy; <a href="mailto:info@nevenhumphrey.com?subject=from Neven Humphrey\'s Website">Neven Humphrey</a> 2010';
	if (full) msg+= ':: web by <a target="_blank" href="http://woodsgood.ca/fwebdesign.htm">woodsgood.ca</a>';
	msg+='</div>';
	document.write(msg);
}

function doSecNav(option) {
	var msg='<div id="secNav">';
   msg+='<img src="images/back_icon.gif" title="Go back" onClick="javascript:history.go(-1);return false;" alt="Go back" border="0">&nbsp;&nbsp;';
//	msg+='<br>';
   msg+='<img src="images/print_icon.gif" title="Print this page" onClick="javascript:window.print();return false;" alt="Print" border="0">&nbsp;&nbsp;';
//	msg+='<br>';
	msg+='<a href="mailto:info@nevenhumphrey.com?subject=from Neven Humphrey\'s Website"><img src="images/email_icon.gif" title="email me" alt="Email me" border="0"></a>';
  	msg+='</div>';
	document.write(msg);
}  

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

//******************************************************************
//
//  Cookie Functions - "Night of the Living Cookie" Version (25-Jul-96)
//
//  Written by:  Bill Dortch, hIdaho Design <bdortch@hidaho.com>
//  The following functions are released to the public domain.
//
//******************************************************************

function doCookie(num) {
	var expdate = new Date (); 			// get current date //
	FixCookieDate (expdate);  				// Correct for Mac date bug - call only once for given Date object! //
	expdate.setTime (expdate.getTime() + (30 * 24 * 60 * 60 * 1000)); // im ms, 30 days from now //
	SetCookie("lang",num,expdate); 		// set the cookie
}

//
// "Internal" function to return the decoded value of a cookie
//
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
//
//  Function to correct for 2.x Mac date bug.  Call this function to
//  fix a date object prior to passing it to SetCookie.
//  IMPORTANT:  This function should only be called *once* for
//  any given date object!
//
function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
//
//  Function to return the value of the cookie specified by "name".
//    name - String object containing the cookie name.
//    returns - String object containing the cookie value, or null if
//      the cookie does not exist.
//
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 null;
}

//
//  Function to create or update a cookie.
//    name - String object containing the cookie name.
//    value - String object containing the cookie value.  May contain
//      any valid string characters.
//    [expires] - Date object containing the expiration data of the cookie.  If
//      omitted or null, expires the cookie at the end of the current session.
//    [path] - String object indicating the path for which the cookie is valid.
//      If omitted or null, uses the path of the calling document.
//    [domain] - String object indicating the domain for which the cookie is
//      valid. If omitted or null, uses the domain of the calling document.
//    [secure] - Boolean (true/false) value indicating whether cookie transmission
//      requires a secure channel (HTTPS).
//
//  To set a secure cookie for path "/myPath", that expires after the
//  current session, you might code:
//
//      SetCookie (myCookieVar, cookieValueVar, null, "/myPath", null, true);
//
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

//  Function to delete a cookie. (Sets expiration date to start of epoch)
//    name -   String object containing the cookie name
//    path -   String object containing the path of the cookie to delete.  This MUST
//             be the same as the path used to create the cookie, or null/omitted if
//             no path was specified when creating the cookie.
//    domain - String object containing the domain of the cookie to delete.  This MUST
//             be the same as the domain used to create the cookie, or null/omitted if
//             no domain was specified when creating the cookie.
//
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}


// ******************************* end of routines *************************** //
-->
