var UserAgent={matches:{},
	supports:{},
	uaDefs:{
		mac:/(\bmac.os\b|\bmac_)/i,
		windows:/\b(win95|win98|win 9x|winnt|windows)\b/i,
		x11:/\bx11\b/i,
		nix:/\b(unix|linux|x11|bsd)\b/i,
		vista:/NT\s*6.0/,
		xp:/NT\s*5\.1/,
		xpsp2:/NT\s*5\.1\s?;\s*SV1/,
		iewin:/msie(.*)?windows/i,
		iewinlt7:/msie [1-6](.*)?windows/i,
		iewin7:/msie 7(.*)?windows/i,
		iewin6:/msie 6(.*)?windows/i,
		iewin55:/msie 5\.5(.*)?windows/i,
		iewin5:/msie 5\.0(.*)?windows/i,
		iewinold:/msie [1-4](.*)?windows/i,
		iemac:/msie 5(.*)?mac/i,
		ns4:/netscape 4/i,
		safari:/(safari|applewebkit)/i,
		khtml:/(konqueror|khtml|safari)/i,
		opera:/opera/i,
		opera9:/opera\/9/i,
		firefox:/firefox/i,
		firefox1dot0:/firefox\/1\.0/i,
		firefox1dot5:/firefox\/1\.5/i,
		firefox2dot0:/firefox\/2/i
	},
	featureDefs:{
		pngAlpha:function(){
			var m=UserAgent.matches;
			return m.khtml||m.opera||m.gecko||m.iewin&&!(m.iewin5||m.iewinold);
		},
		pngAlphaIEWin:function(){
			var m=UserAgent.matches;
			return m.iewin&&!(m.iewin5||m.iewinold);
		},
		elementAlpha:function(){
			var m=UserAgent.matches;
			return m.khtml||m.opera9||m.gecko||(m.iewin&&!m.iewinold);
		},
		elementAlphaIEWin:function(){
			return UserAgent.supports.elementAlpha&&UserAgent.matches.iewin;
		},
		fixedPosition:function(){
			var m=UserAgent.matches;
			return !m.iewin&&(m.gecko||m.khtml||m.opera);
		}
	},
	init:function(){
		var m=this.matches;
		var _54=function(_55,_56){
			m[_55]=_56;
		};
		for(var _57 in this.uaDefs){
			_54(_57,this.uaDefs[_57].test(navigator.userAgent));
		}
		_54("gecko",!m.khtml&&!m.opera&&/(firefox|camino|gecko)/i.test(navigator.userAgent));
		for(var _58 in this.featureDefs){
			this.supports[_58]=this.featureDefs[_58]();
		}
		Browser={
			MSIE:function(){
				return UserAgent.matches.iewin;
			}
		};
		isMacIE=this.matches.iemac;
		isSafari=this.matches.safari;
		isOpera=this.matches.opera;
	},
	addSupportedFeature:function(_59,_60){
		this.supports[_59]=_60;
	}
};
var appVers=navigator.appVersion;
UserAgent.init();

Array.prototype.contains = function(val) {
	var i
	for(i = 0; i < this.length; i++) {
		if (this[i] == val) return true;
	}
	return false
}
Array.prototype.itemContains = function(val) {
	var i
	for(i = 0; i < this.length; i++) {
		if (this[i].indexOf(val) != -1) return true;
	}
	return false
}

if(!window.encodeURIComponent){
	encodeURIComponent=function(str){
		return escape(str);
	};
	decodeURIComponent=function(str){
		return unescape(str);
	};
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/, "");
}
String.prototype.left = function() {
	return this.replace(/^\s+/, "");
}
String.prototype.right = function() {
	return this.replace(/\s+$/, "");
}
String.NUMBERS = ["0","1","2","3","4","5","6","7","8","9"];
String.ALPHA_LOWERCASE = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
String.ALPHA_UPPERCASE = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
String.prototype.getUrlAttribute=function(attName){
	var ls;
	var ind=this.indexOf(URLLib.QUERY_START);
	if(ind!=-1){
		ls=this.substring(ind);
	}else{
		return null;
	}
	if(ls.length>0&&ls.indexOf(attName)!=-1){
		var aNVPairs=ls.substring(1).split(URLLib.QUERY_DELIM);
		var tAttAssignment=_85+URLLib.NVPAIR_DELIM;
		for(var i=0;i<aNVPairs.length;i++){
			if(aNVPairs[i].indexOf(tAttAssignment)==0&&aNVPairs[i].length>tAttAssignment.length){
				return decodeURIComponent(aNVPairs[i].substring(tAttAssignment.length));
			}
		}
	}
	return null;
};
String.prototype.setUrlAttribute=function(attName,attValue){
	var oStr=this;
	if(attValue===false){
		attValue="false";
	}else{
		if(attValue===0){
			attValue="0";
		}
	}
	var curAttValue=oStr.getUrlAttribute(attName);
	if(curAttValue){
		oStr=oStr.replace(attName+URLLib.NVPAIR_DELIM+encodeURIComponent(curAttValue),attName+URLLib.NVPAIR_DELIM+encodeURIComponent(attValue||""));
	}else{
		oStr+=((oStr.indexOf(URLLib.QUERY_START)==-1)?URLLib.QUERY_START:URLLib.QUERY_DELIM)+attName+URLLib.NVPAIR_DELIM+encodeURIComponent(attValue||"");
	}
	return oStr;
};
String.prototype.setUrlAttributes=function(params){
	var oStr=this;
	for(var i in params){
		oStr=oStr.setUrlAttribute(i,params[i]);
	}
	return oStr;
};
String.prototype.containsClass=function(strClass){
	return new RegExp("(^|\\s)"+strClass+"($|\\s)","g").test(this);
};
String.prototype.addClass=function(strClass){
	if(!this.containsClass(strClass)){
		return this.length>0?this+" "+strClass:strClass;
	}
	return this;
};
String.prototype.swapClass=function(strClassOld,strClassNew){
	return this.removeClass(strClassOld).addClass(strClassNew);
};
String.prototype.removeClass=function(strClass){
	if(typeof strClass!="string"){
		if(typeof strClass=="object"&&strClass.constructor==Array){
			var s=this;
			for(var ii=0;ii<strClass.length;ii++){
				s=s.removeClass(strClass[ii]);
			}
		}
		return s;
	}
	if(!this.containsClass(strClass)){
		return this;
	}
	var rx1=new RegExp("\\s"+strClass+"\\s");
	if(rx1.test(this)){
		var rx2=new RegExp("\\s"+strClass);
	}else{
		var rx2=new RegExp("\\s?"+strClass+"\\s?");
	}
	return this.replace(rx2,"");
};
String.prototype.getClasses=function(){
	return this.split(/\s+/);
};
String.prototype.toggleClass=function(strClass) {
	if(this.containsClass(strClass)) {
		return this.removeClass(strClass);
	} else {
		return this.addClass(strClass);
	}
						  
}

Date.prototype.WEEKDAYS = [{long:"Sunday",short:"Sun"},
						   {long:"Monday",short:"Mon"},
						   {long:"Tuesday",short:"Tue"},
						   {long:"Wednesday",short:"Wed"},
						   {long:"Thursday",short:"Thu"},
						   {long:"Friday",short:"Fri"},
						   {long:"Saturday",short:"Sat"}];
Date.prototype.MONTHS = [{long:"January",short:"Jan"},
						 {long:"February",short:"Feb"},
						 {long:"March",short:"Mar"},
						 {long:"April",short:"Apr"},
						 {long:"May",short:"May"},
						 {long:"June",short:"Jun"},
						 {long:"July",short:"Jul"},
						 {long:"August",short:"Aug"},
						 {long:"September",short:"Sep"},
						 {long:"October",short:"Oct"},
						 {long:"November",short:"Nov"},
						 {long:"Decamber",short:"Dec"}];
Date.prototype.getDayName = function() {
	return this.WEEKDAYS[ this.getDay() ];
}
Date.prototype.getMonthName = function() {
	return this.MONTHS[ this.getMonth() ];
}

var URLLib={QUERY_START:"?",QUERY_DELIM:"&",NVPAIR_DELIM:"="};

function fixPNG() {
	// Use only with ie5 - ie6 to fix support of png transparency
	$("img[src$='.png']").each(function() {
		$(this).css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ $(this).attr("src") +"', sizingMethod='image')");
		$(this).attr("src", "/~images/spacer.gif");
		/**/
	});
}

/* Functions to Show and Hide elements with a vertical slide and fading contents.  These require jQuery. */
if(!Veil) {

var Veil = function() {};
Veil = {
	toOpen:{
		duration:800,
		easingOpen:"easeOutQuad"
	},
	toClose:{
		duration:800,
		easingOpen:"easeOutQuad"
	},
	showHide:function(selector) {
		var s = selector + ":not(:animated)";
		if($(s).is(":hidden")) {
			this.show(s);
		} else {
			this.hide(s);
		}
	},
	show:function(selector) {
		var s = selector + ":not(:animated)";
		var c = selector + " > *:not(script, :animated)";
		var opt = (arguments[1]) ? arguments[1] : jQuery.extend( {}, this.toOpen );
		$(c).fadeIn((opt.duration < 1000) ? opt.duration : 1000, "jswing");
		$(s).slideDown(opt);
	},
	hide:function(selector) {
		var s = selector + ":not(:animated)";
		var c = selector + " > *:not(script, :animated)";
		var opt = (arguments[1]) ? arguments[1] : jQuery.extend( {}, this.toClose );
		$(c).fadeOut(opt.duration, "jswing");
		$(s).slideUp(opt);
	},
	getDurationByRate:function(s, r) {
		// s : selector :: r : Rate
		// beacuse the transitions in this object are slides, we can just worry about the elements innerHeight
		var e = $(s);
		var h = e.innerHeight();
		if( e.children().is(":hidden") ) {
			e.children().show()
			h = e.innerHeight();
			e.children().hide()
		}
		// returns a duration (time) in milliseconds.
		return ( (h < r*2) ? h : r*2) / r * 1000;;
	}
}

}