/* This file should be identical to the following files, strung together:
 *
 * 	_bv_config.js
 * 	_bv_utilities.js
 * 	sifr.js
 * 	~site_init.js
 * 
 * This would normally be done automatically by the index.php packer script.
 */

///////// _bv_config.js

var Conf = {
	debug : false,
	js_path : '/js/',
	src_img_clear : '/js/bv/clear.gif',
	src_js_domready : '/js/bv/domready.js',
	src_htc_domready : '/js/bv/domready.htc',
	de_activate__attach_valid_windows : {
		prefix : 'bv',
		allowedTypes : 'newwin',
		viewerLocation : ''
	}
};


///////// _bv_utilities.js

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/
 * Bivia Utilities, v2.0
 * (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
 *
 * $Id$
 *~~~~*/


// set defaults for this file, which may have already been configured
if (!Conf) var Conf = {};
Conf.debug = Conf.debug || false; // note: setting to "true" here cannot be overridden by a "false" somewhere else
Conf.js_path = Conf.js_path || '/js/';
Conf.src_img_clear = Conf.src_img_clear || '/js/bv/clear.gif';
Conf.src_js_domready = Conf.src_js_domready || '/js/bv/domready.js';
Conf.src_htc_domready = Conf.src_htc_domready || '/js/bv/domready.htc';
Conf.ajax_request_timeout = Conf.ajax_request_timeout || 30;
Conf.ajax_response_timeout = Conf.ajax_response_timeout || 30;



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) {
			// 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
			} else {
				/*@cc_on @*/
				/*@if (@_win32) // Win IE 5+ loads js with direct call or htc with ondocumentready event
				//document.write('<script defer src="'+ Conf['src_js_domready'] +'"><'+'/script>');
				document.all.tags("TITLE")[0].addBehavior(Conf['src_htc_domready']);
				@else @*/
				/*@end @*/
			}
			bv.dom.bodyScan(); // a scanner to catch the rest, like Safari and Opera
			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
		check_nodes : 0,
		check_count : 0,
		bodyCheck : function() {
			var Cnt = document.getElementsByTagName('*').length;
			if (bv.dom.check_nodes == Cnt) bv.dom.check_count++;
			else bv.dom.check_count = 0; // every changes resets the count
			bv.dom.check_nodes = Cnt;
			return (
				bv.dom.check_count >= 3 // the number of nodes has been the same for 3 checks
				&&
				(H = document.documentElement || document.getElementsByTagName("html")) // there is a document node
				&&
				H.hasChildNodes() && H.childNodes.length >= 2 // document node has children; the body would be the second node
				&&
				(/[^>]+<\/body>/i).test(H.innerHTML) // some browsers imagine a </body> as soon as they see the <body>; this checks that the character immeditately before the imagined </body> is not a similarly-imagined closing tag, thus, any enclosing wrapper div (etc.) has finished loading -- BUT, the real </body> in the source must be on a line by itself!
			);
		}, // END dom.bodyCheck
		bodyScan : function() {
			if (bv.dom.bodyCheck()) bv.dom.ready('bodyScan');
			else if (!bv.dom.initialized) setTimeout("bv.dom.bodyScan();", 500);
		}, // END dom.bodyScan

		getElementsByClassName : function (el,TagsIn,Class) {
			var It = "\\b"+Class+"\\b";
			var rtn = [];
			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);
	}
}
*/


///////// sifr.js

/*	sIFR 2.0.2
	Copyright 2004 - 2006 Mike Davidson, Shaun Inman, Tomas Jogin and Mark Wubben

	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var hasFlash=function(){var a=6;if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1){document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+a+'))) \n</script\> \n');if(window.hasFlash!=null)return window.hasFlash}if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;return parseInt(b.charAt(b.indexOf(".")-1))>=a}return false}();String.prototype.normalize=function(){return this.replace(/\s+/g," ")};if(Array.prototype.push==null){Array.prototype.push=function(){var i=0,a=this.length,b=arguments.length;while(i<b){this[a++]=arguments[i++]}return this.length}}if(!Function.prototype.apply){Function.prototype.apply=function(a,b){var c=[];var d,e;if(!a)a=window;if(!b)b=[];for(var i=0;i<b.length;i++){c[i]="b["+i+"]"}e="a.__applyTemp__("+c.join(",")+");";a.__applyTemp__=this;d=eval(e);a.__applyTemp__=null;return d}}function named(a){return new named.Arguments(a)}named.Arguments=function(a){this.oArgs=a};named.Arguments.prototype.constructor=named.Arguments;named.extract=function(a,b){var c,d;var i=a.length;while(i--){d=a[i];if(d!=null&&d.constructor!=null&&d.constructor==named.Arguments){c=a[i].oArgs;break}}if(c==null)return;for(e in c)if(b[e]!=null)b[e](c[e]);return};var parseSelector=function(){var a=/^([^#.>`]*)(#|\.|\>|\`)(.+)$/;function r(s,t){var u=s.split(/\s*\,\s*/);var v=[];for(var i=0;i<u.length;i++)v=v.concat(b(u[i],t));return v}function b(c,d,e){c=c.normalize().replace(" ","`");var f=c.match(a);var g,h,i,j,k,n;var l=[];if(f==null)f=[c,c];if(f[1]=="")f[1]="*";if(e==null)e="`";if(d==null)d=document;switch(f[2]){case "#":k=f[3].match(a);if(k==null)k=[null,f[3]];g=document.getElementById(k[1]);if(g==null||(f[1]!="*"&&!o(g,f[1])))return l;if(k.length==2){l.push(g);return l}return b(k[3],g,k[2]);case ".":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;k=f[3].match(a);if(k!=null){if(g.className==null||g.className.match("(\\s|^)"+k[1]+"(\\s|$)")==null)continue;j=b(k[3],g,k[2]);l=l.concat(j)}else if(g.className!=null&&g.className.match("(\\s|^)"+f[3]+"(\\s|$)")!=null)l.push(g)}return l;case ">":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;j=b(f[3],g,">");l=l.concat(j)}return l;case "`":h=m(d,f[1]);for(i=0,n=h.length;i<n;i++){g=h[i];j=b(f[3],g,"`");l=l.concat(j)}return l;default:if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;l.push(g)}return l}}function m(d,o){if(o=="*"&&d.all!=null)return d.all;return d.getElementsByTagName(o)}function o(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}return r}();var sIFR=function(){var a="http://www.w3.org/1999/xhtml";var b=false;var c=false;var d;var ah=[];var al=document;var ak=al.documentElement;var am=window;var au=al.addEventListener;var av=am.addEventListener;var f=function(){var g=navigator.userAgent.toLowerCase();var f={a:g.indexOf("applewebkit")>-1,b:g.indexOf("safari")>-1,c:navigator.product!=null&&navigator.product.toLowerCase().indexOf("konqueror")>-1,d:g.indexOf("opera")>-1,e:al.contentType!=null&&al.contentType.indexOf("xml")>-1,f:true,g:true,h:null,i:null,j:null,k:null};f.l=f.a||f.c;f.m=!f.a&&navigator.product!=null&&navigator.product.toLowerCase()=="gecko";if(f.m&&g.match(/.*gecko\/(\d{8}).*/))f.j=new Number(g.match(/.*gecko\/(\d{8}).*/)[1]);f.n=g.indexOf("msie")>-1&&!f.d&&!f.l&&!f.m;f.o=f.n&&g.match(/.*mac.*/)!=null;if(f.d&&g.match(/.*opera(\s|\/)(\d+\.\d+)/))f.i=new Number(g.match(/.*opera(\s|\/)(\d+\.\d+)/)[2]);if(f.n||(f.d&&f.i<7.6))f.g=false;if(f.a&&g.match(/.*applewebkit\/(\d+).*/))f.k=new Number(g.match(/.*applewebkit\/(\d+).*/)[1]);if(am.hasFlash&&(!f.n||f.o)){var aj=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;f.h=parseInt(aj.charAt(aj.indexOf(".")-1))}if(g.match(/.*(windows|mac).*/)==null||f.o||f.c||(f.d&&(g.match(/.*mac.*/)!=null||f.i<7.6))||(f.b&&f.h<7)||(!f.b&&f.a&&f.k<312)||(f.m&&f.j<20020523))f.f=false;if(!f.o&&!f.m&&al.createElementNS)try{al.createElementNS(a,"i").innerHTML=""}catch(e){f.e=true}f.p=f.c||(f.a&&f.k<312);return f}();function at(){return{bIsWebKit:f.a,bIsSafari:f.b,bIsKonq:f.c,bIsOpera:f.d,bIsXML:f.e,bHasTransparencySupport:f.f,bUseDOM:f.g,nFlashVersion:f.h,nOperaVersion:f.i,nGeckoBuildDate:f.j,nWebKitVersion:f.k,bIsKHTML:f.l,bIsGecko:f.m,bIsIE:f.n,bIsIEMac:f.o,bUseInnerHTMLHack:f.p}}if(am.hasFlash==false||!al.getElementsByTagName||!al.getElementById||(f.e&&(f.p||f.n)))return{UA:at()};function af(e){if((!k.bAutoInit&&(am.event||e)!=null)||!l(e))return;b=true;for(var i=0,h=ah.length;i<h;i++)j.apply(null,ah[i]);ah=[]}var k=af;function l(e){if(c==false||k.bIsDisabled==true||((f.e&&f.m||f.l)&&e==null&&b==false)||(al.body==null||al.getElementsByTagName("body").length==0))return false;return true}function m(n){if(f.n)return n.replace(new RegExp("%\d{0}","g"),"%25");return n.replace(new RegExp("%(?!\d)","g"),"%25")}function as(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}function o(p,q,r,s,t){var u="";var v=p.firstChild;var w,x,y,z;if(s==null)s=0;if(t==null)t="";while(v){if(v.nodeType==3){z=v.nodeValue.replace("<","&lt;");switch(r){case "lower":u+=z.toLowerCase();break;case "upper":u+=z.toUpperCase();break;default:u+=z}}else if(v.nodeType==1){if(as(v,"a")&&!v.getAttribute("href")==false){if(v.getAttribute("target"))t+="&sifr_url_"+s+"_target="+v.getAttribute("target");t+="&sifr_url_"+s+"="+m(v.getAttribute("href")).replace(/&/g,"%26");u+='<a href="asfunction:_root.launchURL,'+s+'">';s++}else if(as(v,"br"))u+="<br/>";if(v.hasChildNodes()){y=o(v,null,r,s,t);u+=y.u;s=y.s;t=y.t}if(as(v,"a"))u+="</a>"}w=v;v=v.nextSibling;if(q!=null){x=w.parentNode.removeChild(w);q.appendChild(x)}}return{"u":u,"s":s,"t":t}}function A(B){if(al.createElementNS&&f.g)return al.createElementNS(a,B);return al.createElement(B)}function C(D,E,z){var p=A("param");p.setAttribute("name",E);p.setAttribute("value",z);D.appendChild(p)}function F(p,G){var H=p.className;if(H==null)H=G;else H=H.normalize()+(H==""?"":" ")+G;p.className=H}function aq(ar){var a=ak;if(k.bHideBrowserText==false)a=al.getElementsByTagName("body")[0];if((k.bHideBrowserText==false||ar)&&a)if(a.className==null||a.className.match(/\bsIFR\-hasFlash\b/)==null)F(a, "sIFR-hasFlash")}function j(I,J,K,L,M,N,O,P,Q,R,S,r,T){if(!l())return ah.push(arguments);aq();named.extract(arguments,{sSelector:function(ap){I=ap},sFlashSrc:function(ap){J=ap},sColor:function(ap){K=ap},sLinkColor:function(ap){L=ap},sHoverColor:function(ap){M=ap},sBgColor:function(ap){N=ap},nPaddingTop:function(ap){O=ap},nPaddingRight:function(ap){P=ap},nPaddingBottom:function(ap){Q=ap},nPaddingLeft:function(ap){R=ap},sFlashVars:function(ap){S=ap},sCase:function(ap){r=ap},sWmode:function(ap){T=ap}});var U=parseSelector(I);if(U.length==0)return false;if(S!=null)S="&"+S.normalize();else S="";if(K!=null)S+="&textcolor="+K;if(M!=null)S+="&hovercolor="+M;if(M!=null||L!=null)S+="&linkcolor="+(L||K);if(O==null)O=0;if(P==null)P=0;if(Q==null)Q=0;if(R==null)R=0;if(N==null)N="#FFFFFF";if(T=="transparent")if(!f.f)T="opaque";else N="transparent";if(T==null)T="";var p,V,W,X,Y,Z,aa,ab,ac;var ad=null;for(var i=0,h=U.length;i<h;i++){p=U[i];if(p.className!=null&&p.className.match(/\bsIFR\-replaced\b/)!=null)continue;V=p.offsetWidth-R-P;W=p.offsetHeight-O-Q;aa=A("span");aa.className="sIFR-alternate";ac=o(p,aa,r);Z="txt="+m(ac.u).replace(/\+/g,"%2B").replace(/&/g,"%26").replace(/\"/g, "%22").normalize() + S + "&w=" + V + "&h=" + W + ac.t;F(p,"sIFR-replaced");if(ad==null||!f.g){if(!f.g){if(!f.n)p.innerHTML=['<embed class="sIFR-flash" type="application/x-shockwave-flash" src="',J,'" quality="best" wmode="',T,'" bgcolor="',N,'" flashvars="',Z,'" width="',V,'" height="',W,'" sifr="true"></embed>'].join("");else p.innerHTML=['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" sifr="true" width="',V,'" height="',W,'" class="sIFR-flash"><param name="movie" value="',J,"?",Z,'"></param><param name="quality" value="best"></param><param name="wmode" value="',T,'"></param><param name="bgcolor" value="',N,'"></param> </object>'].join('')}else{if(f.d){ab=A("object");ab.setAttribute("data",J);C(ab,"quality","best");C(ab,"wmode",T);C(ab,"bgcolor",N)}else{ab=A("embed");ab.setAttribute("src",J);ab.setAttribute("quality","best");ab.setAttribute("flashvars",Z);ab.setAttribute("wmode",T);ab.setAttribute("bgcolor",N)}ab.setAttribute("sifr","true");ab.setAttribute("type","application/x-shockwave-flash");ab.className="sIFR-flash";if(!f.l||!f.e)ad=ab.cloneNode(true)}}else ab=ad.cloneNode(true);if(f.g){if(f.d)C(ab,"flashvars",Z);else ab.setAttribute("flashvars",Z);ab.setAttribute("width",V);ab.setAttribute("height",W);ab.style.width=V+"px";ab.style.height=W+"px";p.appendChild(ab)}p.appendChild(aa);if(f.p)p.innerHTML+=""}if(f.n&&k.bFixFragIdBug)setTimeout(function(){al.title=d},0)}function ai(){d=al.title}function ae(){if(k.bIsDisabled==true)return;c=true;if(k.bHideBrowserText)aq(true);if(am.attachEvent)am.attachEvent("onload",af);else if(!f.c&&(al.addEventListener||am.addEventListener)){if(f.a&&f.k>=132&&am.addEventListener)am.addEventListener("load",function(){setTimeout("sIFR({})",1)},false);else{if(al.addEventListener)al.addEventListener("load",af,false);if(am.addEventListener)am.addEventListener("load",af,false)}}else if(typeof am.onload=="function"){var ag=am.onload;am.onload=function(){ag();af()}}else am.onload=af;if(!f.n||am.location.hash=="")k.bFixFragIdBug=false;else ai()}k.UA=at();k.bAutoInit=true;k.bFixFragIdBug=true;k.replaceElement=j;k.updateDocumentTitle=ai;k.appendToClassName=F;k.setup=ae;k.debug=function(){aq(true)};k.debug.replaceNow=function(){ae();k()};k.bIsDisabled=false;k.bHideBrowserText=true;return k}();

if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac){
	sIFR.setup();
};


///////// ~site_init.js

var setSIFR = function () {
	sIFR.replaceElement(named({sSelector:"body.styleTypeDonL #contentMain h1,body.styleTypeDonL #contentMain h2", sFlashSrc:"/swf/myriad_pro_regular.swf", sColor:"#232323", sWmode:"transparent"}));
	sIFR.replaceElement(named({sSelector:"body.styleTypeLonD #contentMain h1,body.styleTypeLonD #contentMain h2", sFlashSrc:"/swf/myriad_pro_regular.swf", sColor:"#ffffff", sWmode:"transparent"}));
}

if (typeof sIFR == 'function' && bv) {
	bv.event.add(window, 'domready', setSIFR);
};
