
function NachrichtLoeschen(id, typ, referrer)  {
	check = confirm("Möchten Sie die Nachricht wirklich löschen?");
	if(check == true) 
		location.href="/messages/delete/"+typ+"_"+id;
}

function GaestebuchEintragLoeschen(id)  {
	check = confirm("Möchten Sie den Eintrag wirklich löschen?");
	if(check == true) 
		location.href="/profile/guestbook/delete/("+id+")";
}

function LocationLoeschen(id)  {
	check = confirm("Möchten Sie die Location wirklich löschen?");
	if(check == true) {
		location.href="/locations/loeschen/("+id+")";
		loadMyLocations();
	}
}

function AlbumLoeschen(albumid)  {
	check = confirm("Möchten Sie wirklich das komplette Album löschen?");
	if(check == true) 
		location.href="/fotoalben/albumloeschen/"+albumid;
}

function GruppeFotoLoeschen(id, albumid, fotoid, referrer)  {
	check = confirm("Möchten Sie das Foto wirklich löschen?");
	if(check == true) 
		location.href="/group/photodelete/"+id+"_"+albumid+"_"+fotoid+"/("+escape(referrer)+")";
}

function GruppeAlbumLoeschen(gruppeid, albumid, referrer)  {
	check = confirm("Möchten Sie wirklich das komplette Album löschen?");
	if(check == true) 
		location.href="/group/albumdelete/"+gruppeid+"_"+albumid+"/("+referrer+")";
}

function SetForumAbo(thema)  {
	var checked = $('abobox').checked;
	
	if (checked) {
		var t = 'on';
	}
	else {
		var t = 'off';
	}
	
	
	var url = './ajax/form.php?r=groups&f=abo&theme='+thema+'&t='+t;
	var myXhr = new XHR({
			method: 'get',
			onSuccess: function(req){
				$('xhrres').setHTML(req);
				$('xhrres').setStyle('display','block');
				window.scrollTo(0, 0);		
			}
		});
		myXhr.send(url);
}

function URLDecode( encoded )
{
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return plaintext;
};

function Bildwechsel (Bildnr, Bildobjekt) {
  window.document.images[Bildnr].src = Bildobjekt.src;
}

function htmlspecialchars(str,typ) {
	str = str.replace(/&/g, "&amp;" );
    str = str.replace(/</g, "&lt;" );
    str = str.replace(/>/g, "&gt;" );
    str = str.replace(/\"/g, "&quot;" );
	return str;
}

function windowHeight() {
	// Standard browsers
	if (self.innerHeight)
		return self.innerHeight;
	// IE 6
	if (document.documentElement && document.documentElement.clientHeight)
		return y = document.documentElement.clientHeight;
	//IE 5
	if (document.body)
		return document.body.clientHeight;
	// else
	return 0;
}

function handleResize() {
	var height = windowHeight();
	height -= 230;
	height = parseInt(height / 20) * 20;
	document.getElementById('map').style.height = height + "px";
	document.getElementById('mapitems').style.height = height + "px";
	MaxMapItems = height/ 20;
	
	height = windowHeight();
	height -= 230;
	height = parseInt(height / 18) * 18;
	document.getElementById('map').style.height = height + "px";
	document.getElementById('mapitems').style.height = height + "px";
	MaxMapLocationItems = height/ 18;
	
	map.checkResize();
}

		
