/* Funktion, um PHPSESSID zu finden */
function get_php_session() {
	if (window.location.search.length == 0) {
		return "";
	}

	var search = window.location.search.substr(1,window.location.search.length-1)
	var vars = search.split("&");
	for (var i = 0; i < vars.length; i++) {
		if (vars[i].indexOf("PHPSESSID") > -1) {
			return vars[i];
		}
	}
}

/* POPUP für Buddy suchen */
function popup_findbuddy() {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "?"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"findbuddy.php"+sess,
  		"buddypopup",
		"width=400,height=260,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für Buddy hinzufügen */
function popup_addbuddy(user) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"addbuddy.php?id="+user+sess,
  		"buddypopup",
		"width=400,height=260,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für Buddy löschen */
function popup_delbuddy(user) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"delbuddy.php?id="+user+sess,
  		"buddypopup",
		"width=400,height=260,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für QSMS verschicken */
function popup_sendqsms(user) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"sendqsms.php?id="+user+sess,
  		"sendqsmspopup",
		"width=400,height=260,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für QSMS lesen */
function popup_readqsms(message) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"readqsms.php?id="+message+sess,
  		"readqsmspopup",
		"width=400,height=260,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für Bilder */
function popup_showpic(picid) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"showpic.php?id="+picid+sess,
  		picid,
		"width=700,height=600,left=50,top=50,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für vergessenes Passwort */
function popup_newpass() {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "?"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"lostpassword.php"+sess,
  		"passwordpopup",
		"width=400,height=260,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für Special verschicken */
function popup_sendspecial(specialid) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"sendspecial.php?id="+specialid+sess,
  		"sendspecialpopup",
		"width=400,height=360,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für Veranstaltung verschicken */
function popup_sendevent(eventid) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"sendevent.php?id="+eventid+sess,
  		"sendeventpopup",
		"width=400,height=360,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für eCard verschicken */
function popup_sendecard(picid) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"sendecard.php?id="+picid+sess,
  		"sendecardpopup",
		"width=400,height=360,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für statische Kneipenpics */
function popup_staticpic(kneipe,pic) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"showknpic.php?kneipe="+kneipe+"&pic="+pic+sess,
  		kneipe+"_"+pic,
		"width=700,height=600,left=50,top=50,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für KneipenADM */
function popup_kneipenadm(vote) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"kneipenadm.php?id="+vote+sess,
  		vote,
		"width=400,height=260,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für UBB-Help */
function popup_ubbhelp() {
	window.open(
		"ubbhelp.html",
  		"ubbhelp",
		"width=700,height=600,left=50,top=50,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für Profilbeschreibungen */
function popup_profiledetails(profileid) {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "&"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"profiledetails.php?id="+profileid+sess,
  		"profile"+profileid,
		"width=400,height=260,left=350,top=400,scrollbars=yes,menubar=no,resizable=yes"
	);
}

/* POPUP für Chat */
function popup_chat() {
	var sess = get_php_session();
	if ((typeof(sess) == "string") && (sess.length > 0)) {
		sess = "?"+sess;
	} else {
		var sess = "";
	}
	window.open(
		"chat.php"+sess,
  		"Chat",
		"width=600,height=450,left=100,top=100,scrollbars=yes,menubar=no,resizable=yes"
	);
}


