function togglesort(table,type,direction){
$("#optionstabinhalt").load(host+"plugins/adminpanel/adminoptions.php",{"action":"togglesort","table":table,"type":type,"dir":direction});
}

function changeuserrank(user,id){
ranko=document.getElementById(id+'rankselect');
i=ranko.selectedIndex;
rank=ranko.options[i].text;

var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=changeuserrank&name="+user+"&rank="+rank,
   async: false

   }
 ).responseText;
if(response=='set'){alert('Rang von '+user+' ge&auml;ndert in '+rank);}

}	



function adminoptionseigeneclick(perma,type){
$("#optionstabinhalt").load(host+"plugins/adminpanel/adminoptions.php",{"action":"adminoptionseigeneclick","perma":perma,"type":type},function(){
	//$("#overlaycontentholder").animate({width:"800px"},150);
	//$("#overlaycontentholder").animate({},150);
	if(type=='artikel'){}
});
}
function adminoptionsuserclick(buser){
$("#optionstabinhalt").load(host+"plugins/adminpanel/adminoptions.php",{"action":"adminoptionsuserclick","buser":buser});

}

function adminoptionswebtippsclick(id){
$("#optionstabinhalt").load(host+"plugins/adminpanel/adminoptions.php",{"action":"adminoptionswebtippsclick","id":id});

}



function adminoptionsartikelclick(perma){

$("#optionstabinhalt").load(host+"plugins/adminpanel/adminoptions.php",{"action":"adminoptionsartikelclick","perma":perma},function(){

	//$("#overlaycontentholder").animate({width:"800px"},150);
	//$("#overlaycontentholder").animate({},150);
	setTimeout("enable()",100);
});

}

function adminoptionskolummnenclick(perma){
$("#optionstabinhalt").load(host+"plugins/adminpanel/adminoptions.php",{"action":"adminoptionskolummnenclick","perma":perma},function(){
	//$("#overlaycontentholder").animate({width:"800px"},150);
	//$("#overlaycontentholder").animate({},150);
});

}

function adminoptionseventsclick(perma){
$("#optionstabinhalt").load(host+"plugins/adminpanel/adminoptions.php",{"action":"adminoptionseventsclick","perma":perma},function(){
	//$("#overlaycontentholder").animate({width:"800px"},150);
	//$("#overlaycontentholder").animate({},150);
});

}

function adminoptionseventssave(perma){


title=document.getElementById("optionstitle").value;
//var text=document.getElementById('textinput').contentWindow.document.body.innerHTML;
var kurzinfo=document.getElementById('optionskurzinfo').value;
var location=document.getElementById('optionslocation').value;	
var veranstalter=document.getElementById('optionsveranstalter').value;
var stunde=document.getElementById('datumstunde').value;
var tag=document.getElementById('datumtag').value;
var monat=document.getElementById('datummonat').value;
var jahr=document.getElementById('datumjahr').value;
var flyer='';
var freikarten=document.getElementById('freikarten').checked;
if(freikarten==true){frei='ja';}
if(freikarten!=true){frei='nein';}
freikarten=frei;
var gewinnspiel=document.getElementById('gewinnspiel').checked;
if(gewinnspiel==true){gewinn='ja';}
if(gewinnspiel!=true){gewinn='nein';}
gewinnspiel=gewinn;
if(document.getElementById('event_flyerimg')){
var flyer=document.getElementById('event_flyerimg').src;}
			    
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionseventssave&perma="+perma+"&titel="+title+"&kurzinfo="+escape(kurzinfo)+"&veranstalter="+veranstalter+"&location="+location+"&tag="+tag+"&monat="+monat+"&jahr="+jahr+"&stunde="+stunde+"&flyer="+flyer+"&freikarten="+freikarten+"&gewinnspiel="+gewinnspiel,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
 alert('Ã„nderungen gespeichert!');
}


function adminoptionswebtippssave(id){


title=document.getElementById("optionstitle").value;
//var text=document.getElementById('textinput').contentWindow.document.body.innerHTML;
var text=document.getElementById('optionstext').value;
var link=document.getElementById('optionslink').value;	
var autor=document.getElementById('optionsautor').value;

  
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionswebtippssave&link="+link+"&titel="+title+"&text="+escape(text)+"&autor="+autor+"&id="+id,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
 alert('Ã„nderungen gespeichert!');
}

function adminoptionsartikelfrei(perma,frei){
$("#optionstabinhalt").load(host+"plugins/adminpanel/adminoptions.php",{"action":"adminoptionsartikelfrei","perma":perma,"frei":frei});
	//$("#overlaycontentholder").animate({width:"800px"},150);
	//$("#overlaycontentholder").animate({},150);
}

function adminoptionskolummnenfrei(perma,frei){
$("#optionstabinhalt").load(host+"plugins/adminpanel/adminoptions.php",{"action":"adminoptionskolummnenfrei","perma":perma,"frei":frei});
}


function adminoptionseigenesave(perma,type){

if(type=='artikel'){
title=document.getElementById("optionstitle").value;
//var text=document.getElementById('textinput').contentWindow.document.body.innerHTML;
//var text=document.getElementById('editor').value;
text=document.getElementById("editorframe").contentWindow.document.body.innerHTML;	  
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionseigenesave&perma="+perma+"&title="+title+"&text="+escape(text)+"&type="+type,
   async: false

   }).responseText;
 alert('Ã„nderungen gespeichert!');
}

if(type=='events'){
title=document.getElementById("optionstitle").value;
//var text=document.getElementById('textinput').contentWindow.document.body.innerHTML;
var kurzinfo=document.getElementById('optionskurzinfo').value;
var location=document.getElementById('optionslocation').value;	
var veranstalter=document.getElementById('optionsveranstalter').value;
var stunde=document.getElementById('datumstunde').value;
var tag=document.getElementById('datumtag').value;
var monat=document.getElementById('datummonat').value;
var jahr=document.getElementById('datumjahr').value;
var flyer='';
if(document.getElementById('event_flyerimg')){
var flyer=document.getElementById('event_flyerimg').src;}
			      
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionseigenesave&perma="+perma+"&titel="+title+"&kurzinfo="+escape(kurzinfo)+"&veranstalter="+veranstalter+"&location="+location+"&type="+type+"&flyer="+flyer+"&stunde="+stunde+"&tag="+tag+"&monat="+monat+"&jahr="+jahr,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
 alert('Ã„nderungen gespeichert!');
}

if(type=='kolummnen'){

title=document.getElementById("optionstitle").value;
text=document.getElementById("editor").value;

var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionseigenesave&permaorg="+perma+"&title="+title+"&text="+text+"&type="+type,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
 alert('Ã„nderungen gespeichert!');


}



}


function cleararticle(perma){
if(confirm('Artikel wirklich löschen?')){
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=cleararticle&perma="+perma,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
alert('Artikel wurde gelöscht ');
}
}

function adminoptionseigenedelete(perma,type){
if(confirm('Beitrag wirklich löschen?')){
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionseigenedelete&perma="+perma+"&type="+type,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
alert('Beitrag wurde gelöscht ');
}
}

function adminoptionskolumnendelete(perma){
if(confirm('Beitrag wirklich löschen?')){
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionskolumnendelete&perma="+perma,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
alert('Beitrag wurde gelöscht ');
}
}

function adminoptionseventsdelete(perma){
if(confirm('Beitrag wirklich löschen?')){
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionseventsdelete&perma="+perma,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
alert('Beitrag wurde gelöscht ');
}
}

function adminoptionswebtippsdelete(id){
if(confirm('Beitrag wirklich löschen?')){
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionswebtippsdelete&id="+id,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
alert('Beitrag wurde gelöscht ');
}
}



function adminoptionsuserdelete(name){
if(confirm('User wirklich löschen?')){
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=deleteuser&name="+name,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
alert('User wurde gelöscht ');
}
}

function adminoptionsartikelsave(perma){
permal=document.getElementById("optionsperma").value;
autor=document.getElementById("optionsautor").value;
title=document.getElementById("optionstitle").value;
//text=document.getElementById("editor").value;
text=document.getElementById("editorframe").contentWindow.document.body.innerHTML;
frei=document.getElementById('frei').checked;
if(frei==true){frei='true';}
if(frei==false){frei='false';}
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionsartikelsave&permaorg="+perma+"&perma="+permal+"&autor="+autor+"&title="+title+"&text="+escape(text)+"&frei="+frei,
   async: false

   }).responseText;
 alert('&Auml;nderungen gespeichert!');
}

function adminoptionskolummnensave(perma){
permal=document.getElementById("optionsperma").value;
autor=document.getElementById("optionsautor").value;
title=document.getElementById("optionstitle").value;
text=document.getElementById("editor").value;
frei=document.getElementById('frei').checked;
if(frei==true){frei='true';}
if(frei==false){frei='false';}
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionskolummnensave&permaorg="+perma+"&perma="+permal+"&autor="+autor+"&title="+title+"&text="+text+"&frei="+frei,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
 alert('&Auml;nderungen gespeichert!');
}





function adminoptionsusersave(user){
vname=document.getElementById("optionsvname").value;
nname=document.getElementById("optionsnname").value;
ort=document.getElementById("optionsort").value;
mail=document.getElementById("optionsmail").value;
beruf=document.getElementById("optionsberuf").value;
web=document.getElementById("optionsweb").value;
facebook=document.getElementById("optionsfacebook").value;
lastfm=document.getElementById("optionslastfm").value;
myspace=document.getElementById("optionsmyspace").value;
soundcloud=document.getElementById("optionssoundcloud").value;
twitter=document.getElementById("optionstwitter").value;
info=document.getElementById("optionsinfo").value;
pass=document.getElementById("optionspass").value;
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=adminoptionsusersave&nick="+user+"&vname="+vname+"&nname="+nname+"&ort="+ort+"&mail="+mail+"&beruf="+beruf+"&web="+web+"&facebook="+facebook+"&lastfm="+lastfm+"&myspace="+myspace+"&soundcloud="+soundcloud+"&twitter="+twitter+"&info="+info+"&pass="+pass,
   async: false

   }).responseText;
document.getElementById("optionstabinhalt").innerHTML=response;
 alert('&Auml;nderungen gespeichert!');
}

function beitraege(user){
var response=$.ajax({
   type: "POST",
   url: host+"plugins/adminpanel/adminoptions.php",
   data: "action=beitraege&user="+user,
   async: false

   }).responseText;
document.getElementById("backend").innerHTML=response;
/*$('#overlay').fadeIn(1);
$('#overlay').fadeTo(1,0.5);
$("#overlaycontentholder").fadeIn(1);
	$("#overlaycontentholder").animate({width:"800px"},150);*/
document.getElementById('backend').style.display='block';
}

