// clasma.js - Utility library
// Copyright (c) 2008, Clasma Events Inc.

// Define base object

var CLASMA={};

// Define version

CLASMA.vermag=1;
CLASMA.vermin=3;

CLASMA.build=13;

// getVersion
// Call to return version string

CLASMA.getVersion=function()
{
	// make version string
	var m=CLASMA.vermin<10?"0"+CLASMA.vermin:CLASMA.vermin;
	return "v"+CLASMA.vermag+"."+m+"."+CLASMA.build;
};

// Namespace functions

// namespace
// Call to create a namespace

CLASMA.namespace=function(ns)
{
	var o=CLASMA;

	// split namespace
	var s=ns.split(".");
	var n=(s[0]=="CLASMA")?1:0;

	while(n<s.length)
	{
		// add if not present
		if(!o[s[n]]) o[s[n]]={};
		o=o[s[n++]];
	}
    return o;
};

// Define path names

CLASMA.libPath="lib/";
CLASMA.cssPath="css/";
CLASMA.resPath="res/";

// Extend String object

// String trimming

String.prototype.ltrim=function() {return this.replace(/^\s+/g,"");};
String.prototype.rtrim=function() {return this.replace(/\s+$/g,"");};
String.prototype.trim=function() {return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"");};

String.prototype.trimsplit=function(c) {return this.trim().split(new RegExp("\\s*"+c+"\\s*"));};

// HTML tags

String.prototype.addBreaks=function() {return this.replace(/\r\n|\n|\r/g,"<br/>");};
String.prototype.removeBreaks=function() {return this.replace(/<br\/>/g,"\r\n");};

String.prototype.escapeTabs=function() {return this.replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");};

String.prototype.escapeHtml=function() {return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");};
String.prototype.unescapeHtml=function() {return this.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">");};

String.prototype.stripTags=function() {return this.replace(/<([^>]+)>/g,"");};

// String parsing

// parseUrl
// Call to split parts of url

String.prototype.parseUrl=function()
{
	// parse url?
	var m=this.match(/^((http|https|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+\.[^#?\s]+)(#[\w\-]+)?$/);
	return m?{url:RegExp['$&'],protocol:RegExp.$2,host:RegExp.$3,path:RegExp.$4,file:RegExp.$6,hash:RegExp.$7}:null;
};

// parseFile
// Call to split parts of file

String.prototype.parseFile=function()
{
	var d={path:"",file:"",ext:""};

	// find extension mark
	var n=this.lastIndexOf(".");

	if(n>=0) d.ext=this.substr(n+1);
	else n=this.length;

	// find file mark
	var nn=this.lastIndexOf("\\");

	if(nn<0)
	{
		nn=this.lastIndexOf("/");
		if(nn<0) nn=this.lastIndexOf(":");
	}

	nn++;

	// strip out file and path
	d.file=this.substr(nn,n-nn);
	d.path=this.substr(0,nn);

	return d;
};

// parseEmail
// Call to split parts of email address

String.prototype.parseEmail=function()
{
	// split email address
	var m=this.split("@");
	return (m && m.length==2)?{local:m[0],domain:m[1]}:null;
};

// validEmail
// Call to check for valid email address

String.prototype.validEmail=function()
{
	var len=this.length-1;

	// has at sign and not at start/end?
	var at=this.lastIndexOf("@");
	if(at<1 || at==len) return false;

	// has dot after at sign?
	var dot=this.lastIndexOf(".");
	if(dot<=at+1 || dot==len) return false;

	return true;
};

// Find and replace

// oneOf
// Return index of string in array

String.prototype.oneOf=function(ar)
{
	// run down string array
	for(var n=0;n<ar.length;n++)
		if(this.toLowerCase()==ar[n].toLowerCase()) return n;

	return -1;
};

// supplant
// Call to supplant fields in a string

String.prototype.supplant=function(o)
{
	var fn=function(a,b)
	{
		var r=o[b];
		return typeof r==="string" || typeof r==="number"?r:a;
	};
	return this.replace(/{([^{}]*)}/g,fn);
};

// toTitle
// Call to capitalize first letter

String.prototype.toTitle=function()
{
	// lower case and cap first
	function fn() {return arguments[0].toUpperCase();}
	return this.replace(/\b[a-z]/g,fn); //toLowerCase().replace
};

// toCaption
// Call to capitalize each major word

String.prototype.toCaption=function()
{
	// replace functions
	function fn1()
	{
		if(arguments[arguments.length-2]!=0)
		{
			// dont cap these
			var e=/^(a|after|an|and|at|by|for|from|in|into|of|on|onto|over|the|to|up|with|within)$/;
			if(e.test(arguments[0])) return arguments[0];
		}
		// cap first letter
		return arguments[0].replace(/^[a-z]/,fn2);
	}

	function fn2() {return arguments[0].toUpperCase();}

	// switch to lower
	return this.toLowerCase().replace(/\b\w+\b/g,fn1);
};

// Extend Date object

// strTime
// Call to convert date to time string

Date.prototype.strTime=function(secs)
{
	// get time
	var h=this.getHours();
	var m=this.getMinutes();

	// am or pm?
	var pm=(h>=12);
	var n=false;

	// adjust hours
	h%=12;

	if(h==0)
	{
		// add noon/midnight?
		if(m==0) n=true;
		h=12;
	}

	// add leading zero?
	if(m<10) m="0"+m;
	var ts=h+":"+m

	// seconds wanted?
	if(secs)
	{
		var s=this.getSeconds();

		// add leading zero?
		if(s<10) s="0"+s;
		ts+=":"+s
	}

	// add am/pm etc
	if(n) ts+=" "+(pm?"Noon":"Midnight");
	else ts+=" "+(pm?"pm":"am")

	return ts;
};

// Define namespace

CLASMA.namespace("CLASMA.lang");

// Define object

CLASMA.lang=function() {

// Private data

var number="0123456789";

var lower="abcdefghijklmnopqrstuvwxyz";
var upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

// Private functions

// isValid
// Return true if all chars in s are in v

var isValid=function(s,v)
{
	// string exists?
	if(s && s!="")
	{
		// run down string and check
		for(var n=0;n<s.length;n++)
			if(v.indexOf(s.charAt(n))==-1) return false;
	}
	return true;
};

// Private end

return {

// Public data

// Public functions

// Type checking

isUndefined:function(o) {return typeof o=="undefined";},
isNull:function(o) {return o===null;},

isBoolean:function(o) {return typeof o=="boolean";},
isString:function(o) {return typeof o=="string";},
isNumber:function(o) {return typeof o=="number" && isFinite(o);},
isObject:function(o) {return typeof o=="object";},
isFunction:function(o) {return typeof o=="function";},

// Character checking

isNum:function(s) {return isValid(s,number);},
isUpper:function(s) {return isValid(s,upper);},
isLower:function(s) {return isValid(s,lower);},
isAlpha:function(s) {return isValid(s,upper+lower);},
isAlphaNum:function(s) {return isValid(s,upper+lower+number);},

// Math functions

tween:function(t,b,c,d) {return b+((c-b)*(t/d));},
floorit:function(v,n) {v+=n; return v<0?0:v;}

// Public end

}; }();

// Define namespace

CLASMA.namespace("CLASMA.detect");

// Define object

CLASMA.detect=function() {

// Private data

// Private functions

// Private end

return {

// Public data

agent:"unknown",
platform:"unknown",

type:"unknown",

ie:false,
firefox:false,
safari:false,

ver:"unknown",

// Public functions

// setType
// Call to set browser type

setType:function(t,v)
{
	// set type and version
	this.type=t;
	this.ver=new Number(v);

	// set browser flags
	this.ie=false;
	this.firefox=false;
	this.safari=false;

	switch(t)
	{
		case "IE":
			this.ie=true;
			break;

		case "Firefox":
			this.firefox=true;
			break;

		case "Safari":
			this.safari=true;
			break;
	}
	return true;
},

// sniff
// Call to get version number

sniff:function()
{
	// get browser agent
	var a=navigator.userAgent;

	// set platform and agent
	this.platform=navigator.platform;
	this.agent=a;

	// detect explorer?
	if(/MSIE (\d+\.\d+);/i.test(a))
		return this.setType("IE",RegExp.$1);

	// detect firefox?
	if(/Firefox\/(\d+\.\d+)/i.test(a))
		return this.setType("Firefox",RegExp.$1);

	// detect safari?
	if(/Version\/(\d+\.\d+)\.\d+ Safari/i.test(a))
		return this.setType("Safari",RegExp.$1);

	// detect opera
/*	if(/Opera[\/\s](\d+\.\d+)/i.test(a))
		return this.setType("Opera",RegExp.$1);*/

	return false;
}

// Public end

}; }();

// sniff out browser
CLASMA.detect.sniff();

// Element functions

function $(id) {return document.getElementById(id);}
// dom.js - Dom library
// Copyright (c) 2008, Clasma Events Inc.

// Define namespace

CLASMA.namespace("CLASMA.dom");

// Define object

CLASMA.dom=function() {

// Private data

// Private functions

var getE=function(id) {return CLASMA.lang.isString(id)?$(id):id;};
var getS=function(id) {var e=getE(id); return e?e.style:null;};

// Private end

return {

// Public data

// Public functions

// Object fetching

getDocument:function() {return document;},

getHead:function(doc) {if(!doc) doc=document; return doc.getElementsByTagName("head")[0];},
getBody:function(doc) {if(!doc) doc=document; return doc.getElementsByTagName("body")[0];},

getObject:function(id) {return getE(id);},
getStyle:function(id) {return getS(id);},

// Element properties

setId:function(id,v) {var e=getE(id); if(e) e.id=v;},
getId:function(id) {var e=getE(id); return e?e.id:null;},

setClass:function(id,v) {var e=getE(id); if(e) e.className=v;},
getClass:function(id) {var e=getE(id); return e?e.className:null;},

setHtml:function(id,v) {var e=getE(id); if(e) e.innerHTML=v;},
getHtml:function(id) {var e=getE(id); return e?e.innerHTML:null;},

setSrc:function(id,v) {var e=getE(id); if(e) e.src=v;},
getSrc:function(id) {var e=getE(id); return e?e.src:null;},

// Control properties

setScroll:function(id,v) {var e=getE(id); if(e) e.scrollTop=v;},
getScroll:function(id) {var e=getE(id); return e?e.scrollTop:null;},

setValue:function(id,v) {var e=getE(id); if(e) e.value=v;},
getValue:function(id) {var e=getE(id); return e?e.value:null;},

setChecked:function(id,v) {var e=getE(id); if(e) e.checked=v;},
getChecked:function(id) {var e=getE(id); return e?e.checked:null;},

isChecked:function(id) {return this.getChecked(id);},

setDisabled:function(id,v) {var e=getE(id); if(e) e.disabled=v?"disabled":"";},
getDisabled:function(id) {var e=getE(id); return e?e.disabled:null;},

setAttr:function(id,n,v) {var e=getE(id); if(e) e.setAttribute(n,v);},
getAttr:function(id,n) {var e=getE(id); return e?e.getAttribute(n):null;},

// Style properties

setTop:function(id,v) {var s=getS(id); if(s) s.top=v+"px";},
getTop:function(id) {var s=getS(id); return s?s.top:null;},

setLeft:function(id,v) {var s=getS(id); if(s) s.left=v+"px";},
getLeft:function(id) {var s=getS(id); return s?s.left:null;},

setWidth:function(id,v) {var s=getS(id); if(s) s.width=v+"px";},
getWidth:function(id) {var s=getS(id); return s?s.width:null;},

setHeight:function(id,v) {var s=getS(id); if(s) s.height=v+"px";},
getHeight:function(id) {var s=getS(id); return s?s.height:null;},

setFrame:function(id,v,w) {var s=getS(id); if(s) s.backgroundPosition=(-(v*w))+"px";},
getFrame:function(id) {var s=getS(id); return s?s.backgroundPosition:null;},

setDisplay:function(id,v) {var s=getS(id); if(s) s.display=v;},
getDisplay:function(id) {var s=getS(id); return s?s.display:null;},

setShow:function(id,v) {var s=getS(id); if(s) s.display=v?"block":"none";},
getShow:function(id) {var s=getS(id); return s?s.display:null;},

isVisible:function(id) {var s=getS(id); return s && s.display!="none";},

// createElement
// Call to create an element

createElement:function()
{
	var a=arguments;
	var n=0;

	// use optional doc?
	var doc=CLASMA.lang.isString(a[n])?document:a[n++];
	var e=doc.createElement(a[n++]);

	if(e)
	{
		// add attributes
		while(n<a.length)
		{
			o=a[n++].trimsplit("=");
			if(o.length==2) e.setAttribute(o[0],o[1]);
		}
	}
	return e;
},

// getElements
// Call to get element array

getElements:function(tag,from,cls)
{
	// defaults
	if(!tag) tag="*";

	if(from) from=getE(from);
	else from=document;

	if(from)
	{
		// get elements
		var scan=(tag=="*" && from.all)?from.all:from.getElementsByTagName(tag);

		if(cls)
		{
			// search for class name
			var elms=new Array();
			var rexp=new RegExp("(^|\\s)"+cls+"(\\s|$)");

			var e;

			for(var n=0;n<scan.length;n++)
			{
				e=scan[n];

				if(rexp.test(e.className))
					elms.push(e);
			}
			return elms;
		}
		return scan;
	}
	return new Array();
},

// getElementById
// Call for better version of document get

getElementById:function(from,id)
{
	// use orig
	if(!from || from==document)
		return document.getElementById(id);

	// get from address
	from=getE(from);

	if(from)
	{
		// get elements
		var scan=from.all?from.all:from.getElementsByTagName("*");

		if(scan)
		{
			var e;

			// try to find in list
			for(var n=0;n<scan.length;n++)
			{
				e=scan[n];
				if(e.id==id) return(e);
			}
		}
	}
	return null;
},

// enableFormElements
// Call to enable all form elements

enableFormElements:function(form,enable,exempt)
{
	// default params
	if(typeof enable=="undefined") enable=true;
	if(typeof exempt=="undefined") exempt=null;

	// get form object
	form=getE(form);

	if(form)
	{
		// enable all controls
		for(var n=0;n<form.elements.length;n++)
		{
			var e=form.elements[n];
			if(e) e.disabled=!enable;
		}

		if(exempt)
		{
			// disable exempt controls
			var ex=exempt.split(",")

			for(n=0;n<ex.length;n++)
				$(ex[n]).disabled=enable;
		}
	}
},

// evalScripts
// Call to evaluate scripts in element

evalScripts:function(id)
{
	// get element object
	var e=getE(id);

	if(e)
	{
		// get script tags
		var t=e.getElementsByTagName("script");

		for(var n=0;n<t.length;n++)
		{
			var s=t[n];

			var src=s.src;
			var ev;

			// external or inline?
			if(src && src!="") ev=this.loadScript(src);
			else ev=this.evalScript(s.text);

			// had an error?
			if(ev) return ev;

			// remove the tag
			s.parentNode.removeChild(s);
		}
	}
	return null;
},

// evalScript
// Call to evaluate script in global scope

evalScript:function(t)
{
	// get head tag
	var	h=this.getHead();

	// create script tag
	var e=document.createElement("script");

	e.type="text/javascript";
	e.text=t;

	// add script tag to head (eval too)
	var ev=null;

	try {h.appendChild(e);}
	catch(err) {ev=err.description;}

	// remove unwanted script tag?
	if(!CLASMA.detect.ie) h.removeChild(e);

	return ev;
},

// loadScript
// Call to load external script

loadScript:function(src)
{
	// create script tag
	var e=document.createElement("script");

	e.type="text/javascript";
	e.src=src;

	// add script tag to head
	var ev=null;

	try {this.getHead().appendChild(e);}
	catch(err) {ev=err.description;}

	return ev;
},

// getBoundingBox
// Call to get element bounding box

getBoundingBox:function(id)
{
	// get element object
	var e=getE(id);

	if(e)
	{
		var box={top:0,left:0,bottom:0,right:0,width:0,height:0};

		// IE
		if(e.getBoundingClientRect)
		{
			var br=e.getBoundingClientRect();

			box.top=br.top;
			box.left=br.left;
			box.bottom=br.bottom;
			box.right=br.right;
			box.width=br.right-br.left;
			box.height=br.bottom-br.top;

			return box;
		}

		// Firefox, etc
		if(document.getBoxObjectFor)
		{
			var bo=document.getBoxObjectFor(e);

			box.top=bo.y;
			box.left=bo.x;
			box.bottom=bo.y+bo.height;
			box.right=bo.x+bo.width;
			box.width=bo.width;
			box.height=bo.height;

			return box;
		}

		// Safari
		box.width=e.offsetWidth;
		box.height=e.offsetHeight;

		while(e)
		{
			box.left+=e.offsetLeft;
			box.top+=e.offsetTop;

			e=e.offsetParent;
		}

		box.right=box.left+box.width;
		box.bottom=box.top+box.height;

		return box;
	}
	return null;
},

// ptInBoundingBox
// Return true if point in bounding box

ptInBoundingBox:function(id,pt)
{
	// get bounding box
	var b=this.getBoundingBox(id);

	// point within it?
	return pt.top>=b.top && pt.top<b.bottom &&
		pt.left>=b.left && pt.left<b.right;
},

// isChild
// Return true if e is a child of p

isChild:function(p,e)
{
	// run up through parents
	while(e)
	{
		// parent matches?
		if(e==p) return true;
		e=e.parentNode;
	}
	return false;
},

// addEvent
// Call to add event handler

addEvent:function(id,name,fn,capture)
{
	// get element object
	var e=getE(id);

	if(e)
	{
		// set default params
		if(typeof capture=="undefined") capture=false;

		// event listener method?
		if(e.addEventListener) e.addEventListener(name,fn,capture);
		else
		{
			// attach event method?
			if(e.attachEvent) e.attachEvent("on"+name,fn);
			else e["on"+name]=fn;
		}
	}
},

// removeEvent
// Call to remove event handler

removeEvent:function(id,name,fn,capture)
{
	// get element object
	var e=getE(id);

	if(e)
	{
		// set default params
		if(typeof capture=="undefined") capture=false;

		// event listener method?
		if(e.removeEventListener) e.removeEventListener(name,fn,capture);
		else
		{
			// detach event method?
			if(e.detachEvent) e.detachEvent("on"+name,fn);
			else e["on"+name]=null;
		}
	}
},

// Dom load event

// setOnDomLoaded
// Call to trigger dom load event

setOnDomLoaded:function()
{
	// firefox?
	if(document.addEventListener)
	{
		// add event listener
		document.addEventListener("DOMContentLoaded",this.ondomloaded,false);
		return;
	}

	// safari?
	if(CLASMA.detect.safari)
	{
		// setup timer
		var timer=setInterval(function()
		{
			// document ready?
			var s=document.readyState;

			if(s=="loaded" || s=="complete")
			{
				// reset timer/fire event
				clearInterval(timer);
				CLASMA.dom.ondomloaded();
			}
		}
		,10);

		return;
	}
	
	// IE?
	if(CLASMA.detect.ie)
	{
		// write script tag
		document.write("<script id=\"__ie_load\" defer=\"defer\" src=\"javascript:void(0)\"></script>");
		var e=$("__ie_load");

		// setup state change event
		e.onreadystatechange=function()
		{
			// state ready?
			if(e.readyState=="complete")
			{
				// remove script tag
				e.onreadystatechange=null;
				e.removeNode(true);

				// call loader
				CLASMA.dom.ondomloaded();
			}
		}
		return;
	}

	// others
	window.onload=this.ondomloaded;
},

// ondomloaded
// Called when dom is loaded

ondomloaded:function()
{
	// already been called?
	if(!arguments.callee.done)
	{
		// no, flag it and start
		arguments.callee.done=true;

		var fn=window.ondomload;
		if(fn) fn();
	}
},

// addDomLoadEvent
// Call to add listener for dom load

addDomLoadEvent:function(fn)
{
	// remember old
	var pfn=window.ondomload;

	window.ondomload=function()
	{
		// call old and new
		if(pfn) pfn();
		fn();
	}
},

// addLoadEvent
// Call to add listener for load

addLoadEvent:function(fn)
{
	// remember old
	var pfn=window.onload;

	window.onload=function()
	{
		// call old and new
		if(pfn) pfn();
		fn();
	}
}

// Public end

}; }();

// Call dom loader

CLASMA.dom.setOnDomLoaded();
// framework.js - Framework library
// Copyright (c) 2008, Clasma Events Inc.

// Define namespace

CLASMA.namespace("CLASMA.framework");

// Define object

CLASMA.framework=function() {

// Class helpers

var cdd=CLASMA.detect;
var cd=CLASMA.dom;

// Private data

var hint="";

// Private functions

// isExemptTag
// Call to check for exempt tags

var isExemptTag=function(e)
{
	// get tag name
	var n=e.tagName.toLowerCase();

	// select under safari exempt
	if(n=="select" && cdd.safari)
		return true;

	// text areas are exempt
	if(n=="textarea")
		return true;

	// input fields
	if(n=="input")
	{
		// of this type are exempt
		var t=e.getAttribute("type");

		if(t=="text" || t=="password")
			return true;
	}
	return false;
};

// Private end

return {

// Public data

// Keyboard codes

K_BREAK:3,
K_BS:8,
K_TAB:9,
K_RETURN:13,
K_SHIFT:16,
K_CTRL:17,
K_ALT:18,
K_PAUSE:19,
K_CAPSLOCK:20,
K_ESCAPE:27,
K_SPACE:32,
K_PREV:33,
K_NEXT:34,
K_END:35,
K_HOME:36,
K_LEFT:37,
K_UP:38,
K_RIGHT:39,
K_DOWN:40,
K_PRINT:44,
K_INSERT:45,
K_DELETE:46,
K_F1:112,
K_F2:113,
K_F3:114,
K_F4:115,
K_F5:116,
K_F6:117,
K_F7:118,
K_F8:119,
K_F9:120,
K_F10:121,
K_F11:122,
K_F12:123,
K_NUMLOCK:145,
K_SCROLL:145,

// Help functions

// help
// Call to open help window

help:function(chapter)
{
	// set help file
	var url="/pv/help/default.asp";
	var args="";

	// add chapter
	if(chapter && chapter!=0)
		args+="c="+chapter;

	if(args!="") url+="?"+args;

	// set window args
	var s="";

	s+="width=680,";
	s+="height=500,";
	s+="toolbar=no,";
	s+="menubar=no,";
	s+="scrollbars=no,";
	s+="status=no,";
	s+="resizable=yes,";
	s+="location=no,";
	s+="directories=no";

	// open window
	window.open(url,"CLASMA_help",s).focus();

	return false;
},

// Element functions

// setFocus
// Call to set focus on an element

setFocus:function(id)
{
	// set new focus
	var e=cd.getObject(id);
	if(e) e.focus();
},

// selectRange
// Call to set selection range

selectRange:function(id,start,end)
{
	// resolve object
	var e=cd.getObject(id);
	if(!e) return;

	// has selection range?
	if(e.setSelectionRange)
	{
		// set focus and select
		e.focus();
		e.setSelectionRange(start,end);

		return;
	}

	// has text range?
	if(e.createTextRange)
	{
		// create range
		var range=e.createTextRange();

		// select range
		range.collapse(true);

		range.moveEnd("character",end);
		range.moveStart("character",start);

		range.select();
	}
},

// selectReplace
// Call to replace selection

selectReplace:function(id,s)
{
	// resolve object
	var e=cd.getObject(id);
	if(!e) return;

	// has selection range?
	if(e.setSelectionRange)
	{
		// get selection
		var start=e.selectionStart;
		var end=e.selectionEnd;

		// add to value
		e.value=e.value.substring(0,start)+s+e.value.substring(end);

		// select new position
		if(start!=end) this.selectRange(e,start,start+s.length);
		else this.selectRange(e,start+s.length,start+s.length);

		return;
	}

	// has text range?
	if(document.selection)
	{
		// get selection
		var range=document.selection.createRange();

		if(range.parentElement()==e)
		{
			// add to value
			var collapse=(range.text=="");
			range.text=s;

			if(!collapse)
			{
				// select new position
				range.moveStart("character",-s.length);
				range.select();
			}
		}
	}
},

// Effect functions

// gradient
// Call to put gradient behind element

gradient:function(id,start,end,type)
{
	// resolve object
	var e=id?cd.getObject(id):cd.getBody();

	// use clasma colours?
	if(typeof start=="undefined") start="black";
	if(typeof end=="undefined") end="white";
	if(typeof type=="undefined") type="0";

	// only for explorer
	if(cdd.ie)
	{
		// put filter on element
		var a="startColorstr='"+start+"',endColorstr='"+end+"',gradientType='"+type+"'";
		e.style.filter="progid:DXImageTransform.Microsoft.Gradient("+a+")";
	}
},

// opacity
// Call to set element opacity

opacity:function(id,level)
{
	// resolve object
	var e=cd.getObject(id);

	// set default
	if(typeof level=="undefined") level=0.25;

	if(cdd.ie)
	{
		// put filter on element
		var a="Opacity='"+(level*100)+"',Style='0'";
		e.style.filter="progid:DXImageTransform.Microsoft.Alpha("+a+")";
	}
	else e.style.opacity=level;
},

// shadow
// Call to put shadow under element

shadow:function(id)
{
	// only for explorer
	if(cdd.ie)
	{
		// resolve object
		var e=id?cd.getObject(id):cd.getBody();

		// put filter on element
		var a="Color='#303030',Strength=3,Direction=135";
		e.style.filter="progid:DXImageTransform.Microsoft.Shadow("+a+")";
	}
},

// fade
// Call to fade element in or out

fade:function(id,from,to,duration)
{
	// get defaults
	if(typeof from=="undefined") from=1;
	if(typeof to=="undefined") to=0;
	if(typeof duration=="undefined") duration=250;

	// set initial timeout
	CLASMA.framework.onfadetimer(id,from,to,duration,0);
},

// Fade helpers

fadeIn:function(e) {CLASMA.framework.fade(e,0,1);},
fadeOut:function(e) {CLASMA.framework.fade(e);},

// Event functions

// getTarget
// Call to get target of event

getTarget:function(e)
{
	if(!e) e=event;
	return e.target?e.target:e.srcElement;
},

// getCoords
// Call to get event coordinates

getCoords:function(e)
{
	if(!e) e=event;
	return {left:e.clientX,top:e.clientY};
},

// getButtons
// Call to get button states

getButtons:function(e)
{
	if(!e) e=event;
	return e.button;
},

// getShift
// Call to get shift key state

getShift:function(e)
{
	if(!e) e=event;
	return e.shiftKey==1;
},

// getKey
// Call to get key of event

getKey:function(e)
{
	if(!e) e=event;
	return e.keyCode?e.keyCode:e.which;
},

// cancelBubble
// Call to cancel event bubble

cancelBubble:function(e)
{
	if(!e) e=event;

	if(e.stopPropagation) e.stopPropagation();
	if(cdd.ie) e.cancelBubble=true;
},

// cancelDefault
// Call to cancel default event action

cancelDefault:function(e)
{
	if(!e) e=event;

	if(e.preventDefault) e.preventDefault();
	if(cdd.ie) e.returnValue=false;
},

// Screen dimentions

getScreenWidth:function() {return screen.width;},
getScreenHeight:function() {return screen.height;},

// Client dimentions

getClientWidth:function() {return document.documentElement.clientWidth;},
getClientHeight:function() {return document.documentElement.clientHeight;},

// Scroll functions

// getScrollPos
// Return scrollbar positions

getScrollPos:function()
{
	var sp={top:0,left:0};

	// ie and firefox
	if(document.body && document.body.scrollTop)
	{
		sp.top=document.body.scrollTop;
		sp.left=document.body.scrollLeft;

		return sp;
	}

	// explorer 6
	if(document.documentElement && document.documentElement.scrollTop)
	{
		sp.top=document.documentElement.scrollTop;
		sp.left=document.documentElement.scrollLeft;

		return sp;
	}

	// netscape
	if(window.pageXOffset)
	{
		sp.top=window.pageYOffset;
		sp.left=window.pageXOffset;
	}
	return sp; 
},

// Cursor functions

// setCursor
// Call to set body cursor

setCursor:function(c)
{
	if(typeof c=="undefined" || !c) c="default";
	CLASMA.dom.getBody().style.cursor=c;
},

// Browser disable functions

// disableBrowser
// Call to disable unwanted functions

disableBrowser:function()
{
	// override context menu
	cd.addEvent(document,"contextmenu",CLASMA.framework.oncheckexempt);

	// override selection
	if(cdd.ie) cd.addEvent(document,"selectstart",CLASMA.framework.oncheckexempt);
	else
	{
		cd.addEvent(document,"mousedown",CLASMA.framework.onmousedown);
		cd.addEvent(document,"mouseup",CLASMA.framework.onmouseup);

		cd.addEvent(document,"dblclick",CLASMA.framework.ondblclick);
	}
},

// Framework events

// oncheckexempt
// Called to check exempt state

oncheckexempt:function(e)
{
	// get target and check tag
	var t=CLASMA.framework.getTarget(e);

	if(isExemptTag(t))
		return true;

	// remove anoying selection
	if(cdd.safari && window.getSelection)
	{
		var s=window.getSelection();
		if(s && s.removeAllRanges) s.removeAllRanges();
	}

	// cancel default action
	CLASMA.framework.cancelBubble(e);
	CLASMA.framework.cancelDefault(e);

	return false;
},

// onmousedown
// Called when mouse pressed

onmousedown:function(e)
{
	// firefox method?
	if(!cdd.ie)
	{
		// diable select if not exempt
		if(!CLASMA.framework.oncheckexempt(e))
			CLASMA.dom.getBody().style.MozUserSelect="none";

		return true;
	}
	return false;
},

// onmouseup
// Called when mouse released

onmouseup:function(e)
{
	// re-enable select
	if(!cdd.ie)
		CLASMA.dom.getBody().style.MozUserSelect="";

	return true;
},

// ondblclick
// Called when mouse double clicked

ondblclick:function(e)
{
	// element is exempt?
	if(!CLASMA.framework.oncheckexempt(e))
	{
		// remove document selection
		if(document.selection && document.selection.empty)
			document.selection.empty();

		// remove window selection
		if(window.getSelection)
		{
			var sel=window.getSelection();

			if(sel && sel.removeAllRanges)
				sel.removeAllRanges();
		}
	}
	return true;
},

// onenable
// Called to return true

onenable:function()
{
	// always return true
	return true;
},

// ondisable
// Called to return false

ondisable:function()
{
	// always return false
	return false;
},

// onfadetimer
// Called to process fade

onfadetimer:function(id,from,to,duration,time,callback)
{
	// resolve object
	var e=cd.getObject(id);

	// set opacity level
	var level=CLASMA.lang.tween(time,from,to,duration);
	CLASMA.framework.opacity(e,level);

	// show initial?
	if(time==0 && from==0)
		cd.setShow(e,true);

	// got there yet?
	if(time>=duration)
	{
		// hide after?
		if(to==0) cd.setShow(e,false);
		if(callback) callback();

		return;
	}

	// setup timer for next
	setTimeout(function(){CLASMA.framework.onfadetimer(id,from,to,duration,time+50);},50);
},

// onhintfocus
// Called when hint gets focus

onhintfocus:function(e)
{
	// reset value
	hint=e.value;
	e.value="";
},

// onhintblur
// Called when hint loses focus

onhintblur:function(e)
{
	// set value
	e.value=hint;
},

// ontextlimit
// Call to limit text input on key up

ontextlimit:function(e,m)
{
	// get text
	var v=cd.getValue(e);

	// more than one character?
	if(v.length>m+1)
		alert("Your input exceeds the maximum of "+m+" characters and will be truncated.");

	// chop it off
	if(v.length>m)
		cd.setValue(e,v.substring(0,m));
},

// ontextedit
// Call to handle textarea keys

ontextedit:function(id,e)
{
	// what key pressed?
	switch(this.getKey(e))
	{
		case this.K_TAB:
			// force tab insert
			this.selectReplace(id,String.fromCharCode(9));
			setTimeout("document.getElementById('"+id.id+"').focus();",0);

			return false;
	}
	return true;
},

// onprint
// Call to print an element

onprint:function(id)
{
	// resolve object
	var e=cd.getObject(id);

	if(e)
	{
		// set print id
		id="PRINT_output";

		// exists already?
		var d=$(id);

		if(d)
		{
			// destroy old
			d=d.parentNode;
			d.parentNode.removeChild(d);
		}

		// print styles
		var style="overflow:auto;background-color:white;margin:0px;padding:0px";

		var framestyle="style=\"position:absolute;top:-100px;left:-100px;width:0px;height:0px;\"";
		var htmlstyle="style=\"overflow:auto;height:auto\"";
		var bodystyle="style=\""+style+";height:auto\"";
		var divstyle="style=\"display:block;border:none;"+style+"\"";

		// create print frame
		d=document.createElement("div");
		d.innerHTML="<iframe id=\""+id+"\" name=\""+id+"\" "+framestyle+"></iframe>";

		// add to body
		document.body.appendChild(d);

		// get frame document
		var f=document.getElementById(id);
		var doc=null;

		if(f.contentDocument) doc=f.contentDocument;
		else
		{
			if(f.contentWindow) doc=f.contentWindow.document;
			else doc=window.frames[id].document;
		}

		// begin document
		doc.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" ");
		doc.write("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");

		doc.write("<html xmlns=\"http://www.w3.org/1999/xhtml\" "+htmlstyle+">");
		doc.write("<head>");

		// copy stylesheets
		var l=document.getElementsByTagName("link");

		for(var n=0;n<l.length;n++)
		{
			if(l[n].rel.toLowerCase()=="stylesheet")
				doc.write("<link type=\"text/css\" rel=\"stylesheet\" href=\""+l[n].href+"\"/>");
		}

		doc.write("<title>PointView</title>");
		doc.write("</head>");

		// start page body
		doc.write("<body onload=\"this.focus(); this.print();\" "+bodystyle+">");

		// add parent divs and content
		var h=e.innerHTML;

		while(e)
		{
			var c=e.className;
			if(c && c!="") h="<div class=\""+c+"\" "+divstyle+">"+h+"</div>";

			e=e.parentNode;
		}

		// write print content
		doc.write(h);

		// close frame
		doc.write("</body>");
		doc.write("</html>");

		doc.close();

		// make sure focus set for ie
		setTimeout("PRINT_output.focus()",5000);
	}
},

// onprintframe
// Call to print an iframe

onprintframe:function(id)
{
	id.focus(); 
	id.print();
}

// Public end

}; }();
// history.js - History tracker
// Copyright (c) 2008, Clasma Events Inc.

// Define namespace

CLASMA.namespace("CLASMA.history");

// Define object

CLASMA.history=function() {

// Class helpers

var cdd=CLASMA.detect;

// Private data

var histId="historyFrame";
var histUrl="history.htm";

var histTitle;
var histBase;
var histTimer=200;
var histHash=null;
var histChange=null;

var histUseNotify;
var histUseFrame;
var histUseUrl;
var histUseTimer;
var histUseTimerAdd;

// Private functions

// getHash
// Call to get current hash

var getHash=function()
{
	// get current hash
	var hash=window.location.hash;
	return hash?stripHash(hash):"";
};

// setHash
// Call to set current hash

var setHash=function(hash)
{
	// dont set if blank
	if(!cdd.ie || hash!="" || stripHash(window.location.hash)!="")
		window.location.hash=hash;
};

// stripHash
// Call to remove hash symbol

var stripHash=function(hash)
{
	// hash at start? strip it
	if(hash && hash.indexOf("#")==0)
		return hash.substring(1);

	return hash;
};

// writeFrame
// Call to write to tracker frame

var writeFrame=function(s)
{
	// get frame document
	var d=$(histId).contentWindow.document;

	// write to frame
	d.open("javascript:\"<html></html>\"");
	d.write(s);
	d.close();
};

// triggerChange
// Call to trigger change callback

var triggerChange=function(hash)
{
	// set current title
	document.title=histTitle;

	// set frame title?
	if(histUseFrame)
		$(histId).contentWindow.document.title=histTitle;

	// issue callback
	if(histChange) histChange(hash);
};

// Private end

return {

// Public data

// Public functions

// create
// Call to initialise history tracker

create:function(title,fnChange)
{
	// set history params
	histTitle=title?title:document.title;
	histChange=fnChange;

	// get initial base hash
	histBase=getHash();

	// set mechanics flags
	histUseNotify=(cdd.ie && cdd.ver>=8);
	histUseFrame=cdd.ie;
	histUseUrl=false; //true;
	histUseTimer=true; //(cdd.ie || cdd.firefox || cdd.safari);
	histUseTimerAdd=cdd.ie;

	// using notifications?
	if(histUseNotify)
	{
		// setup hash change event
		window.onhashchange=CLASMA.history.onhashchange;

		// then diable these
		histUseFrame=false;
		histUseTimer=false;

		// kick initial change
		CLASMA.history.onhashchange();
	}

	// using frame?
	if(histUseFrame)
	{
		// using external source?
		var s=(histUseUrl?" src=\""+histUrl+"\"":"");

		// create frame object
		document.write(
			"<iframe id=\""+histId+"\""+s+" frameborder=\"0\" style=\"display:none\">"+
			"</iframe>");
	}

	// using timer?
	if(histUseTimer)
	{
		// setup timer event
		setTimeout(CLASMA.history.ontimer,histTimer);
	}

	// output some debug
	/*out("histUseUrl="+(histUseUrl?"true":"false"));
	out("histUseFrame="+(histUseFrame?"true":"false"));
	out("histUseTimerAdd="+(histUseTimerAdd?"true":"false"));
	out("histUseTimer="+(histUseTimer?"true":"false"));
	out("histUseNotify="+(histUseNotify?"true":"false"));
	out("");
	out("histTimer="+histTimer+"ms");
	out("histTitle=\""+histTitle+"\"");
	out("histBase=\""+histBase+"\"");
	out("");
	out("window.location.hash=\""+window.location.hash+"\"");
	out("window.location.href=\""+window.location.href+"\"");
	out("");
	out("CLASMA.history.create");
	out("----------------------------------------");*/
},

// getBaseHash
// Call to get base hash

getBaseHash:function()
{
	// return base hash
	return histBase;
},

// add
// Call to add hash to history

add:function(hash)
{
	// set hash
	setHash(hash);

	// using frame?
	if(histUseFrame)
	{
		// write content
		writeFrame(
			"<html>"+
			"<head>"+
			"<script type=\"text/javascript\">"+
			"parent.CLASMA.history.onframechange('"+hash+"');"+
			"</script>"+
			"</head>"+
			"<body></body>"+
			"</html>");
	}
},

// Event handlers

// onhashchange
// Called when hash changes

onhashchange:function()
{
	// output some debug
	//out("onhashchange");

	// get current hash and change
	var hash=getHash();
	triggerChange(hash);
},

// onframeload
// Called when frame loads

onframeload:function()
{
	// output some debug
	//out("onframeload");

	// get base hash and change
	var hash=CLASMA.history.getBaseHash();
	CLASMA.history.onframechange(hash);
},

// onframechange
// Called when frame changes

onframechange:function(hash)
{
	// output some debug
	//out("onframechange");

	// hash changed
	histHash=hash;

	// set hash
	hash=stripHash(hash);
	setHash(hash);

	// trigger callback
	triggerChange(hash);
},

// ontimer
// Called when timer fires

ontimer:function()
{
	// get current hash
	var hash=getHash();

	// hash changed?
	if(hash!=histHash)
	{
		// output some debug
		//out("ontimer: url change (hash=\""+hash+"\", histHash=\""+histHash+"\")");

/*		if(cdd.ie && document.getElementById(hash))
		{
			alert("Exception: History locations cannot have the same value as _any_ IDs that might be in the document, "+
				"due to a bug in IE; please ask the developer to choose a history location that does not match any HTML "+
				"IDs in this document. The following ID is already taken and cannot be a location: "+hash);
		} */

		// remember old
		histHash=hash;

		// add or just trigger?
		if(histUseTimerAdd) CLASMA.history.add(hash);
		else triggerChange(hash);
	}

	// chain timer
	setTimeout(CLASMA.history.ontimer,histTimer);
}

// Public end

}; }();
// ajax.js - Ajax service library
// Copyright (c) 2008, Clasma Events Inc.

// Define namespace

CLASMA.namespace("CLASMA.ajax");

// Define object

CLASMA.ajax=function() {

// Class helpers

var cdd=CLASMA.detect;

// Ajax message

var msg="<table cellspacing='0' cellpadding='0'><tr><td><img src='{img}' width='16' height='16' style='margin-right:4px'/></td><td style='white-space:nowrap'>{msg}</td></tr></table>";

// Session timeout

var timeout=0;
var timeoutUrl=0;

var timerId=null;

// Private functions

// createRequest
// Call to create XML Http object

var createRequest=function()
{
	var r;

	// create native object?
	try {r=new XMLHttpRequest();}
	catch(e)
	{
		// create for IE6 and above?
		try {r=new ActiveXObject("Microsoft.XMLHTTP");}
		catch(e)
		{
			if(cdd.ie) return null;
		    throw new Error('Ajax not supported.');
		}
	}
	return r;
};

// setMsg
// Call to display message

var setMsg=function(id,o)
{
	// set message response
	o.img="http://clasma.net/common/res/"+o.img;
	CLASMA.ajax.setResponse(id,msg.supplant(o));
};

// Private end

return {

// Public data

// Request methods

GET:"GET",
POST:"POST",
HEAD:"HEAD",

// Ready states

RS_UNINITIALIZED:0,
RS_LOADING:1,
RS_LOADED:2,
RS_INTERACTIVE:3,
RS_COMPLETED:4,

// Status codes

S_OFFLINE:0,
S_OK:200,
S_NOTFROUND:404,

// Security

user:null,
password:null,

// Frames fetch

frames:new Array,
framescb:new Array,

// Public functions

// Helper functions

isReady:function(r) {return r.readyState==this.RS_COMPLETED;},
isValid:function(r) {return r.status==this.S_OK;},

setWait:function(id) {setMsg(id,{img:"wait.gif",msg:"Requesting content..."});},
setError:function(id,err) {setMsg(id,{img:"error.gif",msg:err});},

// request
// Call to send request to server

request:function(url,method,args,callback,async)
{
	// ready params
	if(typeof method=="undefined" || !method) method=this.GET;
	if(typeof args=="undefined" || !args) args="";
	if(typeof async=="undefined") async=true;

	// create request object?
	var r=createRequest();

	if(r)
	{
		if(callback)
		{
			// set response handler
			r.onreadystatechange=function()
			{
				// request is ready?
				if(CLASMA.ajax.isReady(r))
				{
					// reset timeout and call callback
					CLASMA.ajax.resetSessionTimeout();
					callback(r);

				/*	r.onreadystatechange=null;
					r=null; */
				}
			}
		}
		// open request
		r.open(method,url,async,this.user,this.password);

		// set post header?
		if(method==this.POST)
			r.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		/* r.setRequestHeader("If-Modified-Since","Wed, 15 Nov 1995 00:00:00 GMT");*/

		// send request to server
		r.send(args);

		return r;
	}
	// try using frame
	return CLASMA.ajax.requestFrame(url,args,callback);
},

// include
// Call to request url and insert into tag

include:function(url,id,args,callback)
{
	// setup callback
	var cb=function(r)
	{
		// request status ok?
		if(CLASMA.ajax.isValid(r)) CLASMA.ajax.setResponse(id,r.responseText);
		else CLASMA.ajax.setError(id,"Ajax: #"+r.status+" "+r.statusText);

		// execute callback
		if(callback) callback(r);
	}

	// post request?
	try {this.request(url,this.POST,args,cb);}
	catch(e) {this.setError(id,e.message);}
},

// requestFrame
// Call to send request via frame

requestFrame:function(url,args,callback)
{
	// find free frame?
	for(var f=0;f<CLASMA.ajax.frames.length;f++)
		if(!CLASMA.ajax.frames[f]) break;

	// add args to url?
	if(args) url=url+"?"+args;

	// add frame element
	var e=document.createElement("<iframe id='XMLHTTP_frame"+f+"' src='"+url+"' style='display:none'></iframe>");
	document.body.appendChild(e);

	CLASMA.ajax.frames[f]=e;
	CLASMA.ajax.framescb[f]=callback;

	// check for reply
	setTimeout("CLASMA.ajax.checkFrame("+f+",2);",2);

	return null;
},

// checkFrame
// Call to check frame for reply

checkFrame:function(f,delay)
{
	// frame ready?
	var e=CLASMA.ajax.frames[f];

	if(e.readyState=="complete")
	{
		// reset session timeout
		CLASMA.ajax.resetSessionTimeout();

		var fid="XMLHTTP_frame"+f;

		// frame within frame needs to hold
		var d=document.frames[fid].document;
		var hold=(d.frames.length>0);

		// build result
		var r={};

		r.readyState=CLASMA.ajax.RS_COMPLETED;

		r.status=CLASMA.ajax.S_OK;
		r.statusText="";

		try
		{
			// get response and callback
			r.responseText=document.frames[fid].document.body.innerHTML;
			CLASMA.ajax.framescb[f](r);

			// remove frame element?
			if(!hold) e.parentNode.removeChild(e);
		}
		catch(e) {}

		// clear frame buffer
		CLASMA.ajax.frames[f]=null;
		CLASMA.ajax.framescb[f]=null;

		return;
	}
	
	// add delay and try again
	delay*=1.5;

	setTimeout("CLASMA.ajax.checkFrame("+f+","+delay+");",delay);
},

// setResponse
// Call to set request response

setResponse:function(id,s)
{
	// set element contents
	var e=$(id);
	if(e) e.innerHTML=s;
},

// Session timeout

// setSessionTimeout
// Call to set session timeout

setSessionTimeout:function(tm,url)
{
	// set timeout args
	timeout=tm;
	timeoutUrl=url;

	// start timeout
	CLASMA.ajax.resetSessionTimeout();
},

// resetSessionTimeout
// Call to reset session timeout

resetSessionTimeout:function()
{
	// clear old timer, set new
	if(timerId) clearTimeout(timerId);
	if(timeout>0) timerId=setTimeout(CLASMA.ajax.onsessiontimeout,timeout);
},

// onsessiontimeout
// Called by session timeout timer

onsessiontimeout:function()
{
	// Residrect to timeout url
	window.location=timeoutUrl;
}

// Public end

}; }();
// site.js - Site library
// Copyright (c) 2008, Clasma Events Inc.

// Define namespace

CLASMA.namespace("CLASMA.site");

// Define object

CLASMA.site=function() {

// Class helpers

var cdd=CLASMA.detect;
var cd=CLASMA.dom;
var cf=CLASMA.framework;
var ch=CLASMA.history;
var ca=CLASMA.ajax;

// Private data

// Private functions

// pullContent
// Call to pull content from server

var pullContent=function(hash)
{
	// goto default?
	if(!hash || hash=="") hash="home";

	// has arguments?
	var args=null;

	if(hash.indexOf("_")!=-1)
	{
		// split argument
		var s=hash.split("_");

		hash=s[0];
		args="id="+escape(s[1]);
	}

	// is it a menu option?
	var a=CLASMA.site.menu.getOption(hash);
	CLASMA.site.menu.setCurrent(a);

	// ajax callback
	var callback=function(r)
	{
		// execute scripts
		var ev=cd.evalScripts("content");
		if(ev) setTimeout(function(){ca.setError("content","JavaScript: "+ev);},100);

		// scroll to top
		window.scrollTo(0,0);
	};

	// pull content
	var url="content/"+hash+".asp";
	ca.include(url,"content",args,callback);
};

// Private end

return {

// Public data

// Public handlers

// onsiteload
// Called when site loaded

onsiteload:function(title)
{
	// create history tracker
	ch.create(title,CLASMA.site.onhistory);
},

// onhistory
// Called when history changes

onhistory:function(hash)
{
	// pull from server
	pullContent(hash);
},

// Public functions

// pull
// Call to pull page from server

pull:function(a)
{
	// get hash value
	var hash=a.href;
	var n=hash.indexOf("#");

	if(n!=-1) hash=hash.substr(n+1);
	else hash="";

	// add history and pull
	ch.add(hash);
	pullContent(hash);

	return true;
}

// Public end

}; }();
// menu.js - Menu library
// Copyright (c) 2008, Clasma Events Inc.

// Define namespace

CLASMA.namespace("CLASMA.site.menu");

// Define object

CLASMA.site.menu=function() {

// Class helpers

var cd=CLASMA.dom;

// Private data

// Private functions

// Private end

return {

// Public data

// Public functions

// setCurrent
// Call to set current menu selection

setCurrent:function(a)
{
	// get current
	var n=this.getCurrent();

	// remove current, set new
	if(n) cd.setId(n,"");
	if(a) cd.setId(a.parentNode,"current");
},

// getCurrent
// Call to get current menu selection

getCurrent:function()
{
	// get current
	return $("current");
},

// getOption
// Call to find menu anchor from text

getOption:function(text)
{
	// use lowercase
	var t=text.toLowerCase();

	// run down menu options
	var a=cd.getElements("a","menu");

	for(var n=0;n<a.length;n++)
	{
		// found it?
		if(t==a[n].innerHTML.toLowerCase())
			return(a[n]);
	}
	return null;
}

// Public end

}; }();
