<!--
function isEmailAddr(email)
{
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function validRequired(formField,fieldLabel,defaultVal)
{
	var result = true;
	var errDisplay = document.getElementById("err"+formField.name);
	if (formField.value == "" || formField.value == defaultVal)
	{
		errDisplay.innerHTML = "Please enter a value for the \"" + fieldLabel +"\" field."
		//alert('Please enter a value for the "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}
	
	return result;
}

function allDigits(str)
{
	return inValidCharSet(str,"0123456789");
}

function inValidCharSet(str,charset)
{
	var result = true;

	// Note: doesn't use regular expressions to avoid early Mac browser bugs	
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))<0)
		{
			result = false;
			break;
		}
	
	return result;
}

function validEmail(formField,fieldLabel,defaultVal,required)
{
	var result = true;
	var errDisplay = document.getElementById("err"+formField.name);
	if (required && !validRequired(formField,fieldLabel))
		result = false;

	if (result && ((formField.value.length < 3) || !isEmailAddr(formField.value)) )
	{
		errDisplay.innerHTML = "Please enter a complete email address in the form: yourname@yourdomain.com"
		formField.focus();
		result = false;
	}
   
  return result;

}

function validNum(formField,fieldLabel,defaultVal,required)
{
	var result = true;
	var errDisplay = document.getElementById("err"+formField.name);
	if (required && !validRequired(formField,fieldLabel))
		result = false;
  
 	if (result)
 	{
 		if (!allDigits(formField.value))
 		{
 			errDisplay.innerHTML = "Please enter a complete email address in the form: yourname@yourdomain.com"
			formField.focus();		
			result = false;
		}
	} 
	
	return result;
}


function validInt(formField,fieldLabel,required)
{
	var result = true;

	if (required && !validRequired(formField,fieldLabel))
		result = false;
  
 	if (result)
 	{
 		var num = parseInt(formField.value,10);
 		if (isNaN(num))
 		{
 			alert('Please enter a number for the "' + fieldLabel +'" field.');
			formField.focus();		
			result = false;
		}
	} 
	
	return result;
}


function validDate(formField,fieldLabel,required)
{
	var result = true;

	if (required && !validRequired(formField,fieldLabel))
		result = false;
  
 	if (result)
 	{
 		var elems = formField.value.split("/");
 		
 		result = (elems.length == 3); // should be three components
 		
 		if (result)
 		{
 			var month = parseInt(elems[0],10);
  			var day = parseInt(elems[1],10);
 			var year = parseInt(elems[2],10);
			result = allDigits(elems[0]) && (month > 0) && (month < 13) &&
					 allDigits(elems[1]) && (day > 0) && (day < 32) &&
					 allDigits(elems[2]) && ((elems[2].length == 2) || (elems[2].length == 4));
 		}
 		
  		if (!result)
 		{
 			alert('Please enter a date in the format MM/DD/YYYY for the "' + fieldLabel +'" field.');
			formField.focus();		
		}
	} 
	
	return result;
}

function validateForm(frm)
{
	// Customize these calls for your form

	// Start ------->
	if (!validRequired(frm.Name,"Name", "Your Name"))
		return false;

	if (!validEmail(frm.Email,"Email Address","Your Email Address",true))
		return false;

	//if (!validDate(frm.available,"Date Available",true))
	//	return false;

	if (!validNum(frm.Phone,"Phone Number",true))
		return false;
		
	if (!validRequired(frm.AddressLine1,"Address",true))
		return false;
		
	if (!validRequired(frm.City,"City",true))
		return false;
		
	if (!validRequired(frm.State,"State",true))
		return false;
	// <--------- End
	
	return true;
}

__n = false;
function isIE() {
	
	if (!__n)
		__n = navigator.appVersion;

	if (__n.indexOf('MSIE') != -1)
		return __n;
	
	return false;
}



function newWin(loc, w, h) {
	if (!w) { w = 630;}
	if (!h) { h = 500;}
	window.open(loc,"images","height="+h+",width="+w+",status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
	return false;
	
}

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days,path,domain,secure) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime() + (days*24*60*60*1000) );
   		expires = date.toGMTString();
  	}
   document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  	var cookie = readCookie("style");
  	var title = cookie ? cookie : getPreferredStyleSheet();
	setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 180, "/");
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

csize = 0;
szs = ['80%','90%','100%','110%','120%','130%','140%'];

function textSize(dir) {
	var cs = parseFloat(readCookie("txtsize"));
	if (!cs) { cs = csize; }
	if (dir=="up") {
			if (cs < szs.length-1) { 
				cs += 1;
				setSize(cs); 
			}
	} else {
			if (cs >= 1) { 
				cs -= 1;
				setSize(cs); 
			}
		}
}
function setSize(size) {
		createCookie("txtsize", size, 180, "/");
		csize = size;
		document.body.style.fontSize = szs[size];
}
function getAccessButtons(){
		html = "";	return html;
}
/*
function adjustClass(node, debug) {

  		if (node.nodeName=="LI") {
  			node.onmouseover=function() {
  				this.className="hover";
  				
    		}
  			node.onmouseout=function() {
  				this.className=this.className.replace("hover", "");
   			}
		}
}
startList = function() {
	
		if (document.all && document.getElementById) {	
			n = document.getElementById("topnav").childNodes[0];
			
			if (n) {
			l = n.childNodes.length;
			
			for (i=0; i<l; i++) {
 				node = n.childNodes[i];
 				adjustClass(node);
 				nl = node.childNodes.length;
 				
 				for (j=0;j<nl;j++) {
 					cn = node.childNodes[j];
 					
 					if (cn.nodeName=="UL") {
 						cl = cn.childNodes.length;
 						
 						for (k=0; k<cl; k++) {
 							cnode = cn.childNodes[k];	
 							adjustClass(cnode);
 						}
 					}
 				}	
			}
			}
		}
}
window.onload=startList;
*/

//UTILITIES
var isDOM = document.getElementById;


d = {
	$: function(id) {
		return document.getElementById(id);
	},
	getByTag: function(tagname) {
		return document.getElementsByTagName(tagname);
	},
	_tag: function(tag, parent) {
				var par = parent || document;

				return par.getElementsByTagName(tag);
			},

	_class: function(classname, tag, parent)	{
			var matches = [];
			var par = parent || document;

			var els = this._tag(tag, parent);
			var elsl = els.length;

			for(var i=0; i<elsl; i++) {
					if (els[i].className == classname)
						matches.push(els[i]);
				}

			if (matches.length == 1)
				return matches[0];

			return matches.length == 0 ? false : matches;


		},
	Parent: {
					_attr: function(obj, attr, value) {
							if (!obj)
								return false;

							pn = obj.parentNode;

							if (!pn || pn.nodeName.toLowerCase() == 'html')
								return false;

							if (pn && (pn.getAttribute(attr) == value)) {
									return pn;
								}

							return d.Parent._attr(pn, attr, value);


						}

	},
	Desc: {
				__check_par: function(node, parents, index) {

					if (parents.length == 0 || index < 0)
						return true; // if it comes here we know it found a match

					par = parents[index];

					//alert(node.parentNode.nodeName + ' ' + par);

					if (node.parentNode.nodeName.toUpperCase() == par.toUpperCase())
						return d.Desc.__check_par(node.parentNode, parents, index-1);
					else
						return false;

				},
				get: function(tagsn, root) {
					// send tag heirarchy separated by '>'
					// add support for ID & Class attributes later


					pars = tagsn.split(' ');

					node = pars.pop();
					tgl = pars.length;

					tags = d._tag(node, root);
					tgsl = tags.length;


					matched = [];

					for (i=0;i<tgsl;i++) {


						if (d.Desc.__check_par(tags[i], pars, tgl-1)) {
							matched.push(tags[i]);

						}
					}
					if (matched.length == 0) 
						return false;

					return matched;			
				}

			},
			Create: {
				elem: function(el, attrs) {
					e = document.createElement(el);
					for (a in attrs) {
						e[a] = attrs[a];
					}
					return e;

				},
				txt: function(text) {
					return document.createTextNode(text);
				}

			},
			append: function(tag, ntag) {			
				return tag.appendChild(ntag);

			},
			prepend: function(tag, ntag) {
				return tag.insertBefore(ntag, tag.firstChild);
			},
			Toggle: {
				display: function(tag) {
					if (!tag)
						tag = this;

					if (tag.style.display == 'block') 
						tag.style.display = 'none';
					else if (tag.style.display == 'none')
						tag.style.display = 'block';
					else
						tag.style.display = 'none';

				}
			},
			Content: {
				toggle: function(str, str2, tag) {
					if (tag.innerHTML == str)
						tag.innerHTML = str2;
					else if (tag.innerHTML == str2)
						tag.innerHTML = str;

				}

			}
}


function getById(id) {
		return document.getElementById(id);
	}


function getParentNodeByType(obj, type) {
		pn = obj.parentNode;
		if (pn.nodeName == type || pn.nodeName == type.toUpperCase()) {
				return pn;
			}
				
		return getParentNodeByType(pn, type);
	}


function removeWhiteSpaceNodes(parobj, rec) {
			var notWhiteSpaceNode = /\S/g;
			if (!parobj) return;				
			for (i=0;i<parobj.childNodes.length;i++){
				if ((parobj.childNodes[i].nodeType == 3) && (!notWhiteSpaceNode.test(parobj.childNodes[i].nodeValue))) {
					parobj.removeChild(parobj.childNodes[i]);
						i--;
				} else if (rec) {
					removeWhiteSpaceNodes(parobj.childNodes[i], true);
				}
			}
		}

//



//prototype's fabulous bind and $A
var $A = Array.from = function(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) {
    return iterable.toArray();
  } else {
    var results = [];
    for (var i = 0, length = iterable.length; i < length; i++)
      results.push(iterable[i]);
    return results;
  }
}
Function.prototype.bind = function() {
  var __method = this, args = $A(arguments), object = args.shift();
  return function() {
    return __method.apply(object, args.concat($A(arguments)));
  }
}
//


function extend(parent, subclass) {
	var o = { }
	for (var i in parent) {
		o[i] = parent[i];
		if (subclass[i]) {
			o['super_'+i] = parent[i];
		}
	}
	for (var i in subclass) {
		o[i] = subclass[i];
	}
	return o;
}



var E = {
	add: function(obj, evt, func) {
		if (document.addEventListener) obj.addEventListener(evt, func, false);
		else if(document.attachEvent) obj.attachEvent('on'+evt,func);
		},
	remove: function(obj, evt, func) {
			obj.removeEventListener(evt, func, false);
		},
	get: function(e, p) {
			var e = e || window.event;
			if (p) E.pd(e);
			return t = e.target || e.srcElement;
		},
	pd: function(e) {
			if (e.stopPropagation) e.stopPropagation();	 
			else if(e.cancelBubble) e.cancelBubble = true;			
			if (e.preventDefault) e.preventDefault();
			else e.returnValue = false; 
	},
	pos: function(e) {
		var left = 0;
		var top  = 0;
		while (e.offsetParent){
			left += e.offsetLeft;
			top  += e.offsetTop;
			e     = e.offsetParent;
		}
		left += e.offsetLeft;
		top  += e.offsetTop;

		return {x:left, y:top};
	}
}




var Req = {
	__GET: {},
	filename: '',
	query_string: location.search || '',
	type: '',
	uri: location.href,
	initialized: false,
	
	init: function() {
		ps = this.uri
				
		this.type = ps.match(/^https?|ftp|file/);		
		ps = ps.replace(/https?:\/\/|file:\/|ftp:\/\//g, '');
		
		ps = ps.split('/');
		psl = ps.length
		 
		ps[psl-1] = ps[psl-1].split('?');
		this.filename = (ps[psl-1].length > 1) ? ps[psl-1].shift() : ps.pop();
		
		params = location.search.slice(1).split('&');
		for (i=0;i<params.length;i++) {
			x = params[i].split('=');
			this.__GET[x[0]] = unescape(x[1]);
		}
		this.initialized = true;
	},
	get: function(key) {
		return (this.__GET[key] != undefined) ? this.__GET[key] : false;
	},
	set: function(params) {
		//params {'key':'value', 'key2':'value2'}
		try {
			for (key in params) {
				if (key != '')
					this.__GET[key] = params[key];
			}
		} catch(e) {}
	},
	serialize: function() {
		params = [];
		for (key in this.__GET)
			if (key != '')
				if (this.__GET[key] != undefined)
					params.push(key + '=' + escape(this.__GET[key]))
		
		return params.join('&');
		
	},
	Cookie: {
		set: function(name,value,days,path,domain,secure) {
			if (!days) days = 360;
		    
			var date = new Date();
		    date.setTime(date.getTime() + (days*24*60*60*1000) );
		   	expires = date.toGMTString();
		  	
		   document.cookie = name + "=" + escape(value) +
		    ((expires) ? "; expires=" + expires : "") +
		    ((path) ? "; path=" + path : "") +
		    ((domain) ? "; domain=" + domain : "") +
		    ((secure) ? "; secure" : "");
		},

		get: function(name) {
		  var nameEQ = name + "=";
		  var ca = document.cookie.split(';');
		  for(var i=0;i < ca.length;i++) {
		    var c = ca[i];
		    while (c.charAt(0)==' ') c = c.substring(1,c.length);
		    if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length,c.length));
		  }
		  return null;
		}
	}
}
Req.init();

var Util = {
		clean: function(parobj, rec) {
			removeWhiteSpaceNodes(parobj, rec);
		}
	}









var _TextScroller = {
	
	// @private

	_text: '',
	intrvl: 0,
	
	// @public
	content : '',
	height : undefined,
	speed : 1,
	delay : 10,
	top : 0,
	dir : '+',
	allowForceDirectionChange : true,
	pauseOnMouseOver : true,
	showScrollBars : false,
	isPlaying : false,
	
	
	// @private Methods
	__init : function() {
				
		removeWhiteSpaceNodes(this.content);
		
		_text = this.content.childNodes[1];
		if (this.height != undefined)
			_text.style.height = this.height + 'px';
		
		if (this.showScrollBars)
			_text.style.overflow = 'auto';
		else
			_text.style.overflow = 'hidden';
		
		if (this.allowForceDirectionChange)
			E.add(_text, 'click', this.__changeDir.bind(this));
		
		if (this.pauseOnMouseOver) {	
			E.add(_text, 'mouseover', this.__stopScroll.bind(this));
			E.add(_text, 'mouseout', this.__startScroll.bind(this));
		}
		
		this.__startScroll();

	},
	
	
	
	__startScroll : function(e) {
		if (this.isPlaying) return;
		this.isPlaying = true;
		this.intrvl = setInterval(this._animate.bind(this),60);
		this._tsH = this.content.childNodes[1].scrollHeight;
		this._tsT = this.content.childNodes[1].scrollTop;
		this.dc = 0;
		this.y = this._tsT;
		this._bx = this.content.childNodes[1];
	},
	
	_animate : function() {	
			
			if (this.dir == '+') {
				if ((this._tsH - this.y) <= this.height) {
					if (this.dc == this.delay) {
						this.dir = '-'; this.dc = 0;
					} else {
						this.dc += 1;
					}
				} else {
					this.y+=this.speed;
				}
			
			} else {
				if (this.y <= -10) {
					if (this.dc == this.delay) { 
						this.dir = '+'; this.dc = 0;
					} else {
						this.dc += 1;
					}
				} else {
					this.y-=this.speed;
				}
			}
			
			this._bx.scrollTop = this.y;
		
	},
	
	__changeDir : function(e) {
		this.dir = (this.dir == '-') ? '+' : '-';
	},
	
	__stopScroll : function(e) {
		clearInterval(this.intrvl);
		this.isPlaying = false;
	},
	
	startScroll : function(pnl) {
		this.__init(); //will start after initialising.
		//to call without init, use private method __startScroll
	}
	
	
}



function TextScroller() {}
TextScroller.prototype = _TextScroller

function setTextScroller() {
	pnl = getById("fragsuccess");	
	
	if (pnl) {
		scroller = new TextScroller();
		scroller.speed = 1;
		scroller.delay = 20; //delay at begin and end
		scroller.height = 100; // height of the box. this can also be set using css
		scroller.content = pnl; //
		scroller.allowForceDirectionChange = true; //changes direction on click
		scroller.pauseOnMouseOver = true;
		scroller.startScroll();
		
	} else {
		return;
	}

}







var _ContinuousScroller = {
	options: {
		height: 200,
		width: 200,
		speed_multiplier: 10,
		scroll_child: 0,
		delay: 60,
		speed: 3
	},
	id: '',
	container: '',
	scroll_box: '',
	//private
	_intrvl: false,
	_is_playing: false,
	_total_elms: 0,
	_original_height: 0,
	_original_width: 0,
	_wrapper: '',
	_pause_tmr: 1,
	_fc_out: 0,
	
	init: function(c, opts) {
		this.id = c;
		
		this.container = d.$(c); //send a string (ID) of html element;
		removeWhiteSpaceNodes(this.container);
		this.merge_options(opts);
		
		if (opts && opts.container && opts.container != c) {
			this.scroll_box = d.$(opts.container);
		} else {
			this.scroll_box = this.container.childNodes[this.options.scroll_child];
			if (this.scroll_box.nodeName.toUpperCase() == 'H4') {
				this.scroll_box = this.container.childNodes[this.options.scroll_child + 1];
			}
		}
		
		//console.log(this.scroll_box)
		
		// to support blocks without a title
		
		this._original_height = this.scroll_box.scrollHeight;
		this._original_width = this.scroll_box.offsetWidth;
 
		removeWhiteSpaceNodes(this.scroll_box);
		this._total_elms = this.scroll_box.childNodes.length

		this.setup();
		this.start();
		
	},
	setup: function() {
		var w = this._wrapper = document.createElement('div');
		w.id = this.id + '__wrapper';
		
		w.style.height = this.options.height + 'px';
		w.style.overflow = 'hidden';
		w.style.position = 'relative';
		//w.style.width = this._original_width + 'px';
		
		//this.container.appendChild(this._wrapper);
		try {
			this.scroll_box.parentNode.insertBefore(w, this.scroll_box);
		} catch(e) {
			//this.container.appendChild(this._wrapper);
		}
		w.appendChild(this.scroll_box);
				
		this.scroll_box.style.height = this._original_height + 'px';
	},
	start: function() {
		this._intrvl = setInterval(this._animate.bind(this), this.options.speed * this.options.speed_multiplier);
	},
	merge_options: function(opts) {
		for (var i in opts) {
			this.options[i] = opts[i];
		}
	},
	get_style: function(el, prop) {
		
		if (el.currentStyle) {
				return fc.currentStyle[prop];
		} else if (window.getComputedStyle) {
			try {
				return parseInt(document.defaultView.getComputedStyle(el,  '').getPropertyValue(prop));
			} catch(e) { return ''; }
		}							
	},
	_animate: function() {

		var x = this._wrapper.scrollTop;
		var fc = this.scroll_box.childNodes[0];
		
		mb = this.get_style(fc, 'margin-bottom');
		//var fch = this.get_style(fc, 'height');
		if (mb == 'auto' || !mb)
			mb = 0;
			
		fch = fc.offsetHeight;
		
		if (this._pause_tmr == 0) {
				this._wrapper.scrollTop =  this._wrapper.scrollTop + 1;
				
				if(x >= fch + mb) {
					//
					this._pause_tmr = 1;
					this.scroll_box.appendChild(fc);
					this._wrapper.scrollTop = 0;
				}
		} else {
			this._pause_tmr += 1;
		}	
		if (this._pause_tmr > this.options.delay) {
			this._pause_tmr = 0
		}
	}
	
}


function ContinuousScroller(container, options) {
	this.init(container, options); return this;
}
ContinuousScroller.prototype = _ContinuousScroller;



function HorizontalScroller(container, options) {
	this.init(container, options); return this;
}
HorizontalScroller.prototype = extend(_ContinuousScroller, {
	dir: 'left',
	setup: function() {
		this.super_setup();
		this._wrapper.style.width = this.options.width + 'px';
		this.scroll_box.style.whiteSpace = 'nowrap';
		
		//console.log(this._wrapper.scrollLeft, this._wrapper.scrollWidth)
		//console.log(this.container.innerHTML)
		//this._wrapper.scrollLeft = 100;
		
		
		
		
		
	},
	_animate: function() {
		var x = this._wrapper.scrollWidth;
		var wx = this.options.width;
		
		if (this._pause_tmr == 0) {
				
				if (this.dir == 'left')
					this._wrapper.scrollLeft = this._wrapper.scrollLeft + 1;
				else
					this._wrapper.scrollLeft = this._wrapper.scrollLeft - 1;
				
				if(this._wrapper.scrollLeft + wx >= x || this._wrapper.scrollLeft < 1) {
					//
					this._pause_tmr = 1;
					//this.scroll_box.appendChild(fc);
					//this._wrapper.scrollLeft = 0;
					this.toggle_dir();
				}
		} else {
			this._pause_tmr += 1;
		}	
		if (this._pause_tmr > this.options.delay) {
			this._pause_tmr = 0
		}
		
	},
	toggle_dir: function() {
		if (this.dir == 'left')
			this.dir = 'right';
		else
			this.dir = 'left';
	}
	
})

function NewsFeed(container, options) {
	this.init(container, options);
	return this;
}
NewsFeed.prototype = extend(_ContinuousScroller, {
	container: '',
	current_index: 0,
	old_index: 0,
	_current: '',
	_old: '',
	_old_opacity: 0,
	_current_opacity: 0,
	setup: function() {
		this.super_setup();
		for (var i=0; i<this._total_elms; i++) {
			var elc = this.scroll_box.childNodes[i];
			
			//console.log(elc)
			elc.style.height = this.options.height + 'px';
			elc.style.display = 'none';
			elc.style.position = 'absolute';
			elc.style.left = '0px';
			elc.style.top = '0px';
			elc.style.opacity = '0';
			this.set_opacity(elc, 0);
			
			
		}
		this.current_index = 0;
		this.old_index = 0;
		this.get_current();
		
		
	},
	set_opacity: function(el, opacity) {
		el.style.opacity = opacity;
		if (isIE()) {
			el.style.filter = "alpha(opacity=" + opacity*100 + ")";
			el.style.background = this.options.bgcolor;
		}
	},
	get_current: function() {
		this._current = this.scroll_box.childNodes[this.current_index];
		this._current.style.display = 'block';
		
		this._old = this.current_index == this.old_index ? false : this.scroll_box.childNodes[this.old_index];

	},
	next: function() {
		this.old_index = this.current_index;
		this.current_index += 1;
		if (this.current_index >= this._total_elms)
			this.current_index = 0;
		
		this._current_opacity = 0;
		this._old_opacity = 1;
			
		this.get_current();
		this.start();
	},
	_animate: function() {
		var incr = 0.01;
		
		
		
		if (this._old) {	
			if (this._old_opacity < 0) {
				this._old.style.display = 'none';
			} else {
				this._old_opacity = this._old_opacity - incr;
				this.set_opacity(this._old, this._old_opacity);
				return;
			}
		}
		
		
		
		this._current_opacity = this._current_opacity + incr;
		this.set_opacity(this._current, this._current_opacity);
		
		
		//console.log(co >= max);
		
		if (this._current_opacity > 1) {
			clearInterval(this._intrvl);
			setTimeout(this.next.bind(this), this.options.delay);	
			
		}
		
		
		
	}
})


function debug(msg) {
	w = d.$('debugwin');
	if (!w) {
		w = document.createElement('div');
		d.$('container').appendChild(w)
	}
	w.innerHTML += msg + '<br />';
}





function domReady()
{
	this.n = typeof this.n == 'undefined' ? 0 : this.n + 1;
	
	if (typeof document.getElementsByTagName != 'undefined' 
		&& (document.getElementsByTagName('body')[0] != null || document.body != null)) {	
		//alert("The DOM is ready!");

	} else if(this.n < 60) {
		setTimeout('domReady()', 250);
	}
};

//domReady();

PNG = {
	fixed: [],
	needFix: function (img) {
		var ie = isIE();
		if (!ie)
			return false;

		var arVersion = ie.split("MSIE")
		var version = parseFloat(arVersion[1])
	
		if ((version <= 5.5) || (!document.body.filters))
			return false;
		
		var imgName = img.src
		if (!imgName)
			return false;
		
		imgName = imgName.toUpperCase()
		if (imgName.substring(imgName.length-3, imgName.length) != "PNG")
			return false;
		
		return true;
	},
	isFixed: function(img) {
		for (f=0;f<this.fixed.length;f++) {
			if (this.fixed[f] == img)
				return true;
				
		}
		return false;
	},

	fixAll: function() {
		var imgs = d.getByTag('img');
		var imgl = imgs.length;
		
	   for(var i=0; i<imgl; i++) {
		  this.fix(imgs[i]);  
	   }
	
	},
	
	fix: function(img) {
		
		if (!this.needFix(img) || this.isFixed())
			return true;
		
		
		var src = img.src;		
		var imgName = src.toUpperCase()
		
		var imgID = (img.id) ? "id='" + img.id + "' " : ""
		var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		var imgStyle = "display:inline-block;" + img.style.cssText 
			if (img.align == "left") imgStyle = "float:left;" + imgStyle
			if (img.align == "right") imgStyle = "float:right;" + imgStyle
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
			var strNewHTML = "<span " + imgID + imgClass + imgTitle
			 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			 + "(src=\'" + src + "\', sizingMethod='scale');\"></span>" 
			 img.outerHTML = strNewHTML

		this.fixed.push(img);
	}
}

function fixPNG(img) {
	PNG.fix(img);
}

fixed_all_pngs = false;
function fixPNGs() {
	PNG.fixAll();	
}







function rand(end) {
	return Math.floor(Math.random()*end);
}


	
function ImageRotator(container, image_arr) {
	this.container = container;
	this.images = image_arr;
	return true;
}
ImageRotator.prototype.start = function() {
	var c = document.getElementById(this.container)
	if(!c) return;
	
	var r = rand(this.images.length)
	var last = Req.Cookie.get('last_img')
	while (r == last) {
		r = rand(this.images.length);
	}
	c.style.background = 'url('+this.images[r]+') no-repeat right';
	Req.Cookie.set('last_img', r);
	
}



CollapsibleMenu = {
	options: {},
	init: function(holder, opts) {
		
		this.options = opts || {}
		Util.clean(d.$(holder), true);
		
		uls = d.Desc.get('ul li ul', d.$(holder));
		
		
		for (i=0;i<uls.length;i++ ) {
			//some empty UL tags seem to show up sometimes
			
			var ignore = 0;
			
			if (this.options.only) {
				
				for (var j=0; j < this.options.only.length; j++) {
					//console.log(i, j)
					if (i == j) {
						ignore = 1;
						break;
					}
				}
				
			}
			
			//console.log(ignore)
			
			if (ignore == 1)
				continue;
			
			try {
				//remove unwanted whitespace nodes
				while(uls[i].childNodes[0].nodeType == 3) {
					uls[i].childNodes[0].parentNode.removeChild(uls[i].childNodes[0])
				}
				//console.log(uls[i].childNodes.length)
			} catch(e) {
				continue;
			}
			
			uls[i].style.borderLeft = '1px solid #ccc';
			uls[i].style.paddingLeft = '3px';
			uls[i].toggle = d.Toggle.display;
			uls[i].toggle();
			
			
			a = d.Create.elem('a', {'href':'#'})
			d.append(a, d.Create.txt('+'));
			
			a.className = 'hideshow_btn';
			
			E.add(a, 'click', CollapsibleMenu.toggle)
			
			a.toggle = d.Content.toggle;
			
			a.style.width 		= '10px';
			a.style.styleFloat	= 'left';
			a.style.padding 	= '1px';
			a.style.margin 		= '0 2px 0 -9px';
			a.style.position 	= 'relative';
			a.style.border 		= '0px solid #ccc';
			a.style.background 	= '#fff';
			a.style.styleFloat = 'left';
			
			//uls[i].parentNode.firstChild.style.fontWeight = 'bold';
			
			d.prepend(uls[i].parentNode, a);
			
		}
	},
	toggle: function(e) {
		evt = E.get(e, true);
		evt.toggle('-', '+', this);		
		ul = d.Desc.get('li ul', evt.parentNode);
		ul[0].toggle();
		
	}

}


var lBox = {
	Cache: {
		__cached__:{},
		get: function(id) { return this.__cached__[id] },
		put: function(id, content) { this.__cached__[id] = content;}
	},
	init: function(url, id) {
		this.id = id || '__lbox__';
		this.url = url;
		$('body').prepend('<div class="lbox" id="'+this.id+'"><div id="'+this.id+'content" class="lbox_content"></div></div>');
		var lb = $('#'+this.id);
		
		lb.css({ position:'fixed', top:-300, left:'50%',marginLeft:-250,
			background: '#333', zIndex: 9000, height: 300, width:500})

		if (!isIE()) {		
		lb.animate({top: 0, opacity: 1.0}, 300);
		}
		lb.append('<div class="lbox_footer" id="'+this.id+'footer"><a href="#" id="'+this.id+'close_btn" class="lbox_close_btn">Close</a></div>');
		$('#'+this.id+'close_btn').bind('click', this.exit.bind(this)).css({color:'#fff'});
		$('#'+this.id+'footer').css({padding:5});
		
		if (isIE()) { //ie hacks to fake positioned
			lb.css({position:'absolute'});
			sTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop
				$('#'+this.id).css({top:sTop});
			window.onscroll = function() { 
				sTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop
				$('#'+this.id).css({top:sTop});
			}.bind(this);
		}
		var _html = this.Cache.get(url);
		if (_html) this.set_content(_html)
		else $.get(url, {}, this.get_content.bind(this));
	},
	New: function(url) {
		this.init(url);
	},
	Confirm: function(url, cb) {
		this.init(url);
		this.onAction = cb;
		$('#'+this.id+'footer').append('<div class="buttons" style="float:right;"><button type="button" name="ok" id="'+this.id+'ok_button">Continue</button>\
							<button type="button" name="cancel" id="'+this.id+'cancel_button">Cancel</button></div>')
		
		$('#'+this.id+'ok_button').bind('click', this.user_action.bind(this));
		$('#'+this.id+'cancel_button').bind('click', this.user_action.bind(this));
	},
	exit: function(e) {
		$('#'+this.id).remove();
		if (isIE()) { window.onScroll = undefined};
	},
	user_action: function(e) {
		var btn = $(e.target)
		//console.log()
		action = (btn.attr('name') == 'ok' ? true : false)
		this.onAction(action);
	},
	get_content: function(html) {
		this.Cache.put(this.url, html)
		this.set_content(html);
	},
	set_content: function(html) {
		$('#'+this.id+'content').empty().append(html);
	}
	
}

var Site = {
	init: function() {
		this.Disclaimer.init();
	},
	Disclaimer: {
		init: function() {
			var objs;
			
			objs = $("a[href^='mailto:']");
			objs.bind('click', this.show_disclaimer.bind(this));
			
			
			
			objs = $("form[action^='http://jweb.justia.com/sm/contactus']");
			objs.bind('submit', this.show_form_disclaimer.bind(this));
			
			
			
			obsj = $("li.section_12 a").bind('click', this.show_custom_disclaimer.bind(this));
			
			
		},
		show_disclaimer: function(e) {
			e.preventDefault();
			this.forward_to = $(e.target).attr('href');
			lBox.Confirm('files/email_disclaimer.html', this.user_decide.bind(this));
		},
		show_custom_disclaimer: function(e) {
			e.preventDefault();
			this.forward_to = $(e.target).attr('href');
			lBox.Confirm('files/resources_disclaimer.html', this.user_decide.bind(this));
		},
		user_decide: function(confirmed) {
			if (confirmed)
				location.href = this.forward_to;
			
			lBox.exit();
		},		
		show_form_disclaimer: function(e) {
					e.preventDefault();
					this._form = e.target;
					lBox.Confirm('files/email_disclaimer.html', this.user_decide_submit.bind(this));
		},
		user_decide_submit: function(confirmed) {
			if (confirmed)
				this._form.submit();
			else
				this._form = undefined;

			lBox.exit();
		}
				
				
	}	
}


window.onload = function() {
		setTextScroller();
		//fixPNGs();
		
		Site.init();
		
	};



