function ValidateEmail(mailAddress){

	var mailAddress = mailAddress;
	
	if (!mailAddress.value.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)){
    	alert('Die eingegebene E-Mail-Adresse ist nicht korrekt.');
	} 
}

var currItem = "";

function starttimer_menu(){
	the_timer = setTimeout("emocion_autolayers()", 3000);	
}
function stoptimer_menu(){
	clearTimeout(the_timer);
}
function emocion_autolayers() { //v1.4 by PVII
	var g,b,k,f,args=emocion_autolayers.arguments;

	a=parseInt(args[0]);
	
	if(isNaN(a))a=0;

	if(!document.emocionsetc){
		emocionc = new Array();
		document.emocionsetc = true;
		for(var u=0;u<10;u++){
			emocionc[u] = new Array();
		}
	}
	for(k=0;k<emocionc[a].length;k++){
		if((g=emocion_findObj(emocionc[a][k]))!=null){
			b=(document.layers)?g:g.style;
			b.visibility="hidden";
		}
	}

	for(k=1;k<args.length;k++){
		if((g=emocion_findObj(args[k]))!=null){
			b=(document.layers)?g:g.style;
			b.visibility="visible";
			f=false;
		
			for(var j=0;j<emocionc[a].length;j++){
				if(args[k]==emocionc[a][j]) {
					f=true;
				}
			}
			if(!f){
				emocionc[a][emocionc[a].length++]=args[k];
			}
		}
	}
}

function emocion_hidediv(evt) { //v1.3 by PVII
	var b,relT,mT=false; 
	if(document.layers){
		b=evt.target;
		if(b.emocionaHide){
			b.visibility="hidden";
		}else{
			routeEvent(evt);
		}
	}else if(document.all&&!window.opera){
		b=event.srcElement;
		while(b!=null){
			if(b.tagName=="DIV" && b.emocionahD){
				mT=true;break;
			}
			b=b.parentElement;
		}
		if(!b.contains(event.toElement)){
			b.style.visibility="hidden";
		}
	}else if(document.getElementById){
		b=evt.currentTarget;
		relT=evt.relatedTarget;
		while(relT!=null){
			if(b == relT){
				mT = true;break;
			}
			relT=relT.parentNode;
		}
		if(!mT){
			b.style.visibility="hidden";
		}
	}
}

function emocion_autohide() { //v1.3 by PVII
	var i,g,args=emocion_autohide.arguments;

	for(i=0; i < args.length; i++){
		if((g=emocion_findObj(args[i]))!=null){
			g.emocionaHide=true;
			if(document.layers){
				g.captureEvents(Event.MOUSEOUT);
			}
			g.onmouseout=emocion_hidediv;g.emocionahD=true;
		}
	}
}

function emocion_snap() { //v2.65 by PVII
	var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=emocion_snap.arguments;
	a=parseInt(a);

	if(document.layers || window.opera){
		pa='';
	}
	for(k=0; k<(args.length); k+=4){
		if((g=emocion_findObj(args[k]))!=null){
			if((el=emocion_findObj(args[k+1]))!=null){
				a=parseInt(args[k+2]);
				b=parseInt(args[k+3]);
				x=0;
				y=0;
				ox=0;
				oy=0;
				p="";
				tx=1;
				da="document.all['"+args[k]+"']";
				if(document.getElementById){
					d="document.getElementsByName('"+args[k]+"')[0]";
					if(!eval(d)){
						d="document.getElementById('"+args[k]+"')";
						if(!eval(d)){
							d=da;
						}
					}
				}else if(document.all){
					d=da;
				}
				if(document.all||document.getElementById){
					while(tx==1){
						p+=".offsetParent";
						if(eval(d+p)){
							x+=parseInt(eval(d+p+".offsetLeft"));
							y+=parseInt(eval(d+p+".offsetTop"));
						}else{
							tx=0;
						}
					}
					ox=parseInt(g.offsetLeft);
					oy=parseInt(g.offsetTop);
					tw=x+ox+y+oy;
				
					if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
						ox=0;
						oy=0;
						if(g.style.left){
							x=parseInt(g.style.left);
							y=parseInt(g.style.top);
						}else{
							w1=parseInt(el.style.width);
							bx=(a<0)?-5-w1:-10;
							a=(Math.abs(a)<1000)?0:a;
							b=(Math.abs(b)<1000)?0:b;
							x=document.body.scrollLeft+event.clientX+bx;
							y=document.body.scrollTop+event.clientY;
						}
					}
				}else if(document.layers){
					x = g.x;
					y = g.y;
					q0 = document.layers,dd="";
					
					for(var s=0; s < q0.length; s++){
						dd='document.'+q0[s].name;
						if(eval(dd+'.document.'+args[k])){
							x+=eval(dd+'.left');
							y+=eval(dd+'.top');
							break;
						}
					}
				}
				e=(document.layers)?el:el.style;
				xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
				if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
					xx+=parseInt(document.body.leftMargin);
					yy+=parseInt(document.body.topMargin);
				}
				e.left=xx+pa;
				e.top=yy+pa;
			}
		}
	}
}


////////////////////////////////////////////
function emocion_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=emocion_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
	return x;
}

////////////////////////////////////////////

function emocion_preloadImages() { //v3.0
  var d=document;
  if(d.images){
  	if(!d.emocion_p) d.emocion_p=new Array();
		var i,j=d.emocion_p.length,a=emocion_preloadImages.arguments; for(i=0; i < a.length; i++)
	    if (a[i].indexOf("#")!=0){
			d.emocion_p[j]=new Image; d.emocion_p[j++].src=a[i];
		}
	}
}

function emocion_swapImgRestore() { //v3.0
  var i,x,a=document.emocion_sr; for(i=0;a && i < a.length && (x=a[i]) && x.oSrc;i++) x.src=x.oSrc;
}

function emocion_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=emocion_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
	return x;
}

function emocion_swapImage() { //v3.0
	var i,j=0,x,a=emocion_swapImage.arguments;
	document.emocion_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
	if ((x=emocion_findObj(a[i]))!=null){
		document.emocion_sr[j++]=x;
		if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
	}
}

emocion_reloadPage(true);

function emocion_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.emocion_pgW=innerWidth; document.emocion_pgH=innerHeight; onresize=emocion_reloadPage; }}
  else if (innerWidth!=document.emocion_pgW || innerHeight!=document.emocion_pgH) location.reload();
}
emocion_reloadPage(true);

function openPictureWindow(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) {  // v4.01
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');	}else{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">'); 	}
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}
function assign_title(){
	if (navigator.appName.indexOf("Explorer") != -1){
		top.document.title= document.title;
	}
}

var i = 0;
function gallery(){
	if (i == 0){
		document.gallery.previous.value=""
	}
}

function previmg(){
	i--;
	
	if(i > (the_pictures.length -1)){
		i = 0;
	}
	if(i == -1){
		i = (the_pictures.length -1);
	}
	display_navig();
	
	document.getElementById('preview_img').src = the_pictures[i];
}

function display_navig(){
	if(i == 0){
		document.getElementById('prev_link').style.display='none';
	}else{
		document.getElementById('prev_link').style.display='inline';
	}
	if(i == (the_pictures.length -1)){
		document.getElementById('next_link').style.display='none';
	}else{
		document.getElementById('next_link').style.display='inline';
	}
}
function write_num(){
	//document.write(' ' + (i+1) + ' / ' + (the_pictures.length));
}

function showimg(act_image){
	i = act_image;

	if(i == the_pictures.length){
		i = 0;
	}
	display_navig();
	
	document.getElementById('preview_img').src = the_pictures[i];
}

function nextimg(){
	i++;
	
	if(i == the_pictures.length){
		i = 0;
	}
	display_navig();
	
	document.getElementById('preview_img').src = the_pictures[i];
}
function firstimg(){
	i = 0
	document.img.src = images[i];
	document.gallery.previous.value="        ";
	document.gallery.next.value="Nächstes >"
}
function lastimg(){
	i = the_pictures.length
	document.img.src = images[i];
	document.gallery.next.value="    "
	document.gallery.previous.value="< Vorheriges"
}

function stoperror(){
	return true
}
window.onerror=stoperror
