/**********************************************/
/* calle's javascript effects                 */
/* Version 3.6                                */
/* Montag, 7. Juni 1999 13:37:22              */
/* Copyright (C) 1998-99 Carl-Eric Menzel.    */
/* All rights reserved - Alle Rechte          */
/* vorbehalten.                               */
/*                                            */
/* Features:                                  */
/* - standard MouseOver Image effects         */
/* - advanced Image effects such as flashing  */
/*   buttons, javascript-controlled           */
/*   animations and serial "knight-rider"     */
/*   effects                                  */
/* - console window function                  */
/* - programmable form validator              */
/* - "quickfinder" selectbox links            */
/* - everything is easy to use, the site      */
/*   designer does not need to know any       */
/*   javascript                               */
/*                                            */
/* If you want to use this set of scripts,    */
/* write to cfx@bitforce.com to get my per-   */
/* mission. This permission is *free* as long */
/* as I am properly mentioned on the site     */
/* that uses the scripts.                     */
/* For DM 20 / EUR 11 / US$ 12 you may use    */
/* them without mentioning my name.           */
/* ##### You may not use these scripts ###### */
/* ##### without my permission! ############# */
/*                                            */
/* Wenn Sie dieses Script-Set benutzen        */
/* wollen, schreiben Sie an cfx@bitforce.com  */
/* um meine Erlaubnis zu bekommen. Diese      */
/* Erlaubnis ist *kostenlos*, solange ich auf */
/* der entsprechenden Website erwaehnt werde. */
/* Fuer DM 20 / EUR 11 / US$ 12 koennen Sie   */
/* das Script-Set benutzen, ohne meinen Namen */
/* zu nennen.                                 */
/* #### Auf keinen Fall darf das Script- #### */
/* #### Set ohne meine Erlaubnis benutzt #### */
/* #### werden! ############################# */
/*                                            */
/* RPF Agentur fuer Online GmbH, Nuernberg,   */
/* hat eine unbegrenzte Nutzungslizenz.       */
/**********************************************/
cfx_versions = new Array();
test = new cfx_browsertest();
preloaders = new Array();
objects = new Array();
document.cfxloaded = true;
maccheck = false;
cfx_initialize = new Array();
cfx_initialize[0] = "cfx_main_init()";
cfx_versions = new Array();
cfx_versions["cfx"] = "3.6";
cfx_versions["main"] = "3.6";
String.prototype.cfx_trim = cfx_stringtrim;
String.prototype.cfx_digits = cfx_stringdigitcheck;

function cfx_errorhandler() {
	return true;
} //endif

//window.onerror=cfx_errorhandler;

function cfx_browsertest() {
	this.microsoft = false;
	this.browser = true;
	this.timeoutenabled = true;
	this.pageloaded = false
	this.quickmenu = false;
	this.scriptloaded = true;
	if (document.images) { /* das geht bei allen ab NS3 */
	   this.imageenabled=true;
	} else {
	   this.imageenabled=false;
	} //endif
	if (navigator.appName == "Microsoft Internet Explorer") { /* Explorer 3 macht nur Scheisse */
		this.microsoft = true;
		if (eval(navigator.appVersion.charAt(0)) < 4) {
			this.browser = false;
			this.timeoutenabled = false;
			this.imageenabled = false;
		}
	}
} //endfunction

function cfx_init() {
		if ((navigator.userAgent.toLowerCase().indexOf("mac") > -1) && (maccheck == false)) {
			maccheck = true;
			if (cfx_init.arguments.length > 0) {
				window.setTimeout("cfx_init('" + cfx_init.arguments[0] + "')",500);
			} else {
				window.setTimeout("cfx_init()",500);
			} //endif
		} else {
			var i;
			for (i = 0; i < cfx_initialize.length; i++) {
				eval(cfx_initialize[i]);
			} //endfor
			test.pageloaded = true;
			cfx_do_preloading();
			var args = cfx_init.arguments;
			if (args.length > 0) {
				eval(args[0]);
			} //endif
		} //endif
} //endfunction

function cfx_main_init() {
	cfx_messages = new Array();
	cfx_createmessages();
	cfx_language = "de";
	if (test.imageenabled) {
		var imgName = " ";
		var objName = " ";
		var formName = "";
		var i = 0;
		for (i=0; i<document.images.length; i++) {	/* alle Images checken */
			imgName = document.images[i].name;		/* Namen herausfinden */
			if (imgName != "") {	/* hat es ueberhaupt einen ? */
				if (imgName.substring(0,4) == "cfx_") { /* CFX verwendet ausschliesslich gekennzeichnete Images!! */
					objName = imgName.substring(4,(imgName.length)); /* Der imgName besteht aus "cfx_" und dem Namen des dazugehoerenden cfx-Objektes */
					eval(objName + ".name = '" + objName + "'");	/* Trauriger Trick: Das Objekt kriegt seinen Namen vom Image gesagt :-)
																	   object.name = imgName ohne "cfx_"
																	   Das muss dann aber auch der Variablenname fuer das Objekt sein, der im <HEAD> benutzt wird!
																	   Was tut man nicht alles, damit die Designer weniger tippen muessen...#-> */
					eval(objName + ".targ = '" + imgName + "'");	/* Und das dazugehoerige Ziel-Image wird als object.targ abgelegt */
				} //endif
			} //endif
		} //endfor
	} //endif
} //endfunction

function cfx_button(inactimg,actimg) {
	if (test.imageenabled) {	/* Ohne Imagefaehigkeiten legen wir auch kein Objekt an! */
		if (inactimg.substring(0,5) == "anim:") {	/* Das Prefix "anim:" sagt uns, dass hier keine Image-URL folgt, sondern der Bezeichner fuer eine cfx_anim */
			this.animoff = inactimg.substring(5,(inactimg.length));	/* Ohne "anim:" haben wir dann den Namen der cfx_anim */
			this.deact = cfx_animbutton_deact;	/* Fuer die cfx_anim brauchen wir natuerlich eine eigene deact()-Methode */
			if (eval(this.animoff + ".name") == "cfx_unassigned") {	/* Wenn die cfx_anim keinem Image direkt zugeordnet ist - was bei einer ON und einer OFF-Anim auch gar nicht geht... */
				eval(this.animoff + ".name = '" + this.animoff + "'");	/* ...dann wird sie von cfx_init() nicht gefunden und weiss ihren Namen daher nicht. */
			} //endif													/*  Deshalb bekommt sie ihn ueber den Umweg von cfx_button gesagt */
		} else {	/* Im Normalfall haben wir hier aber keine cfx_anim, sondern einfach ein Image */
			this.off = new Image();	/* Damit dieses Bild auch preloaded wird, eroeffnen wir ein neues Image-Object */
			this.off.src = inactimg;
			this.deact = cfx_button_deact;	/* in diesem Fall gibt es natuerlich die Standard-deact()-Methode */
		} //endif
		if (actimg.substring(0,5) == "anim:") {	/* Hier folgt dann dasselbe nochmal fuer den active-Status */
			this.animon = actimg.substring(5,(actimg.length));
			this.act = cfx_animbutton_act;
			if (eval(this.animon + ".name") == "cfx_unassigned") {
				eval(this.animon + ".name = '" + this.animon + "'");
			} //endif
		} else {
			this.on = new Image();
			this.on.src = actimg;
			this.act = cfx_button_act;
		} //endif
		this.state = false;	/* Zu Beginn ist der Button natuerlich im off-Status */
		this.counter = 0;	/* Der counter wird von cfx_flash() benutzt und hier nur initialisiert */
		this.timeoutid = 0;	/* dito */
		this.invert = cfx_invert;	/* invert() invertiert this.state und fuehrt die entsprechende Methode aus. Wird momentan nur von cfx_flash benutzt */
		this.flash = cfx_flash;	/* flash()-Methode, s.o. */
		this.objindex = objects.length;
		objects[this.objindex] = this;
	} //endif
} //endfunction

function cfx_button_act() {
	if (test.pageloaded) {	/* Es darf auf keinen Fall etwas getan werden, bevor die Seite geladen ist! IE4 ueberschuettet uns sonst mit daemlichen Fehlermeldungen!! */
		if (test.imageenabled) {
			if (cfx_button_act.arguments.length>0) {	/* Wird ein Delay angegeben? */
				if (test.timeoutenabled) {	/* und koennen wir ueberhaupt etwas mit timeouts anfangen? */
					var delay = eval(cfx_button_act.arguments[0]);
					this.timeoutid = window.setTimeout(this.name + ".act()",delay);	/* wenn ja, dann rufen wir uns einfach spaeter selbst nochmal auf :-) */
				} else {	/* ansonsten schreiten wir einfach zur Tat */
					this.act();
				} //endif
			} else {
				if (test.timeoutenabled) {
					if (this.timeoutid) {	/* Wartet der Button auf einen Timeout? */
						window.clearTimeout(this.timeoutid);	/* Jetzt sind wir zustaendig, also killen wir den Timeout */
						this.timeoutid = 0;
					} //endif
				} //endif
				this.state = true;
				document[this.targ].src = this.on.src;
			} //endif
		} //endif
	} //endif
} //endfunction

function cfx_button_deact() {	/* Fuer Beschreibung siehe cfx_button_act() */
	if (test.pageloaded) {
		if (test.imageenabled) {
			if (cfx_button_deact.arguments.length>0) {
				if (test.timeoutenabled) {
					var delay = eval(cfx_button_deact.arguments[0]);
					this.timeoutid = window.setTimeout(this.name + ".deact()",delay);
				} else {
					this.deact()
				} //endif
			} else {	
				if (test.timeoutenabled) {
					if (this.timeoutid) {
						window.clearTimeout(this.timeoutid);
						this.timeoutid = 0;
					} //endif
				} //endif
				this.state = false;
				document[this.targ].src = this.off.src;
			} //endif
		} //endif
	} //endif
} //endfunction

function cfx_flash() {
	if (test.pageloaded) {
		if (test.imageenabled) {
			var flashspeed = cfx_flash.arguments[0];
			var newLoc = "";
			if (cfx_flash.arguments.length > 1) {	/* haben wir eine URL als zweites argument? */
				newLoc = cfx_flash.arguments[1];
				var commandstring = "objects[" + this.objindex + "].flash('" + flashspeed + "','" + newLoc + "')";
			} else {
				var commandstring = "objects[" + this.objindex + "].flash('" + flashspeed + "')";
			} //endif
			if (test.timeoutenabled) {
				if (this.counter<3) {	/* wir blinken nur vier mal */
					this.counter++;		/* das wiederholte blinken wird durch rekursives aufrufen via setTimeout() erledigt */
					this.invert();
					window.setTimeout(commandstring,eval(flashspeed));
				} else {
					this.counter = 0;
					this.invert();
					if (newLoc!="") {
						document.location = newLoc;
					} //endif
				} //endif
			} else {	/* wenn wir keine timeouts benutzen duerfen, dann linken wir bloss weiter */
					if (newLoc!="") {
						document.location = newLoc;
					} //endif
			} //endif
		} else {
			if (cfx_flash.arguments.length > 1) {
				document.location = cfx_flash.arguments[1];
			} //endif
		} //endif
	} //endif
} //endfunction

function cfx_invert() {
	if (this.state == false) {
		this.act();
		this.state = true;
	} else {
		this.deact();
		this.state = false;
	} //endif
} //endif

function cfx_multi() {
	if (test.imageenabled) {
		var len = cfx_multi.arguments.length;
		this.targets = new Array();
		for (i = 0; i < len; i+=2) {
			this.targets[cfx_multi.arguments[i]] = new Image();
			this.targets[cfx_multi.arguments[i]].src = cfx_multi.arguments[i+1];
		} //endfor
		this.timeoutid = 0;
		this.set = cfx_multi_set;
		if (this.targets["act"]) {
			this.act = cfx_multi_act;
		}
		if (this.targets["deact"]) {
			this.deact = cfx_multi_deact;
		}
		if (this.targets["act"]) {
			this.hov = cfx_multi_hov;
		}
		this.objindex = objects.length;
		objects[this.objindex] = this;
	} //endif
} //endfunction

function cfx_multi_hov() {
	var args = cfx_multi_hov.arguments;
	if (args.length > 0) {
		this.set("hov",args[0]);
	} else {
		this.set("hov");
	} //endif
} //endif

function cfx_multi_act() {
	var args = cfx_multi_act.arguments;
	if (args.length > 0) {
		this.set("act",args[0]);
	} else {
		this.set("act");
	} //endif
} //endfunction

function cfx_multi_deact() {
	var args = cfx_multi_deact.arguments;
	if (args.length > 0) {
		this.set("deact",args[0]);
	} else {
		this.set("deact");
	} //endif
} //endfunction

function cfx_multi_set() {
	if (test.pageloaded) {
		if (test.imageenabled) {
			var melem = cfx_multi_set.arguments[0];	/* da haben wir den Index des gewuenschten Images */
			if (cfx_multi_set.arguments.length>1) {
				if (test.timeoutenabled) {	/* das uebliche autodelay */
					var delay = eval(cfx_multi_set.arguments[1]);
					var commandstring = this.name + ".set('" + melem + "')";
					this.timeoutid = window.setTimeout(commandstring,delay);
				} else {
					this.set(melem);
				} //endif
			} else {
				if (test.timeoutenabled) {
					if (this.timeoutid) {
						window.clearTimeout(this.timeoutid);
						this.timeoutid = 0;
					} //endif
				} //endif
				document[this.targ].src = this.targets[melem].src; /* und hier wird das image dann gewechselt */
			}
		} //endif
	} //endif
} //endfunction

function cfx_void() {
} //endfunction

function cfx_combo() {
	var args = cfx_combo.arguments;
	var i = 0;
	this.buttons = new Array();
	for (i = 0; i < args.length; i++) {
		this.buttons[i] = args[i];
	} //endfor
	this.act = cfx_combo_act;
	this.deact = cfx_combo_deact;
	this.timeoutid = 0;
	cfx_makeobjindex(this);
} //endfunction

function cfx_combo_act() {
	var args = cfx_combo_act.arguments;
	var i = 0;
	if (args.length > 0) {
		if (test.timeoutenabled) {
			var delay = args[0];
			this.timeoutid = window.setTimeout("objects[" + this.objindex + "].act",delay);
		} else {
			this.act();
		} //endif
	} else {
		if (test.timeoutenabled) {
			if (this.timeoutid) {
				window.clearTimeout(this.timeoutid);
				this.timeoutid = 0;
			} //endif
		} //endif
		for (i = 0; i < this.buttons.length; i++) {
			eval(this.buttons[i] + ".act()");
		} //endif
	} //endif
} //endfunction

function cfx_combo_deact() {
	var args = cfx_combo_deact.arguments;
	var i = 0;
	if (args.length > 0) {
		if (test.timeoutenabled) {
			var delay = eval(args[0]);
			this.timeoutid = window.setTimeout("objects[" + this.objindex + "].deact();",delay);
		} else {
			this.deact();
		} //endif
	} else {
		if (test.timeoutenabled) {
			if (this.timeoutid) {
				window.clearTimeout(this.timeoutid);
				this.timeoutid = 0;
			} //endif
		} //endif
		for (i = 0; i < this.buttons.length; i++) {
			eval(this.buttons[i] + ".deact()");
		} //endif
	} //endif
} //endfunction

function cfx_preloader() {
	if (imageenabled) {
		var args = cfx_preloader.arguments;
		var newPL = preloaders.length;
		preloaders[newPL] = new Array();
		var i = 0;
		for (i = 0; i < args.length; i++) {
			preloaders[newpl][i] = args[i];
		} //endfor
	} //endif
} //endfunction

function cfx_do_preloading() {
	if (preloaders.length > 0) {
		var i = 0;
		var j = 0;
		var k = 0;
		toload = new Array();
		for (i = 0; i < preloaders.length; i++) {
			for (j = 0; j < preloaders[i].length; j++) {
				toload[k] = new Image();
				toload[k].src = preloaders[i][j];
				k++;
			} //endfor
		} //endfor
	} //endif
} //endfunction

function cfx_makeobjindex(obj) {
	obj.objindex = objects.length;
	objects[obj.objindex] = obj;
} //endfunction

function cfx_createmessages() {
	cfx_messages["de"] = new Array();
	cfx_messages["en"] = new Array();
	cfx_done = "cfx_done";
} //endfunction

function cfx_wait(command) {
	window.setTimeout(command,1000);
} //endfunction

function cfx_linkwatcher() {
	if (test.imageenabled) {
		this.oldhash = window.location.hash;
		this.newhash = "newurl";
		this.indics = new Array();
		var ancname = "";
		var colidx = 0;
		var colidx2 = 0;
		var args = cfx_linkwatcher.arguments;
		for (var i = 0; i < args.length; i+=2) {
			ancname = args[i];
			this.indics[ancname] = new cfx_linkwatcher_indic(ancname);
			colidx = args[i+1].indexOf(":");
			colidx2 = args[i+1].lastIndexOf(":");
			if (colidx > 1) {
				if (colidx == colidx2) {
					this.indics[ancname].actmode = args[i+1].substring(colidx+1,args[i+1].length);
					this.indics[ancname].deactmode = "deact";
					this.indics[ancname].targ = args[i+1].substring(0,colidx);
				} else {
					if (colidx2 - colidx < 2) {
						this.indics[ancname].deactmode = args[i+1].substring(colidx2+1,args[i+1].length);
						this.indics[ancname].actmode = "act";
						this.indics[ancname].targ = args[i+1].substring(0,colidx);
					} else {
						this.indics[ancname].actmode = args[i+1].substring(colidx+1,colidx2);
						this.indics[ancname].deactmode = args[i+1].substring(colidx2+1,args[i+1].length);
						this.indics[ancname].targ = args[i+1].substring(0,colidx);
					} //endif
				} //endif
			} else {
				this.indics[ancname].actmode = "act";
				this.indics[ancname].deactmode = "deact";
				this.indics[ancname].targ = args[i+1];
			} //endif
		} //endfor
		this.watch = cfx_linkwatcher_watch;
		this.update = cfx_linkwatcher_update;
		cfx_makeobjindex(this);
		this.timeoutid = window.setTimeout("objects[" + this.objindex + "].watch(true)",500);
	} //endif
} //endfunction

function cfx_linkwatcher_update() {
	var i;
	if (this.newhash.length > 1) {
		acthash = this.newhash.substring(1,this.newhash.length);
	} else {
		acthash = ""
	} //endif
	for (i in this.indics) {
		if (i == acthash) {
			this.indics[i].act();
		} else {
			this.indics[i].deact();
		} //endif
	} //endfor
} //endif

function cfx_linkwatcher_watch(firsttime) {
	this.newhash = window.location.hash;
	if (firsttime) {
		if (this.newhash.length > 1) {
			this.update();
		} //endif
	} else {
		if (this.newhash != this.oldhash) {
			this.update();
		} //endif
	} //endif
	this.oldhash = this.newhash;
	if (test.pageloaded) {
		this.timeoutid = window.setTimeout("objects[" + this.objindex + "].watch(false)",500);
	} else {
		this.timeoutid = window.setTimeout("objects[" + this.objindex + "].watch(true)",500);
	} //endif
} //endif

function cfx_linkwatcher_indic(name) {
	this.name = name;
	this.actmode = "act";
	this.deactmode = "deact";
	this.state = false;
	this.act = cfx_linkwatcher_indic_act;
	this.deact = cfx_linkwatcher_indic_deact;
	cfx_makeobjindex(this);
} //endfunction

function cfx_linkwatcher_indic_act() {
	if (test.pageloaded) {
		if (this.state == false) {
			if (this.actmode == "act") {
				eval(this.targ + ".act()");
			} else {
				if (this.actmode == "deact") {
					eval(this.targ + ".deact()");
				} else {
					eval(this.targ + ".set('" + this.actmode + "')");
				} //endif
			} //endif
			this.state = true;
		} //endif
	} //endif
} //endif

function cfx_linkwatcher_indic_deact() {
	if (this.state == true) {
		if (this.deactmode == "act") {
			eval(this.targ + ".act()");
		} else {
			if (this.deactmode == "deact") {
				eval(this.targ + ".deact()");
			} else {
				eval(this.targ + ".set(" + this.deactmode + ")");
			} //endif
		} //endif
		this.state = false;
	} //endif
} //endif

function cfx_stringtrim() {
	var str = this.toString();
	while (str.substring(0,1) == " ") {
		str = str.substring(1,str.length);
	} //endwhile
	while (str.substring(str.length-1,str.length) == " ") {
		str = str.substring(0,str.length-1);
	} //endwhile
	return str;
} //endfunction

function cfx_stringdigitcheck(strict) {
	var str = this.toString();
	var i = 0;
	var chr;
	if (str.length > 1) {
		for (i = 0; i < str.length; i++) {
			chr = str.substring(i,i+1);
			if (isNaN(parseInt(chr,10))) {
				if (strict == true) {
					return false;
				} else {
					if (((chr == "+") || (chr == "-") || (chr == "(") || (chr == ")") || (chr == " ") || (chr == "/")) == false) {
						return false;
					} //endif
				} //endif
			} //endif
		} //endfor
		return true;
	} else {
		return false;
	} //endif
} // endfunction