var activeImage = 0;
function UnCryptMailto( s, sh ) {
		var n = 0;
		var r = "";
		for( var i = 0; i < s.length; i++)
		{
				n = s.charCodeAt( i );
				if( n >= 8364 )
				{
						n = 128;
				}
				r += String.fromCharCode( n - sh );
		}
		return r;
}
	
function lnkTrans(s, sh)	{
	location.href = 'mailto:'+UnCryptMailto(s, sh);
}

function checkMail(s) {
	var a = false;
	var res = false;
	if(typeof(RegExp) == 'function') {
		var b = new RegExp('abc');
		if(b.test('abc') == true){a = true;}
	}

	if(a == true)	{
		reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
								 '(\\@)([a-zA-Z0-9\\-\\.]+)'+
								 '(\\.)([a-zA-Z]{2,5})$');
		res = (reg.test(s));
	}
	else {
		res = (s.search('@') >= 1 &&
			s.lastIndexOf('.') > s.search('@') &&
			s.lastIndexOf('.') >= s.length-5)
	}
	return(res);
}


function switchImages() {

	if ($('imageList') && $('imageList').childNodes.length>1) {
		setTimeout('nextImage()',1500);
		setInterval('nextImage()',4000);
	}
}

function nextImage() {

	for (i=0;i<$('imageList').childNodes.length;i++) {		
		if (i==(activeImage+1)) {
			//$('imageList').childNodes[i].appear({ duration: 1.5 });
			Effect.Appear($('imageList').childNodes[i], { duration: 1.5 });	
			activeImage++;	
			break;
		}	
		else {
			if (i==(activeImage)) {			
				
				//$('imageList').childNodes[i].fade({ duration: 1.5 });
				Effect.Fade($('imageList').childNodes[i], { duration: 1.5 });			
				if ((i+1)==$('imageList').childNodes.length) {
					$('imageList').childNodes[0].appear({ duration: 1.5 });
						activeImage=0;						
				}					 
			}					
		}			
	}

}


function show_exception( requestObject, ex) {
	alert("Keine AJAX-Anfrage an " + requestObject.url + " moeglich: " + ex);
}

function show_failure( requestObject ) {
	alert("Error from Server:" + requestObject.statusText);
}
