function showSimpleOkBox(boxtext){
	$.post("/box/simpleokbox/", {
		'boxtext':	boxtext
		},
		function(data) {
			$("#boxlayer").html(data);
			openLayer('simpleokbox');
		}
	);	
}

function showSimpleOkBoxWithLink(boxtext,link){
	$.post("/box/simpleokboxwithlink/", {
		'boxtext':	boxtext,
		'link': link
		},
		function(data) {
			$("#boxlayer").html(data);
			openLayer('simpleokboxwithlink');
		}
	);	
}

function removeGroup(groupid) {
	$.post("/box/removegroup/", {
		'groupid':	groupid
		},
		function(data) {
			$("#boxlayer").html(data);
			openLayer('removegroup');
		}
	);
}

function quitFromGroup(groupid) {
	$.post("/box/quitfromgroup/", {
		'groupid':	groupid
		},
		function(data) {
			$("#boxlayer").html(data);
			openLayer('quitfromgroup');
		}
	);
}

function denyInvite(groupid) {
	$.post("/box/deny/", {
		'groupid':	groupid
		},
		function(data) {
			$("#boxlayer").html(data);
			openLayer('deny');
		}
	);
}

function removeProfile(){
	$.get("/box/removeprofile/", {
		},
		function(data) {
			$("#boxlayer").html(data);
			openLayer('removeprofile');
		}
	);
}

function removeUserFromGroup(userid, groupid){
	$.post("/box/removefromgroup/", {
		'userid':	userid,
		'groupid':	groupid
		},
		function(data) {
			$("#boxlayer").html(data);
			openLayer("removefromgroup");
		}
	);
}

function continueJoin(type, groupid, userid, joinrule){

	if(type == "moderated"){
		joinmessage = $("textarea#joinmessage").val();
	}else{
		joinmessage = "";
	}

	$.post("/groups/join/", {
		'groupid': groupid,
		'userid': userid,
		'joinrule': joinrule,
		'joinmessage': joinmessage,
		'ajaxpost': 1
	},
		function(data) {
			$("div#firstbuttons").css("display", "none");
			if(type == "moderated"){
				$("div#moderated").css("display", "none");
				$("div#moderated_success").css("display", "");
			}else{
				$("div#open").css("display", "none");
				$("div#open_success").css("display", "");
			}

		}
	);

}

function joinGroupLoggedin(groupid){
	$.post("/box/joinbox/", {
			'groupid':	groupid
		},
		function(data) {
			$("#boxlayer").html(data);
			openLayer('joinlayer');
		}
	);
}

function joinGroupNotLoggedin(){
	$.get("/box/joinboxnotloggedin/", {
		},
		function(data) {
			$("#boxlayer").html(data);
			openLayer('joinlayer_notloggedin');
		}
	);
}
