
/*~~~~~~~~~~~~~~~~~**~~~pop up window~~**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function NewWindow(mypage, myname, w, h, scroll, resize) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resize+',toolbar=no,location=no,status=no,menubar=no,dependent=no';
    win = window.open(mypage, myname, winprops);
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
/*~~~~~~~~~~~~~~~~~**~~~pop up window~~**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/*~~~~~~~~~~~~~~~~**~~~roll overs~~~**~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
$(document).ready(function(){
$(".rollover").hover(
	 function() {
	  curr = $(this).find("img").attr("src");
	  overlen = curr.length;
	  over = curr.substr(0, overlen-4);
	  over = over+'_on.gif';
	  $(this).find("img").attr({ src: over});
	 },
	 function() {
	  $(this).find("img").attr({ src: curr});
	 }
	)

	$(".rollover").find("img").each(function(i) {
	  temp = this.src;
	  prelen = temp.length;
	  pre = temp.substr(0, prelen-4);
	  pre = pre+'_on.gif';
	  preload_image_object = new Image();
	  preload_image_object.src = pre;
	});
});//close document ready
*/
/*~~~~~~~~~~~~~~~~**~~~roll overs~~~**~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/
 * Bivia Utilities, v2.1.1
 * (c) 2005 bivia.com
 * created by Ben Curtis of bivia.com, February 22 2005
 * objectified, Decemeber 22, 2005
 *   - event object largely inspired/ported from Dean Edwards's events
 *     http://dean.edwards.name/my/events.js
 * enhanced domready event handling, September 20, 2006
 *   - ref: http://dean.edwards.name/weblog/2006/06/again/
 *
 * $Id: global.js,v 1.1.2.15.10.5 2008/03/07 20:58:55 bpontius Exp $
 *~~~~*/



var Conf = {
	debug : false,
	js_path : '/templates/abs/js/',
	src_img_clear : '/templates/abs/img/clear.gif',
	complete : true
};



var bv = {
	tickBase : new Date(),
	initialized : false,
	init : function () {
		bv.initialized = new Date();
		bv.debug.init();
		bv.css.init();
		bv.dom.init();
		bv.ajax.init();
	}, // END init

	bv_guid : 1,
	guid_counter : 2, // 0 is reserved, bv.bv_guid == 1
	getNewGuid : function() { return bv.guid_counter++; },
	getId : function (el,base) {
		if (!el.id) {
			var b = (base) ? base : "bv";
			el.id = b + bv.getNewGuid();
		}
		return el.id;
	},
	
	debug : {
		initialized : false,
		init : function () {
			bv.debug.initialized = new Date();
			if (Conf['debug']) {
				bv.event.add(window, 'domready', function () { bv.debug.msg('domready','debug'); });
				bv.event.add(window, 'domready', function () { bv.debug.msg('domready (prioritized)','debug'); }, "priority");
				bv.event.add(window, 'load', function () { bv.debug.msg('page loaded','debug'); });
				bv.event.add(window, 'load', bv.debug.make);
				bv.debug.win = window.open('', '_blank');
				bv.debug.msg('init','debug');
			} else {
				bv.debug.msg = function () { };
			}
			if (!window.d) window.d = bv.debug.msg;
		},
		cnt : 1,
		msgList : { debug : ['script-parse [event #0 :: msg @ 0s]'] },
		msgWait : null,
		msg : function(Msg,Cat) {
			if (bv.debug.msgWait) clearTimeout(bv.debug.msgWait);
			if (!Cat) Cat = 'unspecified';
			if (!bv.debug.msgList[Cat])
				bv.debug.msgList[Cat] = new Array();
			var Now = new Date();
			bv.debug.msgList[Cat].push(Msg +' [event #'+ bv.debug.cnt++ +' :: msg @ '+ ((Now.getTime() - bv.tickBase.getTime()) /1000) +'s]');
			bv.debug.msgWait = setTimeout('bv.debug.make();', 1000);
		}, // END debug.msg
		make : function() {
			if (!bv.dom.initialized) return;
			var Alert = '<ul>';
			for (var Cat in bv.debug.msgList) {
				if (typeof Cat != "string" || (typeof bv.debug.msgList[Cat] != "object" || !bv.debug.msgList[Cat].length)) continue;
				Alert += '<li>'+ Cat +'<ol>';
				for (var xx=0; xx<bv.debug.msgList[Cat].length; xx++)
					Alert += '<li>'+ bv.debug.msgList[Cat][xx] +'</li>';
				Alert += '</ol></li>';
			}
			var Now = new Date();
			Alert += '</ul><br />-- end tick count: '+ ((Now.getTime() - bv.tickBase.getTime()) /1000) +'s --';
			if (bv.debug.win) {
				bv.debug.win.document.open();
				bv.debug.win.document.write(Alert);
				bv.debug.win.document.close();
			}
		} // END debug.make
	},

	event : {
		add : function(el, evt, fn, prioritize) {
			if (evt == 'domready') el = window;
			if (typeof el == "string") el = document.getElementById(el);
			if (!el) return;
			if (evt == 'domready') {
				if (prioritize) bv.dom.readyList.unshift(fn);
				else bv.dom.readyList.push(fn);
				if (bv.dom.initialized)
					bv.dom.ready('event.add'); // do not call function directly, because you want it executed in order
			} else { // start Dean Edwards-port code
				if (!fn.bv_guid) fn.bv_guid = bv.getNewGuid();
				if (!el.bv_events) el.bv_events = {};
				if (!el.bv_events[evt]) {
					el.bv_events[evt] = {};
					if (el["on" + evt]) { // store any previously-assigned handlers
						el.bv_events[evt][0] = el["on" + evt];
					}
				}
				el.bv_events[evt][fn.bv_guid] = fn;
				el["on" + evt] = bv.event.handle;
			}
		}, // END event.add
		remove : function(el, evt, fn) {
			if (el.events && el.bv_events[evt] && fn.bv_guid)
				delete el.bv_events[evt][fn.bv_guid];
		}, // END event.remove
		handle : function(e) {
			var Rtn = true;
			e = e || bv.event.fixEvent(window.event);
			for (var ii in this.bv_events[e.type]) {
				this.bv_handleEvent = this.bv_events[e.type][ii];
				if (this.bv_handleEvent(e) === false)
					Rtn = false;
			}
			return Rtn;
		}, // END event.handle
		fixEvent : function (event) {
			if (!event) { // error thrown on unload?
				event = { type : 'unknown' };
			}
			// add W3C standard event methods
			event.preventDefault = bv.event.fixEvent_preventDefault;
			event.stopPropagation = bv.event.fixEvent_stopPropagation;
			return event;
		},
		fixEvent_preventDefault : function() {
			this.returnValue = false;
		},
		fixEvent_stopPropagation : function() {
			this.cancelBubble = true;
		}

	}, // END event

	dom : {
		initialized : false,
		init : function () {
			bv.dom.initialized = false; // not initialized until dom.ready is run
			if (document.addEventListener) {
				document.addEventListener('DOMContentLoaded', bv.dom.ready, false); // Gecko-based browsers, Opera 9+
			} else {
				/*@cc_on @*/
				/*@if (@_win32)
				document.write('<scr'+'ipt id="__ie_onload" defer="defer" src="javascript:false;"><\/script>');
				var script = document.getElementById("__ie_onload");
				script.onreadystatechange = function() {
					if (this.readyState == "complete") {
						bv.dom.ready(); // call the domready handler
					}
				};
				/*@end @*/
			}

			if (/WebKit/i.test(navigator.userAgent)) { // Safari
				var _timer = setInterval(function() {
					if (/loaded|complete/.test(document.readyState)) {
						bv.dom.ready(); // call the onload handler
						clearInterval(_timer);
					}
				}, 10);
			}

			bv.event.add(window, 'load', bv.dom.ready); // fail-safe fire onload, in case the above hangs
			bv.event.add(window, 'unload', function(){ window.bv = null; } ); // clean up after yourself
			if (!document.documentElement) document.documentElement = document.getElementsByTagName('html')[0];
			bv.css.addClass(document.documentElement, 'domCapable domLoading');
		}, // END dom.init

		readyList : [
			function () {
				bv.dom.initialized = new Date();
				if (bv.css && bv.css.addClass)
					bv.css.addClass(document.documentElement, 'domReady');
				if (bv.css && bv.css.removeClass)
					bv.css.removeClass(document.documentElement, 'domLoading');
			}
		],
//		readyDeferList : [],
		ready : function() {
			while (this.E = bv.dom.readyList.shift()) // deletes as it goes
				this.E(); // note: may safely support multiple, simultaneous firings
//			while (this.E = bv.dom.readyDeferList.shift()) this.E(); 
		}, // END dom.ready

		getElementsByClassName : function (el,TagsIn,Class) {
			var rtn = [];
			if (! el || ! el.getElementsByTagName) return rtn;
			var It = "\\b"+Class+"\\b";
			var Tags = TagsIn.split(",");
			for (var xx=0; xx<Tags.length; xx++) {
				var Els = (el.getElementsByTagName) ? el.getElementsByTagName(Tags[xx]) : el.all;
				for (var ii=0; ii<Els.length; ii++) {
					if (Els[ii].className.match(It))
						rtn[rtn.length] = Els[ii];
				}
			}
			return rtn;
		},
		getChildNodesOfType : function (el,TagsIn) {
			var rtn = [];
			TagsIn = TagsIn.toUpperCase();
			for (var xx=0; xx<el.childNodes.length; xx++)
				if ((","+TagsIn+",").indexOf(","+ el.childNodes[xx].nodeName +",") != -1)
					rtn[rtn.length] = el.childNodes[xx];
			return rtn;
		}
	}, // END dom
	
	css : {
		initialized : false,
		init : function () {
			bv.css.initialized = new Date();
			bv.css.makeRuleSheet();
		},
		
		ruleSheet : null,
		makeRuleSheet : function () {
// deactivate until Safari bug is squashed
return;
/*
			var ruleSheet = document.createElement('style');
			ruleSheet.type = 'text/css';
			document.getElementsByTagName('head')[0].appendChild(ruleSheet);
			bv.css.ruleSheet = document.styleSheets[document.styleSheets.length -1] || ruleSheet;
*/
			bv.css.ruleSheet = document.styleSheets[document.styleSheets.length -1];
			if (!bv.css.ruleSheet.rules) // make Mozilla conform to IE and Safari
				bv.css.ruleSheet.rules = bv.css.ruleSheet.cssRules;
		},
		insertRule : function (selector, declaration) {
// deactivate until Safari bug is squashed
return;
			var index = bv.css.ruleSheet.rules.length;
			if (bv.css.ruleSheet.insertRule)
				bv.css.ruleSheet.insertRule(selector +'{'+ declaration +'}', index);
			else bv.css.ruleSheet.addRule(selector, declaration,index);
/* 
	annoying Safari bug; seems it won't render a new style rule to the page 
	unless you change one of its properties first
*/
			bv.css.ruleSheet.rules[index].style.orphans = 'inherit';
			return index;
		}, // END css.insertRule
		deleteRule : function (selector) {
// deactivate until Safari bug is squashed
return;
			for (var xx=0; xx<bv.css.ruleSheet.rules.length; xx++)
				if (bv.css.ruleSheet.bv_rules[xx].selectorText.toLowerCase() == selector)
					bv.css.deleteRuleByIndex(xx);
		}, // END css.deleteRule
		deleteRuleByIndex : function (index) {
// deactivate until Safari bug is squashed
return;
			if (bv.css.ruleSheet.deleteRule)
				bv.css.ruleSheet.deleteRule(index);
			else bv.css.ruleSheet.removeRule(index);
		}, // END css.deleteRuleByIndex

		addClass : function (el,nm) {
			var regex = new RegExp("\\b"+nm+"\\b");
			if (!el.className.match(regex))
				el.className = bv.string.trim(el.className +" "+ nm, true);
		}, // END style.addClass
		removeClass : function (el,nm) {
			var regex = new RegExp("\\b"+nm+"\\b", "g");
			el.className = bv.string.trim(el.className.replace(regex, ''), true);
		}, // END css.removeClass

		getValue : function (el,prop) {
			if (document.defaultView && document.defaultView.getComputedStyle) {
				return document.defaultView.getComputedStyle(el,'').getPropertyValue(prop);
			} else {
				var propCased = bv.string.camelCase(prop);
				if (el.currentStyle) {
					return el.currentStyle[propCased];
				} else return el.style[propCased];
			}
		},
		getOffset : function (el,base) { // no base = offset from parent
			// IE will treat the offset as to the parentNode; Moz refers all to the body element
			// so if we're not finding an offset relative to a base, take a shortcut for IE:
			if (!base && el.offsetParent == el.parentNode) {
				return { top : el.offsetTop, left : el.offsetLeft };
			} else if (!base) base = el.parentNode;
//			var elOffset   = bv.css.getOffsetFromRoot(el);
//			var baseOffset = bv.css.getOffsetFromRoot(base);
			return {
				top  : el.offsetTop  - base.offsetTop,
				left : el.offsetLeft - base.offsetLeft
			};
		},
		getOffsetFromRoot : function (el) {
			var offset = { top : 0, left : 0};
			while (el) {
				offset.top  += el.offsetTop;
				offset.left += el.offsetLeft;
				el = el.offsetParent;
			}
			return offset;
		},
		getWindowSize : function () {
			if (typeof(window.innerWidth) == 'number') {
				return {
					w : window.innerWidth,
					h : window.innerHeight
				};
			} else {
				if (window.document.documentElement && window.document.documentElement.clientWidth) {
					return {
						w : window.document.documentElement.clientWidth,
						h : window.document.documentElement.clientHeight
					};
				} else {
					if (window.document.body && window.document.body.clientWidth) {
						return {
							w : window.document.body.clientWidth,
							h : window.document.body.clientHeight
						};
//							w : window.document.document.body.clientWidth,
//							h : window.document.document.body.clientHeight
					}
				}
			}
			return false;
		},
		opacity : {
			get : function (el) {
				var Style = null;
				var Alpha = 1;
				if (typeof el.bv_opacity == 'number')
					Alpha = el.bv_opacity;
				else if (Style = bv.css.getValue(el, 'opacity'))
					Alpha = parseFloat(Style);
				else if (Style = bv.css.getValue(el, '-moz-opacity'))
					Alpha = parseFloat(Style);
				else if (el.filters && el.filters.length && el.filters.alpha)
					Alpha = parseFloat(el.filters.alpha.opacity) /100;
				if (Alpha >= 0.99999) Alpha = 1; // unmask masked values
				if (Alpha <= 0.00001) Alpha = 0; // unmask masked values
				return Alpha;
			},
			set : function (el,Alpha) {
				if (Alpha > 0.99) Alpha = 0.99999; // mask incoming 1 to prevent fully-visible flickering transitions
				if (Alpha < 0.01) Alpha = 0.00001; // mask incoming 0 to prevent fully-invisible flickering transitions
				el.bv_opacity = parseInt(Alpha *100000) /100000; // helps speed getter; needed for Safari in some cases
				el.style.opacity = el.bv_opacity;
				el.style.MozOpacity = el.bv_opacity;
				el.style.KHTMLOpacity = el.bv_opacity;
				if (el.filters && !el.filters.alpha) // if this hasn't been declared yet as a style, it's not a filter object
					el.style.filter += ' alpha(opacity='+ (el.bv_opacity *100) +')'; // append to prevent overwriting previous filters
				if (el.filters && el.filters.length && el.filters.alpha)
					el.filters.alpha.opacity = el.bv_opacity *100;
				if (el.bv_opacity >= 0.99999) el.bv_opacity = 1; // unmask masked values
				if (el.bv_opacity <= 0.00001) el.bv_opacity = 0; // unmask masked values
				return el.bv_opacity;
			},
			adjustBy : function (el,AlphaDelta) {
				if ((""+AlphaDelta).charAt((""+AlphaDelta).length -1) == "%") {
					var Pct = parseFloat(AlphaDelta) /100;
					AlphaDelta = (Pct >= 0) ? // round up/down away from zero
						Math.ceil((1 - bv.css.opacity.get(el)) * Pct) :
						Math.floor(bv.css.opacity.get(el) * Pct);
				}
				return bv.css.opacity.set(el, bv.css.opacity.get(el) + parseFloat(AlphaDelta));
			}
		}
	}, // END css
	
	ajax : {
		isAvailable : false,
		index : 1,
		calls : [],
		groundState : [],
		historian : null,
		historicRecord : {},
		hashWas : self.location.hash,
		lastToGo : { id:null, at:new Date() },
		
		init : function () {
			if (bv.ajax.initIo()) {
				bv.ajax.isAvailable = true;
//				bv.event.add(window, 'domready', bv.ajax.history.init, 'priority');
			}
		},
		
		addHistory : function () {},
		history : {
			init : function () {
				if (!bv.ajax.historian) {
					if (document.all) {
						var bb = document.createElement('iframe');
						bb.id = 'bvAjaxHistorian';
						bb.height = 1;
						bb.width = 1;
						bb.style.visibility = 'hidden';
						bb.style.position = 'absolute';
						document.getElementsByTagName('body')[0].appendChild(bb);
						bv.ajax.historian = bb.contentWindow;
						bv.ajax.addHistory = function (id) {
							bv.ajax.historian.document.open();
							bv.ajax.historian.document.write('<script type="text/javascript">');
							bv.ajax.historian.document.write('parent.location.hash = "'+ id +'";');
							bv.ajax.historian.document.write('\<\/\scr\ipt>');
							bv.ajax.historian.document.close();
						}
					// start a history for Win IE, which ignores the first document
						bv.ajax.addHistory(self.location.hash);
					} else {
						bv.ajax.historian = {};
						bv.ajax.addHistory = function (id) {
							self.location.hash = id;
						};
					}
					bv.ajax.history.pollTimer = setInterval('bv.ajax.history.poll();', 221);
					bv.ajax.history.poll();
				}
			}, // END ajax.history.init
		
			addToGround : function (fn) {
				bv.ajax.history.init();
				if (typeof fn == 'function')
					bv.ajax.groundState.push(fn);
			},
			goToGround : function () {
				for (var xx=0; xx<bv.ajax.groundState.length; xx++)
					bv.ajax.groundState[xx]();
			},
			pollTimer : null,
			poll : function () {
				if (self.location.hash != bv.ajax.hashWas) {
					bv.ajax.hashWas = self.location.hash;
					var id = (bv.ajax.hashWas.indexOf('#') == 0) ? bv.ajax.hashWas.substring(1) : bv.ajax.hashWas;
					bv.ajax.history.go(id);
				}
			}, // END ajax.history.poll
			make : function (id, call) {
				bv.ajax.history.init();
				if (bv.ajax.historian) {
					while (bv.ajax.historicRecord[id]) id = id + bv.getNewGuid();
					bv.ajax.historicRecord[id] = call;
					bv.ajax.addHistory(id);
				}
			}, // END ajax.history.make
			go : function (id) {
			// make sure we didn't just go here
				if (bv.ajax.lastToGo.id == id) {
					var Now = new Date();
					if (Now.getTime() - bv.ajax.lastToGo.at.getTime() < 1000)
						return false;
				}
				bv.ajax.lastToGo = { id:id, at:new Date() };
				if (bv.ajax.historicRecord[id] && typeof bv.ajax.historicRecord[id] == 'function')
					bv.ajax.historicRecord[id]();
				else bv.ajax.history.goToGround();
			}
		}, // END ajax.history
		
		initIo : function () {
			var Rtn = false;
			if (window.XMLHttpRequest) {
				Rtn = new XMLHttpRequest();
			} else if (window.ActiveXObject) {
				try {
					Rtn = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try {
						Rtn = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (e) {
						Rtn = false;
					}
				}
			}
			return Rtn;
		}, // END ajax.initIo

		makeCallback : function (callback) {
			var Rtn = {
				success : bv.ajax.respSuccess,
				loading : bv.ajax.respLoading,
				error   : bv.ajax.respError,
				timeout : bv.ajax.respTimeout
			};
			if (typeof callback == 'function')
				Rtn.success = callback;
			else if (typeof callback == 'object') {
				for (var Prop in callback)
					Rtn[Prop] = callback[Prop];
			}
			return Rtn;
		}, // END ajax.makeCallback

		setup : function (callback, expectXML, avoidCache, addHeaders, followOnRedirect, requestTimeout, responseTimeout) {
			var cb = bv.ajax.makeCallback(callback);

			var http = {
				index : bv.ajax.index++,
				callback : cb,
				expectXML : (expectXML !== false) ? true : false,
				avoidCache : avoidCache || false,
				addHeaders : (typeof addHeaders != 'object') ? {} : addHeaders,
				followOnRedirect : (followOnRedirect !== false) ? true : false,
				requestTimeout : (typeof requestTimeout != 'number') ? parseFloat(Conf.ajax_request_timeout) : parseFloat(requestTimeout),
				requestTimer : null,
				responseTimeout : (typeof responseTimeout != 'number') ? parseFloat(Conf.ajax_response_timeout) : parseFloat(responseTimeout),
				responseTimer : null,
				hasBegunLoading : false,
				checkState : bv.ajax.checkState,
				redirect : bv.ajax.redirect,
				go : bv.ajax.go
			}
			http.io = bv.ajax.initIo();

			bv.ajax.calls[http.index] = http;
			return http;
		}, // END ajax.setup
		
		respSuccess : function () {},
		respLoading : function () {},
		respError : function () {},
		respTimeout : function () { this.io.abort(); this.callback.error(); },
		
		redirect : function () {
			/*
				use the properties of the object and the Location header
				to redirect the request to the new location
				(need a new io object)
			*/
		},
		
		checkState : function () {
			if (this.requestTimer) clearTimeout(this.requestTimer);
			if (this.io.readyState == 1) {
				if (!this.hasBegunLoading)
					this.callback.loading();
				this.hasBegunLoading = true;
				this.responseTimer = setTimeout("bv.ajax.calls["+ this.index +"].callback.timeout();", 1000* this.responseTimeout);
			} else if (this.io.readyState == 4) {
				if (this.responseTimer) clearTimeout(this.responseTimer);
				this.hasBegunLoading = true;
				if (this.io.status == 200) {
					this.callback.success();
				} else if (this.io.status > 299 && this.io.status < 400) {
					this.redirect();
				} else if (this.io.callback[this.io.status]) {
					this.io.callback[this.io.status](this.io.statusText);
				} else {
					this.io.callback.error(this.io.status, this.io.statusText);
				}
			}
		}, // END ajax.checkState
		
		go : function (url, content) {
			this.io.abort();
			this.hasBegunLoading = false;
			this.requestTimer = setTimeout("bv.ajax.calls["+ this.index +"].callback.timeout();", 1000* this.requestTimeout);
			this.io.onreadystatechange = this.checkState;
			if (content) {
				this.io.open("POST", url, true);
				this.io.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				this.io.send(bv.string.makeKeyValueString(content));
			} else {
				if (this.avoidCache)
					url = bv.string.appendQueryString(url, "ord="+ Math.random());
				this.io.open("GET", url, true);
				this.io.send(null);
			}
		}, // END ajax.go
	
		pronto : function (url, callback) {
			var http = { url : url };
			http.io = bv.ajax.initIo();
			if (!http.io) return false;
			http.callback = bv.ajax.makeCallback(callback);
			http.hasBegunLoading = false;
	
			http.io.onreadystatechange = function () {
				if (http.io.readyState == 1) {
					if (!http.hasBegunLoading)
						http.callback.loading(http);
					http.hasBegunLoading = true;
				} else if (http.io.readyState == 4) {
					http.hasBegunLoading = true;
					if (http.io.status == 200) {
						http.callback.success(http.io.responseText, http.io.responseXML, http);
					} else if (http.callback[http.status]) {
						http.callback[http.io.status](http.io.statusText, http);
					} else {
						http.callback.error(http.io.status, http.io.statusText, http);
					}
				}
			}
	
	// gotta remember to check for memory leaks...
	
			http.io.open("GET", url, true);
			http.io.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); // avoid the cache
			http.io.send(null);
			return http;
		} // END prontoAjax
	}, // END ajax
	
	string : {
		trim : function (s,dedupe) {
			// Mac IE chokes on the '?'; you can break this into two replaces for Mac IE compatibility
			s = s.replace(/^[\t\r\n\s]*(.*?)[\t\r\n\s]*$/, '$1');
			if (dedupe) // reduce internal runs of whitespace
				s = s.replace(/[\t\r\n\s]+/g, ' ');
			return s;
		},
		camelCase : function (s) {
			var bits = s.split("[- ]+");
			for (var xx=1; xx<bits.length; xx++)
				if (bits[xx].length)
					bits[xx] = bits[xx].charAt(0).toUpperCase() + bits[xx].substring(1);
			return bits.join('');
		},
		stripHTML : function (s) {
			return s.replace(/<\/?\w+.*?>/g,'');
		},
		parseKeyValueString : function (s,d) {
			if (!d) d = "|"; // delimiter for multiple values with the same key
			while (s.charAt(0) == "?") s = s.substring(1);
			var Pairs = s.split(/\&(amp;)?/);
			var Rtn = {};
			for (var xx=0; xx<Pairs.length; xx++) {
				var NameValue = Pairs[xx].split("=");
				if (Rtn[unescape(NameValue[0])])
					Rtn[unescape(NameValue[0])] += d;
				else
					Rtn[unescape(NameValue[0])] = '';
				Rtn[unescape(NameValue[0])] += Rtn[unescape(NameValue[1])]
			}
			return Rtn;
		},
		makeKeyValueString : function (obj, escapeAmp, delimiter, separater) {
			var amp = (escapeAmp) ? "&amp;" : "&";
			var d = delimiter || amp;
			var s = separater || "=";
			var Arr = [];
			for (var Prop in obj)
				Arr.push(escape(Prop) + s + escape(obj[Prop]));
			return Arr.join(d);
		},
		appendQueryString : function (url, string, escapeAmp) {
			var amp = (escapeAmp) ? "&amp;" : "&";
			var pre = (url.indexOf("?") != -1) ? amp : "?";
			return url + pre + string;
		}
	}, // END string
	
	data : {
		isEmailFormat : function (str) {
			return /^[^\s]@[^\s]\.\w{2,}$/.test(str);
		}
	}, // END form
	
	cookie : {
		get : function (name) {
		
		},
		set : function (name, value, path, expires, domain) {
		
		},
		verifyAccepted : function () {}
	},
	
	array : {
		shuffle : function (a) {
			if (a.length < 2) return a;
			var Last = a[a.length -1]; // store the current last element
			do a = a.sort(bv.utility.sortRandom);
			while (Last == a[0]); // repeat until the new first is not the old last
			return a;
		}
	}, // END array

	utility : {
		sortRandom : function (a,b) {
			if (Math.random() > 0.5) return 1;
			else return -1;
		}
	},

	complete : true
}; // END bv declaration
bv.init();

/* add to debug:

function loopThrough(el,depth) {
	var D = depth || 0;
	var Indent = "";
	for (var xx=0; xx<D; xx++) Indent += "-";
	var Items = el.childNodes;
	for (var xx=0; xx<Items.length; xx++) {
		d(Indent +' '+ Items[xx].nodeName +' offsetWidth:'+ Items[xx].offsetWidth, 'map menus');
		if (Items[xx].hasChildNodes())
			loopThrough(Items[xx], D +1);
	}
}
*/


/*******************************************************************************
 *   END: _bv_utilities.js                                                     *
 *                                                                             *
 *   START: bvDimForm                                                          *
 ******************************************************************************/
 
 


var bvDimForm = {

	init : function (el) { // verify ability, find targetted lists
		if (!bv) return; // require bv_utilities.js
		var Trg = (el) ? el : document;
		var Els = bv.dom.getElementsByClassName(Trg, 'input', 'bvDimmable');
		for (var xx=0; xx<Els.length; xx++) {
			Els[xx].bvDimForm_txt = Els[xx].getAttribute('title');
			Els[xx].title = '';
			Els[xx].bvDimForm_dim = bvDimForm.dim;
			Els[xx].bvDimForm_nodim = bvDimForm.nodim;
			bv.event.add(Els[xx], 'blur', Els[xx].bvDimForm_dim);
			bv.event.add(Els[xx], 'focus', Els[xx].bvDimForm_nodim);
			if (!Els[xx].form.bvDimForm_index) {
				Els[xx].form.bvDimForm_index = [];
				Els[xx].form.bvDimForm_nodimAll = bvDimForm.nodimAll;
				bv.event.add(Els[xx].form, 'submit', Els[xx].form.bvDimForm_nodimAll);
			}
			Els[xx].form.bvDimForm_index.push(Els[xx]);
			Els[xx].bvDimForm_dim();
		}
	},
	
	nodimAll : function () {
		for (var xx=0; xx<this.bvDimForm_index.length; xx++) {
			this.bvDimForm_index[xx].bvDimForm_nodim();
		}
	},
	
	dim : function () {
		if (this.value == '' || this.value == this.bvDimForm_txt) {
			bv.css.addClass(this, 'bvDim');
			this.value = this.bvDimForm_txt;
		}
	},
	
	nodim : function () {
		bv.css.removeClass(this, 'bvDim');
		if (this.value == this.bvDimForm_txt) {
			this.value = '';
		}
	}

}

if (bv && bv.event) bv.event.add(window, "domready", bvDimForm.init);



/*******************************************************************************
 *   END: bvDimForm                                                            *
 *                                                                             *
 *   START: bnwTabber                                                          *
 ******************************************************************************/



var bnwTabber = {
	
	init : function () {
		var Ord = ['First','Second','Third','Fourth','Fifth','Sixth','Seventh','Eighth','Ninth','Tenth'];
		var dl = document.getElementsByTagName('dl');
		for (var xx=0; xx<dl.length; xx++) {
			if (/\bbnwTabber\b/.test(dl[xx].className)) {
				dl[xx].bnwTabber_last = '';
				var dt = dl[xx].getElementsByTagName('dt');
				for (var ii=0; ii<dt.length; ii++) {
					dt[ii].bnwTabber_blk = dl[xx];
					dt[ii].bnwTabber_tab = Ord[ii];
					dt[ii].bnwTabber_grp = dt[ii].className.replace(/^.*grp\w+\b.*$/, "\1");
					if (dl[xx].className.indexOf('show' + dt[ii].bnwTabber_tab) != -1) {
						bv.css.removeClass(dl[xx], dl[xx].bnwTabber_last);
						dl[xx].bnwTabber_last = dt[ii].bnwTabber_tab;
					}
					bv.event.add(dt[ii], 'mousedown', bnwTabber.cancel);
					bv.event.add(dt[ii], 'click', bnwTabber.toggle);
				}
			}
		}
	}, // END: init
	
	toggle : function () {
		bv.css.removeClass(this.bnwTabber_blk, 'show'+ this.bnwTabber_blk.bnwTabber_last);
		this.bnwTabber_blk.bnwTabber_last = this.bnwTabber_tab;
		bv.css.addClass(this.bnwTabber_blk, 'show'+ this.bnwTabber_blk.bnwTabber_last);
	}, // END: toggle
	
	cancel : function () { return false; },

	complete : true
};

if (bv && bv.event) bv.event.add(window, 'domready', bnwTabber.init);





/*******************************************************************************
 *   END: bnwTabber                                                            *
 *                                                                             *
 *   START: bvAttachValidWindows                                               *
 ******************************************************************************/



var bvAttachValidWindows = {
	type : {
		newwin : {
			win : 'bvwin',
			viewerLocation : '',
			params : '',
			rtn : false
		},
		offsite : {
			win : 'offsite',
			viewerLocation : '',
			params : '',
			rtn : true
		}
	},
	notOffsite : new RegExp("^$"), // finds nothing
	src : document,
	
	addType : function (Obj) {
		for (var Key in Obj) {
			bvAttachValidWindows.type[Key] = {
				win : 'bv',
				viewerLocation : '',
				params : '',
				focus : true,
				rtn : true
			};
			for (var Param in Obj[Key]) {
				bvAttachValidWindows.type[Key][Param] = Obj[Key][Param];
			}
		}
	}, 
	
	init : function (el) {
		var Trg = (el) ? el : bvAttachValidWindows.src;
		if (typeof Trg == 'string') Trg = document.getElementById(Trg);
		if (!Trg) return;
		var As = Trg.getElementsByTagName('a');
		for (var xx=0; xx<As.length; xx++) {
			if (
					As[xx].href.indexOf('http://') == 0
				&&
					As[xx].href.indexOf(location.host.replace(/^[\w\d\-]*(\b.+\.\w+)$/, "$1")) == -1
				&&
					! bvAttachValidWindows.notOffsite.test(As[xx].href)
			) {
				bv.css.addClass(As[xx], 'offsite');
			}
			if (!As[xx].className) continue;
			var types = As[xx].className.split(" ");
			for (var ii=0; ii<types.length; ii++) {
				var Key = types[ii];
				if (bvAttachValidWindows.type[Key]) {
					As[xx].bvAttachedWindow = bvAttachValidWindows.type[Key];
					if (bvAttachValidWindows.type[Key].viewerLocation + bvAttachValidWindows.type[Key].params == '')
						As[xx].target = bvAttachValidWindows.type[Key].win;
					bv.event.add(As[xx], 'click', bvAttachValidWindows.open);
				}
			}
		}
	},
	
	open : function () {
		var newWin = window.open(
				this.bvAttachedWindow.viewerLocation+this.href,
				this.bvAttachedWindow.win,
				this.bvAttachedWindow.params
			);
		if (this.bvAttachedWindow.focus) newWin.focus();
		return this.bvAttachedWindow.rtn;
	},
	
	complete : true

}

if (window.bv && bv.event) bv.event.add(window, 'domready', bvAttachValidWindows.init );


// configure domains that should not be opened into a new "offsite" window
// by default, any link that differs only by host but matches the domain is not offsite
bvAttachValidWindows.notOffsite = new RegExp("\\b(bibles.com|constanthope.org|goodnewsnews.com)\\b", "i");

bvAttachValidWindows.addType({
	popVid : {
		win : 'popVid',
		viewerLocation : '',
		params : 'height=400,width=490,resizable',
		rtn : false
	}
});


/*******************************************************************************
 *   END: bvAttachValidWindows                                                 *
 *                                                                             *
 *   START: catSlides                                                          *
 ******************************************************************************/


// javascript:alert(catSlides.shows[0].cat.slides[3].innerHTML);

var catSlides = {

	delay : 6, // seconds between slides
	fade  : 1, // seconds, duration of the fade
	steps : 25, // more = smoother fade
	shows : [],
	controls : null,
	
	init : function (Id, SlideDat) {
		var S = document.getElementById(Id);
		if (S) {
			var Control = bv.dom.getElementsByClassName(S, 'li', 'controlBar');
			var Slides  = S.getElementsByTagName('li');
			S.cat = {
				btns   : [],
				slides : [],
				cursor : 0,
				last   : null,
				wait   : null
			};
			S.advance = catSlides.advanceSlide;
			for (var xx=0; Slide = Slides[xx]; xx++) {
				if (! /\bcontrolBar\b/.test(Slide.className)) { // anything not a controlBar is a slide
					S.cat.slides.push(Slide);
					if (/\bcurrent\b/.test(Slide.className)) {
						if (S.cat.last) bv.css.removeClass(S.cat.last, 'current');
						S.cat.last = Slide;
						S.cat.cursor = S.cat.slides.length -1;
					}
				}
			}
			if (S.cat.slides.length == 0) return;
			for (var idx in SlideDat) {
				var N = S.cat.slides[0].cloneNode(true);
				bv.css.removeClass(N, 'current');
				N.getElementsByTagName('a')[0].setAttribute('href', SlideDat[idx].url);
				N.getElementsByTagName('img')[0].setAttribute('src', SlideDat[idx].img);
				S.cat.slides.push(N);
				S.appendChild(N);
			}
			
			if (! catSlides.controls) {
			var C = document.createElement('div');

			C.className = 'controls';

			var Prev = document.createElement('div');
			Prev.className = 'controlPrev';
			var PrevLink = document.createElement('a'); //create an <a> element
			PrevLink.href = '#'; //IE won’t recognize an <a> without an “href”
			PrevLink.className = 'controlPrev';
			Prev.appendChild(PrevLink); //add an <a> element to this <div>

			var Play = document.createElement('div');
			Play.className = 'controlPlay controlStatePause';
			var PlayLink = document.createElement('a'); //create an <a> element
			PlayLink.href = '#'; //IE won’t recognize an <a> without an “href”
			PlayLink.className = 'controlPlay controlStatePlay';
			Play.appendChild(PlayLink); //add an <a> element to this <div>

			var Next = document.createElement('div');
			Next.className = 'controlNext';
			var NextLink = document.createElement('a'); //create an <a> element
			NextLink.href = '#'; //IE won’t recognize an <a> without an “href”
			NextLink.className = 'controlNext';
			Next.appendChild(NextLink); //add an <a> element to this <div>

			C.appendChild(Prev);
			C.appendChild(Play);
			C.appendChild(Next);

			catSlides.controls = C;

				
// 				var CSS = document.createElement('style');
// 				CSS.setAttribute('type', 'text/css');
// alert(document.styleSheets.length);
// 				document.getElementsByTagName('head')[0].appendChild(CSS);
// 				try { CSS.appendChild(document.createTextNode(' ')); } catch(err) {} // fix for Safari not recognizing an empty block
// 				var StyleSheet = document.styleSheets[document.styleSheets.length -1];
// alert(document.styleSheets.length +'\n'+ StyleSheet.insertRule +'\n'+ StyleSheet.addRule);
// 
// 				if (StyleSheet.addRule) {
// 					for (var ii=0; ii<100; ii++) {
// 						StyleSheet.addRule('#catSlides li.slideFade'+ ii, 'opacity:'+ ((ii/100)-0.001) +'; z-index:'+(105-ii)+';', ii);
// 					}
// 				} else {
// 					for (var ii=0; ii<100; ii++) {
// 						StyleSheet.insertRule('#catSlides li.slideFade'+ ii +' { opacity:'+ ((ii/100)-0.001) +'; z-index:'+(105-ii)+'; }', ii);
// 					}
// 				}

// 				var Styles = [];
// 				for (var ii=0; ii<100; ii++) {
// 					Styles.push('#catSlides li.slideFade'+ ii +' { opacity:'+ ((ii/100)-0.001) +'; z-index:'+(105-ii)+'; }\n');
// 				}


// try {
// 	CSS.appendChild(document.createTextNode(Styles));
// 	document.getElementsByTagName('head')[0].appendChild(CSS);
// } catch  (error) {
// 	document.getElementsByTagName('body')[0].innerHTML += '<style type="text/css">'+Styles+'</style>';
// }
//
// var StyleSheet = document.createTextNode(Styles);
// CSS.appendChild(StyleSheet);
//				document.getElementsByTagName('head')[0].appendChild(CSS);
//				CSS.appendChild(document.createTextNode(Styles));

			} // END: creating controls and styles
			
			for (var xx=0; Li = Control[xx]; xx++) { // for each controlBar...
				var Btns =  Li.appendChild(catSlides.controls.cloneNode(true)); // ...add the controls
				S.cat.btns[0] = Btns.childNodes[0];
				S.cat.btns[0].cat = { host : S };
				bv.event.add(S.cat.btns[0], 'click', catSlides.prev);
				S.cat.btns[1] = Btns.childNodes[1];
				S.cat.btns[1].cat = { host : S, state : 0 };
				S.cat.btns[1].play = catSlides.play;
				bv.event.add(S.cat.btns[1], 'click', catSlides.play);
				S.cat.btns[2] = Btns.childNodes[2]
				S.cat.btns[2].cat = { host : S };
				S.cat.btns[2].next = catSlides.next;
				bv.event.add(S.cat.btns[2], 'click', catSlides.next);
			}
			
// alert(S.innerHTML);
			catSlides.shows.push(S);
			S.cat.btns[1].play();
		}
	}, // END: init
	
	prev : function (e) {
		if (this.cat.host.cat.cursor == 0)
			this.cat.host.cat.cursor = this.cat.host.cat.slides.length;
		this.cat.host.cat.cursor--;
		this.cat.host.advance();
		if (typeof e == 'object' && e.type == 'click') this.cat.host.cat.btns[1].play('pause');
	}, // END: prev
	
	next : function (e) {
		this.cat.host.cat.cursor++;
		if (this.cat.host.cat.cursor == this.cat.host.cat.slides.length)
			this.cat.host.cat.cursor = 0;
		this.cat.host.advance();
		if (typeof e == 'object' && e.type == 'click') this.cat.host.cat.btns[1].play('pause');
	}, // END: next
	
	play : function (e) {
		if (this.cat.state || (typeof e == 'string' && e == 'pause')) {
			bv.css.addClass(this, 'controlStatePause');
			bv.css.removeClass(this, 'controlStatePlay');
			this.cat.state = 0;
			if (this.cat.host.cat.wait) clearInterval(this.cat.host.cat.wait);
		} else {
			bv.css.addClass(this, 'controlStatePlay');
			bv.css.removeClass(this, 'controlStatePause');
			this.cat.state = 1;
			if (typeof e == 'object' && e.type == 'click') this.cat.host.cat.btns[2].next();
			var Src = this;
			this.cat.host.cat.wait = setInterval(function () { Src.cat.host.cat.btns[2].next(); }, catSlides.delay *1000);
		}
	}, // END: play
	
	
	advanceSlide : function () {//alert(this +'\n'+ this.cat +'\n'+ this.cat.cursor +'\n'+ this.cat.last);
		var setFade = function (Incoming, BaseClass, i) {
			return function () {
				Incoming.className = BaseClass + ' slideFade'+ i;
			};
		}
		var wrapFade = function (Incoming, Outgoing) {
			return function () {
				Incoming.className = Incoming.className.replace(/\bslideFade\d+\s*/g, '');
				bv.css.removeClass(Outgoing, 'current');
			};
		}

		for (var xx=0; xx<25; xx++) { setTimeout(setFade(this.cat.slides[this.cat.cursor], 'current', xx * 100 / catSlides.steps), (xx *((1000 * catSlides.fade)/catSlides.steps)) +1); }
		setTimeout(wrapFade(this.cat.slides[this.cat.cursor], this.cat.last), (1000 * catSlides.fade) + 50);

		bv.css.addClass(this.cat.slides[this.cat.cursor], 'current slideFade0');
		this.cat.last = this.cat.slides[this.cat.cursor];
	}, // END: advanceSlide
	
	complete : true
};




/*******************************************************************************
 *   END: catSlides                                                            *
 *                                                                             *
 *   START: fontSizer                                                          *
 ******************************************************************************/



var fontSizer = {
	base : null,
	
	init : function (el) {
		var Trg = (el && el.nodeType) ? el : document.getElementById('contentMain');
		if (!Trg || !(/\bfontSizeable\b/.test(Trg.className))) return;
		fontSizer.base = document.getElementsByTagName('body')[0];
		fontSizer.set(fontSizer.get());
		if (bv.dom.getElementsByClassName(Trg, 'div', 'fontSizer').length) return;
		else {
			var UI = document.createElement('div');
			var fsUp = document.createElement('div');
			var fsDown = document.createElement('div');
			UI.className = 'fontSizerUI';
			fsUp.className = 'fontSizerIncrease';
			fsDown.className = 'fontSizerDecrease';
			UI.appendChild(fsUp);
			UI.appendChild(fsDown);
			Trg.insertBefore(UI, Trg.firstChild);
			bv.event.add(fsUp, 'click', fontSizer.increase);
			bv.event.add(fsDown, 'click', fontSizer.decrease);
		}
	},
	
	get : function () {
		if (null != (Val = document.cookie.match(/\bfontSizer=(\d)\b/))) {
			return parseInt(Val[1]);
		} else return 5;
	},
	
	set : function (val) {
		if (typeof val == 'number') {
			if (val < 0) val = 0;
			if (val > 9) val = 9;
			var Now = new Date();
			var Expires = new Date();
			Expires.setTime(Now.getTime() + (6 * 30 * 24 * 60 * 60 * 1000)); // now + 6 months
			document.cookie = 'fontSizer='+ val +'; path=/; expires='+ Expires.toUTCString()
			fontSizer.base.className = fontSizer.base.className.replace(/\bfontSize-\d\s*/, '');
			bv.css.addClass(fontSizer.base, 'fontSize-'+ val);
			return val;
		} else return false;
	},
	
	increase : function () {
		fontSizer.set(fontSizer.get() +1);
	},
	
	decrease : function () {
		fontSizer.set(fontSizer.get() -1);
	},

	complete : true
}

bv.event.add(window, 'domready', fontSizer.init);