function Logout()
{
	if(confirm("您确认现在就退出系统？"))
	{
		location.href=_URL_+"/admin/logout/";
	}
}

function CancelBack()
{
	if(confirm("您确认放弃保存本次操作？"))
	{
		history.go(-1);
	}
}

function Cancel()
{
	history.go(-1);
}

function ResetData(objid)
{
	document.getElementById(objid).reset();
}

function Handle()
{
	alert("操作成功");
	history.go(-1);
}

function loadByPagesize(s)
{
	url = window.location.href;
	url = url.replace(/\/pagesize\/\d+\/{0,1}/,"");
	location=url+'/pagesize/'+s.options[s.selectedIndex].value+'/';
}

function dotb(title, url)
{
	$(document).ready(function(){ tb_show(title, url, null); });
}

function doth(wd,type,uid,uname,act)
{
	$.ajax({
		type: "POST",
		url:  "/user/doing/action/save",
		data: "uid="+uid+"&type="+type+"&act="+act,
		success: function(msg){
			if (msg=='succeed')
			{
				alert(wd+uname+act+"成功！");
			}
			else if(msg=='nofixreg')
			{
				alert("请填写基本资料完成注册！");
				location.href="/user/regbasic/";
			}
			else
			{
				alert(msg);
				if(msg=='对不起，请您先登陆后才能继续')
				{
					location.href="/user/login/";
				}
			}
		}
	});
}
function imgv(url)
{
	$("#imgview").attr("src","/uploads/max_img/"+url);
}

var flag=false;
function DrawImage(ImgD,width,height){
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
		flag=true;
		if(image.width/image.height>= width/height){
			if(image.width>width){
				ImgD.width=width;
				ImgD.height=(image.height*width)/image.width;
			}else{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
			ImgD.alt="点击查看详细信息...";
		}
		else{
			if(image.height>height){
				ImgD.height=height;
				ImgD.width=(image.width*height)/image.height;
			}else{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
			ImgD.alt="点击查看详细信息...";
		}
	}
}

function express(type)
{
	if ($("#tname").val()== '')
	{
		alert("请输入您的姓名！");
		return false;
	}
	if ($("#age").val()== '')
	{
		alert("请输入您的年龄！");
		return false;
	}
	if ($("#tel").val()== '')
	{
		alert("请输入您的电话！");
		return false;
	}
	$.ajax({
		type: "POST",
		url:  "/user/login/action/express",
		data: "truename="+$("#tname").val()+"&age="+$("#age").val()+"&gender="+$("input[@name=sex][@checked]").val()+"&tel="+$("#tel").val()+"&classid="+$("#cateid").val()+"&type="+type,
		success: function(msg){
			if (msg=='succeed')
			{
				alert("我们将有专业人员联系您!");
				$("#tname").val("");
				$("#age").val("");
				$("#tel").val("");
			}
			else
			{
				alert("未知错误");
			}
		}
	});
}

function upgrade()
{
	if(confirm("您确认升级成为高级会员吗？"))
	{
		$.ajax({
			type: "POST",
			url:  "/user/login/action/express",
			data: "type=upgrade",
			success: function(msg){
				if (msg=='succeed')
				{
					alert("我们将有专业人员联系您!");
				}
				else if(msg=='nofixreg')
				{
					alert("请填写基本资料完成注册！");
					location.href="/user/regbasic/";
				}
				else
				{
					alert(msg);
				}
			}
		});
	}
}

function authrequ()
{
	if(confirm("您确认要提交诚信验证吗？"))
	{
		$.ajax({
			type: "POST",
			url:  "/user/login/action/express",
			data: "type=auth",
			success: function(msg){
				if (msg=='succeed')
				{
					alert("我们将有专业人员联系您!");
				}
				else if(msg=='nofixreg')
				{
					alert("请填写基本资料完成注册！");
					location.href="/user/regbasic/";
				}
				else
				{
					alert(msg);
				}
			}
		});
	}
}


