function StepBack( defaultUrl )
{
	// This uses referrer because a simple history.back() will not force a reload of the page
	
	if( document.referrer.indexOf( window.location.host ) != -1 )
	{
		window.location = document.referrer;
		return;
	}
	
	window.location = defaultUrl;
}

// Technique taken from SitePoint Article:
// http://www.sitepoint.com/article/rounded-corners-css-javascript
function roundedCorners() { 
 var divs = document.getElementsByTagName('div'); 
 var rounded_divs = []; 
 /* First locate all divs with 'rounded' in their class attribute */
 for (var i = 0; i < divs.length; i++) { 
   if (/\brounded\b/.exec(divs[i].className)) { 
     rounded_divs[rounded_divs.length] = divs[i]; 
   } 
 } 
 /* Now add additional divs to each of the divs we have found */ 
 for (var i = 0; i < rounded_divs.length; i++) { 
   var original = rounded_divs[i]; 
   /* Make it the inner div of the four */ 
   original.className = original.className.replace('rounded', ''); 
   /* Now create the outer-most div */ 
   var tr = document.createElement('div'); 
   tr.className = 'rounded2'; 
   /* Swap out the original (we'll put it back later) */ 
   original.parentNode.replaceChild(tr, original); 
   /* Create the two other inner nodes */ 
   var tl = document.createElement('div'); 
   var br = document.createElement('div'); 
   /* Now glue the nodes back in to the document */ 
   tr.appendChild(tl); 
   tl.appendChild(br); 
   br.appendChild(original); 
 } 
} 
/* Run the function once the page has loaded: */ 

window.onload = roundedCorners;

function ImagePopup() {

  // load the popup image into a temporary Image structure
  // once its finished loading, open the window with the correct Image dimensions
  // pulled from the Image structure

  var img=new Image;
  
  img.src=this.href;
  
  img.onload=function () {
    var win=window.open(img.src, "popup", "width="+(img.width+16)+",height="+(img.height+16))
		win.focus();
  };
}

/**************************************************************
	Urchin Tracking Module(UTM),
	$Revision: 1.4 $,
	Copyright 2002 Urchin Software Corporation-
***************************************************************/
var __utmf;

if (!__utmf) {
 var __utm1,__utm2,__utm3,__utmi,__utmn,__utmd,__utmu,__utmp,__utmr;
 __utm1 = document.cookie.indexOf("__utm1=");
 __utm2 = document.cookie.indexOf("__utm2=");
 __utm3 = document.cookie.indexOf("__utm3=");
 __utmn = Math.round(Math.random() * 4294967295);
 __utmd = new Date();
 __utmu = Math.round(__utmd.getTime()/1000);
 if ((__utm1 < 0) || (__utm2 < 0)) {
  document.cookie="__utm1="+__utmn+"."+__utmu+"; path=/; expires=Sun, 18 Jan 2038 00:00:00 GMT";
  document.cookie="__utm2="+__utmu+"; path=/; expires=Sun, 18 Jan 2038 00:00:00 GMT";
  document.cookie="__utm3="+__utmu+"; path=/;";
 } else if (__utm3 < 0) {
  document.cookie="__utm2="+__utmu+"; path=/; expires=Sun, 18 Jan 2038 00:00:00 GMT";
  document.cookie="__utm3="+__utmu+"; path=/;";
 }
 __utmr = document.referrer;
 if (!__utmr) {__utmr = "-";}
 else {
  __utmp = __utmr.indexOf(document.domain);
  if ((__utmp >= 0) && (__utmp <= 8)) __utmr = 0;
 }
 var __utmi = new Image(1,1);
 __utmi.src ="/images/__utm.gif?utmn="+__utmn+"&utmr="+__utmr;
 __utmf = 1;
}

var dialogueWindows = new Object();

onunload = closeAllDialogues;

/**
 * Open a dialogue window
 * 
 * Window will be placed in the centre of screen, and a reference is kept so all windows can be closed by calling closeAllDialogues()
 */
function openDialogue( windowName, windowUrl, windowWidth, windowHeight ) 
{	
	var dialogue = dialogueWindows[ windowName ];
	var windowTop = ( screen.height / 2 ) - ( windowHeight / 2 );
	var windowLeft = ( screen.width / 2 ) - ( windowWidth / 2 );
	var features = 'height=' + windowHeight + ',width=' + windowWidth + ',top=' + windowTop + ',left=' + windowLeft + ',scrollbars=no,resizable=yes,status=no';
	
	if( dialogue && ! dialogue.closed )
		dialogue.close();
	
	dialogueWindows[ windowName ] = window.open( windowUrl, windowName, features );
}

/**
 * Close all windows that were opened by openDialogue()
 */
function closeAllDialogues()
{
	for( windowName in dialogueWindows )
	{	
		var dialogue = dialogueWindows[ windowName ];
		
		if( dialogue && ! dialogue.closed )
			dialogue.close();
	}
}

function FixCookieDate(date)
{
var base = new Date(0);
var skew = base.getTime(); // Dawn of (Unix) time. Should be zero.
if (skew > 0) date.setTime (date.getTime() - skew); // Mac OS - Ahead of it's time.
}

function cookieExpire(zNumberOfDays)
{
var exp = new Date(); 
FixCookieDate(exp);
//exp.setTime(exp.getTime() + (zNumberOfDays*24*60*60*1000));
exp.setTime(exp.getTime() + (zNumberOfDays*60*1000));

return exp;
}

function getCookieVal(offset)
{
var endstr = document.cookie.indexOf (";", offset);

if (endstr == -1) endstr = document.cookie.length;

return unescape(document.cookie.substring(offset, endstr));
}

function cookieRead(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 cookieSet(name, value, expires, path, domain, secure)
{
document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}

function cookieDelete(name, path, domain)
{
if (cookieRead(name))
{
document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}