function ModifyPassword()
{
    if (_isLocked)
    {
        Alert(_lang_locked);
        return false;
    }

	if ($.trim(this.Password.value) == "")
	{
		Alert(_lang_password_incorrect, function(){this.Password.select();}, this);
		return false;
	}
	
	$(":submit")[0].disabled = true;
	SetStatusMessage(_lang_working);

	$.ajax(
	{
		url : _webPath + "ilghar.aspx?Object=Member&Operation=Modify&ID=" + _id,
		data : "Password=" + encodeURIComponent(this.Password.value),
		type : "POST",
		error : function(request)
		{
			Alert(_lang_operation_fail);
	        $(":submit")[0].disabled = false;
	        SetStatusMessage();
		},
		success : function(data)
		{
			Alert(_lang_operation_success);
			$(":submit")[0].disabled = false;
	        SetStatusMessage();
		}
	});
	return false;
}

function ModifyMaterial()
{
    if (_isLocked)
    {
        Alert(_lang_locked);
        return false;
    }

	var data = "RealName=" + encodeURIComponent(this.RealName.value);
	data += "&Birthday=" + this.Birthday.value;
	data += "&Phone=" + encodeURIComponent(this.Phone.value);
	data += "&Mobile=" + encodeURIComponent(this.Mobile.value);
	data += "&Address=" + encodeURIComponent(this.Address.value);
	data += "&Zip=" + encodeURIComponent(this.Zip.value);
	data += "&Homepage=" + encodeURIComponent(this.Homepage.value);
	data += "&QQ=" + encodeURIComponent(this.QQ.value);
	data += "&SexID=" + this.SexID.value;
	data += "&RegionID=" + this.RegionID.value;
	data += "&IndustryID=" + this.IndustryID.value;
	
	$(":submit")[0].disabled = true;
	SetStatusMessage(_lang_working);

	$.ajax(
	{
		url : _webPath + "ilghar.aspx?Object=Member&Operation=Modify&ID=" + _id,
		data : data,
		type : "POST",
		error : function(request)
		{
			Alert(_lang_operation_fail);
			$(":submit")[0].disabled = false;
	        SetStatusMessage();
		},
		success : function(data)
		{
			Alert(_lang_operation_success);
			$(":submit")[0].disabled = false;
	        SetStatusMessage();
		}
	});
	return false;
}

function Init()
{
	if (typeof (_page) == "undefined")
		return;
	
	if (_page == "password")
	{
		$("form").submit(ModifyPassword);
	}
	else if (_page == "material")
	{
		var birthday = $("[name=Birthday]");
		birthday.val(birthday.val().replace(/\s.*/, ""))
		birthday.focus(function(){new DatePicker(this);});
		$("form").submit(ModifyMaterial);
	}
}
Init(true);