var jahr=2008, monat=2, tag=21, stunde=19, minute=00, sekunde=00; // Start-Datum in MEZ
function countup() {
   var startDatum=new Date(jahr,monat-1,tag,stunde,minute,sekunde);
   zielDatum=new Date(); // Aktuelles Datum
   if(startDatum<zielDatum)  {
      var jahre=0, monate=0, tage=0, stunden=0, minuten=0, sekunden=0;
      while(startDatum<zielDatum) {
         jahre = jahre+1;
         startDatum.setFullYear(startDatum.getFullYear()+1);
      }
      startDatum.setFullYear(startDatum.getFullYear()-1);
      jahre = jahre-1;
      while(startDatum<zielDatum) {
         monate++;
         startDatum.setMonth(startDatum.getMonth()+1);
      }
      startDatum.setMonth(startDatum.getMonth()-1);
      monate = monate-1;
      while(startDatum.getTime()+(24*60*60*1000)<zielDatum) {
         tage = tage+1;
         startDatum.setTime(startDatum.getTime()+(24*60*60*1000));
      }
      stunden=Math.floor((zielDatum-startDatum)/(60*60*1000));
      startDatum.setTime(startDatum.getTime()+stunden*60*60*1000);
      minuten=Math.floor((zielDatum-startDatum)/(60*1000));
      startDatum.setTime(startDatum.getTime()+minuten*60*1000);
      sekunden=Math.floor((zielDatum-startDatum)/1000);
      (jahre!=1)?jahre=jahre+" Jahre,  ":jahre=jahre+" Jahr,  ";
      (monate!=1)?monate=monate+" Monate,  ":monate=monate+" Monat,  ";
      (tage!=1)?tage=tage+" Tage,  ":tage=tage+" Tag,  ";
      (stunden!=1)?stunden=stunden+" Stunden,  ":stunden=stunden+" Stunde,  ";
      (minuten!=1)?minuten=minuten+" Minuten  und  ":minuten=minuten+" Minute  und  ";
      if(sekunden<10) sekunden="0"+sekunden;
      (sekunden!=1)?sekunden=sekunden+" Sekunden":sekunden=sekunden+" Sekunde";
      document.getElementById("startpage_countup").innerHTML=jahre+monate+tage+stunden+minuten+sekunden;
   } else document.getElementById("startpage_countup").innerHTML= "0 Jahre,  0 Monate,  0 Tage,  0 Stunden,  0 Minuten  und  00 Sekunden";
   setTimeout('countup()',200);
}
function agb() {
   window.open('/pages/agb.php','AGBs','height=300,width=400,left=100,top=100,location=no,menubar=no,resizeable=yes,scrollbars=yes,status=yes,toolbar=no');
}
function bildrichtlinien() {
   window.open('/pages/bildrichtlinien.php','Bildrichtlinien','height=300,width=400,left=100,top=100,location=no,menubar=no,resizeable=yes,scrollbars=yes,status=yes,toolbar=no');
}
function openchat(id) {
   window.open('/chat/?id='+id,'CHAT'+id,'height=320,width=270,left=100,top=100,location=no,menubar=no,resizeable=yes,scrollbars=no,status=no,toolbar=no');
}
function openInternalChatWindow(usrid,usrname,usrpic) {
	$.ajax({
      type: "GET",
      url: "/pages/save.php?openchat&id="+usrid,
      data: "",
      success: function(msg){
      }
   });
   fastActualisate = true;
   anzChatOpen += 1;
	if(document.getElementById("chatfenster"+usrid)) {
	   document.getElementById("chatfenster"+usrid).style.display = 'block';
	} else {
	   document.getElementById("chatfenster").innerHTML += '<div class="chatfensterall" id="chatfenster'+usrid+'"><div class="chatfensterprofil" onmouseover="dragStart(event,\'chatfenster'+usrid+'\');" onmouseout="dragEnd();"><div class="chatfensterpic"><img src="/community/profil/pics/'+usrpic+'.gif" width="15" height="20" /></div><div class="chatfenstername">'+usrname+'</div><div class="chatfenstercross" onclick="closeInternalChatWindow(\''+usrid+'\');"></div></div><div class="chatfensterchattext" id="chatwindow"><div id="chattext" class="chattext"></div><div class="bottom"><a name="bottom"></a></div></div><div class="chatfenstereingabe"><div class="chatfenstericon"></div><div class="chatfensterinput"><form onsubmit="sendmessage(this.chat.value,'+usrid+');this.chat.value=\'\';return false;"><input type="text" style="width:100%;" name="chat" /></form></div></div></div>';
	   document.getElementById("chatfenster"+usrid).style.left = (window.innerWidth-280)+"px";
	   if(anzChatOpen*300 < window.innerHeight) {
	   	document.getElementById("chatfenster"+usrid).style.top = (anzChatOpen*300-300)+"px";
	   } else {
	   	document.getElementById("chatfenster"+usrid).style.top = "0px";
	      if(anzChatOpen > 0) {
	   		document.getElementById("chatfenster"+usrid).style.left = (window.innerWidth-280*2)+"px";
	   	}
	   }
	}
}
function closeInternalChatWindow(usrid) {
	$.ajax({
      type: "GET",
      url: "/pages/save.php?closechat&id="+usrid,
      data: "",
      success: function(msg){
      }
   });
   anzChatOpen -= 1;
   if(anzChatOpen <= 0) {
   	fastActualisate = false;
   }
  	document.getElementById("chatfenster"+usrid).style.display = 'none';
}
// Registzrierung - Eingaben überprüfen
function registrationckeckusername() {
   var uname = document.registration.username.value;
   var picture = document.getElementById("registration_username_picture");
   var ausgabe = document.getElementById("registration_username_ausgabe");
   if(uname.length < 3) {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = "Der Username ist zu kurz (min. 3 Zeichen)";
      return;
   }
   if(uname.length > 30) {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = "Der Username ist zu lang (max. 30 Zeichen)";
      return;
   }
   if(uname.indexOf("+") != -1 || uname.indexOf("-") != -1) {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = 'Die Zeichen "+" und "-" dürfen nicht im Usernamen vorkommen';
      return;
   }
   if(uname.indexOf("\\") != -1 || uname.indexOf("/") != -1) {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = 'Die Zeichen "\\" und "/" dürfen nicht im Usernamen vorkommen';
      return;
   }
   if(uname.substr(0,1).search("[a-zA-Z]") == -1) {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = 'Das erste Zeichen muss ein Buchstabe sein';
      return;
   }
   picture.src = '/bilder/symbole/loading.gif';
   $.ajax({
      type: "GET",
      url: "/pages/registration_check.php",
      data: "uname="+escape(uname),
      success: function(msg){
         msg = unescape(msg);
         msg = msg.replace(/\+/g," ");
         var nmsg = msg.split("&next;");
         if(nmsg[0] == 1) {
            picture.src = '/bilder/symbole/ok.gif';
            ausgabe.innerHTML = '';
         } else {
            picture.src = '/bilder/symbole/fehler.gif';
            ausgabe.innerHTML = nmsg[1];
         }
      }
   });
   if(document.getElementById("registration_pw_picture").src.indexOf("bilder/pixel.gif") == -1) {
      registrationckeckpw();
   }
}
function registrationckeckpw() {
   var data = document.registration.pw.value;
   var picture = document.getElementById("registration_pw_picture");
   var ausgabe = document.getElementById("registration_pw_ausgabe");
   if(data.length < 4) {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = "Das Passwort ist zu kurz (min. 4 Zeichen)";
      return;
   }
   if(data.length > 30) {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = "Das Passwort ist zu lang (max. 30 Zeichen)";
      return;
   }
   if(data == document.registration.username.value) {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = "Der Username und das Passwort dürfen nicht gleich sein";
      return;      
   }
   picture.src = '/bilder/symbole/ok.gif';
   ausgabe.innerHTML = '';
   if(document.getElementById("registration_pw_picture").src.indexOf("bilder/pixel.gif") == -1) {
      registrationckeckpwwdh();
   }
}
function registrationckeckpwwdh() {
   var picture = document.getElementById("registration_pwwdh_picture");
   var ausgabe = document.getElementById("registration_pwwdh_ausgabe");
   if(document.registration.pw.value != document.registration.pwwdh.value) {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = "Die Passwörter passen nicht zusammen";
   } else {
      picture.src = '/bilder/symbole/ok.gif';
      ausgabe.innerHTML = "";
   }
}
function registrationckeckemail() {
   var data = document.registration.email.value;
   var picture = document.getElementById("registration_email_picture");
   var ausgabe = document.getElementById("registration_email_ausgabe");
   if(data.indexOf("@") != -1) {
      var email = data.split("@");
      var domain = email[1].split(".");
   } else {
      var email = new Array();
      email[0] = "";
      var domain = new Array();
      domain[0] = "";
      domain[1] = "";
   }
   if(data.length < 5 || data.indexOf("@") == -1 || data.indexOf(".") == -1 || email[0].length < 1 || domain[0].length < 1 || domain[1].length < 2) {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = "Bitte deine echte Email-Adresse angeben";
      return
   }
   picture.src = '/bilder/symbole/loading.gif';
   $.ajax({
      type: "GET",
      url: "/pages/registration_check.php",
      data: "email="+escape(data),
      success: function(msg){
         msg = unescape(msg);
         msg = msg.replace(/\+/g," ");
         var nmsg = msg.split("&next;");
         if(nmsg[0] == 1) {
            picture.src = '/bilder/symbole/ok.gif';
            ausgabe.innerHTML = '';
         } else {
            picture.src = '/bilder/symbole/fehler.gif';
            ausgabe.innerHTML = nmsg[1];
         }
      }
   });
}
function registrationckeckgeburtstag() {
   var data = document.registration.geburtstag.value;
   var picture = document.getElementById("registration_geburtstag_picture");
   var ausgabe = document.getElementById("registration_geburtstag_ausgabe");
   if(data == "") {
      picture.src = '/bilder/symbole/ok.gif';
      ausgabe.innerHTML = "";
      return
   }
   picture.src = '/bilder/symbole/loading.gif';
   $.ajax({
      type: "GET",
      url: "/pages/registration_check.php",
      data: "bday="+escape(data),
      success: function(msg){
         msg = unescape(msg);
         msg = msg.replace(/\+/g," ");
         var nmsg = msg.split("&next;");
         if(nmsg[0] == 1) {
            picture.src = '/bilder/symbole/ok.gif';
            ausgabe.innerHTML = '';
            document.registration.geburtstag.value = nmsg[1];
         } else {
            picture.src = '/bilder/symbole/fehler.gif';
            ausgabe.innerHTML = nmsg[1];
         }
      }
   });
}
function registrationcheckgeschlecht() {
   var picture = document.getElementById("registration_geschlecht_picture");
   picture.src = '/bilder/symbole/ok.gif';
}
function registrationckeckagb() {
   var picture = document.getElementById("registration_agb_picture");
   var ausgabe = document.getElementById("registration_agb_ausgabe");
   if(document.registration.agb.checked == true) {
      picture.src = '/bilder/symbole/ok.gif';
      ausgabe.innerHTML = '';
   } else {
      picture.src = '/bilder/symbole/fehler.gif';
      ausgabe.innerHTML = 'Bitte akzeptiere die AGB';
   }
}
function registration_newcaptcha() {
   document.getElementById("registration_captcha").src = "/bilder/captcha/captcha.php?"+Math.round(Math.random()*99999);
}
function tooltip(eff,cont,id) {
   if(!document.getElementById("sb_tooltip_"+id)) {
      document.getElementById("tooltips").innerHTML += "<div class='tooltip' id='sb_tooltip_"+id+"'>"+cont+"</div>";
   }
   if(eff == "show") {
      document.getElementById("sb_tooltip_"+id).innerHTML = cont;
      document.getElementById("sb_tooltip_"+id).style.left = mousex+100+"px";
      document.getElementById("sb_tooltip_"+id).style.top = mousey+"px";
      $("#sb_tooltip_"+id).css('opacity',0).css('display','block').stop(1,1).animate({top: mousey+"px",left: mousex+30+"px",opacity:1},250);
   } else {
      $("#sb_tooltip_"+id).stop(1,1).animate({top: mousey+"px",left: mousex+100+"px",opacity:0},250,"linear",function() {$("#sb_tooltip_"+id).css('display','none')});
   }
}
var mousex;
var mousey;
var absmousex;
var absmousey;
document.onmousemove = function(e) {
   if(!e) e = window.event;
      var body = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ?
      window.document.documentElement : window.document.body;
      mousex = e.pageX ? e.pageX : e.clientX + body.scrollLeft  - body.clientLeft;
      mousey = e.pageY ? e.pageY : e.clientY + body.scrollTop - body.clientTop;
	if(dragDiv == true) {
	   if((e.clientX-startDragLeft) >= 0 && window.innerWidth > (e.clientX-startDragLeft)+250) {
	   	toDragDiv.style.left = (e.clientX-startDragLeft)+"px";
	   }
	   if((e.clientY-startDragTop) >= 0 && window.innerHeight > (e.clientY-startDragTop)+300) {
	   	toDragDiv.style.top = (e.clientY-startDragTop)+"px";
	   }
	}
}
var toDragDiv = document;
var toDragDivName = "";
var dragDiv = false;
var startDragLeft = 0;
var startDragTop = 0;
toDragDiv.onmousedown = function(e) {
	if(toDragDiv != document) {
   	if(e.offsetX) {
			startDragLeft = e.offsetX;
			startDragTop = e.offsetY;
		} else{
			startDragLeft = e.layerX;
			startDragTop = e.layerY;
	 	}
	 	if(startDragLeft == undefined) {
	 	   startDragLeft = 0;
		}
	 	if(startDragTop == undefined) {
	 	   startDragTop = 0;
		}
		dragDiv = true;
	}
}
document.onmouseup = function() {
	if(dragDiv == true) {
		dragDiv = false;
		if(sessionStorage != undefined) {
			sessionStorage.setItem(toDragDivName,toDragDiv.style.left+","+toDragDiv.style.top);
		}
		toDragDiv = document;
	   toDragDivName = "";
   }
}
function dragStart(e,id) {
	if(dragDiv != true) {
	   toDragDiv = document.getElementById(id);
	   toDragDivName = id;
		for(var i = 0; i < document.getElementsByClassName("chatfensterall").length;i++) {
		   document.getElementsByClassName("chatfensterall")[i].style.zIndex = '1';
		}
		toDragDiv.style.zIndex = '4';
   }
}
function dragEnd() {
	if(dragDiv != true) {
   	toDragDiv = document;
   }
}
function notiz_bearb() {
   $("#community_notiz").animate({opacity:0},500,"linear",function() {$("#community_notiz").css("display","none"),$("#community_notiz_form").css("display","block").css("opacity","0").animate({opacity:1},500,"linear",function() {document.community_notiz.notiz.focus()})});
}
function save_notiz() {
   var notiz = document.community_notiz.notiz.value;
   if(notiz == "") {
      tnotiz = "Keine Notiz vorhanden";
   } else {
      var tnotiz = notiz.replace(/\n/g,"<br />");
   }
   document.getElementById("community_notiz").innerHTML = tnotiz.replace(/</g,"<")+" <img src='/bilder/symbole/pencil.png' width='15' height='15' alt='bearbeiten' />";
   $("#community_notiz_form").animate({opacity:0},500,"linear",function() {$("#community_notiz_form").css("display","none"),$("#community_notiz").css("display","block").css("opacity","0").animate({opacity:1},500);});
   $.ajax({
      type: "GET",
      url: "/community/save.php?notiz="+escape(notiz),
      data: "",
      success: function(msg){
      }
   });
}
function senden(ida,idb) {
   document.getElementsByName(ida)[0].text.value = window.getElementsByName(idb).senden();
   alert(document.getElementsByName(ida)[0].text.value);
   return false;
}
function tabboxchange(kastenid,tabid,anzahl) {
   for(var i=1;i<anzahl+1;i++) {
      document.getElementById("tabboxcontentarea_"+kastenid+i).style.display = 'none';
      document.getElementById("tabboxtitleli_"+kastenid+i).style.fontWeight = "100";
   }
   document.getElementById("tabboxcontentarea_"+kastenid+tabid).style.display = 'block';
   document.getElementById("tabboxtitleli_"+kastenid+tabid).style.fontWeight = "Bold";
}
function showstatus() {
   if(document.getElementById("status").style.display == "block") {
      $("#status").hide("drop",{direction: "up"},500);
      document.getElementById("statuspfeil").src = '/bilder/symbole/pfeil_unten.gif';
   } else {
      $("#status").show("drop",{direction: "up"},500);
      document.getElementById("statuspfeil").src = '/bilder/symbole/pfeil_oben.gif';
   }
}
function set_status(status) {
   $.ajax({
      type: "GET",
      url: "/pages/save.php?status="+escape(status),
      data: "",
      success: function(msg){
         $("#status").hide("drop",{direction: "up"},500);
         document.getElementById("statuspfeil").src = '/bilder/symbole/pfeil_unten.gif';
         document.getElementById("statustext").innerHTML = status;
      }
   });
}
function awaymessage_edit() {
   document.getElementById("community_awaymsg_input").style.display = 'block';
   document.getElementById("community_awaymsg").style.display = 'none';
   document.edit_msg.message.focus();
}
function changetext(text) {
   $.ajax({
      type: "GET",
      url: "/community/save.php?away&text="+escape(text),
      data: "",
      success: function(msg){
         document.getElementById("community_awaymsg_input").style.display = 'none';
         document.getElementById("community_awaymsg").style.display = 'block';
         document.getElementById("community_awaymsg").innerHTML = text.replace("<","&lt;")+' <img src="/bilder/symbole/pencil.png" width="15" height="15" alt="b" style="cursor:pointer;" />';
      }
   });
}
var piczoombildurl;
var piczoombildid;
function show_piczoom (bildid,url) {
   piczoombildurl = bildid+'';
   var x = $("#"+bildid).offset().left;
   var y = $("#"+bildid).offset().top;
   var bild = new Image();
   bild.src = url;
   var oldwidth = $("#"+bildid).width();
   var oldheight = $("#"+bildid).height();
   $("#layerdarkbottom").css({display:'block',opacity:'0'});
   $("#layerdarkbottom").animate({opacity:'0.9'},1000);
   bild.onload = function() {
   	document.getElementById(bildid).style.visibility = 'hidden';
      var tscroll = getScrollXY();
      var scroll = tscroll[1];
      var left = 833/2-bild.width/2;
      var tmaxheight = getSize();
      var maxheight = tmaxheight[1];
      var top = maxheight/2-bild.height/2;
      $("#layerpicturex").css({'display':'block','left':x+oldwidth-15+"px",'top':y-15+"px","width":"0px","height":"0px"});
      $("#layerpicturex").animate({'width':'30px','height':'30px','left':left+bild.width-15+'px','top':top+scroll-15+'px'},1000,"swing");
      $("#layerpicturebottom").css({'display':'block','position':'absolute','top':y,'left':x,'width':oldwidth,'height':oldheight});
      $("#layerpicturebottom").animate({width:bild.width+"px",height:bild.height+"px",left:left+"px",top:top+scroll+"px"},1000,"swing");
      document.getElementById("picgrosimgtag").src = bild.src;
      $("#picgrosimgtag").css({'width':oldwidth,'height':oldheight});
      $("#picgrosimgtag").animate({width:bild.width+"px",height:bild.height+"px"},1000,"swing");
   }
}
function closepiczoom() {
   var x = $("#"+piczoombildurl).offset().left;
   var y = $("#"+piczoombildurl).offset().top;
   var oldwidth = $("#"+piczoombildurl).width();
   var oldheight = $("#"+piczoombildurl).height();
   $("#layerdarkbottom").animate({opacity:'0'},1000,"linear",function() {$("#layerdarkbottom").css({'display':'none'})});
   $("#layerpicturebottom").animate({width:oldwidth+"px",height:oldheight+"px",left:x+"px",top:y+"px"},1000,"swing",function(){$("#layerpicturebottom").css({'display':'none'})});
   $("#layerpicturex").animate({width:"0px",height:"0px",left:x+oldwidth-15+"px",top:y-15+"px"},1000,"swing",function(){$("#layerpicturex").css({'display':'none'}),$("#"+piczoombildurl).css({'visibility':'visible'})});
   $("#picgrosimgtag").animate({width:oldwidth+"px",height:oldheight+"px"},1000,"swing");
}
function getScrollXY() {
   var scrX = 0, scrY = 0;
   if(typeof(window.pageYOffset) == 'number') {
      scrX = window.pageXOffset;
      scrY = window.pageYOffset;
   } else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
      scrX = document.body.scrollLeft;
      scrY = document.body.scrollTop;
   } else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
      scrX = document.documentElement.scrollLeft;
      scrY = document.documentElement.scrollTop;
   }
   return [scrX,scrY];
}
function getSize() {
   var width = 0, height = 0;
   if(typeof(window.innerWidth) == 'number') {
      width = window.innerWidth;
      height = window.innerHeight;
   } else if(document.Element && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
      width = document.documentElement.clientWidth;
      height = document.documentElement.clientHeight;
   } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
      width = document.body.clientWidth;
      height = document.body.clientHeight;
   }
   return [width,height];
}
function save_gruppenmitgliedsstatus(element,gruppenid,userid) {
   var wert = element.value;
   document.getElementById("loading").style.display = 'block';
   $.ajax({
      type: "GET",
      url: "/community/gruppen/show/edit/save.php?mitgliedstatusbearb="+wert+"&id="+gruppenid+"&userid="+userid,
      data: "",
      success: function(msg){
         document.getElementById("loading").style.display = 'none';
      }
   });
}
function sendgroupinvitation(gruppe,userid) {
   document.getElementById("loading").style.display = 'block';
   $.ajax({
      type: "GET",
      url: "/community/gruppen/show/save.php?freundeinladen&gruppe="+gruppe+"&id="+userid,
      data: "",
      success: function(msg){
         document.getElementById("loading").style.display = 'none';
         document.getElementById("gruppefreundeeinladen_"+userid+"_"+gruppe).style.display = 'none';
      }
   });
}
function sendeventinvitation(event,userid) {
   document.getElementById("loading").style.display = 'block';
   $.ajax({
      type: "GET",
      url: "/community/events/show/save.php?einladen&id="+event+"&user="+userid,
      data: "",
      success: function(msg){
         document.getElementById("loading").style.display = 'none';
         document.getElementById("eventfreundeeinladen_"+userid+"_"+event).style.display = 'none';
      }
   });
}
function get_messagecontent(messagegroup,userid,key,betreff) {
   document.getElementById("loading").style.display = 'block';
   $.ajax({
      type: "GET",
      url: "/community/postfach/save.php?getmailcontent&gruppe="+messagegroup+"&id="+userid,
      data: "",
      success: function(msg){
         msg = unescape(msg);
         var i = 0;
         while(document.getElementsByName("messageboxm").length > i) {
	    document.getElementsByName("messageboxm")[i].style.backgroundColor = 'transparent';
	    i = i+1;
         }
         document.getElementById("messageboxm"+messagegroup+""+userid+""+key).style.backgroundColor = '#444444';
         document.getElementById("mailtextcontent").innerHTML = msg;
         document.getElementById("messageanswerformular").style.display = 'block';
         document.messageanswerformular.id.value = userid;
         document.messageanswerformular.gruppe.value = messagegroup;
         document.messageanswerformular.key.value = key;
         document.messageanswerformular.text.value = '';
         if(betreff.substr(0,3) != "RE:") {
	    betreff = "RE: "+betreff;
	 }
         document.messageanswerformular.betreff.value = betreff;
         if(document.getElementById("messagebetreff"+messagegroup+""+userid+""+key).style.fontWeight != '100') {
            document.getElementById("messagebetreff"+messagegroup+""+userid+""+key).style.fontWeight = '100';
            document.getElementById("messagebild"+messagegroup+""+userid+""+key).src = '/bilder/symbole/email_open.png';
         }
         document.getElementById("loading").style.display = 'none';
      }
   });
}
function send_message() {
   document.getElementById("loading").style.display = 'block';
   var text = document.messageanswerformular.text.value;
   var etext = escape(text);
   var betreff = document.messageanswerformular.betreff.value;
   var ebetreff = escape(betreff);
   var user = document.messageanswerformular.id.value;
   var euser = escape(user);
   var gruppe = document.messageanswerformular.gruppe.value;
   var egruppe = escape(gruppe);
   var key = document.messageanswerformular.key.value;
   $.ajax({
      type: "POST",
      url: "/community/postfach/save.php?answer&js",
      data: {"id":euser,"gruppe":egruppe,"text":etext,"betreff":ebetreff},
      success: function(msg){
         document.getElementById("messagebild"+gruppe+""+user+""+key).src = '/bilder/symbole/email_answered.png';
         get_messagecontent(gruppe,user,key,betreff);
      }
   });
}
function save_freundtags(userid,tags) {
	var tag = escape(tags);
	document.getElementById("loading").style.display = 'block';
	$.ajax({
      type: "POST",
      url: "/community/freunde/save.php?tags="+tag+"&id="+userid,
      data: {},
      success: function(msg){
 			document.getElementById("loading").style.display = 'none';
 			document.getElementById("freundetag"+userid+"textt").innerHTML = tags.replace(/</g,"<");
 			document.getElementById("freundetag"+userid+"text").style.display = 'block';
 			document.getElementById("freundetag"+userid+"form").style.display = 'none';
      }
   });
}
function loadregions(land) {
   document.getElementById("loading").style.display = 'block';
   land = escape(land);
	$.ajax({
      type: "POST",
      url: "/community/profil/edit/save.php?getregion="+land,
      data: {},
      success: function(msg){
         msg = unescape(msg);
			var message = msg.split("&next;");
			var regionlength = document.prbearbdatenform.region.length;
   		for(ia=0;ia<regionlength;ia++) {
     			document.prbearbdatenform.region.options[document.prbearbdatenform.region.length-1] = null;
     		}
	  		var stadtlength = document.prbearbdatenform.stadt.length;
     		for(ic=0;ic<stadtlength;ic++) {
     			document.prbearbdatenform.stadt.options[document.prbearbdatenform.stadt.length-1] = null;
     		}
       	document.prbearbdatenform.region.options[document.prbearbdatenform.region.length] = new Option("Region wählen","0", false, true);
       	document.prbearbdatenform.stadt.options[document.prbearbdatenform.stadt.length] = new Option("Bitte zuerst Region wählen","0", false, true);
			var i = 0;
			while(i<message.length) {
			   if(message[i] != "") {
			   	document.prbearbdatenform.region.options[document.prbearbdatenform.region.length] = new Option(message[i], message[i], false, true);
			   }
			   i = i+1;
			}
			document.prbearbdatenform.region[0].selected = true;
			document.prbearbdatenform.stadt[0].selected = true;
			document.getElementById("loading").style.display = 'none';
      }
   });
}
function loadcities(land,region) {
   document.getElementById("loading").style.display = 'block';
   land = escape(land);
   region = escape(region);
	$.ajax({
      type: "POST",
      url: "/community/profil/edit/save.php?getcity&land="+land+"&region="+region,
      data: {},
      success: function(msg){
         msg = unescape(msg);
			var message = msg.split("&next;");
	  		var stadtlength = document.prbearbdatenform.stadt.length;
     		for(ic=0;ic<stadtlength;ic++) {
     			document.prbearbdatenform.stadt.options[document.prbearbdatenform.stadt.length-1] = null;
     		}
       	document.prbearbdatenform.stadt.options[document.prbearbdatenform.stadt.length] = new Option("Bitte wählen","0", false, true);
			var i = 0;
			while(i<message.length) {
			   if(message[i] != "") {
					var msgg = message[i].split("&biele;");
			   	document.prbearbdatenform.stadt.options[document.prbearbdatenform.stadt.length] = new Option(msgg[0], msgg[1], false, true);
			   }
			   i = i+1;
			}
			document.prbearbdatenform.stadt[0].selected = true;
			document.getElementById("loading").style.display = 'none';
      }
   });
}
function get_standort() {
	document.getElementById("loading").style.display = 'block';
	if (navigator.geolocation) {
	   navigator.geolocation.getCurrentPosition(get_standort_success, get_standort_error);
	} else {
	   document.getElementById("prbearbwohnortmeldung").innerHTML = "Dein Browser unterstützt leider keine Standortbestimmung";
	   document.getElementById("prbearbwohnortmeldung").style.display = 'block';
	}
}
function get_standort_success(position) {
 	document.getElementById("prbearbwohnortmeldung").innerHTML = "Dein Standort: "+position.coords.latitude+"/"+position.coords.longitude+"! Es konnte keine Stadt bestimmt werden, wir arbeiten aber daran, dass dieses Feature bald funktionieren wird";
 	document.getElementById("prbearbwohnortmeldung").style.display = 'block';
	document.getElementById("loading").style.display = 'none';
}
function get_standort_error() {
	document.getElementById("prbearbwohnortmeldung").innerHTML = "Der Standort konnte nicht ermittelt werden";
	document.getElementById("prbearbwohnortmeldung").style.display = 'block';
	document.getElementById("loading").style.display = 'none';
}
function resetpunkte() {
   document.getElementById("loading").style.display = 'block';
	$.ajax({
      type: "POST",
      url: "/community/profil/edit/save.php?resetpoints",
      data: {},
      success: function(msg){
 			document.getElementById("loading").style.display = 'none';
 			document.getElementById("prbearbpunkte").innerHTML = '0';
      }
   });
}
var getbenachrichtigungenaktuellerstand = "";
if(sessionStorage != undefined) {
	var notwert = sessionStorage.getItem("notificationsearly");
} else {
	var notwert = undefined;
}
if(notwert != undefined) {
	var notificationsearly = notwert.split(",");
} else {
	var notificationsearly = new Array();
}
var unreadChatMessages = 0;
var unreadNotifications = 0;
function getbenachrichtigungen() {
	var zusatz = document.title.split("|");
	if(zusatz[1] == "" || zusatz[1] == undefined) {
	   var zsz = "";
	} else {
	   var zsz = " |"+zusatz[1];
	}
	$.ajax({
      type: "POST",
      url: "/pages/save.php?benach",
      data: {},
      success: function(msg){
         if(msg == "" || msg == undefined) {
            return;
			}
         var tmsg = msg;
 			msg = msg.split("&next;");
			eval("var anzahlgesamt = "+msg[0]+"+"+msg[1]+"+"+msg[2]+"+"+msg[3]+"+"+msg[4]+";");
			if(anzahlgesamt != undefined) {
			   unreadNotifications = anzahlgesamt;
				if(getbenachrichtigungenaktuellerstand != tmsg) {
				   getbenachrichtigungenaktuellerstand = tmsg;
					document.getElementById("_obenleistemessagebox").innerHTML = "";
					if(msg[0] != 0) {
						document.getElementById("_obenleistemessagebox").innerHTML = "<a href='/community/profil/?id=my' title='"+msg[0]+" neue Pinnwandeinträge'><img src='/bilder/symbole/guestbook.png' width='15' height='15' /></a>";
					}
					if(msg[1] != 0) {
						document.getElementById("_obenleistemessagebox").innerHTML = document.getElementById("_obenleistemessagebox").innerHTML+"<a href='/community/freunde/angebote' title='"+msg[1]+" neue Freundschaftsanfrage(n)'><img src='/bilder/symbole/friends.png' width='15' height='15' /></a>";
					}
					if(msg[2] != 0) {
						document.getElementById("_obenleistemessagebox").innerHTML = document.getElementById("_obenleistemessagebox").innerHTML+"<a href='/community/postfach/' title='"+msg[2]+" neue Nachricht(en)'><img src='/bilder/symbole/mail.png' width='15' height='15' /></a>";
					}
					if(msg[3] != 0) {
							document.getElementById("_obenleistemessagebox").innerHTML = document.getElementById("_obenleistemessagebox").innerHTML+"<a href='/community/gruppen/invitations' title='"+msg[3]+" neue Gruppeneinladung(en)'><img src='/bilder/symbole/groupinvitation.gif' width='15' height='15' /></a>";
					}
					if(msg[4] != 0) {
						document.getElementById("_obenleistemessagebox").innerHTML = document.getElementById("_obenleistemessagebox").innerHTML+"<a href='/community/events' title='"+msg[4]+" Eventeinladungen'><img src='/bilder/symbole/date.png' width='15' height='15' /></a>";
					}
		   		document.getElementById("chatlist").innerHTML = msg[6];
		   		document.getElementById("anzchatonline").innerHTML = msg[7];
					var chtmsgs = msg[9].split("&saubeil;");
					if(chtmsgs[0] != "") {
					   var i = 0;
						var AnzNewMessages = chtmsgs.length;
						if(windowActivated == false) {
					   	unreadChatMessages += AnzNewMessages;
					   }
						while(i<AnzNewMessages) {
						   if(windowActivated == false) {
								PlayBGSound("1");
							}
						   var chtmsg = chtmsgs[i].split("&saubiele;");
						   openInternalChatWindow(chtmsg[0],chtmsg[1],chtmsg[2]);
						   showChatMessage(chtmsg[0],chtmsg[3],chtmsg[4]);
						   i++;
						}
					}
					var gesmsganz = unreadNotifications+unreadChatMessages;
					if(gesmsganz != 0) {
					   document.title = "Saubielen.de ("+(unreadNotifications+unreadChatMessages)+") - Deine Community";
					} else {
				   	document.title = "Saubielen.de - Deine Community";
					}
		   		if(window.webkitNotifications) {
						var notifications = msg[8].split("&saubeil;");
						var notpw = notifications[0].split("&saubielenn;");
						var notgroup = notifications[1].split("&saubielenn;");
						var notfriend = notifications[2].split("&saubielenn;");
						var notevent = notifications[3].split("&saubielenn;");
						var notpostfach = notifications[4].split("&saubielenn;");
						var i = 0;
						var tmp;
						while(i<notpw.length) {
						   if(notpw[i] != "") {
							   tmp = notpw[i].split("&biele;");
							   if(!notificationsearly.contains("gb"+tmp[0])) {
									notificationsearly[notificationsearly.length] = "gb"+tmp[0];
								   if(window.webkitNotifications.checkPermission() == 0 && showNotifications == true) {
										window.webkitNotifications.createNotification("/community/profil/pics/"+tmp[2]+".gif", "Pinnwandeintrag von "+tmp[1],tmp[3]).show();
									}
								}
							}
						   i++;
						}
						i = 0;
						while(i<notgroup.length) {
						   if(notgroup[i] != "") {
							   tmp = notgroup[i].split("&biele;");
							   if(!notificationsearly.contains("gr"+tmp[0])) {
									notificationsearly[notificationsearly.length] = "gr"+tmp[0];
								   if(window.webkitNotifications.checkPermission() == 0 && showNotifications == true) {
										window.webkitNotifications.createNotification("/community/profil/pics/"+tmp[2]+".gif", "Gruppeneinladung von "+tmp[1],tmp[3]).show();
									}
								}
							}
						   i++;
						}
						i = 0;
						while(i<notfriend.length) {
						   if(notfriend[i] != "") {
							   tmp = notfriend[i].split("&biele;");
							   if(!notificationsearly.contains("fr"+tmp[0])) {
									notificationsearly[notificationsearly.length] = "fr"+tmp[0];
								   if(window.webkitNotifications.checkPermission() == 0 && showNotifications == true) {
										window.webkitNotifications.createNotification("/community/profil/pics/"+tmp[2]+".gif", "Freundschaftsantrag",tmp[1]).show();
									}
								}
							}
						   i++;
						}
						i = 0;
						while(i<notevent.length) {
						   if(notevent[i] != "") {
							   tmp = notevent[i].split("&biele;");
							   if(!notificationsearly.contains("ev"+tmp[0])) {
									notificationsearly[notificationsearly.length] = "ev"+tmp[0];
								   if(window.webkitNotifications.checkPermission() == 0 && showNotifications == true) {
										window.webkitNotifications.createNotification("/community/events/pics/"+tmp[2]+".gif", "Eventeinladung",tmp[3]).show();
									}
								}
							}
						   i++;
						}
						i = 0;
						while(i<notpostfach.length) {
						   if(notpostfach[i] != "") {
							   tmp = notpostfach[i].split("&biele;");
							   if(!notificationsearly.contains("po"+tmp[0])) {
									notificationsearly[notificationsearly.length] = "po"+tmp[0];
								   if(window.webkitNotifications.checkPermission() == 0 && showNotifications == true) {
										window.webkitNotifications.createNotification("/community/profil/pics/"+tmp[2]+".gif", "Nachricht von "+tmp[1],tmp[3]).show();
									}
								}
							}
						   i++;
						}
						if(sessionStorage != undefined) {
	      				sessionStorage.setItem("notificationsearly",notificationsearly.join(","));
	      			}
      			}
				}
			}
			if(fastActualisate == true) {
				setTimeout("getbenachrichtigungen()",1000);
			} else {
				setTimeout("getbenachrichtigungen()",10000);
			}
      }
   });
}
Array.prototype.contains = function (elem) {
	var i;
	for (i = 0; i < this.length; i++) {
		if (this[i] == elem) {
			return true;
		}
	}
	return false;
};
function games_bildungstest() {
   window.open('/games/g/bildungstest/','Bildungstest','height=410,width=560,left=100,top=100,location=no,menubar=no,resizeable=yes,scrollbars=no,status=no,toolbar=no');
}
function games_wurfeln() {
   window.open('/games/g/wurfeln/wurfeln.php','Würfeln','height=150,width=220,left=100,top=100,location=no,menubar=no,resizeable=yes,scrollbars=no,status=no,toolbar=no');
}
function games_brunnerium() {
   window.open('/games/g/brunnerium/brunnerium.php','Brunnerium','height=310,width=560,left=100,top=100,location=no,menubar=no,resizeable=yes,scrollbars=no,status=no,toolbar=no');
}
function deletebox(id) {
	$.ajax({
      type: "POST",
      url: "/pages/save.php?changeboxvisibility&box="+id+"&sichtbar=0",
      data: {},
      success: function(msg){
 			$("#"+id).animate({opacity:"0",height:"0px",margin:"0px"},1000,"swing",function(){$("#"+id).css({'display':'none'})});
      },
      error: function() {
         alert("Die Box konnte nicht entfernt werden");
      }
   });
}
function box_change_visibility(id,visibility) {
	if(visibility == true) {
	   var sichtbar = "1";
	} else {
	   var sichtbar = "0";
	}
	$.ajax({
      type: "POST",
      url: "/pages/save.php?changeboxvisibility&box="+id+"&sichtbar="+sichtbar,
      data: {},
      success: function(msg){
         if(visibility == true) {
            document.getElementById("prbearbinhltbrchid"+id).style.backgroundColor = '#202020';
         } else {
            document.getElementById("prbearbinhltbrchid"+id).style.backgroundColor = '#0D0D0D';
         }
      },
      error: function() {
         alert("Die Sichtbarkeit der Box konnte nicht geändert werden");
      }
   });
}
function deletefavorit(favid) {
	document.getElementById("loading").style.display = 'block';
	$.ajax({
      type: "POST",
      url: "/community/save.php?delfav&id="+favid,
      data: {},
      success: function(msg){
			document.getElementById("loading").style.display = 'none';
			$("#comfav"+favid).animate({opacity:"0",height:"0px"},1000,"swing",function(){$("#comfav"+favid).css({'display':'none'})});
      }
   });
}
function favoritbearb(favid) {
   $("#comfavlink"+favid).animate({opacity:0},500,"linear",function() {$("#comfavlink"+favid).css("display","none"),$("#comfavform"+favid).css("display","block").css("opacity","0").animate({opacity:1},500,"linear")});
   $("#favfunc"+favid).animate({opacity:0},500,"linear",function() {$("#favfunc"+favid).css("display","none"),$("#favfuncsave"+favid).css("display","block").css("opacity","0").animate({opacity:1},500,"linear")});
}
function favoritenbearbcancel(favid) {
   $("#comfavform"+favid).animate({opacity:0},500,"linear",function() {$("#comfavform"+favid).css("display","none"),$("#comfavlink"+favid).css("display","block").css("opacity","0").animate({opacity:1},500,"linear")});
   $("#favfuncsave"+favid).animate({opacity:0},500,"linear",function() {$("#favfuncsave"+favid).css("display","none"),$("#favfunc"+favid).css("display","block").css("opacity","0").animate({opacity:1},500,"linear")});
}
function savefavorit(favid) {
	document.getElementById("loading").style.display = 'block';
	var link = document.getElementsByName("comfavformlink"+favid)[0].value;
	var titel = document.getElementsByName("comfavformtitel"+favid)[0].value;
	$.ajax({
      type: "POST",
      url: "/community/save.php?savefav&id="+favid+"&titel="+escape(titel)+"&link="+escape(link),
      data: {},
      success: function(msg){
			document.getElementById("loading").style.display = 'none';
			document.getElementById("comfavlink"+favid).innerHTML = '<a href="'+link+'" target="_blank">'+titel+'</a>';
			favoritenbearbcancel(favid);
      }
   });
}
function insertfavorit() {
	$("#favoritneu").css({height:"0px",opacity:0,display:'block'}).animate({opacity:1,height:"62px"},500,"swing");
}
function newfavabbrechen() {
	$("#favoritneu").animate({opacity:0,height:"0px"},500,"swing",function() {$("#favoritneu").css({display:'none'})});
}
function delete_sbpw_pinn(id) {
	document.getElementById("loading").style.display = 'block';
	$.ajax({
      type: "POST",
      url: "/community/save.php?deletesbpw&id="+id,
      data: {},
      success: function(msg){
			document.getElementById("loading").style.display = 'none';
			$("#communitysbpwpinn"+id).animate({opacity:"0",height:"0px"},1000,"swing",function(){$("#communitysbpwpinn"+id).css({'display':'none'})});
      }
   });
}
function delete_gruppen_pw(id) {
	document.getElementById("loading").style.display = 'block';
	$.ajax({
      type: "POST",
      url: "/community/gruppen/show/save.php?delpin&del="+id,
      data: {},
      success: function(msg){
			document.getElementById("loading").style.display = 'none';
			$("#gruppepw"+id).animate({opacity:"0",height:"0px"},1000,"swing",function(){$("#gruppepw"+id).css({'display':'none'})});
      }
   });
}
function delete_pinn(id) {
	document.getElementById("loading").style.display = 'block';
	$.ajax({
      type: "POST",
      url: "/community/profil/save.php?deletepw&id="+id,
      data: {},
      success: function(msg){
			document.getElementById("loading").style.display = 'none';
			$("#pwpinn"+id).animate({opacity:"0",height:"0px"},1000,"swing",function(){$("#pwpinn"+id).css({'display':'none'})});
      }
   });
}
function likestatus(id,status) {
	var weiter = true;
	if(status == "1") {
		if(document.getElementById("like"+id)) {
		   if(document.getElementById("like"+id).style.display == '') {
		      weiter = false;
			}
		}
	}
	if(status == "0") {
		if(document.getElementById("dislike"+id)) {
		   if(document.getElementById("dislike"+id).style.display == '') {
		      weiter = false;
			}
		}
	}
	if(weiter == true) {
	document.getElementById("loading").style.display = 'block';
	$.ajax({
      type: "POST",
      url: "/pages/save.php?like&id="+id+"&l="+status,
      data: {},
      success: function(msg){
			if(status == "1" || status == "x") {
			   if(document.getElementById("dislike"+id) && document.getElementById("dislike"+id).style.display == "") {
					//$("#dislike"+id).animate({opacity:"0",height:"0px"},1000,"swing",function(){$("#dislike"+id).css({'display':'none'})});
					document.getElementById("dislike"+id).style.display = 'none';
					// Anzahl von dislike um 1 verringern
					var tmpjezganz = document.getElementById("anzahldislike"+id).innerHTML;
					eval("var newanzahl = "+tmpjezganz+"-1;");
					document.getElementById("anzahldislike"+id).innerHTML = newanzahl;
				}
				if(status == "1") {
					if(document.getElementById("like"+id)) {
				      //$("#like"+id).css({display:""}).animate({opacity:"1",height:"20px"},1000,"swing");
						document.getElementById("like"+id).style.display = '';
					} else {
						// Namen hinzufügen
						var tbody = document.getElementById("tablelike"+id).getElementsByTagName("tbody")[0];
						var row = document.createElement("tr");
						tbody.appendChild(row).setAttribute("id", "like"+id, 0);
						var td1 = document.createElement("td");
						var td2 = document.createElement("td");
						var td3 = document.createElement("td");
						td1.innerHTML = "<img src='/community/profil/pics/"+gl_bildklein+".gif' width='15' height='20' />";
						td2.innerHTML = gl_username;
						td3.innerHTML = "<a href=\"javascript:likestatus('"+id+"','x');\"><img src='/bilder/symbole/cross.png' width='12' height='12' alt='x' /></a>";
						row.appendChild(td1);
						row.appendChild(td2);
						row.appendChild(td3);
						tbody.appendChild(row);
					}
					// Anzahl von like um 1 erhöhen
					var tmpjezganz = document.getElementById("anzahllike"+id).innerHTML;
					eval("var newanzahl = "+tmpjezganz+"+1;");
					document.getElementById("anzahllike"+id).innerHTML = newanzahl;
				}
			}
			if(status == "0" || status == "x") {
			   if(document.getElementById("like"+id) && document.getElementById("like"+id).style.display == "") {
					//$("#like"+id).animate({opacity:"0",height:"0px"},1000,"swing",function(){$("#like"+id).css({'display':'none'})});
					document.getElementById("like"+id).style.display = 'none';
					// Anzahl von like um 1 verringern
					var tmpjezganz = document.getElementById("anzahllike"+id).innerHTML;
					eval("var newanzahl = "+tmpjezganz+"-1;");
					document.getElementById("anzahllike"+id).innerHTML = newanzahl;
				}
				if(status == "0") {
					if(document.getElementById("dislike"+id)) {
				      //$("#dislike"+id).css({display:""}).animate({opacity:"1",height:"20px"},1000,"swing");
						document.getElementById("dislike"+id).style.display = '';
					} else {
						// Namen hinzufügen
						var tbody = document.getElementById("tabledislike"+id).getElementsByTagName("tbody")[0];
						var row = document.createElement("tr");
						tbody.appendChild(row).setAttribute("id", "dislike"+id, 0);
						var td1 = document.createElement("td");
						var td2 = document.createElement("td");
						var td3 = document.createElement("td");
						td1.innerHTML = "<img src='/community/profil/pics/"+gl_bildklein+".gif' width='15' height='20' />";
						td2.innerHTML = gl_username;
						td3.innerHTML = "<a href=\"javascript:likestatus('"+id+"','x');\"><img src='/bilder/symbole/cross.png' width='12' height='12' alt='x' /></a>";
						row.appendChild(td1);
						row.appendChild(td2);
						row.appendChild(td3);
						tbody.appendChild(row);
					}
					// Anzahl von dislike um 1 erhöhen
					var tmpjezganz = document.getElementById("anzahldislike"+id).innerHTML;
					eval("var newanzahl = "+tmpjezganz+"+1;");
					document.getElementById("anzahldislike"+id).innerHTML = newanzahl;
				}
			}
			document.getElementById("loading").style.display = 'none';
      }
   });
   }
}
function retmeldung(ret) {
	if(glblmeldungidentificator == "seite_addtoprofil") {
	   if(ret == 1) {
	      document.getElementById("loading").style.display = 'block';
	      var seitenid = document.meldungformular.id.value;
	      var kateg = document.meldungformular.kateg.value;
			$.ajax({
      		type: "POST",
      		url: "/community/seiten/show/save.php?add&id="+seitenid+"&kateg="+kateg,
      		data: {},
      		success: function(msg){
					document.getElementById("loading").style.display = 'none';
					$("#meldung").animate({opacity:"0"},1000,"swing",function(){$("#meldung").css({'display':'none'})});
					$("#addtoprofil").animate({opacity:0},500,"linear",function() {$("#addtoprofil").css("display","none"),$("#delfromprofil").css("display","block").css("opacity","0").animate({opacity:1},500,"linear")});
      		}
   		});
			$("#meldung").animate({opacity:0},500,"swing",function() {$("#meldung").css({display:'none'})});
	   } else {
			$("#meldung").animate({opacity:0},500,"swing",function() {$("#meldung").css({display:'none'})});
	   }
	}
}
var glblmeldungidentificator;
function seite_addtoprofil(id) {
   glblmeldungidentificator = "seite_addtoprofil";
	var inhalt = "<form name='meldungformular'><input type='hidden' name='id' value='"+id+"' />Bitte wähle eine Kategorie aus, in der diese Seite in deinem Profil erscheint:<br />";
	inhalt = inhalt+"<select name='kateg'>";
	inhalt = inhalt+"<option value='1'>Sonstiges</option>";
	inhalt = inhalt+"<option value='2'>Ausbildung</option>";
	inhalt = inhalt+"<option value='3'>Sport</option>";
	inhalt = inhalt+"<option value='4'>Bücher</option>";
	inhalt = inhalt+"<option value='5'>Filme</option>";
	inhalt = inhalt+"<option value='6'>Freizeit</option>";
	inhalt = inhalt+"<option value='7'>Spiele</option>";
	inhalt = inhalt+"<option value='8'>Aktivitäten</option>";
	inhalt = inhalt+"<option value='9'>Fernsehen</option>";
	inhalt = inhalt+"<option value='10'>Finanzen</option>";
	inhalt = inhalt+"<option value='11'>Zitate</option>";
	inhalt = inhalt+"<option value='12'>Interesse</option>";
	inhalt = inhalt+"<option value='13'>Computer</option>";
	inhalt = inhalt+"<option value='14'>Technik</option>";
	inhalt = inhalt+"<option value='15'>Internet</option>";
	inhalt = inhalt+"<option value='16'>Gefühle</option>";
	inhalt = inhalt+"<option value='17'>Orte</option>";
	inhalt = inhalt+"<option value='18'>Liebe</option>";
	inhalt = inhalt+"<option value='19'>Reisen</option>";
	inhalt = inhalt+"<option value='20'>Browser</option>";
	inhalt = inhalt+"<option value='21'>Gesundheit</option>";
	inhalt = inhalt+"<option value='22'>Essen&Trinken</option>";
	inhalt = inhalt+"<option value='23'>Geschichte</option>";
	inhalt = inhalt+"</select></form>";
	document.getElementById("btnabbr").value = 'Abbrechen';
	document.getElementById("btnok").value = 'Zum Profil hinzufügen';
	document.getElementById("meldungfrage").innerHTML = inhalt;
	$("#meldung").css({display:'block',opacity:0}).animate({opacity:1},500,"swing");
}
function seite_deletefromprofil(id) {
	$.ajax({
		type: "POST",
		url: "/community/seiten/show/save.php?dellike&id="+id,
		data: {},
		success: function(msg){
			document.getElementById("loading").style.display = 'none';
			$("#delfromprofil").animate({opacity:0},500,"linear",function() {$("#delfromprofil").css("display","none"),$("#addtoprofil").css("display","block").css("opacity","0").animate({opacity:1},500,"linear")});
		}
	});
}
function addnewpagebearbitem() {
	var tbody = document.getElementById("seitebearbeitenid").getElementsByTagName("tbody")[0];
	var row = document.createElement("tr");
	var td1 = document.createElement("td");
	var td2 = document.createElement("td");
	td1.innerHTML = "<input type='text' name='name[]' style='width:100%;' />:";
	td2.innerHTML = "<textarea style='width:100%;height:50px;' name='value[]'></textarea>";
	td1.className = "profilinfoname";
	td2.className = "profilinfovalue";
	row.appendChild(td1);
	row.appendChild(td2);
	tbody.appendChild(row);
}
function showmorelinkedpages(boxid) {
   var oldheight = $("#"+boxid).height();
   $("#"+boxid).css({display:'block',opacity:0,height:"0px"}).animate({opacity:1,height:oldheight+"px"},1200,"swing");
   $("#"+boxid+"more").animate({opacity:"0"},500,"swing",function(){
		$("#"+boxid+"more").css({'display':'none'}),
		$("#"+boxid+"less").css({display:'block',opacity:0}).animate({opacity:1},500,"swing",function(){})
	});
}
function showlesslinkedpages(boxid) {
   $("#"+boxid).animate({opacity:"0",height:"0px"},1200,"swing",function(){$("#"+boxid).css({'display':'none'})});
   $("#"+boxid+"less").animate({opacity:"0"},500,"swing",function(){$("#"+boxid+"less").css({'display':'none'}),$("#"+boxid+"more").css({display:'block',opacity:0}).animate({opacity:1},500,"swing")});
}
function shorturlcheck(e)	{
	var keynum;
	var keychar;
	var numcheck;
	if(window.event) {
		keynum = e.keyCode;
	} else if(e.which) {
		keynum = e.which;
	}
	if(keynum == 8 || keynum == 13 || keynum == 37 || keynum == 39 || keynum == 9 || keynum == 46) {
	   return true;
	}
	keychar = String.fromCharCode(keynum);
	numcheck = /^[a-zA-Zäüö0-9 -]{0,1000}$/;
	return numcheck.test(keychar);
}
function noreturn(e) {
	var keynum;
	if(window.event) {
		keynum = e.keyCode;
	} else if(e.which) {
		keynum = e.which;
	}
	if(keynum == 13) {
	   return false;
	}
	return true;
}
function lade_communitywidgetwetter(cityid) {
	$.ajax({
      type: "GET",
      url: "/community/widgets/wetter/weather.php?loc="+cityid,
      success: function(msg){
         msg = unescape(msg);
			if(msg == "404") {
			   $("#widgetcommunitywetterload").animate({opacity:"0"},500,"swing",function(){$("#widgetcommunitywetterload").css({'display':'none'}),$("#widgetcommunitywettercnf").css({display:'block',opacity:0}).animate({opacity:1},500,"swing")});
			} else {
				var values = msg.split("&next;");
				document.getElementById("widgetcommunitywetter_cityname").innerHTML = values[0]+", "+values[1];
				document.getElementById("widgetcommunitywetter_conditionbild").src = "/bilder/wetter/"+values[16];
				document.getElementById("widgetcommunitywetter_conditiontemp").innerHTML = values[18]+" °"+values[3];
				document.getElementById("widgetcommunitywetter_conditionsunrise").innerHTML = values[14];
				document.getElementById("widgetcommunitywetter_conditionsunset").innerHTML = values[15];
				document.getElementById("widgetcommunitywetter_conditionwind").innerHTML = "W: "+values[8]+" ("+values[9]+" "+values[6]+")";
				document.getElementById("widgetcommunitywetter_conditionpressure").innerHTML = "Druck: "+values[12]+" "+values[5];
				document.getElementById("widgetcommunitywetter_conditionhumidity").innerHTML = "Feucht: "+values[10]+" %";
				document.getElementById("widgetcommunitywetter_forecastaday").innerHTML = values[19];
				document.getElementById("widgetcommunitywetter_forecastabild").src = "/bilder/wetter/"+values[20];
				document.getElementById("widgetcommunitywetter_forecastalow").innerHTML = values[21];
				document.getElementById("widgetcommunitywetter_forecastahigh").innerHTML = values[22];
				document.getElementById("widgetcommunitywetter_forecastbday").innerHTML = values[24];
				document.getElementById("widgetcommunitywetter_forecastbbild").src = "/bilder/wetter/"+values[25];
				document.getElementById("widgetcommunitywetter_forecastblow").innerHTML = values[26];
				document.getElementById("widgetcommunitywetter_forecastbhigh").innerHTML = values[27];
				$("#widgetcommunitywetterload").animate({opacity:"0"},500,"swing",function(){$("#widgetcommunitywetterload").css({'display':'none'}),$("#widgetcommunitywetteranz").css({display:'block',opacity:0}).animate({opacity:1},500,"swing")});
			}
      },
      error: function() {
         $("#widgetcommunitywetterload").animate({opacity:"0"},500,"swing",function(){$("#widgetcommunitywetterload").css({'display':'none'}),$("#widgetcommunitywetterlerr").css({display:'block',opacity:0}).animate({opacity:1},500,"swing")});
      }
   });
}
function easter_found_egg(id,hash) {
   document.getElementById("loading").style.display = 'block';
   $.ajax({
      type: "GET",
      url: "/pages/save.php?easter&id="+id+"&hash="+hash,
      success: function(msg){
         msg = unescape(msg);
   		document.getElementById("loading").style.display = 'none';
			$("#easter_egg_"+id).animate({opacity:"0"},500,"swing",function(){$("#easter_egg_"+id).css({'display':'none'})});
			show_benachrichtigung(msg,5000);
      }
   });
}
function show_benachrichtigung(text,time) {
	document.getElementById("page_benachrichtigung").innerHTML = text;
	$("#page_benachrichtigung").css({display:'block',opacity:0}).animate({opacity:1},500,"swing");
	setTimeout(hide_benachrichtigung,time);
}
function hide_benachrichtigung() {
   $("#page_benachrichtigung").animate({opacity:"0"},500,"swing",function(){$("#page_benachrichtigung").css({'display':'none'})})
}
function checkfilesize(evt) {
	if(window.File && window.Blob) {
		var size = evt.target.files[0].size;
		if (size >= 1048576) { // 1 MB
			meldungausgabe.innerHTML = "Die Datei ist zu groß (maximal 1MB)";
		} else {
			meldungausgabe.innerHTML = "";
		}
	}
}
function activate_notifications() {
	if(window.webkitNotifications) {
		window.webkitNotifications.requestPermission();
		return true;
	} else {
      return false;
	}
}
var abicountdown;
function abicountdown() {
	var output = document.getElementById("abicountdown");
	var akt_datum_abi_Datum = new Date()-timediff;
	var Abiende = new Date("05 31, 2011 17:45:00");
	if(Math.round((Abiende-akt_datum_abi_Datum)/100) >= 0) {
		var zsek = String(Math.round((Abiende-akt_datum_abi_Datum)/100));
		var text = "Noch ";
		var i = 0;
		var laenge = zsek.length;
		if(navigator.appCodeName == "Safari") {
		   text = text+zsek;
		} else {
			while(i < laenge) {
			   text = text+"<img src='/bilder/ziffern/"+zsek.substr(i,1)+".gif' alt='"+zsek.substr(i,1)+"' />";
			   i = i+1;
			}
		}
		text = text+" 10tl-Sek. bis zum Abiende";
	} else {
	   var text = "";
	   window.clearInterval(abicountdown);
	}
	output.innerHTML = text;
}
var anzahlmaxneuladen = 20;
var neuladenanz = 0;
var loadNeuPosts = false;
function checkAndLoadOlderPostsSBPW() {
	if (window.innerHeight) {
		var hoehe = window.innerHeight;
	} else if (document.body && document.body.offsetHeight) {
		var hoehe = document.body.offsetHeight;
	} else {
		var hoehe = 0;
	}
	if(window.pageYOffset) {
		var scrolltop = window.pageYOffset;
	} else {
		var scrolltop = document.body.scrollTop;
	}
	var diffNeuLoad = document.getElementById("maintable").offsetHeight-scrolltop-hoehe;
	if(diffNeuLoad <= 1000 && neuladenanz < anzahlmaxneuladen && loadNeuPosts == false) {
	   loadNeuPosts = true;
	   neuladenanz++;
      LoadOlderPostsSBPW();
	}
}
function LoadOlderPostsSBPW()  {
	document.getElementById("loadNewPostsSBPWloading").style.visibility = 'visible';
   $.ajax({
      type: "POST",
      url: "/community/save.php?getPosts&page="+neuladenanz,
      data: {},
      success: function(msg){
			document.getElementById("loadNewPostsSBPWloading").style.visibility = 'hidden';
         document.getElementById("sbpwcommenthtml").innerHTML = document.getElementById("sbpwcommenthtml").innerHTML+msg;
         loadNeuPosts = false;
      }
   });
}
function sendmessage(stext,chatTo,formular) {
	if(stext == "")   {
	   return false;
	}
   var jetzt = new Date();
   var std = jetzt.getHours();
   var min = jetzt.getMinutes();
   if(min >= 0 && min < 10) {
      var minute = "0"+min;
	} else {
      var minute = min;
	}
	document.getElementById("chatfenster"+chatTo).getElementsByClassName("chattext")[0].innerHTML += "<table width='100%'><tr><td class='chatwindowtext'><b class='chatwindowtimechtname'>"+gl_username+"</b> "+stext+"</td><td class='chatwindowtime'>"+std+":"+minute+"</td></tr></table>";
   chatunten(chatTo);
	$.ajax({
      type: "GET",
      url: "/chat/save.php?send&text="+escape(stext)+"&id="+chatTo,
      data: "",
      success: function(msg){
         msg = unescape(msg);
         if(msg == "5") {
            document.getElementById("chatfenster"+chatTo).getElementsByClassName("chattext")[0].innerHTML += '<div class="meldung">'+document.getElementById("chatfenster"+chatTo).getElementsByClassName("chatfenstername")[0].innerHTML+' ist offline.</div>';
         } else if(msg == "6") {
            document.getElementById("chatfenster"+chatTo).getElementsByClassName("chattext")[0].innerHTML += '<div class="meldung">Du bist offline.</div>';
         }
   		chatunten(chatTo);
      },
      error: function(e){
         document.getElementById("chatfenster"+chatTo).getElementsByClassName("chattext")[0].innerHTML += '<div class="meldung">Nachricht konnte nicht gesendet werden! Prüfe deine Internetverbindung</div>';
   		chatunten(chatTo);
      }
   });
}
function showChatMessage(userId,time,text) {
   document.getElementById("chatfenster"+userId).getElementsByClassName("chattext")[0].innerHTML += "<table width='100%'><tr><td class='chatwindowtext'><b class='chatwindowtimechtname'>"+document.getElementById("chatfenster"+userId).getElementsByClassName("chatfenstername")[0].innerHTML+"</b> "+text+"</td><td class='chatwindowtime'>"+time+"</td></tr></table>";
	chatunten(userId);
}
function chatunten(chatTo) {
	document.getElementById("chatfenster"+chatTo).getElementsByClassName("chatfensterchattext")[0].scrollTop = document.getElementById("chatfenster"+chatTo).getElementsByClassName("chatfensterchattext")[0].scrollHeight - document.getElementById("chatfenster"+chatTo).getElementsByClassName("chatfensterchattext")[0].offsetHeight;
	return true;
}
function PlayBGSound(soundid) {
	if(playSounds == true) {
		thisMovie("PlayBackGroundSoundScript").playSoundTrack(soundid);
	}
}
function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}
