/****************************************************************************
* scripts.js
* Common JavaScript functions: initialization, text-scroller, window-opener
* author: a.fehn@design-aspekt.com | date: 2003-03-10
*
* produced by design aspekt
* http://design-aspekt.com
***************************************************************************/

// if your not 'index' go to 'index' ;-) 
//if (top.window.name != "{name}") top.location.href = "index.php"

//______________________________________________________________________
//TEXTSCROLLER
//You set the width and height of the divs inside the style tag, you only have to
//change the divCont, Remeber to set the clip the same as the width and height.
//If you want it to move faster you can set this lower:
var speed=50
//Sets variables to keep track of what's happening
var loop, timer
//Makes the object go up

function goDown(move){
	if(this.y>-this.scrollHeight+clipWindow.clipHeight){
		this.moveIt(0,this.y-move)
			if(loop) setTimeout(this.obj+".down("+move+")",speed)
	}
}
//Makes the object go down
function goUp(move){
	if(this.y<0){
		this.moveIt(0,this.y-move)
		if(loop) setTimeout(this.obj+".up("+move+")",speed)
	}
}
//Calls the scrolling functions. Also checks whether the page is loaded or not.
function scroll(speed){
	if(loaded){
		loop=true;
		if(speed>0) scrolltext.down(speed)
		else scrolltext.up(speed)
	}
}
//Stops the scrolling (called on mouseout)
function noScroll(){
	loop=false
	if(timer) clearTimeout(timer)
}

//______________________________________________________________________
// Layer
function getLayer(layerID) {
	return (document.getElementById?document.getElementById(layerID).style:document.all?document.all[layerID].style:document.layers[layerID]);
}
function layerAn() {
	for(i=0;i<arguments.length;i++) { getLayer(arguments[i]).visibility="visible"; }
}
function layerAus() {
	for(i=0;i<arguments.length;i++) { getLayer(arguments[i]).visibility="hidden"; }
}

var timeout = 500;
function timeoutAn() {
	var arg='';
	for(i=0;i<arguments.length;i++) {arg += arguments[i]+',';}
	arg = arg.substr(0,arg.length-1);
	setTimeout("layerAn('"+arg+"')",timeout);
}
function timeoutAus() {
	var arg='';
	for(i=0;i<arguments.length;i++) {arg += arguments[i]+',';}
	arg = arg.substr(0,arg.length-1);
	ausschalten = setTimeout("layerAus('"+arg+"')",timeout);
}

//______________________________________________________________________
// Bildwechsel
var Bilder = new Array();
function vorLader(bildName,src1,src2) {
	Bilder[bildName]=new Array();
	Bilder[bildName]["aus"]=new Image();
	Bilder[bildName]["aus"].src=src1;
	Bilder[bildName]["an"]=new Image();
	Bilder[bildName]["an"].src=src2;
}
//vorLader("home","grafiken/home_out.gif","grafiken/home_ov.gif");

var Swaps = new Array();					
function vorLaderSwap() {
	for (i=0; i<arguments.length; i++) {
		Swaps[i] = new Image();
		Swaps[i].src = arguments[i];
	}
}
//vorLaderSwap("pix/home_1.gif","pix/home_2.gif");

function getImage(bildName,layerID) {
	return (document.all||document.getElementById?window.document.images[bildName]:layerID?document.layers[layerID].document.images[bildName]:window.document.images[bildName]);
}
function bildAn(bildName,layerID) {
	getImage(bildName,layerID).src=Bilder[bildName]["an"].src;
}
function bildAus(bildName,layerID) {
	getImage(bildName,layerID).src=Bilder[bildName]["aus"].src;
}
function swapImage(bildName,bildNr,layerID) {
	getImage(bildName,layerID).src=Swaps[bildNr].src;
}
// macromedia-funktionen
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//______________________________________________________________________
// opens new window
function popup(url) {
	var w = 400; var h = 500;
	l = Math.round(screen.width/2) - Math.round(w/2);
	t = Math.round(screen.height/2) - Math.round(h/2);
	if (screen.height<h) { h = (screen.height-80);}
	owin = open(url,'popup','toolbar=0,status=0,scrollbars=1,width='+w+',height='+h+',resizable=1,top='+t+',left='+l);
	owin.focus();
}
function openwin(url,w,h,r,s) {
	if (screen.height<h) { h = (screen.height-80);}
	owin = open(url,'','toolbar=0,status=1,scrollbars='+s+',width='+w+',height='+h+',resizable='+r+',top=0,left=0');
	owin.focus();
}
