////////GLOBAL VAR////////////////////////////////////////////////////////

/////////////////////////BROWSERABFRAGE///////////////////////////
	var isNew=0;
    var isIE=0;
	var isIE4=0;
	var isIE50=0;
	var isIE55=0;
	var isIE6=0;
	var isNS=0; //Netscape based, z.B. Mozilla
	var isNS4=0;
	var isNS5=0; //auch Mozilla
	var isOP6=0;
	var isOP7=0;
	var isXX=0;

	var version= navigator.appVersion;
	//alert(version);
	var appName = navigator.appName;
	//alert(appName);
	var userAgent = navigator.userAgent;
	//alert(userAgent);

	var brow=((navigator.appName)+(parseInt(version)));
	//alert(brow);

	if(appName.search(/netscape/gi) > -1)
	{
		isNS=1;

		if(version.indexOf("4.") == 0)
		{
		    isNS4=1;
		}
		else
		if(version.search(/5./gi) > -1)  //funzt ni weil auch 4.75
		{
		    isNS5=1;
  		    isNew=1;
		}

	}
	else
	if (brow=="Microsoft Internet Explorer4")
	{
		isIE=1;
		isIE4=1;
		if(userAgent.search(/MSIE 5.5/gi) > -1)
		{
		    isIE55=1;
			isNew=1;
		}
		else
		if(userAgent.search(/MSIE 5.0/gi) > -1)
		{
		    isIE50=1;
			isNew=1;
		}
		else
		if(userAgent.search(/MSIE 6/gi) > -1)
		{
		    isIE6=1;
			isNew=1;
		}
	}
	else
	if(userAgent.search(/Opera/gi)> -1)
	{
		if(version.search(/6/gi)>-1)
		{
		    isOP6=1;
		}
		else
		if(version.search(/7/gi)>-1)
		{
		    isOP7=1;
		}
	}
	else isXX=1;

	var docObj = (isNS4) ? 'document' : 'document.all';
	var styleObj = (isNS4) ? '' : '.style';


//////////////////////////////////////////////////////////////////////////////////////////


	/////////////////////////////////////////////////////////////////////
	/* testet, ob Site fertig geladen, alle Objekte vorhanden (JS/CSS) */
	/////////////////////////////////////////////////////////////////////
	function testID(id)
	{
		//Frame-Exist-Test
		// Aber wie???

			var obj;
			if (isIE4 || isNS6)
			{
				obj=parent.main.document.getElementById(id);
			}
			if (isNS4)
			{
				obj=eval('parent.main.document.'+id);
			}
			if (isXX)
			{
				obj=parent.main.document.getElementById(id); //opera
			}

			//alert(obj);
			if (!isIE50 || !isIE4)
			{
				if 	(obj==undefined) return false;
				else return true;
				//if (obj=="[object]") return true; else return false;
			}
			else return false;
	}


	function initNSPopup(ebene)
	{
		var offsetY=parent.main.document.layers[ebene].pageY;
		if (offsetY>0)	parent.main.document.layers[ebene].moveToAbsolute(0,-offsetY);
	}


function goBack()
{
	window.history.back();
}

/////////////////////////////////////////////open window////////////////////////////
function ow(page,name)
{
groesse="width=*,height=*";
var presets=",scrollbars=Yes,resizable=Yes";
var attr=groesse.concat(presets);
fenster=window.open(page,name,attr);
}
/////////////////////////////////////////////////////////////////////////////////////
function getLanguage()
{
	/*
	//in die url gehen und auf .de oder .com prüfen
	var host = window.location.host;
	var re = new RegExp("localhost","gi");
	if (re.test(host))
	{
		return 1;
	}
	var re = new RegExp(".de","gi");
	if (re.test(host))
	{
		//alert("de");
		return 1; //german
	}
	var re = new RegExp(".com","gi");
	if (re.test(host))
	{
		//alert("com");
		return 0; //english
	}
	*/
}

///////////////////////////////////////////////////////////////////////////////////////

function chFrames(f1,f2)
{
	parent.main.location.href=f1;
	parent.left.location.href=f2;
}

function error()
{
	alert("moment");
}


function show2_print(page)
{
	var name="Print-Version";
	var groesse="width=500,height=500,top=80,left=100";
	var presets=",scrollbars=Yes,resizable=Yes";
	var attr=groesse.concat(presets);
	//fenster=window.open(page,name,attr);
	fenster = open(page,"Fenster2",attr);
}

function getFileName()
{
	var url = window.document.URL;
	var pos=url.lastIndexOf('/');
	if (pos == 0) pos=url.lastIndexOf('\\');
	var filename = url.slice(pos+1);
	return filename;
}

function checkForm(object, emailStr, errorMsg) {
	if (_validate(emailStr)){
		return true;
	} else {
		alert(errorMsg);
		object.focus();
		return false;
	}
}

function validate(object, emailStr) {

	if (_validate(emailStr)){
		object.style.visibility='visible';
	} else {
 		object.style.visibility='hidden';
	}
}

function validateEmailStr(object, emailStr) {

	if (emailStr == "") {
		object.style.visibility='hidden';
		return;
	}

	if (_validate(emailStr)){
		object.src = 'res/pics/symbol_ok.png';
		object.style.visibility='visible';
	} else {
 		object.src = 'res/pics/symbol_false.png';
		object.style.visibility='visible';
	}
}

function _validate(emailStr) {

	// (c) Sandeep V. Tamhankar (stamhankar@hotmail.com)

	/* The following pattern is used to check if the entered e-mail address
	   fits the user@domain format.  It also is used to separate the username
	   from the domain. */
	var emailPat = /^(.+)@(.+)$/;
	/* The following string represents the pattern for matching all special
	   characters.  We don't want to allow special characters in the address.
	   These characters include ( ) < > @ , ; : \ " . [ ]    */
	var specialChars = "\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
	/* The following string represents the range of characters allowed in a
	   username or domainname.  It really states which chars aren't allowed. */
	var validChars = "\[^\\s" + specialChars + "\]";
	/* The following pattern applies if the "user" is a quoted string (in
	   which case, there are no rules about which characters are allowed
	   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	   is a legal e-mail address. */
	var quotedUser = "(\"[^\"]*\")";
	/* The following pattern applies for domains that are IP addresses,
	   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	   e-mail address. NOTE: The square brackets are required. */
	var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	/* The following string represents an atom (basically a series of
	   non-special characters.) */
	var atom = validChars + '+';
	/* The following string represents one word in the typical username.
	   For example, in john.doe@somewhere.com, john and doe are words.
	   Basically, a word is either an atom or quoted string. */
	var word = "(" + atom + "|" + quotedUser + ")";
	// The following pattern describes the structure of the user
	var userPat = new RegExp("^" + word + "(\\." + word + ")*$");
	/* The following pattern describes the structure of a normal symbolic
	   domain, as opposed to ipDomainPat, shown above. */
	var domainPat = new RegExp("^" + atom + "(\\." + atom +")*$");


	/* Validation */

	/* Begin with the coarse pattern to simply break up user@domain into
	   different pieces that are easy to analyze. */
	var matchArray = emailStr.match(emailPat);
	if (matchArray == null) {
	  /* Too many/few @'s or something; basically, this address doesn't
	     even fit the general mould of a valid e-mail address. */
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	// See if "user" is valid
	if (user.match(userPat) == null) {
	    // user is not valid
	    return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	   host name) make sure the IP address is valid. */
	var IPArray = domain.match(ipDomainPat);
	if (IPArray != null) {
	    // this is an IP address
		  for (var i=1;i<=4;i++) {
		    if (IPArray[i]>255) {
		    	return false;
		    }
	    }
	    return true;
	}

	// Domain is symbolic name
	var domainArray = domain.match(domainPat);
	if (domainArray == null) {
		return false;
	}

	/* domain name seems valid, but now make sure that it ends in a
	   three-letter word (like com, edu, gov) or a two-letter word,
	   representing country (uk, nl), and that there's a hostname preceding
	   the domain or country. */

	/* Now we need to break up the domain to get a count of how many atoms
	   it consists of. */
	var atomPat = new RegExp(atom,"g");
	var domArr = domain.match(atomPat);
	var len = domArr.length;
	if (domArr[domArr.length-1].length<2 ||
	    domArr[domArr.length-1].length>5) {
	   // the address must end in a two letter or three letter word.
	   return false;
	}

	// Make sure there's a host name preceding the domain.
	if (len < 2) {
	   return false;
	}

	// If we've gotten this far, everything's valid!
	return true;
}

function showTooltip(evt,object, visible)
{
//	var evt = null;
	alert(evt);

	if (visible)
	{
		if (isIE4 || isIE50 || isIE55 || isIE6)
		{
			evt = window.event;
			object.style.left = evt.x + 10;
			object.style.top = evt.y - 10;
		}
		else
		{
//			evt = _evt;
			alert(evt.pageX);
			object.style.left = evt.pageX + 10;
			object.style.top = evt.pageY - 10;
		}
		object.style.visibility='visible';
	}
	else
	{
		object.style.visibility='hidden';
	}
}

var blinkVisible = true;
var blinkElId;
var blinkHandle;

function blinkIt(elId)
{
	//centerElement(elId);
	blinkElId = elId;
	blinkHandle = window.setInterval("blink2()",500);
}

function blink2()
{
	var el;

	if (document.all)
	{
    	el = eval("document.all." + blinkElId);
		//el = document.getElementById(elId);
	}
	else if (document.getElementById)
	{
    	el = document.getElementById(blinkElId);
	}


	if(blinkVisible)
	{
		el.style.visibility = "hidden";
		blinkVisible = false;
	}
	else
	{
		el.style.visibility = "visible";
		blinkVisible = true;
	}
}

function showLayer(id) {
	if (document.getElementById(id).style.display == "none") {
		document.getElementById(id).style.display="block";
	} else {
		document.getElementById(id).style.display="none";
	}
}