viewEdit = function (info, idcontainer, value, text) {
	$.post(
		HOST_HAT + "ajax/viewedit",
		{pinfo: info, pvalue: value, ptext: text},
		function (html) {
			$("#" + idcontainer).html(html);
		}
	)
}
saveEdit = function (info, idcontainer, value, text) {
	if (info == 'intro') {
		$('#txtIntro').val(stripTags($('#txtIntro').val(), ''));
		var intro = $('#txtIntro').val();
		if (intro == '') {
			$('#ErrorMessageIntro').html(com_msg_requiredintroduce);
			$('#ErrorMessageIntro').css('display', 'block');
			return false;
		} else if (intro.length < 30 || intro.length > 500) {
			$('#ErrorMessageIntro').html(com_msg_invalidintroduce);
			$('#ErrorMessageIntro').css('display', 'block');
			return false;
		}
	}
	if (info == 'age') {
		var py = $('#cbYear').val();
		var pm = $('#cbMonth').val();
		var pd = $('#cbDay').val();		
		if (py=='') {
			alert(vhome_msg_requiredyear);
			return false;
		}
		if (pm=='') {
			pm = '00';			
		}
		if (pd=='') {
			pd = '00';			
		}		
		var value = py+'/'+pm+'/'+pd;
	}
	$.post(
		HOST_HAT + "ajax/saveedit",
		{pinfo: info, pvalue: value, ptext: text},
		function (html) {
			$("#"+idcontainer).html(html);
		}
	)
}
addWish = function() {
	$('#txtWish').val(stripTags($('#txtWish').val(), ''));
	var strWish = $('#txtWish').val();
	if(strWish == ''){
		$('#ErrorMessageWish').html(com_msg_requiredcontent);
		$('#ErrorMessageWish').css('display', 'block');
		return false;
	} else {
		$.post(HOST_HAT + "ajax/saveedit",{pinfo:'wish', pvalue:strWish},function (html){$("#divListDream").html(html);});
		$('#txtWish').val('');
		$('#ErrorMessageWish').html('');
		$('#ErrorMessageWish').css('display', 'none');
	}
}
showboxgift = function(offset) {
	$.get(HOST_HAT+'ajax/boxgift?username='+username+'&offset='+offset, function(html){$("#spanGift").html(html);});
}
deletegift = function(id, offset) {
	if (confirm(com_msg_confirmdelete)) {
		$.post(HOST_HAT + 'ajax/deletegift?username='+username + '&ofsset='+offset,{id:id}, function(html){$("#spanGift").html(html);});
	}
}
$(document).ready(function() {
	showboxgift(0);
});

