/******************************/
/* CFX V5.0 - Main Module     */
/* cfx_main.js - V5.0beta     */
/* Copyright 1999             */
/* Carl-Eric Menzel           */
/* Bitforce Media             */
/* RPF Online                 */
/* cfx@bitforce.com           */
/* Nur mit Genehmigung zu     */
/* benutzen!                  */
/******************************/

function cfx_errorhandler() {
	location.reload();
	return true;
} //endfuncton

function cfx_errorhandler_debug(msg, url, lno){
	alert(msg + "\n\n" + url + "\n\n" + "line: " + lno);
	return true;
} //endfunction

var cfxdone = false;
var cfxprivate_preinit_commands = new Array();
var cfxprivate_afterinit_commands = new Array();
var cfx = new cfx_components();
document.cfx = cfx;
preloaders = new Array();
document.cfxloaded = true;
cfxdone = true;
cfxprivate_preinit();
maccheck = false;
cfx.initialize[0] = "cfx_main_init()";
String.prototype.cfx_trim = cfx_stringtrim;
String.prototype.cfx_digits = cfx_stringdigitcheck;
window.onload = cfx_init;
window.onerror = cfx_errorhandler;

//document.write('<script language="JavaScript1.1">');
//document.write('fuck_netscape();');
//document.write('</script>');
//alert('bla');

//window.setTimeout("fuck_netscape();",10);

function fuck_netscape() {
	if (cfx.main) {
		alert(window.location.href + ': yeah2');
	} else {
		alert(window.location.href + ': no');
		location.reload();
	}
}

function cfx_components() {
	this.main = true;
	this.button = false;
	this.multi = false;
	this.combo = false;
	this.preloader = false;
	this.hashwatcher = false;
	this.anim = false;
	this.comboanim = false;
	this.hotwin = false;
	this.quickmenu = false;
	this.shaker = false;
	this.textfield = false;
	this.ticker = false;
	this.mousebox = false;
	this.debug = false;
	this.afterinitdone = false;
	this.cfxlocation = "jscripts/";
	this.initialize = new Array();
	this.on_load = new Array();
	this.on_resize = new Array();
	this.test = new cfx_browsertest();
	this.objects = new Array();
} //endfunction

function cfx_debug(full) {
	window.onerror = cfx_errorhandler_debug;
	if (full) cfx.debug = true;
} //endif

function cfx_browsertest() {
	this.microsoft = false;
	this.browser = true;
	this.timeoutenabled = true;
	this.pageloaded = false
	this.quickmenu = false;
	this.scriptloaded = true;
	this.layerenabled = true;
	if (document.images) { /* das geht bei allen ab NS3 */
	   this.imageenabled=true;
	} else {
	   this.imageenabled=false;
	} //endif
	if ((navigator.userAgent.toLowerCase().indexOf("msie 4.5") > 0) && (navigator.userAgent.toLowerCase().indexOf("mac") > 0)) {
		this.layerenabled = 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
		cfx.test.pageloaded = true;
		if (cfx.on_load.length > 0) {
			for (i = 0; i < cfx.on_load.length; i++) {
				eval(cfx.on_load[i]);
			} //endfor
		} //endif
		cfxprivate_afterinit();
		var args = cfx_init.arguments;
		if (args.length > 0) {	/* unglaublich!!! NS4.5 Mac gibt mir typeof = STRING, obwohl es ein event-OBJECT ist...GRRRRRRR */
			if ((typeof args[0] == "string") && (args[0].substring(0,1) != "[")) {
				eval(args[0]);
			}
		} //endif
		if (cfx.preloader) {
			cfx_do_preloading();
		} //endif
	} //endif
	window.onresize = cfxprivate_onresize_exec;
} //endfunction

function cfx_main_init() {
	/* NOP */
} //endfunction

function cfx_void() {
} //endfunction

function cfx_makeobjindex(obj) {
	obj.objindex = cfx.objects.length;
	cfx.objects[obj.objindex] = obj;
} //endfunction

function cfx_wait(command) {
	window.setTimeout(command,1000);
} //endfunction

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
	return true;
} // endfunction

function cfx_textselect() {
	if (!this.objindex) {
		cfx_makeobjindex(this);
	} //endif
	window.setTimeout("cfx.objects[" + this.objindex + "].select();",1);
} //endfunction

function cfx_setframes() {
	var args = cfx_setframes.arguments;
	var targ = false;
	for (var i = 0; i < args.length; i += 2) {
		targ = cfxprivate_checkframe(window.top,args[i]);
		if (targ) {
/*			if (cfx.debug) {
				alert("Target: " + targ.name + ", URL: " + args[i+1]);
			} */
			targ.location = args[i+1];
		}  //endif
	} //endfor
} //endfunction

function cfx_backlink() {
	var args = cfx_backlink.arguments;
	if (args.length > 1) {
		var targ = false;
		for (var i = 0; i < args.length; i+=2) {
			targ = cfxprivate_checkframe(window.opener.top,args[i]);
			if (targ) {
				targ.location.href = args[i+1];
				targ = false;
			} else {
				return false;
			} //endif
		} //endfor
	} else {
		var url = args[0];
		window.opener.location.href = url;
	} //endif
	window.opener.focus();
	window.close();
	return true;
} //endfunction

function cfxprivate_checkframe(win,targ) {
	var subresult = false;
	if (win.frames.length > 0) {
		for (var i = 0; i < win.frames.length; i++) {
			if (win.frames[i].name == targ) {
				return win.frames[i];
			} else {
				subresult = cfxprivate_checkframe(win.frames[i],targ);
				if (subresult) {
					return subresult;
				} // endif
			} //endif
		} //endfor
		return false;
	} else {
		return false;
	} //endif
	return false;
} //endfunction

function cfx_framebuster() {
	if (window != top) {
		top.location = window.location;
	} //endif
} //endif

function cfx_closeback() {
	if (window.opener) {
		window.opener.focus();
		window.close();
	} //endif
} //endif

function cfx_onload(command) {
	cfx.on_load[cfx.on_load.length] = command;
} //endfunction

function cfxprivate_preinit() {
	var args = cfxprivate_preinit.arguments;
	if (args.length > 0) {
		if (cfxdone) {
			eval(args[0]);
		} else {
			if (!cfxprivate_preinit_commands) {
				cfxprivate_preinit_commands = new Array();
			}
			cfxprivate_preinit_commands[cfxprivate_preinit_commands.length] = args[0];
		}
	} else {
		if (cfxprivate_preinit_commands) {
			for (var i = 0; i < cfxprivate_preinit_commands.length; i++) {
				eval(cfxprivate_preinit_commands[i]);
			}
			cfxprivate_preinit_commands = false;
		}
	}
}

function cfx_onresize(command) {
	cfx.on_resize[cfx.on_resize.length] = command;
} //endfunction

function cfxprivate_onresize_exec() {
	if (cfx.on_resize.length > 0) {
		for (i = 0; i < cfx.on_resize.length; i++) {
			eval(cfx.on_resize[i]);
		} //endfor
	} //endif
}

function cfxprivate_afterinit() {
	var args = cfxprivate_afterinit.arguments;
	if (args.length > 0) {
		if (cfx.afterinitdone) {
			eval(args[0]);
		} else {
			if (!cfxprivate_afterinit_commands) {
				cfxprivate_afterinit_commands = new Array();
			}
			cfxprivate_afterinit_commands[cfxprivate_afterinit_commands.length] = args[0];
		}
	} else {
		if (cfxprivate_afterinit_commands) {
			for (var i = 0; i < cfxprivate_afterinit_commands.length; i++) {
				eval(cfxprivate_afterinit_commands[i]);
			}
			cfxprivate_afterinit_commands = false;
			cfx.afterinitdone=true;
		}
	}
}