function initScrollmatic3000(){
	var sw = new ScrollWindow(document.getElementById('scroll-container'),document.getElementById('process-top-nav'),504,4);
	sw.init();
}

function faqinator(){

	h=document.documentElement.firstChild;
	h.appendChild(c=document.createElement('link')).setAttribute('href','/css/faq.css');
	c.setAttribute('rel','stylesheet');
	var first = null;
	var faq = document.getElementById('faq-list');
	var lis = faq.getElementsByTagName('li');
	for(var k=0;k<lis.length;k++){
		if(lis[k].className.toLowerCase() == 'q off'){
			var a = lis[k].nextSibling;
			while(a.nodeType != 1){a = a.nextSibling;}
			lis[k].a = a;
			if(k==1){first = a;}
			//alert(a.scrollHeight);
			a.tween = new Tween(a,"height",0,a.scrollHeight,150,'px','',"easeSin");
			lis[k].onclick = function(){
				this.className = this.a.tween.position==0?"q on":"q off";
				this.a.tween.fv = this.a.scrollHeight;//ie sucks
				this.a.tween.play();
				return false;
			}
		}
	}
	first.tween.play();
}

function findLinks(){
	var a = document.getElementsByTagName('a');
	
	for(var k=0;k<a.length;k++){
		if(a[k].className.indexOf('external') != -1){
			a[k].href = '/external_site.html?url=' + a[k].href;
		} else if(a[k].className.indexOf('popupLink') != -1){
			a[k].onclick = function(){
				window.opener.open(this.href,"_self");
				window.opener.focus();
				return false;
			}
		} else if(a[k].className.indexOf('pdf') != -1){
			a[k].onclick = function(){
				dcsMultiTrack('DCS.dcsuri',this.href);
			}
		}
	}
}

function init(){
	if(arguments.callee.doOnce){return;}
	arguments.callee.doOnce=true;
	if(document.getElementById('scroll-container') && ScrollWindow && Tween){
		initScrollmatic3000();
	}
	if(document.getElementById('faq-list') && Tween){
		faqinator();
	}
	findLinks();
}

if(document.addEventListener){document.addEventListener("DOMContentLoaded",init,null);}
window.onload=init;