String.prototype.trim = function()
{
	return (this.replace(/^\s*|\s*$/g,""));
}
String.prototype.strlen = function()
{
	return (this.length);
}
Array.prototype.in_array = function(val)
{
	for(var i=0;i<this.length;i++)
	{
		if(this[i] == val)
			return true;
	}
	return false;
}

Array.prototype.Unique = function()
{
	var arr = new Array();
	for(var i=0;i<this.length;i++)
	{
		if(!arr.in_array(this[i]))
		{
			arr.push(this[i]);
		}
	}

	return arr;
}

Array.prototype.remove = function(val)
{
	for(var i=0;i<this.length;i++)
	{
		if(this[i] == val)
			this.splice(i,1);
	}

	return this;
}

//用户登录
function user_login()
{
	var geturl = '/doctor/login.html';
	var pars = 'user='+$('user').value+'&password='+$('password').value;
	var myAjax = new Ajax.Request(
							geturl,
							{method:'post',parameters:pars,onComplete:ShowLoginResult}
							);
}
function ShowLoginResult(originalRequest)
{
	var returnText = originalRequest.responseText;
	if(returnText == 1)
	{
		var txt ='<table width="100%" cellpadding="0" cellspacing="0" border="0" bgcolor="#A59B8F">';
		txt +='<tr>';
		txt +='<td bgcolor="#96846C" style="padding-left:8px;color:#FFF;font-weight:bold;height:22px">';
		txt +='<img src="/tpl/images/login_icon.gif" border="0" align="absmiddle" />';
		txt +='会员信息';
		txt +='</td>';
		txt +='</tr>';
		txt +='<tr><td height="5"></td></tr>';
		txt +='<tr><td>';
		txt +='医心网欢迎你:)';
		txt +='</td></tr>';
		txt +='<tr><td height="5"></td></tr>';
		txt +='<tr><td>';
		txt +='<a href="./modpassword.html" class="white">修改密码</a>&nbsp;';
		txt +='<a href="./modinfo.html" class="white">修改个人资料</a>';
		txt +='</td></tr>';
		txt +='<tr><td height="5"></td></tr>';
		txt +='<tr><td>';
		txt +='<a href="./logout.html"  class="white">注销</a>';
		txt +='</td></tr>';
		txt +='</table>';
		$('login').innerHTML = txt;
	}
	else
	{
		$('err').innerHTML = returnText;
	}
}
//用户注册
function user_register()
{
	document.location.href="/doctor/reg.html";
}