function getJQData(data){
	if (!data){
		showNotice('system error!!!');
		return false;
	}
	var resp;
	eval("resp = " + data);
	if (!resp){
		showNotice('system error!!!');
		return false;
	}
	return resp;
}

function showFTPForm(){
	//$("#ftp_form").show();
	$("#ftp_form").toggle();
}

function giveRights(){
	server = encodeURIComponent($("input[name=server]").val());
	user = encodeURIComponent($("input[name=user]").val());
	password = encodeURIComponent($("input[name=password]").val());
	$('#ftp_res').html('<div align="center"><img src="../templates/pilot_3_theme/images/ajax-loader.gif"></div>');
	str = "server="+server+"&user="+user+"&password="+password;
	$.post("index.php?sel=give_rights", str, function(data){
		data = getJQData(data);
		$("#ftp_res").html(data["msg"]);
		if (data["success"]=='1'){
			$("#permissions").html(data["ret_str"]);
			if (data["next_step"]=='1'){
				$("#results").html($("#success_source").html());
			}
		}
	})
}