var aktuelleurl = './?ajax=1';
var akteullertitel = ' ';

CLOSED_IMAGE='style/add.png';OPEN_IMAGE='style/delete.png';function makeCollapsible(a){a.style.listStyle='none';a.style.marginLeft='0';a.style.paddingLeft='0';var b=a.firstChild;while(b!=null){if(b.nodeType==1){var c=new Array();var d=b.firstChild;while(d!=null){if(d.tagName=='OL'||d.tagName=='UL'){d.style.display='none';c.push(d)}d=d.nextSibling}var e=document.createElement('img');e.setAttribute('src',CLOSED_IMAGE);e.setAttribute('class','collapsibleClosed');e.onclick=createToggleFunction(e,c);b.insertBefore(e,b.firstChild)}b=b.nextSibling}}function createToggleFunction(a,b){return function(){if(a.getAttribute('class')=='collapsibleClosed'){a.setAttribute('class','collapsibleOpen');a.setAttribute('src',OPEN_IMAGE)}else{a.setAttribute('class','collapsibleClosed');a.setAttribute('src',CLOSED_IMAGE)}for(var i=0;i<b.length;i++){b[i].style.display=(b[i].style.display=='block')?'none':'block'}}}

function ajax(url, titel, id)
{
	aktuelleurl = url;
	var req = new Request({
		url:url,
		onSuccess: function(txt)
		{
			$(id).set('html', txt);
			document.title = titel + ' - www.ferienhaus-pfalz.info - Ferienhaus im Feriendorf Eichwald in der Pfalz';
			aktuellertitel = titel;
			if($('aktivitaeten'))
			{
				makeCollapsible(document.getElementById('aktivitaeten'));
			}
		},
		onFailure: function()
		{
			$(id).set('html', 'Bei dem Aufruf der Datei gab es einen Fehler, bitte versuchen sie es später nocheinmal!');
		}
	});
scroll(0,0);
$(id).innerHTML = '<p style="text-align:center;"><br><br><br><br><img src="style/loader.gif"><br><br>Seite wird geladen</p>'; 
req.send();
}

/**
*
*  AJAX IFRAME METHOD (AIM)
*  http://www.webtoolkit.info/
*
**/

AIM={frame:function(c){var n='f'+Math.floor(Math.random()*99999);var d=document.createElement('DIV');d.innerHTML='<iframe style="display:none" src="about:blank" id="'+n+'" name="'+n+'" onload="AIM.loaded(\''+n+'\')"></iframe>';document.body.appendChild(d);var i=document.getElementById(n);if(c&&typeof(c.onComplete)=='function'){i.onComplete=c.onComplete}return n},form:function(f,a){f.setAttribute('target',a)},submit:function(f,c){AIM.form(f,AIM.frame(c));if(c&&typeof(c.onStart)=='function'){return c.onStart()}else{return true}},loaded:function(a){var i=document.getElementById(a);if(i.contentDocument){var d=i.contentDocument}else if(i.contentWindow){var d=i.contentWindow.document}else{var d=window.frames[a].document}if(d.location.href=="about:blank"){return}if(typeof(i.onComplete)=='function'){i.onComplete(d.body.innerHTML)}}}

/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/

var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(a){var b="";var c,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;a=Base64._utf8_encode(a);while(i<a.length){c=a.charCodeAt(i++);chr2=a.charCodeAt(i++);chr3=a.charCodeAt(i++);enc1=c>>2;enc2=((c&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else if(isNaN(chr3)){enc4=64}b=b+this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4)}return b},decode:function(a){var b="";var c,chr2,chr3;var d,enc2,enc3,enc4;var i=0;a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<a.length){d=this._keyStr.indexOf(a.charAt(i++));enc2=this._keyStr.indexOf(a.charAt(i++));enc3=this._keyStr.indexOf(a.charAt(i++));enc4=this._keyStr.indexOf(a.charAt(i++));c=(d<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;b=b+String.fromCharCode(c);if(enc3!=64){b=b+String.fromCharCode(chr2)}if(enc4!=64){b=b+String.fromCharCode(chr3)}}b=Base64._utf8_decode(b);return b},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");var b="";for(var n=0;n<a.length;n++){var c=a.charCodeAt(n);if(c<128){b+=String.fromCharCode(c)}else if((c>127)&&(c<2048)){b+=String.fromCharCode((c>>6)|192);b+=String.fromCharCode((c&63)|128)}else{b+=String.fromCharCode((c>>12)|224);b+=String.fromCharCode(((c>>6)&63)|128);b+=String.fromCharCode((c&63)|128)}}return b},_utf8_decode:function(a){var b="";var i=0;var c=c1=c2=0;while(i<a.length){c=a.charCodeAt(i);if(c<128){b+=String.fromCharCode(c);i++}else if((c>191)&&(c<224)){c2=a.charCodeAt(i+1);b+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2}else{c2=a.charCodeAt(i+1);c3=a.charCodeAt(i+2);b+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3}}return b}}

rc = new Array();
rc['1'] = 'Die Datei wurde erfogreich hochgeladen!<br /><br />';
rc['2'] = 'Die Datei konnte nicht hochgeladen werden, da sie kein JPG Bild ist!<br /><br />';
rc['3'] = '';
rc['4'] = '';
rc['5'] = '';
rc['6'] = '';

function startCallback()
{
	return true;
}

function completeCallback(response)
{
	$('response').innerHTML = rc[response.split('|')[0]];
	$('response2').innerHTML = response.split('|')[1];
}
