/*
/////////////////////////////
Copyright (c) 2008 Seth Van Booven
OnTheSnow.com Globals
Version 1.0 (2008-05-15)
/////////////////////////////
*/

/*
/////////////////////////////
	Globals
/////////////////////////////
*/

if (typeof OTS == 'undefined') {
	var OTS = {};
}

OTS.domain = '';
OTS.baseURL = '' + OTS.domain;
OTS.imgURL = '' + OTS.domain;
/*
OTS.domain = 'onthesnow.com';
OTS.baseURL = 'http://dev1.' + OTS.domain;
OTS.imgURL = 'http://dev1.' + OTS.domain;
*/

OTS.$ = function() {
	var oArr = [];
	var len = arguments.length;
	for (var i = 0; i < len; ++i) {
		var o = arguments[i];
		if (typeof o == 'string') {
			o = document.getElementById(o);
		}
		if (len == 1) return o;
		oArr.push(o);
	}
	return oArr;
}
OTS.getElm = function(id) {
	return (typeof id != 'object') ? OTS.$(id) : id;
}
OTS.hasParent = function(obj, parent) {
	var el = OTS.getElm(obj);
	var an = OTS.getElm(parent);
	while (el != document && el != null) {
		if (el == an) return true;
		el = el.parentNode;
	}
	return false;
}
OTS.isContained = function(obj, e) {
	var e = window.event || e;
	var c = e.relatedTarget || ((e.type == 'mouseover') ? e.fromElement : e.toElement);
	while (c && c != obj) {
		try {
			c = c.parentNode;
		} catch(e){
			c = obj;
		}
	}
	if (c == obj)	{
		return true;
	} else {
		return false;
	}
}
OTS.setHTML = function(id, s) {
	var o = OTS.getElm(id);
	if (!o) return;
	o.innerHTML = s;
}
OTS.addHTML = function(id, s) {
	var o = OTS.getElm(id);
	if (!o) return;
	o.innerHTML += s;
}
OTS.getHTML = function(id) {
	var o = OTS.getElm(id);
	if (!o) return;
	return o.innerHTML;
}
OTS.setStyle = function(id, s, v) {
	var o = OTS.getElm(id);
	if (!o) return;
	if (s == 'opacity') {
		OTS.setOpacity(o, v);
	} else {
		o.style[s] = v;
	}
}
OTS.getStyle = function(id, s) {
	var o = OTS.getElm(id);
	if (!o) return;
	if (s == 'opacity') {
		
	} else {
		if (o.currentStyle) {
			var x = o.currentStyle[s];
		} else if (window.getComputedStyle) {
			var x = document.defaultView.getComputedStyle(o, null).getPropertyValue(s);
		}
		return x;
	}
}
OTS.setClass = function(id, s) {
	var o = OTS.getElm(id);
	if (!o) return;
	o.className = s;
}
OTS.addClass = function(id, s) {
	var o = OTS.getElm(id);
	if (!o) return;
	var n = s;
	if (o.className != '') {
		n = ' ' + n;
	}
	o.className += n;
}
OTS.delClass = function(id, s) {
	var o = OTS.getElm(id);
	if (!o) return;
	var n = s;
	if (o.className != '') {
		n = ' ' + n;
	}
	o.className = o.className.replace(n, '');
}
OTS.setOpacity = function(o, opacity) {
	o.style.opacity = (opacity / 100);
	o.style.MozOpacity = (opacity / 100);
	o.style.KhtmlOpacity = (opacity / 100);
	o.style.filter = 'alpha(opacity=' + opacity + ')';
}
OTS.getPos = function(obj) {
	return {
		left : OTS.getOffset(obj, 'left'),
		top : OTS.getOffset(obj, 'top')
	}
}
OTS.getOffset = function(obj, type) {
	var curoffset = (type == 'left') ? obj.offsetLeft : obj.offsetTop;
	var elm = obj.offsetParent;
	while (elm != null) {
		curoffset += (type == 'left') ? elm.offsetLeft : elm.offsetTop;
		var ml = parseInt(OTS.getStyle(elm, 'marginLeft'));
		if (type == 'left' && ml > 0 && document.all) {
			curoffset -= ml;
		}
		elm = elm.offsetParent;
	}
	return curoffset;
}
OTS.getPageScroll = function(obj) {
	var o = obj;
	var y;
	if (obj == null) {
		if (self.pageYOffset) {
			y = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop) {
			y = document.documentElement.scrollTop;
		} else if (document.body) {
			y = document.body.scrollTop;
		}
	} else {
		if (o.pageYOffset) {
			y = o.pageYOffset;
		} else if (o.documentElement && o.documentElement.scrollTop) {
			y = o.documentElement.scrollTop;
		} else if (o) {
			y = o.scrollTop;
		}
	}
	return y;
}
OTS.setPageScroll = function(obj, y) {
	var o = obj;
	if (o.pageYOffset) {
		o.pageYOffset = y;
	} else if (o.documentElement && o.documentElement.scrollTop) {
		o.documentElement.scrollTop = y;
	} else if (o) {
		o.scrollTop = y;
	}
}
OTS.getPageSize = function() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight) {
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	if (yScroll < windowHeight) {
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}
	if (xScroll < windowWidth) {
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	return {
		pageWidth : pageWidth,
		pageHeight : pageHeight,
		windowWidth : windowWidth,
		windowHeight : windowHeight
	}
}
OTS.getQuery = function(v, s, d1, d2) {
	var q = (!s) ? unescape(location.search).substring(1) : s;
	if (!q) return '';
	var z1 = (!d1) ? '=' : d1;
	var z2 = (!d2) ? '&' : d2;
	var j = q.split(z2);
	for (var i = 0; i < j.length; i++) {
		var c = j[i].split(z1);
		c[0] = c[0].replace(/^\s+|\s+$/g, '');
		c[1] = c[1].replace(/^\s+|\s+$/g, '');
		if (v == c[0]) {
			return c[1];
		}
	}
	return '';
}
OTS.setCookie = function(name, value, hours, path, domain) {
	if (!hours) hours = 1000000; /* 100+ years */
	var d = new Date();
	d.setTime(d.getTime() + (hours * 3600 * 1000));
	document.cookie = name + '=' + escape(value) + ';expires=' + d.toGMTString() + ';path=' + ((path) ? path : '/') + ((domain) ? ';domain=' + domain : '');
}
OTS.getCookie = function(name) {
	if (name == null) {
		return document.cookie;
	} else {
		var cArr = document.cookie.split(';');
		for (var i = 0; i < cArr.length; ++i) {
			var c = cArr[i].split('=');
			if (c[0] && c[1]) {
				c[0] = c[0].replace(/^\s+|\s+$/g, '');
				c[1] = c[1].replace(/^\s+|\s+$/g, '');
				if (name == c[0]) {
					return unescape(c[1]);
				}
			}
		}
		return '';
	}
}
OTS.delCookie = function(name, path, domain) {
	if (OTS.getCookie(name)) {
		document.cookie = name + '=' + ((path) ? ';path=' + path : '') + ((domain) ? ';domain=' + domain : '') + ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
	}
}
OTS.noValue = function(o, c) {
	if (o.value != o.title) return;
	o.value = '';
	if (!c) c = 'recall';
	o.className = o.className.replace(c, '');
}
OTS.reValue = function(o, c) {
	if (o.value != '') return;
	o.value = o.title;
	if (!c) c = 'recall';
	o.className += ' ' + c;
}
OTS.randArray = function(a) {
	for (var j, x, i = a.length; i; j = parseInt(Math.random() * i), x = a[--i], a[i] = a[j], a[j] = x);
	return a;
}
OTS.ease = {};
OTS.ease.strongEaseOut = function(t,b,c,d) {
	return c*((t=t/d-1)*t*t*t*t+1)+b;
}

OTS.ajax = function(url, method, post, xml) {
	this.url = url;
	this.method = method;
	this.error = this.processErr;
	this.post = (post == null) ? 'get' : post;
	this.xml = (xml == null) ? '' : xml;
	this.id = null;
	this.html = '';
}
OTS.ajax.prototype.request = function() {
	if (window.XMLHttpRequest) {
		this.req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		this.req = new ActiveXObject('Microsoft.XMLHTTP');
	}
	if (this.req) {
		var _this = this;
		this.req.onreadystatechange = function() {
			_this.processReq();
		};
		this.req.open(this.post, this.url, true);
		this.req.send(null);
	} else {
		return;
	}
}
OTS.ajax.prototype.processReq = function() {
	if (this.req.readyState == 4) {
		if (this.req.status == 200) {
			var s = (this.xml == 'xml') ? this.req.responseXML : this.req.responseText;
			this.method(s, this.id, this.html);
		} else {
			/*alert('There was a problem retrieving your request. ' + this.req.statusText);*/
		}
	}
}
OTS.ajax.prototype.processErr = function(s) {
	/*alert('There was a problem retrieving your request. ' + s);*/
}

OTS.gaTrkImp = function(a) {
	try {
		if (a) {
			pageTracker._trackPageview(a);
		} else {
			pageTracker._trackPageview();
		}
	} catch(err) {}
	try {
		if (a) {
			pageTracker2._trackPageview(a);
		} else {
			pageTracker2._trackPageview();
		}
	} catch(err) {}
}
OTS.gaTrkEvt = function(a, b, c) {
	try {
		pageTracker._trackEvent(a, b, c);
	} catch(err) {}
	try {
		pageTracker2._trackEvent(a, b, c);
	} catch(err) {}
}

/*
/////////////////////////////
	ScrollToTop
/////////////////////////////
*/

OTS.scrollToObj = function(o) {
	var o = OTS.$(o);
	if (!o) return;
	var p = OTS.getPos(o);
	var t = (new Date()).getTime();
	var b = OTS.getPageScroll();
	var c = p.top - b;
	var d = 250;
	var s = new OTS.scrollTo(t, b, c, d);
}
OTS.scrollToTop = function() {
	var t = (new Date()).getTime();
	var b = OTS.getPageScroll();
	var c = 0 - b;
	var d = 250;
	var s = new OTS.scrollTo(t, b, c, d);
}
OTS.scrollTo = function(t, b, c, d) {
	this.slideClear();
	this.t = t;
	this.b = b;
	this.c = c;
	this.d = d;
	var _this = this;
	this.t1 = window.setInterval(function() {
		_this.slideAni();
	}, 10);
};
OTS.scrollTo.prototype.slideAni = function() {
	var t = (new Date()).getTime() - this.t;
	if (t > this.d) {
		this.slideClear();
		//scrollTo(0, 0);
		return;
	} else {
		var x = OTS.ease.strongEaseOut(t, this.b, this.c, this.d);
		scrollTo(0, x);
	}
}
OTS.scrollTo.prototype.slideClear = function() {
	if (this.t1) {
		window.clearInterval(this.t1);
		this.t1 = null;
	}
}

/*
/////////////////////////////
	Misc
/////////////////////////////
*/

OTS.popWin = function(url, name, options) {
	return window.open(url, name, options);
}
OTS.popWinOptions = function(w, h, toolbar, status, scrollbars, resizeable) {
	var sw = screen.width;
	var sh = screen.height;
	if (w == null) w = (sw >= 1024) ? 925 : 625;
	if (h == null) h = (sw >= 1024) ? 600 : 500;
	if (toolbar == null) toolbar = 'no';
	if (status == null) status = 'yes';
	if (scrollbars == null) scrollbars = '1';
	if (resizeable == null) resizeable = 'yes';
	var cx = (sw * .5) - (w * .5);
	var cy = (sh * .5) - (h * .5);
	var sOptions = 'toolbar=' + toolbar + ',menubar=no,status=' + status + ',scrollbars=' + scrollbars + ',resizable=' + resizeable + ',screenX=' + cx + ',screenY=' + cy + ',left=' + cx + ',top=' + cy + ',width=' + w + ',height=' + h + '';
	return sOptions;
}

OTS.getNewsId = function() {
	var u = location.toString();
	var m = u.match(/\/a\/(\d+)/);
	var id = 0;
	if (m) {
		id = m[0].substring(3);
	}
	return id;
}

OTS.printThis = function(id) {
	var o = OTS.$(id);
	if (!o) {
		o = document.body;
		/*o = OTS.$('storypage');*/
	}
	if (!o) return;
	var s = o.innerHTML;
	s = s.split('<!-- STORY STARTS HERE -->');
	s = s[1].split('<!-- STORY ENDS HERE -->');
	s = s[0];
	s = s.replace(/(\n|\r)+/ig, '');
	s = s.replace(/<script[^>]*?>.*?<\/script>/ig, '');
	s = s.replace(/<style[^>]*?>.*?<\/style>/ig, '');
	s = s.replace(/on(click|mouseover|mouseout)="([^>]+)"/ig, '');
	s = s.replace(/(<img([^>]+)>)/ig, '');
	var html = '';
	html += '<html><head><title>Print this page</title>';
	html += '<link rel="stylesheet" href="' + OTS.imgURL + '/ots/css/print.css" media="all" />';
	html += '</head><body onload="if(window.print)window.print();">';
	html += '<p><img src="' + OTS.imgURL + '/ots/images/logo_sm.gif" alt="" border="0" align="left" /> <div align="right"><a href="#" onclick="window.print(); return false;">Print this page</a></div></p><br clear="all" />';
	html += s;
	html += '<p>URL: <a href="' + location.href + '">' + location.href + '</a></p>';
	html += '<hr /><p>Copyright &#169; 1968-2008 Mountain News Corp. All Rights Reserved.</p>';
	html += '</body></html>';
	var p = OTS.popWin('', 'print_pop', OTS.popWinOptions(650, 450));
	p.document.write(html);
	p.document.close();
	var sid = OTS.getNewsId();
	OTS.gaTrkEvt('ARTLNKS', 'open', sid + ' + Print');
}

OTS.emailThis = function(id, title) {
	var b = '';
	var o = OTS.$(id);
	if (!o) {
		o = OTS.$('storybody');
	}
	if (o) {
		b = o.innerHTML;
		b = b.replace(/<br(\s+\/)?>/ig, '\n');
		b = b.replace(/(<([^>]+)>)/ig, '');
		ba = b.split(' ');
		var ts = '';
		for (var i = 0; i < ba.length; i++) {
			ts += ba[i] + ' ';
			if (i == 50) {
				ts += '...';
				break;
			}
		}
		b = ts;
	}
	b = b.replace(/#/g, '%23');
	b = b.replace(/&/g, '%26');
	b = b.replace(/\n+/ig, '%0D%0A');
	b += '%0D%0A%0D%0AURL: ' + location.href;
	var t = 'OnTheSnow';
	if (title == null) {
		title = '';
		var hd = OTS.$('storyhd');
		if (hd) {
			title = '- ' + hd.innerHTML
		}
	}
	t += ' ' + title;
	t = t.replace(/#/g, '%23');
	t = t.replace(/&/g, '%26');
	var s = 'mailto:?subject=' + t + '&body=' + b;
	location.href = s;
	var sid = OTS.getNewsId();
	OTS.gaTrkEvt('ARTLNKS', 'open', sid + ' + E-mail');
}

OTS.retweetThis = function() {
	var sid = OTS.getNewsId();
	OTS.gaTrkEvt('ARTLNKS', 'open', sid + ' + Retweet');
}

OTS.doArtLnks = function(id) {
	var o = OTS.$('storybody');
	if (!o) return;
	var lnks = o.getElementsByTagName('a');
	for (var i = 0, l = lnks.length; i < l; i++) {
		var a = lnks[i];
		if (a.onclick) continue;
		a.onclick = function() {
			var t0 = (OTS.$('storyhd')) ? (OTS.$('storyhd').innerText || OTS.$('storyhd').textContent) : '';
			var t1 = (id) ? id : t0;
			var t2 = this.innerText || this.textContent;
			var t3 = this.href;
			var t = t1 + ' + ' + t2 + ' + ' + t3;
			OTS.gaTrkEvt('ARTLNKS', 'open', t);
			/*
			if ((this.href.indexOf('http://') > -1) && (this.href.indexOf('onthesnow') == -1)) {
				var hd = (document.title != '') ? document.title : t0;
				var u = '/f/?u=' + this.href + '&r=' + location.href + '&t=' + hd;
				window.open(u, 'OTSEXTLNK');
				return false;
			}
			*/
		}
		if ((a.href.indexOf('http://') > -1) && (a.href.indexOf('onthesnow') == -1)) {
			a.target = '_blank';
		}
	}
};

OTS.doTAHeight = function(o) {
	var id = o.id;
	var o1 = OTS.$(id);
	if (!o1) return;
	var o2 = OTS.$(id + '_stmp');
	if (!o2) {
		o1.ppS = false;
		o1.ppH = o1.offsetHeight;
		o2 = document.createElement('div');
		o2.id = id + '_stmp';
		o2.className = 'fTxt';
		OTS.setStyle(o2, 'width', o1.offsetWidth - 26 + 'px');
		OTS.setStyle(o2, 'position', 'absolute');
		OTS.setStyle(o2, 'top', 0);
		OTS.setStyle(o2, 'left', '-2000px');
		OTS.setStyle(o2, 'visibility', 'hidden');
		document.body.appendChild(o2);
	}
	var s = o1.value;
	s = s.replace(/\n/g, '<br />');
	OTS.setHTML(o2, s);
	var h1 = o1.offsetHeight;
	var h2 = o2.offsetHeight;
	/*status = h1 + ' / ' + h2 + ' / ' + o1.ppH;*/
	if (h2 > h1) {
		if (o1.ppS == false) o1.ppS = true;
		if (h2 > 600) h2 = 600;
		OTS.setStyle(o1, 'height', (h2 + 30) + 'px');
	} else {
		if (o1.ppS == true) {
			if (h2 < o1.ppH) h2 = o1.ppH - 30;
			OTS.setStyle(o1, 'height', (h2 + 30) + 'px');
		}
	}
}

OTS.doSortLang = function(o) {
	var s = o.options[o.selectedIndex].value;
	var u = location.href;
	u = u.substring(0, u.indexOf('?'));
	if (s != '') u += '?l=' + s;
	location.href = u;
}

OTS.showMoreNav = {
	opened : false,
	txt : ''
}
OTS.showMoreNav.toggle = function(id) {
	var o = OTS.$(id + '_more');
	if (!o) return;
	var o1 = OTS.$(id + '_morelink');
	if (!o1) return;
	if (OTS.showMoreNav.opened == false) {
		OTS.showMoreNav.txt = OTS.getHTML(o1);
		OTS.showMoreNav.opened = true;
	}
	if (OTS.getStyle(o, 'display') == 'none') {
		OTS.setStyle(o, 'display', 'inline');
		OTS.setHTML(o1, 'Less');
	} else {
		OTS.setStyle(o, 'display', 'none');
		OTS.setHTML(o1, OTS.showMoreNav.txt);
	}
}

/*
/////////////////////////////
	Nav Map
/////////////////////////////
*/

OTS.navmapURL = OTS.baseURL + '/ajax/regions.html?v=1';
OTS.navmap = {
	map : null,
	mObj : null,
	mpObj : null,
	iLen : 1,
	wt : 250,
	t1 : null,
	mactive : false,
	msactive : false,
	isloaded : false
};
OTS.navmap.initMap = function() {
	OTS.navmap.rObj = OTS.$('rnav');
	OTS.navmap.mObj = OTS.$('rnav_canvas');
	OTS.navmap.mtObj = OTS.$('rnav_canvas_top');
	OTS.navmap.mbObj = OTS.$('rnav_canvas_bot');
	OTS.navmap.mmObj = OTS.$('rnav_canvas_mid');
	OTS.navmap.mpObj = OTS.$('rnav_canvas_marker');
	if (!OTS.navmap.rObj || !OTS.navmap.mObj || !OTS.navmap.mmObj || !OTS.navmap.mpObj) return;
	OTS.navmap.setUpMap();
}
OTS.navmap.setUpMap = function() {
	OTS.navmap.mpObj.style.display = 'block';
	OTS.navmap.mpObj.onclick = function() {
		OTS.navmap.toggleMap();
	};
	OTS.navmap.mpObj.onmouseover = function() {
		this.className += ' over';
	};
	OTS.navmap.mpObj.onmouseout = function() {
		this.className = this.className.replace(/over/, '');
	};
}
OTS.navmap.toggleMap = function() {
	if (OTS.navmap.mactive) {
		OTS.navmap.hideMap();
	} else {
		OTS.navmap.showMap();
	}
}
OTS.navmap.showMap = function() {
	OTS.navmap.mpObj.className = 'on';
	OTS.navmap.mtObj.style.display = 'block';
	OTS.navmap.mbObj.style.display = 'block';
	OTS.navmap.mObj.style.height = '0';
	OTS.navmap.mObj.style.display = 'block';
	OTS.navmap.mactive = true;
	//OTS.navmap.slideMapOpenDone();
	OTS.navmap.slideMapOpen();
	var o = OTS.$('nav_home');
	if (!o) return;
	o.className = 'active';
	OTS.navmap.posMarker(o);
}
OTS.navmap.posMarker = function(o) {
	if (!o) return;
	var w = o.offsetWidth;
	w = Math.ceil((w * .5) + 4);
	OTS.navmap.mpObj.style.left = w + 'px';
}
OTS.navmap.slideMapOpenDone = function() {
	OTS.navmap.msactive = false;
	//OTS.navmap.mtObj.style.display = 'block';
	//OTS.navmap.mbObj.style.display = 'block';
	OTS.navmap.mmObj.style.display = 'block';
	OTS.navmap.mObj.style.height = OTS.navmap.wt + 'px';
	//OTS.navmap.rObj.className = 'on';
	OTS.navmap.makeMap();
}
OTS.navmap.slideMapOpen = function() {
	OTS.navmap.clearMapSlide();
	OTS.navmap.msactive = true;
	OTS.navmap.aniLen = 250;
	OTS.navmap.startTime = (new Date()).getTime();
	OTS.navmap.begin = 0;
	OTS.navmap.change = OTS.navmap.wt - OTS.navmap.begin;
	OTS.navmap.t1 = window.setInterval('OTS.navmap.animateMapOpen()', 10);
}
OTS.navmap.animateMapOpen = function() {
	var elapsed = (new Date()).getTime() - OTS.navmap.startTime;
	if (elapsed > OTS.navmap.aniLen) {
		OTS.navmap.clearMapSlide();
		OTS.navmap.slideMapOpenDone();
		return;
	} else {
		var x = OTS.ease.strongEaseOut(elapsed, OTS.navmap.begin, OTS.navmap.change, OTS.navmap.aniLen);
		OTS.navmap.mObj.style.height = x + 'px';
	}
}
OTS.navmap.hideMap = function() {
	OTS.navmap.mactive = false;
	OTS.navmap.mpObj.className = '';
	OTS.navmap.mtObj.style.display = 'none';
	OTS.navmap.mbObj.style.display = 'none';
	//OTS.navmap.mmObj.style.display = 'none';
	OTS.navmap.mObj.style.height = OTS.navmap.wt + 'px';
	//OTS.navmap.rObj.className = '';
	OTS.navmap.slideMapCloseDone();
	//OTS.navmap.slideMapClose();
	var o = OTS.$('nav_home');
	if (!o) return;
	o.className = '';
}
OTS.navmap.slideMapCloseDone = function() {
	OTS.navmap.clearMapSlide();
	OTS.navmap.mObj.style.height = '0';
	OTS.navmap.mObj.style.display = 'none';
	OTS.navmap.msactive = false;
}
OTS.navmap.slideMapClose = function() {
	OTS.navmap.clearMapSlide();
	OTS.navmap.msactive = true;
	OTS.navmap.aniLen = 250;
	OTS.navmap.startTime = (new Date()).getTime();
	OTS.navmap.begin = OTS.navmap.wt;
	OTS.navmap.change = 0 - OTS.navmap.begin;
	OTS.navmap.t1 = window.setInterval('OTS.navmap.animateMapClose()', 10);
}
OTS.navmap.animateMapClose = function() {
	var elapsed = (new Date()).getTime() - OTS.navmap.startTime;
	if (elapsed > OTS.navmap.aniLen) {
		OTS.navmap.clearMapSlide();
		OTS.navmap.slideMapCloseDone(0);
		return;
	} else {
		var x = OTS.ease.strongEaseOut(elapsed, OTS.navmap.begin, OTS.navmap.change, OTS.navmap.aniLen);
		OTS.navmap.mObj.style.height = x + 'px';
	}
}
OTS.navmap.clearMapSlide = function() {
	if (OTS.navmap.t1) {
		window.clearInterval(OTS.navmap.t1);
		OTS.navmap.t1 = null;
	}
}
OTS.navmap.makeMap = function() {
	if (OTS.navmap.isloaded) return;
	var r = new OTS.ajax(OTS.navmapURL, OTS.navmap.makeMapUpdate, 'post');
	r.request();
}
OTS.navmap.makeMapUpdate = function(s) {
	var html = '<div id="rmap">';
	html += s;
	html += '</div>';
	OTS.navmap.mmObj.innerHTML = html;
	OTS.navmap.isloaded = true;
	OTS.gaTrkEvt('Navigation', 'FindAResort', location.href);
}
OTS.togDisplay = function(id) {
	var o = OTS.$(id);
	if (!o) return;
	if (o.style.display == 'none') {
		o.style.display = 'block';
	} else {
		o.style.display = 'none';
	}
}

/*
/////////////////////////////
	Zip Code Nearby
/////////////////////////////
*/

OTS.imgURL = '';
OTS.zipperOptions = {
	enter : 'Enter A Zip Code:',
	save : 'Save',
	notfound : 'No results found.'
}
OTS.zipperReqURL = OTS.baseURL + '/ajax/ajax_zipper.html';
OTS.zipper = {
	active : false,
	w : 150,
	v : 0,
	change : function(id, target, e) {
		OTS.zipper.n = (id) ? id : 'rnav_nearby_zip';
		OTS.zipper.obj = OTS.$(OTS.zipper.n + '_value');
		if (!OTS.zipper.obj) return;
		if (OTS.zipper.obj.innerHTML.indexOf('<') == 0) {
			OTS.zipper.obj.innerHTML = '';
		}
		OTS.zipper.v = OTS.zipper.obj.innerHTML;
		OTS.zipper.target = target;
		OTS.zipper.showMenu(id);
	},
	showMenu : function() {
		var s = '<div class="ttip2" style="width:' + (OTS.zipper.w + 10) + 'px;">';
		s += '<form id="zip_form" name="zip_form" action="" method="post" onsubmit="OTS.zipper.doChange(this); return false;" style="width:' + OTS.zipper.w + 'px; padding:5px 10px 5px 5px; position:relative;">';
		s += '<div class="close" style="position:absolute; top:0; right:0;"><a href="#" onclick="OTS.zipper.hideMenu(); return false;"><img src="' + OTS.imgURL + '/ots/images/icon_close2.gif" alt="X" border="0" align="absmiddle" /></a></div>';
		s += '<strong>' + OTS.zipperOptions.enter + '</strong><br />';
		s += '<input type="text" name="zipper" value="' + OTS.zipper.v + '" size="10" onfocus="this.select();" />';
		s += '<input type="submit" value="' + OTS.zipperOptions.save + '" /><br />';
		//s += '<input type="checkbox" value="" checked="checked" /> Save to profile?';
		s += '</form></div><b class="marker_tm"></b>';
		var o = OTS.$('zipper_menu');
		if (!o) {
			o = document.createElement('div');
			o.id = 'zipper_menu';
			o.className = 'ttip';
			var t = OTS.$('empty');
			if (!t) return;
			t.appendChild(o);
		}
		o.innerHTML = s;
		var p = OTS.getPos(OTS.zipper.target);
		//if (document.all) p.left -= 20;
		OTS.setStyle(o, 'position', 'absolute');
		OTS.setStyle(o, 'left', (p.left - (OTS.zipper.w - 40)) + 'px');
		OTS.setStyle(o, 'top', (p.top + 20) + 'px');
		if (document.zip_form.zipper.value == '') {
			document.zip_form.zipper.focus();
		} else {
			document.zip_form.zipper.select();
		}
		OTS.zipper.active = true;
		OTS.gaTrkEvt('ZipCoder', 'open', location.href);
	},
	hideMenu : function() {
		var o = OTS.$('zipper_menu');
		if (!o) return;
		OTS.setHTML(o, '');
		OTS.setStyle(o, 'left', '-2000px');
		OTS.zipper.active = false;
	},
	doChange : function(o, w) {
		if (w == 'f') {
			OTS.zipper.n = 'rmap_nearby_zip';
			OTS.zipper.obj = OTS.$(OTS.zipper.n + '_value');
			if (!OTS.zipper.obj) return;
			OTS.zipper.v = OTS.zipper.obj.innerHTML;
		}
		var v = (o.zipper.value);
		if (v == '') return;
		if (v == OTS.zipper.v) {
			OTS.zipper.hideMenu();
			return;
		}
		OTS.zipper.doReq(v);
	},
	doReq : function(v) {
		var u = OTS.zipperReqURL + '?z=' + v + '&c=8&t=1';
		var r = new OTS.ajax(u, OTS.zipper.doUpdate);
		r.id = v;
		r.html = OTS.zipper.obj.innerHTML;
		r.request();
		var ico = (OTS.zipper.n == 'rnav_nearby_zip') ? '_blue' : '';
		OTS.setHTML(OTS.zipper.n + '_results', '<br /><img src="http://images.onthesnow.com/ots/images/icon_loading' + ico + '.gif" alt="" border="0" />');
		OTS.zipper.hideMenu();
		OTS.gaTrkEvt('ZipCoder', 'submit', v + ' + ' + location.href);
	},
	doUpdate : function(s, id, html) {
		OTS.setHTML(OTS.zipper.n + '_value', id);
		OTS.setHTML(OTS.zipper.n + '_results', s);
	},
	closeMenu : function(e) {
		var o = e.target || e.srcElement;
		if (!OTS.hasParent(o, 'zipper_menu') && o.className.indexOf(OTS.zipper.n + '_lnk') == -1) {
			if (OTS.zipper.active == true) {
				OTS.zipper.hideMenu();
			}
		}
	},
	doLogin : function() {
		OTS.doLogin('abuse');
	}
}
addEvent(document, 'click', OTS.zipper.closeMenu);

/*
/////////////////////////////
	Helpful
/////////////////////////////
*/

OTS.helpfulReqURL = OTS.baseURL + '/community/ajax/ajax_helpful.html';
OTS.helpful = {
	vote : function(id, w) {
		if (w == 'up') {
			OTS.helpful.doUp(id);
		} else {
			OTS.helpful.doDown(id);
		}
	},
	doUp : function(id) {
		var o = OTS.$('hpfl_up_' + id);
		if (!o) return;
		var r = new OTS.ajax(OTS.helpfulReqURL + '?o=up&id=' + id, OTS.helpful.setUp);
		r.id = id;
		r.html = o.innerHTML;
		r.request();
		OTS.setHTML(o, '<span class="iloading"></span>');
	},
	setUp : function(s, id, html) {
		var d = eval('(' + s + ')');
		if (d.success == 1) {
			OTS.setHTML('hpfl_up_' + id, '<span>' + d.upvote + '</span> <span class="ithmbsup chkd"></span>');
			OTS.setHTML('hpfl_dn_' + id, '<span>' + d.dnvote + '</span> <span class="ithmbsdn chkdoff"></span>');
		} else {
			OTS.setHTML('hpfl_up_' + id, html);
		}
	},
	doDown : function(id) {
		var o = OTS.$('hpfl_dn_' + id);
		if (!o) return;
		var r = new OTS.ajax(OTS.helpfulReqURL + '?o=dn&id=' + id, OTS.helpful.setDown);
		r.id = id;
		r.html = o.innerHTML;
		r.request();
		OTS.setHTML(o, '<span class="iloading"></span>');
	},
	setDown : function(s, id, html) {
		var d = eval('(' + s + ')');
		if (d.success == 1) {
			OTS.setHTML('hpfl_dn_' + id, '<span>' + d.dnvote + '</span> <span class="ithmbsdn chkd"></span>');
			OTS.setHTML('hpfl_up_' + id, '<span>' + d.upvote + '</span> <span class="ithmbsup chkdoff"></span>');
		} else {
			OTS.setHTML('hpfl_dn_' + id, html);
		}
	},
	doLogin : function() {
		OTS.doLogin('helpful');
	}
}

OTS.flagOptions = {
	reportas : 'Report Item As',
	choose : 'Choose one',
	additional : 'Additional Comments?',
	comments : 'Comments',
	report : 'Report',
	flag : [
		'Obscenity/vulgarity',
		'Hate speech',
		'Personal attack',
		'Advertising/Spam',
		'Copyright/Plagiarism',
		'Other'
	]
}
OTS.flagReqURL = OTS.baseURL + '/community/ajax/ajax_flag.html';
OTS.flag = {
	active : false,
	report : function(id, target, e) {
		OTS.flag.oAb = OTS.$('hpfl_ab_' + id);
		if (!OTS.flag.oAb) return;
		OTS.flag.target = target;
		OTS.flag.showMenu(id);
	},
	showMenu : function(id) {
		var s = '<div class="ttip2" style="width:150px;">';
		s += '<form id="abuse_form" name="abuse_form" action="" method="post" onsubmit="OTS.flag.doReport(this); return false;" style="width:140px; padding:5px 10px 5px 5px; position:relative;">';
		s += '<input type="hidden" name="review_id" value="' + id + '" />';
		s += '<div class="close" style="position:absolute; top:0; right:0;"><a href="#" onclick="OTS.flag.hideMenu(); return false;"><img src="' + OTS.imgURL + '/ots/images/icon_close2.gif" alt="X" border="0" align="absmiddle" /></a></div>';
		s += '<div id=""><strong>' + OTS.flagOptions.reportas + ':</strong><br /><select id="abuse_flag" name="abuse_flag">';
		s += '<option value="">' + OTS.flagOptions.choose + '</option>';
		for (var i = 0; i < OTS.flagOptions.flag.length; i++) {
			s += '<option value="' + (i + 1) + '">' + OTS.flagOptions.flag[i] + '</option>';
		}
		s += '</select></div><p id="report_comment_link"><a href="#" onclick="OTS.flag.showComment(); return false;">' + OTS.flagOptions.additional + '</a></p>';
		s += '<div id="report_comment" style="display:none;"><strong>' + OTS.flagOptions.comments + ':</strong><br /><textarea id="abuse_comment" name="abuse_comment"></textarea></div>';
		s += '<input type="submit" value="' + OTS.flagOptions.report + '" /></form>';
		s += '</div><b class="marker"></b>';
		var o = OTS.$('flag_menu');
		if (!o) {
			o = document.createElement('div');
			o.id = 'flag_menu';
			o.className = 'ttip';
			document.body.appendChild(o);
		}
		o.innerHTML = s;
		var p = OTS.getPos(OTS.flag.target);
		if (document.all) p.left += 20;
		OTS.setStyle(o, 'position', 'absolute');
		OTS.setStyle(o, 'left', p.left + 'px');
		OTS.setStyle(o, 'top', (p.top + 20) + 'px');
		OTS.flag.active = true;
	},
	hideMenu : function() {
		var o = OTS.$('flag_menu');
		if (!o) return;
		OTS.setHTML(o, '');
		OTS.setStyle(o, 'left', '-2000px');
		OTS.flag.active = false;
	},
	doReport : function(o) {
		var abuse_flag = escape(o.abuse_flag.value);
		if (abuse_flag == '') return;
		var abuse_comment = escape(o.abuse_comment.value);
		OTS.flag.doReq(o.review_id.value, abuse_flag, abuse_comment);
	},
	doReq : function(id, abuse_flag, abuse_comment) {
		var o = OTS.$('hpfl_ab_' + id);
		if (!o) return;
		var u = OTS.flagReqURL + '?o=ab&id=' + id + '&abuse_flag=' + abuse_flag + '&abuse_comment=' + abuse_comment;
		var r = new OTS.ajax(u, OTS.flag.doUpdate);
		r.id = id;
		r.html = o.innerHTML;
		r.request();
		OTS.setHTML(o, '<span class="iloading"></span>');
		OTS.flag.hideMenu();
	},
	doUpdate : function(s, id, html) {
		var d = eval('(' + s + ')');
		if (d.success == 1) {
			OTS.setHTML('hpfl_ab_' + id, '<span class="iabuse chkd">Reported</span>');
		} else {
			OTS.setHTML('hpfl_ab_' + id, html);
		}
	},
	showComment : function() {
		OTS.setStyle('report_comment_link', 'display', 'none');
		OTS.setStyle('report_comment', 'display', 'block');
	},
	closeMenu : function(e) {
		var o = e.target || e.srcElement;
		if (!OTS.hasParent(o, 'flag_menu') && o.className.indexOf('iabuse') == -1) {
			if (OTS.flag.active == true) {
				OTS.flag.hideMenu();
			}
		}
	},
	doLogin : function() {
		OTS.doLogin('abuse');
	}
}
addEvent(document, 'click', OTS.flag.closeMenu);

/*
/////////////////////////////
	Ratings
/////////////////////////////
*/

OTS.ratingsReqURL = OTS.baseURL + '/community/ajax/ajax_rating.html';
OTS.ratings = {
	t1 : null,
	active : false,
	showMore : function(id, target) {
		OTS.ratings.clearHide();
		OTS.ratings.target = target;
		OTS.ratings.t1 = setTimeout('OTS.ratings.doShow(' + id + ')', 500);
	},
	hideMore : function() {
		OTS.ratings.clearHide();
		if (OTS.ratings.active == true) {
			OTS.ratings.t1 = setTimeout('OTS.ratings.doHide()', 200);
		} else {
			
		}
	},
	doHide : function() {
		OTS.ratings.clearHide();
		var o = OTS.$('ratings_menu');
		if (!o) return;
		OTS.setHTML(o, '');
		OTS.setStyle(o, 'left', '-2000px');
		OTS.ratings.active = false;
	},
	doShow : function(id) {
		/*
		var u = OTS.ratingsReqURL + '?id=' + id;
		var r = new OTS.ajax(u, OTS.ratings2.doUpdate);
		r.id = id;
		r.request();
		*/
		var o = OTS.$('rev_rating' + id);
		if (!o) return;
		var html = o.innerHTML;
		html = '<ul class="rater_min rater_min_sm">' + html + '</ul>';
		OTS.ratings.doUpdate(html, id);
		OTS.ratings.active = true;
	},
	doUpdate : function(s, id) {
		var html = '<div class="ttip2">';
		html += s;
		html += '</div><b class="marker"></b>';
		var o = OTS.$('ratings_menu');
		if (!o) {
			o = document.createElement('div');
			o.id = 'ratings_menu';
			o.className = 'ttip';
			document.body.appendChild(o);
		}
		o.innerHTML = html;
		var p = OTS.getPos(OTS.ratings.target);
		OTS.setStyle(o, 'position', 'absolute');
		OTS.setStyle(o, 'left', p.left + 'px');
		OTS.setStyle(o, 'top', (p.top + 25) + 'px');
	},
	clearHide : function() {
		clearTimeout(OTS.ratings.t1);
	}
}
OTS.rating = {
	showMore : function(target, size) {
		OTS.rating.target = target;
		var html = '<span>';
		html += OTS.rating.target.innerHTML;
		html += '</span><b class="marker"></b>';
		var o = OTS.$('rating_menu');
		if (!o) {
			o = document.createElement('div');
			o.id = 'rating_menu';
			o.className = 'ttip_sm';
			document.body.appendChild(o);
		}
		o.innerHTML = html;
		var w = 80;
		var h = 1;
		if (size == 'sm') {
			w = 52;
			h = 4;
		}
		var p = OTS.getPos(OTS.rating.target);
		OTS.setStyle(o, 'position', 'absolute');
		OTS.setStyle(o, 'left', (p.left + w) + 'px');
		OTS.setStyle(o, 'top', (p.top - h) + 'px');
	},
	hideMore : function() {
		var o = OTS.$('rating_menu');
		if (!o) return;
		OTS.setHTML(o, '');
		OTS.setStyle(o, 'left', '-2000px');
	}
}

/*
/////////////////////////////
	Members
/////////////////////////////
*/

OTS.memberReqURL = OTS.baseURL + '/community/ajax/profile_ticket.html';
OTS.members = {
	t1 : null,
	active : false,
	showMore : function(id, target, e) {
		OTS.members.target = target;
		OTS.members.clearHide();
		OTS.members.t1 = setTimeout('OTS.members.doShow(' + id + ')', 500);
	},
	hideMore : function() {
		OTS.members.clearHide();
		if (OTS.members.active == true) {
			OTS.members.t1 = setTimeout('OTS.members.doHide()', 200);
		} else {
			
		}
	},
	doHide : function() {
		OTS.members.clearHide();
		var o = OTS.$('members_menu');
		if (!o) return;
		OTS.setHTML(o, '');
		OTS.setStyle(o, 'left', '-2000px');
		OTS.members.active = false;
	},
	doShow : function(id) {
		var o = OTS.$('members_menu');
		if (o) OTS.setHTML(o, '');
		var u = OTS.memberReqURL + '?user_id=' + id + '&img=md';
		var r = new OTS.ajax(u, OTS.members.doUpdate);
		r.id = id;
		r.request();
		OTS.members.active = true;
	},
	doUpdate : function(s, id) {
		var html = '<div class="ttip2" style="width:250px;">';
		html += '<div class="profile_ticket_sm">' + s + '</div>';
		html += '</div><b class="marker"></b>';
		var o = OTS.$('members_menu');
		if (!o) {
			o = document.createElement('div');
			o.id = 'members_menu';
			o.className = 'ttip';
			o.onmouseover = OTS.members.clearHide;
			o.onmouseout = OTS.members.hideMore;
			document.body.appendChild(o);
		}
		o.innerHTML = html;
		var p = OTS.getPos(OTS.members.target);
		OTS.setStyle(o, 'position', 'absolute');
		OTS.setStyle(o, 'left', p.left + 'px');
		OTS.setStyle(o, 'top', (p.top + 25) + 'px');
	},
	clearHide : function() {
		if (OTS.members.t1) {
			clearTimeout(OTS.members.t1);
			OTS.members.t1 = null;
		}
	}
}

/*
/////////////////////////////
	Favorites
/////////////////////////////
*/

OTS.favoritesTxtObj = {
	t1 : 'Add to favorites',
	t2 : 'Remove from favorites'
}
OTS.favoritesReqURL = OTS.baseURL + '/community/ajax/ajax_favorites.html';
OTS.favorites = {
	showMore : function(id, target, which) {
		OTS.favorites.target = target;
		var html = '<span>' + (which == 'r' ? OTS.favoritesTxtObj.t2 : OTS.favoritesTxtObj.t1) + '</span><b class="marker"></b>';
		var o = OTS.$('favs_menu');
		if (!o) {
			o = document.createElement('div');
			o.id = 'favs_menu';
			o.className = 'ttip_sm';
			document.body.appendChild(o);
		}
		o.innerHTML = html;
		var p = OTS.getPos(OTS.favorites.target);
		OTS.setStyle(o, 'position', 'absolute');
		OTS.setStyle(o, 'left', (p.left + 20) + 'px');
		OTS.setStyle(o, 'top', (p.top - 2) + 'px');
	},
	hideMore : function() {
		var o = OTS.$('favs_menu');
		if (!o) return;
		OTS.setHTML(o, '');
		OTS.setStyle(o, 'left', '-2000px');
	},
	add : function(id) {
		//OTS.favorites.doAddAni(id);
		OTS.favorites.doReq(id, 'a');
	},
	remove : function(id) {
		OTS.favorites.doReq(id, 'r');
	},
	doReq : function(id, which) {
		var o = OTS.$('favorite_' + id);
		if (!o) return;
		var u = OTS.favoritesReqURL + '?o=' + which + '&id=' + id + '';
		if (which == 'r') {
			var m = OTS.favorites.doRemove;
		} else {
			var m = OTS.favorites.doAdd;
		}
		var r = new OTS.ajax(u, m);
		r.id = id;
		r.html = o.innerHTML;
		r.request();
		OTS.setHTML(o, '<span class="iloading"></span>');
		OTS.favorites.hideMore();
	},
	doAdd : function(s, id, html) {
		var d = eval('(' + s + ')');
		if (d.success == 1) {
			OTS.setHTML('favorite_' + id, '<a href="#" onclick="OTS.favorites.remove(\'' + id + '\'); return false;" onmouseover="OTS.favorites.showMore(\'' + id + '\', this, \'r\');" onmouseout="OTS.favorites.hideMore();"><img src="' + OTS.imgURL + '/ots/images/icon_fav_remove.gif" alt="" border="0" align="absmiddle" /></a>');
			//OTS.favorites.doAddAni(id);
		} else {
			OTS.setHTML('favorite_' + id, html);
		}
		OTS.favorites.hideMore();
	},
	doAddAni : function(id) {
		var f = OTS.$('favorite_' + id);
		if (!f) return;
		var o = OTS.$('favs_ani');
		if (!o) {
			o = document.createElement('div');
			o.id = 'favs_ani';
			o.style.cssText = 'position:absolute; z-index:9999;';
			var t = OTS.$('empty');
			if (!t) return;
			t.appendChild(o);
		}
		o.innerHTML = '<img src="http://www.onthesnow.com/ots/images/icon_fav.gif" alt="" border="0" align="absmiddle" />';
		var p = OTS.getPos(f);
		o.style.left = p.left + 'px';
		o.style.top = p.top + 'px';
		OTS.favorites.slideAdd(o);
	},
	doRemove : function(s, id, html) {
		var d = eval('(' + s + ')');
		if (d.success == 1) {
			OTS.setHTML('favorite_' + id, '<a href="#" onclick="OTS.favorites.add(\'' + id + '\'); return false;" onmouseover="OTS.favorites.showMore(\'' + id + '\', this, \'a\');" onmouseout="OTS.favorites.hideMore();"><img src="' + OTS.imgURL + '/ots/images/icon_fav.gif" alt="" border="0" align="absmiddle" /></a>');
		} else {
			OTS.setHTML('favorite_' + id, html);
		}
		OTS.favorites.hideMore();
	},
	load : function() {
		o = document.createElement('div');
		var s = OTS.getCookie();
		s = s.replace(/;/g, ';<br />');
		o.innerHTML = s;
		document.body.appendChild(o);
	},
	doLogin : function() {
		OTS.doLogin('favorites');
	}
}
OTS.favorites.showOnGrid = function(id) {
	var o = OTS.$('favorite_' + id);
	if (!o) return;
	OTS.setStyle(o, 'visibility', 'visible');
}
OTS.favorites.hideOnGrid = function(id) {
	var o = OTS.$('favorite_' + id);
	if (!o) return;
	OTS.setStyle(o, 'visibility', 'hidden');
}

OTS.favorites.slideAdd = function(o) {
	var p = OTS.getPos(OTS.$('nav_home'));
	OTS.favorites.mObj = o;
	OTS.favorites.clearSlideAdd();
	OTS.favorites.aniLen = 550;
	OTS.favorites.startTime = (new Date()).getTime();
	OTS.favorites.beginx = parseInt(o.style.left);
	OTS.favorites.changex = (p.left - 2) - OTS.favorites.beginx;
	OTS.favorites.beginy = parseInt(o.style.top);
	OTS.favorites.changey = (p.top + 2) - OTS.favorites.beginy;
	OTS.favorites.t1 = window.setInterval('OTS.favorites.animateAdd()', 10);
}
OTS.favorites.animateAdd = function() {
	var elapsed = (new Date()).getTime() - OTS.favorites.startTime;
	if (elapsed > OTS.favorites.aniLen) {
		OTS.favorites.clearSlideAdd();
		OTS.favorites.mObj.parentNode.removeChild(OTS.favorites.mObj);
		return;
	} else {
		var x = OTS.ease.strongEaseOut(elapsed, OTS.favorites.beginx, OTS.favorites.changex, OTS.favorites.aniLen);
		OTS.favorites.mObj.style.left = x + 'px';
		var y = OTS.ease.strongEaseOut(elapsed, OTS.favorites.beginy, OTS.favorites.changey, OTS.favorites.aniLen);
		OTS.favorites.mObj.style.top = y + 'px';
	}
}
OTS.favorites.clearSlideAdd = function() {
	if (OTS.favorites.t1) {
		window.clearInterval(OTS.favorites.t1);
		OTS.favorites.t1 = null;
	}
}

/*
/////////////////////////////
	Random Tease
/////////////////////////////
*/

OTS.rndTease = function(id) {
	this.curr = 0;
	this.old = this.curr;
	this.tS = 0;
	this.tLen = 0;
	this.cLen = 6;
	this.cArr = [];
	this.rArr = [];
	this.id = id;
	this.rand = 1;
}
OTS.rndTease.prototype.init = function(name, clss) {
	if (!document.getElementById || !document.getElementsByTagName) return;
	this.id = name;
	this.clss = (clss) ? clss : this.id;
	var o = OTS.$(this.id);
	if (!o) return;
	o.className = this.clss;
	
	var oArr = o.getElementsByTagName('li');
	var jtLen = oArr.length;
	if (jtLen == 0) return;
	for (var i = 0; i < jtLen; i++) {
		this.cArr.push(oArr[i].innerHTML);
		this.rArr.push(i);
		if (i > 46) break;
	}
	this.tLen = this.cArr.length;
	if (this.rand) this.rArr = OTS.randArray(this.rArr);
	
	o.innerHTML = '';
	o.style.display = 'block';
	
	this.nObj1 = document.createElement('div');
	this.nObj1.id = this.id + '_str';
	if (this.tLen > this.cLen) {
		this.nObj1.className = this.clss + '_str';
	} else {
		this.nObj1.className = this.clss + '_str off';
	}
	o.appendChild(this.nObj1);
	
	this.nObj2 = document.createElement('div');
	this.nObj2.id = this.id + '_body';
	this.nObj2.className = this.clss + '_body';
	this.nObj1.appendChild(this.nObj2);
	
	this.nObj = document.createElement('div');
	this.nObj.id = this.id + '_main';
	this.nObj.className = this.clss + '_main';
	this.nObj2.appendChild(this.nObj);
	
	if (this.tLen > this.cLen) {
		this.doNav();
	}
	this.set(this.curr);
	
	//alert(o.innerHTML);
}
OTS.rndTease.prototype.set = function(n) {
	this.old = this.curr;
	this.curr = n;
	
	var o1 = document.getElementById(this.id + 'ipn' + this.old);
	if (o1) o1.className = 'ipn';
	
	var o2 = document.getElementById(this.id + 'ipn' + this.curr);
	if (o2) o2.className = 'ipn_on';
	
	var x = Math.floor(parseInt(n) * this.cLen);
	var s = '<ul>';
	for (var i = 0; i < this.cLen; i++) {
		if (x > this.rArr.length - 1) break;
		var c = ((i + 1) % this.cLen == 0) ? ' last' : '';
		s += '<li class="ipb' + c + '">' + this.cArr[this.rArr[x]] + '</li>';
		x++;
	}
	s += '</ul>';
	this.nObj.innerHTML = s;
}
OTS.rndTease.prototype.doNav = function() {
	var o = OTS.$(this.id);
	if (!o) return;
	
	var d = document.createElement('div');
	d.id = this.id + '_nav';
	d.className = this.clss + '_nav';
	o.appendChild(d);
	
	var c = Math.ceil(this.tLen / this.cLen);
	var _this = this;
	for (var i = 0; i < c; i++) {
		var s = document.createElement('a');
		s.href = '#';
		s.title = (i + 1) + '/' + c;
		s.id = this.id + 'ipn' + i;
		s.className = 'ipn';
		s.innerHTML = i + 1;
		s.i = i;
		s.onclick = function() {
			_this.set(this.i);
			return false;
		}
		d.appendChild(s);
	}
	
	var dp = document.createElement('div');
	dp.id = this.id + '_prev';
	dp.className = this.clss + '_prev';
	var p = document.createElement('a');
	p.href = '#';
	p.title = '<';
	p.innerHTML = '&laquo;';
	p.onclick = function() {
		_this.prev();
		return false;
	}
	dp.appendChild(p);
	o.appendChild(dp);
	
	var dn = document.createElement('div');
	dn.id = this.id + '_next';
	dn.className = this.clss + '_next';
	var n = document.createElement('a');
	n.href = '#';
	n.title = '>';
	n.innerHTML = '&raquo;';
	n.onclick = function() {
		_this.next();
		return false;
	}
	dn.appendChild(n);
	o.appendChild(dn);
}
OTS.rndTease.prototype.prev = function() {
	var n = this.curr - 1;
	if (n < 0) n = Math.ceil(this.tLen / this.cLen) - 1;
	this.move(n);
}
OTS.rndTease.prototype.next = function() {
	var n = this.curr + 1;
	if (n > Math.ceil(this.tLen / this.cLen) - 1) n = 0;
	this.move(n);
}
OTS.rndTease.prototype.move = function(n) {
	this.set(n);
}

/*
/////////////////////////////
	Litebox
/////////////////////////////
*/

OTS.litebox = {
	load : function() {
		OTS.litebox.subbox = document.createElement('div');
		OTS.litebox.subbox.id = 'litebox';
		OTS.litebox.subbox.style.textAlign = 'center';
		OTS.litebox.subbox.style.width = '100%';
		OTS.litebox.subbox.style.display = 'none';
		OTS.litebox.subbox.style.position = 'absolute';
		OTS.litebox.subbox.style.top = '0';
		OTS.litebox.subbox.style.left = '0';
		OTS.litebox.subbox.style.zIndex = '9998';
		
		OTS.litebox.content = document.createElement('div');
		OTS.litebox.content.id = 'litebox_content';
		OTS.litebox.content.style.display = 'none';
		OTS.litebox.content.style.position = 'relative';
		OTS.litebox.content.style.margin = '0 auto';
		OTS.litebox.subbox.appendChild(OTS.litebox.content);
		
		/*var body = document.getElementsByTagName('body').item(0);*/
		/*document.body.appendChild(OTS.litebox.subbox);*/
		var o = OTS.$('empty');
		if (!o) return;
		o.appendChild(OTS.litebox.subbox);
	},
	showDiv : function(obj) {
		/*
		litebox.Obj = $(obj);
		if (!litebox.Obj) return;
		litebox.Obj = litebox.Obj.clone();
		litebox.Obj.injectInside(litebox.SubBox);
		litebox.Obj.setStyle('display', 'block');
		*/
		
		OTS.litebox.show();
	},
	showIframe : function(u, w, h) {
		/*
		if (!litebox.SubBox) return;
		litebox.Obj = new Element('div', {'id' : 'litebox_iframe'});
		litebox.Obj.injectInside(litebox.SubBox);
		litebox.Obj.addClass('litebox_frame');
		litebox.Obj.setHTML('<iframe src="' + u + '" width="' + w + '" height="' + h + '" allowtransparency="true" framespacing="0" frameborder="no" scrolling="auto"></iframe>');
		litebox.Obj.setStyle('display', 'block');
		*/
		
		OTS.litebox.show();
	},
	showAjax : function(u) {
		if (!OTS.litebox.subbox) return;
		
		var pgeSizeArr = OTS.getPageSize();
		var pgeScroll = OTS.getPageScroll();
		
		OTS.litebox.subbox.style.display = 'block';
		
		OTS.litebox.content.innerHTML = '<span class="iloading"></span>';
		OTS.litebox.content.style.width = '30px';
		OTS.litebox.content.style.display = 'block';
		
		var lightboxTop = pgeScroll + ((pgeSizeArr[3] * .5) - (OTS.litebox.subbox.offsetHeight * .5));
		OTS.litebox.content.style.top = lightboxTop + 'px';
		
		var r = new OTS.ajax(u, OTS.litebox.writeAjax);
		r.request();
	},
	writeAjax : function(s) {
		var pgeSizeArr = OTS.getPageSize();
		var pgeScroll = OTS.getPageScroll();
		
		OTS.litebox.content.innerHTML = '<div id="litebox_data" class="litebox">' + s + '</div>';
		OTS.litebox.content.style.width = '600px';
		OTS.litebox.content.style.display = 'block';
		
		var subbox_close = document.createElement('div');
		subbox_close.innerHTML = '<a href="#" onclick="litebox.hide(); return false;"><img src="' + OTS.imgURL + '/ots/images/icon_close2.gif" alt="" border="0" /></a>';
		subbox_close.style.position = 'absolute';
		subbox_close.style.top = '20px';
		subbox_close.style.right = '20px';
		OTS.litebox.content.appendChild(subbox_close);
		
		var lightboxTop = pgeScroll + ((pgeSizeArr[3] * .5) - (OTS.litebox.subbox.offsetHeight * .5));
		OTS.litebox.content.style.top = lightboxTop + 'px';
		
		OTS.litebox.toggleObjects('hidden');
	},
	show : function() {
		/*
		litebox.Box.addEvent('click', litebox.hide);
		litebox.Box.setStyle('height', Window.getScrollHeight());
		litebox.Box.setStyle('visibility', 'visible');
		litebox.Box.setStyle('opacity', '.8');
		litebox.SubBox.setStyle('display', 'block');
		litebox.SubBox.setStyle('top', ((Window.getHeight() * .5) - (litebox.Obj.offsetHeight * .5) + (Window.getScrollTop() - 120)));
		litebox.SubBox.setStyle('left', (Window.getWidth() * .5) - (litebox.SubBox.offsetWidth * .5));
		litebox.Close = new Element('div').injectInside(litebox.SubBox).addClass('litebox_close');
		litebox.Close.addEvent('click', litebox.hide);
		*/
	},
	hide : function() {
		OTS.litebox.content.innerHTML = '';
		OTS.litebox.subbox.style.display = 'none';
		OTS.litebox.toggleObjects('visible');
	},
	toggleObjects : function(s) {
		var elms = document.getElementsByTagName('select');
		for (var i = 0; i != elms.length; i++) {
			elms[i].style.visibility = s;
		}
		var elms2 = document.getElementsByTagName('iframe');
		for (var i = 0; i != elms2.length; i++) {
			elms2[i].style.visibility = s;
		}
		var elms3 = document.getElementsByTagName('object');
		for (var i = 0; i != elms3.length; i++) {
			elms3[i].style.visibility = s;
		}
		var elms4 = document.getElementsByTagName('embed');
		for (var i = 0; i != elms4.length; i++) {
			elms4[i].style.visibility = s;
		}
	}
}

OTS.loginReg = {
	load : function() {
		OTS.loginReg.Form = document.getElementById('loginreg_box');
		if (!OTS.loginReg.Form) return;
		
		var ja = document.getElementsByTagName('a');
		for (var i = 0; i < ja.length; i++) {
			if (ja[i].className == 'signin') {
				ja[i].onclick = function() {
					OTS.loginReg.show();
					return false;
				}
				/*ja[i].href = '#';*/
			}
		}
		
		OTS.loginReg.Box = document.getElementById('litebox');
		if (OTS.loginReg.Box) OTS.loginReg.Box.onclick = function() {
			OTS.loginReg.hide();
			return false;
		}
		
		OTS.loginReg.Close = document.createElement('div');
		OTS.loginReg.Close.className = 'litebox_close';
		OTS.loginReg.Form.appendChild(OTS.loginReg.Close);
		if (OTS.loginReg.Close) OTS.loginReg.Close.onclick = function() {
			OTS.loginReg.hide();
			return false;
		}
	},
	show : function(s) {
		var pgeSizeArr = OTS.getPageSize();
		var pgeScroll = OTS.getPageScroll();
		var f = OTS.loginReg.Form;
		OTS.setStyle(OTS.loginReg.Box, 'height', pgeSizeArr.pageHeight + 'px');
		OTS.setStyle(OTS.loginReg.Box, 'display', 'block');
		OTS.setStyle(OTS.loginReg.Box, 'opacity', '80');
		var t = (pgeSizeArr.windowHeight * .5) - (f.offsetHeight * .5);
		if (pgeSizeArr.windowHeight > 600) {
			t = 120;
		}
		OTS.setStyle(OTS.loginReg.Form, 'top', (pgeScroll + t) + 'px');
		OTS.setStyle(OTS.loginReg.Form, 'left', (pgeSizeArr.pageWidth * .5) - (f.offsetWidth * .5) + 'px');
		var o = OTS.$('user_login');
		if (!o) return;
		o.user_name.focus();
		OTS.litebox.toggleObjects('hidden');
		OTS.loginReg.showMsgr(s);
	},
	hide : function() {
		OTS.setStyle(OTS.loginReg.Form, 'top', '-1000px');
		OTS.setStyle(OTS.loginReg.Form, 'left', '-2000px');
		OTS.setStyle(OTS.loginReg.Box, 'display', 'none');
		OTS.litebox.toggleObjects('visible');
		OTS.loginReg.hideMsgr();
	},
	showMsgr : function(s) {
		var o = OTS.$('login_msgr');
		if (!o) return;
		//if (!s) s = 0;
		if (!s) return;
		var t = '<div class="login_msgr">';
		t += OTS.loginMsgTxtObj[s];
		t += '</div>';
		OTS.setHTML(o, t);
	},
	hideMsgr : function() {
		var o = OTS.$('login_msgr');
		if (!o) return;
		OTS.setHTML(o, '');
	}
}

/*
/////////////////////////////
	Auth validation
/////////////////////////////
*/

OTS.loginMsgTxtObj = {
	'generic' : "Generic",
	'login' : "Login",
	'register' : "Register",
	'favorites' : "Favorites",
	'helpful' : "Helpful",
	'abuse' : "Abuse",
	'review' : "Review",
	'comment' : "Comment",
	'blog' : "Blog"
}
OTS.doLogin = function(s) {
	OTS.loginReg.show(s);
}
OTS.loginTxtObj = {
	't1' : 'Username or E-mail',
	't2' : 'Password'
}
OTS.validateLogin = function() {
	var f = document.user_login;
	var s = '';
	if (f.user_name.value == '') s += OTS.loginTxtObj.t1 + "<br />";
	if (f.password.value == '') s += OTS.loginTxtObj.t2 + "<br />";
	if (s != '') {
		OTS.validateWriteErrs('login_errors', s);
		return false;
	} else {
		f.submit();
	}
}
OTS.registerTxtObj = {
	't1' : 'Username',
	't2' : 'E-mail Address',
	't3' : 'Passord',
	't4' : 'Retype Password'
}
OTS.validateReg = function() {
	var f = document.user_register;
	var s = '';
	if (f.user_name.value == '') s += OTS.registerTxtObj.t1 + "<br />";
	if (f.email.value == '') s += OTS.registerTxtObj.t2 + "<br />";
	if (f.password.value == '') s += OTS.registerTxtObj.t3 + "<br />";
	if (f.password_check.value == '') s += OTS.registerTxtObj.t4 + "<br />";
	if (s != '') {
		OTS.validateWriteErrs('reg_errors', s);
		return false;
	} else {
		f.submit();
	}
}
OTS.validateWriteErrs = function(id, s) {
	var s = '' + '<h4>Error</h4>' + s + '';
	var elm = document.getElementById(id);
	if (elm) {
		elm.innerHTML = '<div class="errors">' + s + '</div>';
		elm.style.display = 'block';
	} else {
		s = s.replace(/<\/h4>/g, "\n\n");
		s = s.replace(/<br \/>/g, "\n");
		s = s.replace(/(<([^>]+)>)/ig,""); 
		alert(s);
	}
}

/*
/////////////////////////////
	
/////////////////////////////
*/

window.onerror = function() {
	return true;
}
function globalInit() {
	//litebox.load();
	//OTS.loginReg.load();
}
function addEvent(obj, evType, fn) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, true);
		return true;
	} else if (obj.attachEvent) {
		var r = obj.attachEvent('on' + evType, fn);
		return r;
	} else {
		return false;
	}
}
addEvent(window, 'load', globalInit);

/*
/////////////////////////////
	Misc - Legacy
/////////////////////////////
*/

function searchBgClear(o, v) {
	if (v == 1) v = '-20px';
	o.style.backgroundPosition='0 ' + v;
}
function MM_openBrWindow(theURL, winName, features) {
	window.open(theURL, winName, features);
}

/*
/////////////////////////////
mad_dropdown_1.1.js
/////////////////////////////
*/

var Obj;
var drop;
function Suggesting(this_obj, event, value, id, d_id, url, wait_msg, nchr, dchr, delay ) {
	if (!Obj) {
		Obj = new madSuggest(event, value, id, d_id, url, nchr, dchr, delay, wait_msg);
	} else if (Obj.id != id) {
		Obj = new madSuggest(event, value, id, d_id, url, nchr, dchr, delay, wait_msg);
	}
	if (delay) {
		Obj.delay = delay;
	}
	Obj.doSuggest();
	if (Obj.trigger == 1) {
		drop = new DropDown(this_obj, event, '285px', 'd_results', 'keyup', Obj.trigger);
		//drop.dropmenuobj.style.left = drop.dropmenuobj.x - drop.clearbrowseredge("rightedge") + "px";
		//drop.dropmenuobj.style.top = drop.dropmenuobj.y - drop.clearbrowseredge("bottomedge") + drop.obj.offsetHeight + "px";
	}
	return false;
}
function elmOff(o) {
	var elm = document.getElementById(o);
	if (!elm) return;
	elm.style.display = 'block';
}
function elmOn(o) {
	var elm = document.getElementById(o);
	if (!elm) return;
	elm.style.display = "block";
}
/* Ajax requester */
var req;
var id;
function loadHTMLDoc(url, _id, msg) {
	id = _id;
	var o = document.getElementById(id);
	if (o) o.innerHTML = msg;
    /* branch for native XMLHttpRequest object */
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url, true);
        req.send(null);
    /* branch for IE/Windows ActiveX version */
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send();
        }
    }
}
function processReqChange() {
    if (req.readyState == 4) {
        if (req.status == 200) {
			/*alert(req.responseText); */
			var ads = req.responseText;		
			parseAds(ads);
        } else {
            alert("There was a problem retrieving the XML data:\n" + req.statusText);
        }
    }
}
function parseAds(s) {
	var ads = s;
	var p = "000";
	if (s.indexOf("adpos") > -1) {
		/*alert('Is here'); */
		p = s.substring(s.indexOf("adpos") + 6, s.indexOf("adpos") + 9);
	}
	document.getElementById(id).innerHTML = s;
}
function loadHTMLDocObj(url,_id, string_message, skip) {
	this.id = _id;
	this.url = url;
	this.string_message = string_message;
	if (this.string_message == ''){
		this.string_message = 'Retrieving your request.';
	}	
	if (skip != 'y') {
		document.getElementById(this.id).innerHTML = this.string_message;
	}
	var _this = this;
	if (window.XMLHttpRequest) {
		this.req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		this.req = new ActiveXObject("Microsoft.XMLHTTP");
    }
	if (this.req){
		var _this = this;
	   	this.req.onreadystatechange = function() {
			_this.processReq();
		};
	   	this.req.open("GET", url, true);
	    	this.req.send(null);
	} else {
		return;
	}
}
loadHTMLDocObj.prototype.processReq = function() {
    if (this.req.readyState == 4) {
        if (this.req.status == 200) {
			/*alert(req.responseText); */
			var s = this.req.responseText;	
			document.getElementById(this.id).innerHTML = s;	
        } else {
            document.getElementById(this.id).innerHTML = 'There was a problem retrieving your request.' + req.statusText;
        }
    }
}
/* The POSTER */
function madbuilderPost(form, id) {
	this.form = form;
	this.id = id;
	this.formObj = eval('document.' + form);	
	this.action = (!this.formObj.action ? '' : this.formObj.action);
	this.uri = '';
} 
madbuilderPost.prototype.makeGetRequest = function() {
	this.makeURI();
	this.uri = this.action + '?' + this.uri; 
	var r = new loadHTMLDocObj(this.uri, this.id, '');	
}
madbuilderPost.prototype.makeURI = function() {
	var uri;
	for (var i = 0; i < this.formObj.elements.length; ++i) {
		if (this.formObj.elements[i].type == 'radio' || this.formObj.elements[i].type == 'checkbox') {				
			if (this.formObj.elements[i].checked){
				uri = ((i != 0) ? uri + '&' : '') + this.formObj.elements[i].name + '=' + this.formObj.elements[i].value;
			}
		} else {
			uri = ((i != 0) ? uri + '&' : '') + this.formObj.elements[i].name + '=' + this.formObj.elements[i].value;
		}
	}
	this.uri = uri;
}
/* The Suggester */
function update_form_field(form, name, value) {
	var formObj = document.getElementById(form);
	for (var i = 0; i < formObj.elements.length; ++i) {
		if (formObj.elements[i].name == name) {
			formObj.elements[i].value = value;
		}
	}
}
var _mad_timer;
var delay = 200;
function clearMadSuggest() {
	clearTimeout(_mad_timer);
}
function madSuggest(pressevent, value, id, d_id, url, nchr, dchr, delay, wait_msg) {
	this.url = url;
	this.trigger = 0;
	this.pressevent = pressevent;
	this.id = id;
	this.d_id = d_id;
	this.nchr = !nchr ? 3 : nchr;
	this.dchr = !dchr ? 0 : dchr;
	this.delay = delay;
	//this.wait_msg = !wait_msg ? 'Retrieving' : wait_msg;
	this.wait_msg = !wait_msg ? '<div style="background:#fff; position:absolute; top:-26px; left:-21px;"><img src="http://images.onthesnow.com/ots/images/icon_loading.gif" alt="" border="0" /></div>' : wait_msg;
	/*alert(wait_msg); */
	this.genSkipChars();
}	
madSuggest.prototype.delay_loadHTMLDoc = function() {
	clearMadSuggest();
	_mad_timer = setTimeout("loadHTMLDoc('" + this.target_url + "','" + this.d_id + "','" + this.wait_msg + "')", this.delay);
	var o = document.getElementById(this.d_id);
	if (o) o.innerHTML = this.wait_msg;	
}
madSuggest.prototype.genSkipChars = function() {
	var skipChars=new Array();
	skipChars["9"]=1;
	skipChars["16"]=1;
	skipChars["17"]=1;
	skipChars["18"]=1;
	skipChars["19"]=1;
	skipChars["20"]=1;
	skipChars["27"]=1;
	skipChars["33"]=1;
	skipChars["34"]=1;
	skipChars["35"]=1;
	skipChars["36"]=1;
	skipChars["37"]=1;
	skipChars["38"]=1;
	skipChars["39"]=1;
	skipChars["40"]=1;
	skipChars["45"]=1;
	skipChars["46"]=1;
	skipChars["91"]=1;
	skipChars["92"]=1;
	skipChars["93"]=1;
	skipChars["96"]=1;
	skipChars["97"]=1;
	skipChars["98"]=1;
	skipChars["99"]=1;
	skipChars["100"]=1;
	skipChars["101"]=1;
	skipChars["102"]=1;
	skipChars["103"]=1;
	skipChars["104"]=1;
	skipChars["105"]=1;
	skipChars["112"]=1;
	skipChars["113"]=1;
	skipChars["114"]=1;
	skipChars["115"]=1;
	skipChars["116"]=1;
	skipChars["117"]=1;
	skipChars["118"]=1;
	skipChars["119"]=1;
	skipChars["120"]=1;
	skipChars["121"]=1;
	skipChars["122"]=1;
	skipChars["123"]=1;
	skipChars["144"]=1;
	skipChars["145"]=1;
	this.skipTheseChars=skipChars;
}
madSuggest.prototype.doSuggest = function() {		
	var charCode = (this.pressevent.which)? this.pressevent.which : (event.keyCode);
	if (this.skipTheseChars[charCode]) {
	
	} else {
		if (charCode != 13) {
			var word = document.getElementById(this.id).value; 	
			if (word.length >= this.nchr) {
				var _word = word;
				if (encodeURIComponent) {
					_word = encodeURIComponent(_word);
				} else {
					_word = escape(_word);
				}
				this.target_url = this.url + _word;
				this.delay_loadHTMLDoc();
				this.trigger = 1;	
				elmOn(this.d_id);
			} else if(word.length > 0) {
			 	if (word.length >= this.dchr && (word.charAt(0) == "'" || word.charAt(0) == '"' || ( word.charAt(0) >= 0 && word.charAt(0) <=9 ))) {	
					var _word = word;
					if (encodeURIComponent) {
						_word = encodeURIComponent(_word);
					} else {
						_word = escape(_word);
					}
					this.target_url = this.url + _word;
					this.delay_loadHTMLDoc();
					this.trigger = 1;
					elmOn(this.d_id);
				} else {
					elmOff(this.d_id);
				}
			} else {
				elmOff(this.d_id);
			}
		}
	}
}


/*
/////////////////////////////
mad_requester_1.1.js
/////////////////////////////
*/

var disappeardelay = 250;
var hidemenu_onclick = 'yes';
var ie4 = document.all;
var ns6 = document.getElementById && !document.all;
var dd_object;
if (ie4 || ns6) {
	/*document.write('<div id="dropmenudiv" onmouseover="clearhidemenu();" onmouseout="dynamichide(event);"></div>'); */
}
function DropDown(obj, e, con_w, id, event_type, trigger) {
	this.obj = obj;
	this.e = e;
	this.con_w = con_w;
	this.id = id;
	this.dropmenuobj = document.getElementById(this.id);
	if (!this.dropmenuobj) {
		this.dropmenuobj = document.createElement('div');
		this.dropmenuobj.id = this.id;
		var t = document.getElementById('empty');
		if (!t) return;
		t.appendChild(this.dropmenuobj);
	}
	this.dropmenuobj.style.width = con_w;
	this.event_type = event_type ? event_type : e.type;
	if (trigger == 1) {
		dd_object = this;
		this.do_menu();
	}
}
DropDown.prototype.do_menu = function() {
	if (window.event) event.cancelBubble = true;
	else if (this.e.stopPropagation) this.e.stopPropagation();
	clearhidemenu();
	if (ie4 || ns6) {
		this.showhide("visible", "hidden", this.con_w);
		this.dropmenuobj.x = this.getposOffset("left");
		this.dropmenuobj.y = this.getposOffset("top");
		this.dropmenuobj.style.left = this.dropmenuobj.x - this.clearbrowseredge("rightedge") + "px";
		this.dropmenuobj.style.top = this.dropmenuobj.y - this.clearbrowseredge("bottomedge") + this.obj.offsetHeight + "px";
	}
	return clickreturnvalue();
}
DropDown.prototype.getposOffset = function(offsettype) {
	var totaloffset = (offsettype == "left") ? this.obj.offsetLeft : this.obj.offsetTop;
	var parentEl = this.obj.offsetParent;
	while (parentEl != null) {
		totaloffset = (offsettype == "left") ? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
		parentEl = parentEl.offsetParent;
	}
	return totaloffset;
}
DropDown.prototype.clearbrowseredge = function(whichedge) {
	var edgeoffset = 0;
	if (whichedge == "rightedge") {
		var windowedge = ie4 && !window.opera ? iecompattest().scrollLeft + iecompattest().clientWidth - 15 : window.pageXOffset + window.innerWidth - 15;
		this.dropmenuobj.contentmeasure = this.dropmenuobj.offsetWidth;
		if (windowedge - this.dropmenuobj.x < this.dropmenuobj.contentmeasure) edgeoffset = this.dropmenuobj.contentmeasure - this.obj.offsetWidth;
	} else {
		var windowedge = ie4 && !window.opera ? iecompattest().scrollTop + iecompattest().clientHeight - 15 : window.pageYOffset + window.innerHeight - 18;
		this.dropmenuobj.contentmeasure = this.dropmenuobj.offsetHeight;
		if (windowedge - this.dropmenuobj.y < this.dropmenuobj.contentmeasure) edgeoffset = this.dropmenuobj.contentmeasure + this.obj.offsetHeight;
	}
	return edgeoffset;
}
DropDown.prototype.showhide = function(visible, hidden) {
	if (ie4 || ns6) {
		/* this.dropmenuobj.style.left = this.dropmenuobj.style.top = -2000 + "px"; */
	}
	if (this.con_w != "") {
		this.dropmenuobj.widthobj = this.dropmenuobj.style;
		this.dropmenuobj.widthobj.width = this.con_w;
	}
	if ((this.e.type == "click" || this.e.type == this.event_type) && (this.dropmenuobj.style.visibility == hidden || this.dropmenuobj.style.visibility == '') || this.e.type == "mouseover") {	
		this.dropmenuobj.style.visibility = visible;
	} else if (this.e.type == "click") {
		this.dropmenuobj.style.visibility = hidden;
	} else {
		this.dropmenuobj.style.visiblity = hidden;
	}
}
function dynamichide(e) {
	if (ie4 && !dropmenuobj.contains(e.toElement)) {
		delayhidemenu();
	} else if (ns6 && e.currentTarget != e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget)) {
		delayhidemenu();
	}
}
function hidemenu(e) {
	if (typeof dd_object != "undefined") {
		if (typeof dd_object.dropmenuobj != "undefined") {
			if (ie4 || ns6) {
				dd_object.dropmenuobj.style.visibility = "hidden";
			}
		}
	}
}
function delayhidemenu() {
	if (ie4 || ns6) {
		delayhide = setTimeout("hidemenu()", disappeardelay);
	}
}	
function iecompattest() {
	return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}
function clickreturnvalue() {
	if (ie4 || ns6) return false;
	else return true;
}
function contains_ns6(a, b) {
	while (b.parentNode) {
		if ((b = b.parentNode) == a) {
			return true;
		}
	}
	return false;
}
function clearhidemenu() {
	if (typeof delayhide != "undefined") {
		clearTimeout(delayhide);
	}
}
if (hidemenu_onclick == "yes") {
	document.onclick = hidemenu;
}


/*
/////////////////////////////
seo_tracking.js
/////////////////////////////
*/

/* get the http referer and encode it */
var refr = escape(document.referrer);
/* get the host domain */
var dom = location.hostname;
var stURL="http://na.decdna.net/n/13446/45299/www.onthesnow.com/5tpfrs;11;3;;6;;1hr5ql;;;;;1;/i/c?0&1pixgif&referer=" + refr;
/* if the referrer is external preload the image request and does not contain 247SEO argument = "N" and XE_MKT and DNAid */
if ((refr && refr.search(dom) == -1) && (location.href.toUpperCase().indexOf("247SEO=N") == -1) && (location.href.toUpperCase().indexOf("247SEM") == -1) && (location.href.toUpperCase().indexOf("XE_MKT") == -1) && (location.href.toUpperCase().indexOf("DNAID") == -1)) {
	imageTR = new Image();
	imageTR.src = stURL;
}
