
function newspopup(url, name, width, height, woptions) {
var jetzt = new Date();
var expiredate = new Date(2005,20,11);
// Eingabe (Jahr,Monat,Tag)
// Monat beginnt bei 0 = Januar, 1= Februar usw., Tag und Jahr ganz normal
alert(expiredate);
if(jetzt<expiredate) {
	action = 'width='+width+',height='+height+','+woptions;
	NewsFenster = window.open(url, name, action);
	NewsFenster.focus();
	}
}

function popup(url, name, width, height, woptions) {
	action = 'width='+width+',height='+height+','+woptions;
	Fenster = window.open(url, name, action);
	Fenster.focus();
}

/* ** Navi ** */
function initNavi()
{
	var loc = new String(document.location);
	var sections = new Array('werk','text','netz','kontakt','impressum','exposes');
	for (var i = 0; i < sections.length; i++) {
		if (loc.indexOf('/'+sections[i]+'/') != -1) {
			d = document.getElementsByName(sections[i]);
			if (d.length == 1) {
				d.item(0).className = 'active';
			}
		}
	}
}

/* ** Scroller ** */
function verifyCompatibleBrowser()
{ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
    return this 
} 

bw=new verifyCompatibleBrowser() 

var speed=5
var loop, timer 

function ConstructObject(obj,nest)
{ 
	nest=(!nest) ? '':'document.'+nest+'.' 
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
    this.up=MoveAreaUp;
    this.down=MoveAreaDown; 
    this.MoveArea=MoveArea; 
    this.x = 0;
    this.y = 0; 
    this.obj = obj + "Object";
    eval(this.obj + "=this") 
    return this 
} 

function MoveArea(x,y)
{ 
    this.x=x;
    this.y=y; 
    this.css.left = this.x; 
    this.css.top = this.y + 'px'; 
} 

function MoveAreaDown(move)
{ 
	if (this.y > -this.scrollHeight + this.objContainer.clipHeight) { 
    	this.MoveArea(0, this.y - move); 
    	if (loop) {
    		setTimeout(this.obj+".down("+move+")", speed);
    	}
	}
}

function MoveAreaUp(move)
{
	if (this.y < 0) {
		this.MoveArea(0, this.y - move);
		if (loop) {
			setTimeout(this.obj+".up("+move+")", speed);
		}
	}
}

function PerformScroll(scrollerName, speed)
{ 
	if (initialised) { 
		loop=true; 
		if (speed > 0) {
			scrollerObjects[scrollerName].objScroller.down(speed);
		} else {
			scrollerObjects[scrollerName].objScroller.up(speed);
		}
	}
}

function CeaseScroll()
{ 
    loop=false;
    if (timer) {
    	clearTimeout(timer);
    }
}

var initialised; 

function InitialiseScrollableArea(name)
{ 	
	scrollerObjects[name] = new Object();
    scrollerObjects[name].objContainer=new ConstructObject('scrollContainer' + name);
    scrollerObjects[name].objScroller=new ConstructObject('scrollContent' + name, 'scrollContainer' + name);
    scrollerObjects[name].objScroller.MoveArea(0,0); 
    scrollerObjects[name].objContainer.css.visibility='visible';
    scrollerObjects[name].objScroller.objContainer = scrollerObjects[name].objContainer;
    
	initialised=true; 
    //show buttons?
    
    if (scrollerObjects[name].objScroller.scrollHeight < scrollerObjects[name].objContainer.clipHeight) {
			document.images['scroll_up'].src = '/images/spacer.gif';
			document.images['scroll_down'].src = '/images/spacer.gif';			
	}
}

var scrollerObjects = new Object();

function initScroller()
{
	for (var i = 0; i < scrollElements.length; i++) {
		InitialiseScrollableArea(scrollElements[i]);	
	}
}

function initwerknavi()
{
	locationString = new String(document.location);	
	werkid = 'werk' + locationString.substring(locationString.lastIndexOf('/') + 1, locationString.lastIndexOf('.'));
	d = document.getElementsByName(werkid);
	dscroll = document.getElementById('scrollContainerA');
	//alert(dscroll.clientHeight);
	//alert(scrollerObjects['A'].objScroller.MoveArea);
	if (d.length == 1) {
		//alert(d.item(0).offsetTop);
		if (d.item(0).offsetTop > dscroll.clientHeight) {
			scrollerObjects['A'].objScroller.MoveArea(0, dscroll.clientHeight - d.item(0).offsetTop - d.item(0).clientHeight);
		}
		d.item(0).className = 'active';
	}
}

