function doSuccess(action){
  Ext.MessageBox.show({
    title: '成功'
    ,msg: action.result.message
    ,buttons: Ext.MessageBox.OK
    ,icon: Ext.MessageBox.INFO
    });
}

function doServerFailure4UploadForm(action){
	var str=action.response.responseText;
	str=str.replace(/<[^<]*>/g, "", str);
	var tempobj;
	try{
		tempobj=Ext.decode(str);
	}catch(e){
    Ext.MessageBox.show({
      title: '错误',
      width: 600,
      msg: action.response.responseText,
      buttons: Ext.MessageBox.OK,
      icon: Ext.MessageBox.ERROR
    });
		return;
	}
	if (tempobj.message.indexOf("session不存在,请先登录") > -1) {
	  hyzxLogin();
	}else{
    Ext.MessageBox.show({
      title: '错误',
      width: 400,
      msg: tempobj.message,
      buttons: Ext.MessageBox.OK,
      icon: Ext.MessageBox.ERROR
    });
	}
}

function doServerFailure(action){
	if (action.response.status!=200){
		Ext.MessageBox.show({
      title: '错误'
      ,width:600
      ,msg: '请与网站管理员联系，错误代码  '+action.response.status+'  !<br/>'+action.response.statusText
      ,buttons: Ext.MessageBox.OK
      ,icon: Ext.MessageBox.ERROR
    });
	}
}

function doClientFailure(action){
  var errobj,msg;
	if (action.response.status == 200) {
		var errobj = action.result;
		var msg = errobj.message;
		if (msg.indexOf("session不存在,请先登录") > -1){ 
			hyzxLogin();
	  }else{
		  Ext.MessageBox.show({
			  title: '错误',
			  width: 400,
			  msg: msg,
			  buttons: Ext.MessageBox.OK,
			  icon: Ext.MessageBox.ERROR
		  });
	  }
  }
}

function doProxyFailure(proxy, store, response, e){
  if (response.status != 200) {
		Ext.Msg.show({
			title: '错误代码：' + response.status
			,width: 400
			,msg: response.responseText||response.statusText
			,buttons: Ext.MessageBox.OK
			,icon: Ext.MessageBox.ERROR
		});
	}
	else 
	{
		var result = Ext.util.JSON.decode(response.responseText);
		if(result.message)
		{
		    if (result.message.indexOf("session不存在,请先登录") > -1)
		    {
				hyzxLogin();
			}
			else
			{
				Ext.MessageBox.show
				({
					title: '错误',
					width: 400,
					msg: result.message,
					buttons: Ext.Msg.OK,
					icon: Ext.MessageBox.ERROR
				});
			}
		}
	}
}


function doAjaxFailure(response){
  if (response.status != 200) {
    Ext.Msg.show({
      title: '错误代码：' + response.status
      ,width: 400
      ,msg: response.responseText||response.statusText
      ,buttons: Ext.MessageBox.OK
      ,icon: Ext.MessageBox.ERROR
    });
  }
  else {
    var result = Ext.util.JSON.decode(response.responseText);
    if(!result.success){
    	if(result.message)
		{
	      if (result.message.indexOf("session不存在,请先登录") > -1) {
					hyzxLogin();
				}
				else {
					Ext.MessageBox.show({
						title: '错误',
						width: 400,
						msg: result.message,
						buttons: Ext.Msg.OK,
						icon: Ext.MessageBox.ERROR
					});
				}
		}
	}
  }
}

function showError(info){
	Ext.Msg.show({
    title:'错误'
    ,width:300
		,msg:info
		,buttons: Ext.Msg.OK
		,icon: Ext.MessageBox.ERROR
  }); 
}

function showInfo(title,info){
  Ext.Msg.show({
    title:title
		,width:300
    ,msg:info
    ,buttons: Ext.Msg.OK
    ,icon: Ext.MessageBox.INFO
  }); 
}

function ajaxSF(response){
	var result = Ext.util.JSON.decode(response.responseText);
    if(!result.success)
    {
    	if(result.message)
		{
	      if (result.message.indexOf("session不存在,请先登录") > -1) {
		  	hyzxLogin();
		  }
		  else {
			Ext.MessageBox.show({
				title: '错误',
				width: 400,
				msg: result.message,
				buttons: Ext.Msg.OK,
				icon: Ext.MessageBox.ERROR
			});
		  }
		}
	}
	return result.success;
}

