function $el() {
	return document.getElementById(arguments[0]);
}
function bindEvent(el, sType, fn, capture) {
	if(window.attachEvent) {
		el.attachEvent("on" + sType, fn);
	} else if(window.addEventListener) {
		el.addEventListener(sType, fn, (capture));   
	}
}
var headline_count;
var headline_interval;
var old_headline = 0;
var current_headline=0;
jQuery.noConflict();
jQuery(document).ready(function(){
	menu();
  headline_count = jQuery("div.headline").size();
  jQuery("div.headline").eq(current_headline).css('top','5px');
  
  headline_interval = setInterval(headline_rotate,6000); //time in milliseconds
  jQuery('#scrollup').hover(function() {
    clearInterval(headline_interval);
  }, function() {
    headline_interval = setInterval(headline_rotate,6000); //time in milliseconds
    headline_rotate();
  });
});
function headline_rotate() {
  current_headline = (old_headline + 1) % headline_count; //remainder will always equal old_headline until it reaches headline_count - at which point it becomes zero. clock arithmetic
  jQuery("div.headline").eq(old_headline).animate({top: -205},"slow", function() {
    jQuery(this).css('top','210px');
    });
  jQuery("div.headline").eq(current_headline).show().animate({top: 5},"slow");  
  old_headline = current_headline;
}
function SelectClick(n,v){
var q = location.search.substring(1),str='?',isthere=false,pairs = q.split('&');
for(var i=0;i<pairs.length;i++){var s = pairs[i].split('=');
if(s[0]==n){
	isthere=true;
	if(v!="")str+=n+'='+v+'&';
	} else {
str+=pairs[i]+'&';}}if(!isthere) str+=n+'='+v+'&';
return window.location.href=location.pathname+str.substring(0,str.length-1)}
/** menu **/
function menu(){
	var pd = location.href.match(/(pd.)([0-9]+)(.)([0-9]+)([a-z0-9\-\.]+)$/);
	//if(pd) alert(pd[4]);
	var t = location.href.match(/(t.)([0-9]+)(.)([0-9]+)(.*)$/);
	//if(t) alert(t[2]);
	if(!$el('nav')) return;
	var el = $el('nav').getElementsByTagName('a');
	for(var i=0;i<el.length;i++){
		if(el[i].href==location.href){
			el[i].style.fontWeight = 'bold';
			if(el[i].className=='arrow'){
				el[i].nextSibling.style.display = 'block';
			} else {
				el[i].parentNode.parentNode.style.display = 'block';
			}
		} else if(pd){
			if(el[i].href.indexOf("t."+pd[4]+".")>-1){
				el[i].parentNode.parentNode.style.display = 'block';
				el[i].style.fontWeight = 'bold';
			}
		} else if(t){
			if(el[i].href.indexOf("t."+t[2]+".")>-1){
				el[i].parentNode.parentNode.style.display = 'block';
				el[i].style.fontWeight = 'bold';
			}
		}
	}
}