function PositionFabrics(FabricName) {
	DiffX = -50;
	DiffY = 50;

	if (document.all) {
		document.all(FabricName).style.left = event.clientX + document.body.scrollLeft + DiffX;
		document.all(FabricName).style.top = event.clientY + document.body.scrollTop + DiffY;
	}

}

function MM_callJS(jsStr) { //v2.0
	return eval(jsStr)
}

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_showHideLayers() { //v3.0
	var i, p, v, obj, args = MM_showHideLayers.arguments;
	for (i = 0; i < (args.length - 2); i += 3) if ((obj = MM_findObj(args[i])) != null) {
		v = args[i + 2];
		if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v = 'hide') ? 'hidden' : v; }
		obj.visibility = v;
	}
}

function ShowFabric(FabricName) {
	if (document.all) {
		PositionFabrics(FabricName)
		MM_showHideLayers(FabricName, '', 'show')
	}
}

//browser detection
var isNav = false;
var isIE = false;
var coll;
var style;
var activeMenu = 0;

if (parseInt(navigator.appVersion) >= 4) {
	if (navigator.appName == "Netscape") {
		isNav = true;
		coll = "document";
		style = "";
	} else {
		isIE = true;
		coll = "document.all";
		style = ".style";
	}
}


if (!isNav && !isIE) {
	//	top.location.href="nodhtml.htm"
}

var menu_aktiv = 0;
function menu(Rubrik, offset) {
	if (menu_aktiv != Rubrik) {
		if (menu_aktiv) menu_zu("menu" + menu_aktiv);
		if (isNav) {
			eval('document["' + 'menu' + Rubrik + '"].top = 79');
			eval('document["' + 'menu' + Rubrik + '"].left = offset');
		} else {
			eval('document.all["' + 'menu' + Rubrik + '"].style.pixelTop = 79');
			eval('document.all["' + 'menu' + Rubrik + '"].style.pixelLeft = offset');
		}
	}

	menu_auf("menu" + Rubrik);
	menu_aktiv = Rubrik;

}

function menu_auf(menu_name) {
	eval(coll + '["' + menu_name + '"]' + style + '.visibility = "visible"');
}

function menu_zu(menu_name) {
	eval(coll + '["' + menu_name + '"]' + style + '.visibility = "hidden"');
}

function alleaus() {
	if (menu_aktiv) {
		menu_zu("menu" + menu_aktiv);
		menu_aktiv = 0;
	}
}

function init() {
	if (isNav) { document.captureEvents(Event.MOUSEUP); }
	document.onmouseup = alleaus;
}


function MM_validateForm() { //v4.0
	var i, p, q, nm, test, num, min, max, errors = '', args = MM_validateForm.arguments;
	for (i = 0; i < (args.length - 2); i += 3) {
		test = args[i + 2];
		val = MM_findObj(args[i]);
		if (val) {
			nm = val.name;
			if ((val = val.value) != "") {
				if (test.indexOf('isEmail') != -1) {
					p = val.indexOf('@');
					if (p < 1 || p == (val.length - 1))
						errors += '- ' + nm + ' muss eine E-Mail Adresse sein.\n';
				}
				else if (test != 'R') {
					if (isNaN(val))
						errors += '- ' + nm + ' muss eine Zahl sein.\n';
					if (test.indexOf('inRange') != -1) {
						p = test.indexOf(':');
						min = test.substring(8, p);
						max = test.substring(p + 1);
						if (val < min || max < val)
							errors += '- ' + nm + ' must contain a number between ' + min + ' and ' + max + '.\n';
					}
				}
				else if (test == 'R') {	// required checkbox
					var inputType = document.getElementsByName(nm)[0].getAttribute("type");
					if (inputType == "checkbox" && document.getElementsByName(nm)[0].checked != true)
						errors += '- ' + nm + ' muss ausgewählt werden.\n';
				}
			}
			else if (test.charAt(0) == 'R')
				errors += '- ' + nm + ' muss ausgefüllt werden.\n';
		}
	}
	if (errors)
		alert('Deutsch: \n   Bitte mindestens die Felder mit * ausfüllen. \n\n'
  						+ 'Français: \n   Veuillez remplir au moins les lignes avec * s.v.p. \n\n'
						+ 'English: \n   Please fill all fields marked *.');
	document.MM_returnValue = (errors == '');
}

var TwoSIC_validateForm = MM_validateForm;

function GoToDE() {
	if (parent.location.href.substr(parent.location.href.length - 1) == "/")
		parent.location = parent.location + "default.asp";
	else
		parent.location = String(parent.location).replace(/(french\.)|(english\.)/i, 'default.');
}

function GoToEN() {
	if (parent.location.href.substr(parent.location.href.length - 1) == "/")
		parent.location = parent.location + "english.asp";
	else
		parent.location = String(parent.location).replace(/(default\.)|(french\.)/i, 'english.');
}

function GoToFR() {
	if (parent.location.href.substr(parent.location.href.length - 1) == "/")
		parent.location = parent.location + "french.asp";
	else
		parent.location = String(parent.location).replace(/(default\.)|(english\.)/i, 'french.');
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init == true) with (navigator) {
		if ((appName == "Netscape") && (parseInt(appVersion) == 4)) {
			document.MM_pgW = innerWidth; document.MM_pgH = innerHeight; onresize = MM_reloadPage;
		}
	}
	else if (innerWidth != document.MM_pgW || innerHeight != document.MM_pgH) location.reload();
}
MM_reloadPage(true);

