var Scroll = {
	yOffset			: 0,
	scrollLoop 		: false, 
	scrollInterval	: null,
	getWindowHeight	: function() {
		if (document.all) {  return (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight; }
		else { return window.innerHeight; }
		},
	getScrollLeft	: function() {
		if (document.all) { return (document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft; }
		else { return window.pageXOffset; }
		},
	getScrollTop	: function() {
		if (document.all) { return (document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop; }
		else { return window.pageYOffset; }
		},
	getElementYpos	: function(el) {
		var y = 0;
		while(el.offsetParent){
			y += el.offsetTop
			el = el.offsetParent;
			}
		return y;
		},
	to: function(id){
		id = id.replace(/^[^#]*#/,'');
		if(id!='top')cq(id);
		if(this.scrollLoop){
			clearInterval(this.scrollInterval);
			this.scrollLoop = false;
			this.scrollInterval = null;
			}
		var container = document.getElementById('main');
		var documentHeight = this.getElementYpos(container) + container.offsetHeight;
		var windowHeight = this.getWindowHeight()-this.yOffset;
		var ypos = this.getElementYpos(document.getElementById(id));
		if(ypos > documentHeight - windowHeight) ypos = documentHeight - windowHeight;
		this.scrollTo(0,ypos-this.yOffset);
		},
	scrollTo: function(x,y) {
		if(this.scrollLoop) {
			var left = this.getScrollLeft();
			var top = this.getScrollTop();
			if(Math.abs(left-x) <= 1 && Math.abs(top-y) <= 1) {
				window.scrollTo(x,y);
				clearInterval(this.scrollInterval);
				this.scrollLoop = false;
				this.scrollInterval = null;
				}
			else {
				window.scrollTo(left+(x-left)/10, top+(y-top)/10);
				}
			}
		else {
			this.scrollInterval = setInterval("Scroll.scrollTo("+x+","+y+")",10);
			this.scrollLoop = true;
			}
		}
	};
	
window.onload = init;
var pqid;
function init() {
	url = ''+window.location;
	surl = url.split('#');
	if(surl[1] && tq(surl[1])) cq(surl[1]);
}
function cq(qid) {
	if(pqid) tq(pqid).className = 'faq_q';
	pqid = qid;
	tq(qid).className = 'faq_q_s';
	return false;
}
function tq(qid) {
	d = document;
	return d.getElementById(qid);
}