var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion);
var version = "";
var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);

if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror" || browserName=="Opera") {version = "n3";} else {version = "n2";}


// Blurring links:
function blurLink(theObject)
{
	if (msie4)	{theObject.blur();}
}


// JS function for mouse-over
function over(name,imgObj)	{	//
	if (version == "n3" && document[name]) {document[name].src = eval(name+"_h.src");}
	else if (typeof(document.getElementById)=="function" && document.getElementById(name)) {document.getElementById(name).src = eval(name+"_h.src");}
	else if (imgObj)	{imgObj.src = eval(name+"_h.src");}
}


// JS function for mouse-out
function out(name,imgObj)	{	//
	if (version == "n3" && document[name]) {document[name].src = eval(name+"_n.src");}
	else if (typeof(document.getElementById)=="function" && document.getElementById(name)) {document.getElementById(name).src = eval(name+"_n.src");}
	else if (imgObj)	{imgObj.src = eval(name+"_n.src");}
}


function openPic(url,winName,winParams)	{	//
	var theWindow = window.open(url,winName,winParams);
	if (theWindow)	{theWindow.focus();}
}


function popup(file, name, gx, gy, px, py, options) {	
	spawn = window.open(file, name, 'width=' + gx + ',height=' + gy + ',left=' + px + ',top=' + py + ((options != '') ? ',' + options : ''));
	spawn.resizeTo(gx, gy);
	spawn.moveTo(px, py);
	spawn.focus();
	return;
}


function weblocation(ziel)
{
	parent.opener.location.href=ziel;
	window.close();
}


function go(select) {
	window.location.href=select.options[select.options.selectedIndex].value;
}


function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


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+' muß eine gültige Email-Adresse sein.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' muß eine Zahl sein.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' muß eine Zahl zwischen '+min+' und '+max+' sein.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' wird benötigt.\n'; }
  } if (errors) alert('Die folgenden Fehler sind aufgetreten:\n'+errors);
  document.MM_returnValue = (errors == '');
}


// decrypt helper function
function decryptCharcode(n,start,end,offset) {
	n = n + offset;
	if (offset > 0 && n > end)	{
		n = start + (n - end - 1);
	} else if (offset < 0 && n < start)	{
		n = end - (start - n - 1);
	}
	return String.fromCharCode(n);
}


// decrypt string
function decryptString(enc,offset) {
	var dec = "";
	var len = enc.length;
	for(var i=0; i < len; i++)	{
		var n = enc.charCodeAt(i);
		if (n >= 0x2B && n <= 0x3A)	{
			dec += decryptCharcode(n,0x2B,0x3A,offset);	// 0-9 . , - + / :
		} else if (n >= 0x40 && n <= 0x5A)	{
			dec += decryptCharcode(n,0x40,0x5A,offset);	// A-Z @
		} else if (n >= 0x61 && n <= 0x7A)	{
			dec += decryptCharcode(n,0x61,0x7A,offset);	// a-z
		} else {
			dec += enc.charAt(i);
		}
	}
	return dec;
}


// decrypt spam-protected emails
function linkTo_UnCryptMailto(s)	{
	location.href = decryptString(s,-4);
}



