function backup()
{
	$('#backupresult p').html("");
	$("#backupresult img").fadeIn();
	$('#backupresult').slideDown('fast');
	$.post("execute.php?ac=backupFor",{'username':$('#id').attr("value"),'password':$('#password').attr('value')},backupresult);
	return false;
}
function backupresult(code)
{
	if(code=="true")
		$text = $('#id').attr('value')+" sucessful backuped";
	else
		$text = "Error occured. We are sorry for the inconvinient";
	$('#backupresult p').html($text);
	$('#backupresult img').hide();
}
function recover()
{
	$('#backupresult p').html("");
	$("#backupresult img").fadeIn();
	$('#backupresult').slideDown('fast');
	$.post("execute.php?ac=backupRecover",{'username':$('#id').attr("value"),'password':$('#password').attr('value')},recoverResult);
	return false;
}
function recoverResult(code)
{
	if(code=="false")
		$text = "Error occured. We are sorry for the inconvinient";
	else
	{
		$files = code.split('|');
		$text = "Here's your backup: <a href=\"/"+$files[0]+"\" alt=\"ym list\">Messenger List</a> and <a href=\"/"+$files[1]+"\" alt=\"ym list\">Address Book</a>";
	}
	$("#backupresult img").hide();
	$("#backupresult p").html($text);
}

$(document).ready(function()
{
	$('#backupform').bind('submit',function(){return false;});
	$("#backupsubmit").bind('click',backup);
	$("#recoversubmit").bind('click',recover);
});