//经纪人信息js

//取出动态数据源基地址
var BASEPATH= G_TGPATH;
//动态刷新间隔已分钟为单位
var REFRESHTIME = 0;
//静态刷新间隔已小时为单位
var STREFRESHTIME = 0;

//标签
var CK_JJR_LABEL_USERS = "JJR_LABEL_USERS";
//用户所属标签
var CK_JJR_USER_LABELS = "JJR_USER_LABELS";

//权限定义
var G_Rights = [];
var G_Actions = [];
var G_groups = [];
var G_users = [];
var G_broker = {};

//初始化
var xmlHttp=null;
var userinfo=[];
var result=null;
var sqsid =null;//券商编号
var sbid = null;//经济人编号

//分配长期权限
function SetProcus(cid,procuids,procuidates){
	userinfo = getSysUser();
	result = null;
	sqsid = userinfo[2];
	sbid = userinfo[0];
	var url = null;
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	url = BASEPATH +"/inter/procus.do?qsid=" + sqsid.toLowerCase() + "&bid=" + sbid.toLowerCase() + "&cid=" + cid.toLowerCase() + "&pid=" + procuids.toLowerCase() + "&deli=" + procuidates.toLowerCase() + "&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			xmlHttp = null;
			return null;
		}        
	}	
	var data=xmlHttp.responseText;	
	try
	{
		result = eval('('+ data +')').scd;
	}
	catch (e)
	{
		url = null;
		xmlHttp = null;
		result = null;
	}
	try{
		return result;
	}finally{
		url = null;
		xmlHttp = null;
	}
}

//基本数据字典
function loadBaseData(){
	userinfo = getSysUser();
	result = null;
	sqsid = userinfo[2];
	var odata = client_data_load("MD:" + sqsid.toLowerCase(),"0");
	if (odata != null)
	{
		var now = new Date();
		var df=(now.getTime()-odata.TimeStamp.getTime())/3600/1000; 
		if (df < STREFRESHTIME)
		{
			try
			{
				result = eval('('+ odata.dValue +')');
			}
			catch (e)
			{
				odata = null;
				result = null;
			}
			return result;
		}
	}
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	var url = BASEPATH +"/inter/qursysset.do?qsid=" + sqsid.toLowerCase() + "&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		odata = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			odata = null;
			xmlHttp = null;
			return null;
		}
	}
	var data=xmlHttp.responseText;
	client_data_save("MD:" + sqsid.toLowerCase(),"1",data,"0");
	try
	{
		result = eval('('+ data +')'); 
	}
	catch (e)
	{
		result = null;
	}
	try{
		return result;
	}finally{
		data = null;
		url = null;
		odata = null;
		xmlHttp = null;
	}
}

//获取经纪人的用户的静态数据
function loadStaticData(){
	userinfo = getSysUser();
	result = null;
	sqsid = userinfo[2];
	scid = userinfo[0];
	var odata = client_data_load("MS:" + sqsid.toLowerCase() + ":" + scid.toLowerCase(),"0");
	if (odata != null)
	{
		var now = new Date();
		var df=(now.getTime()-odata.TimeStamp.getTime())/3600/1000; 
		if (df < STREFRESHTIME)
		{
			try
			{
				result = eval('('+ odata.dValue +')');
			}
			catch (e)
			{
				result = null;
			}
			odata = null;
			xmlHttp = null;
			return result;
		}
	}
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	
	var url = BASEPATH +"/file/subBroker.do?bid=" + scid.toLowerCase() + "&qsid="+ sqsid.toLowerCase() +"&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		odata = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			odata = null;
			xmlHttp = null;
			return null;
		}       
	}
	var data=xmlHttp.responseText;	
	client_data_save("MS:" + sqsid.toLowerCase() + ":" + scid.toLowerCase(),"1",data,"0");
	try
	{
		result = eval('('+ data +')'); 
	}
	catch (e)
	{
		result = null;
	}
	try{
		return result;
	}finally{
		data = null;
		url = null;
		odata = null;
		xmlHttp = null;
	}
}

//获取用户的经纪人列表
//type=1全部,2名字id
function loadData(type){
	userinfo = getSysUser();
	result = null;	
	sqsid = userinfo[2];
	scid = userinfo[0];
	var odata = client_data_load("MJ:" + type.toLowerCase() + ":" + sqsid.toLowerCase() + ":" + scid.toLowerCase(),"0");
	if (odata != null)
	{
		var now = new Date();
		var df=(now.getTime()-odata.TimeStamp.getTime())/60/1000; 
		if (df < REFRESHTIME)
		{
			try
			{
				result = eval('('+ odata.dValue +')');
			}
			catch (e)
			{
				result = null;
			}
			odata = null;
			xmlHttp = null;
			return result;
		}
	}
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	var url = BASEPATH +"/inter/qurbrokerlist.do?qsid=" + sqsid.toLowerCase() + "&cid=" + scid.toLowerCase() + "&type=" + type + "&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		odata = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			odata = null;
			xmlHttp = null;
			return null;
		}        
	}
	var data=xmlHttp.responseText;	
	client_data_save("MJ:" + type.toLowerCase() + ":" + sqsid.toLowerCase() + ":" + scid.toLowerCase(),"1",data,"0");
	try
	{
		result = eval('('+ data +')'); 
	}
	catch (e)
	{
		result = null;
	}
	try{
		return result;
	}finally{
		data = null;
		url = null;
		odata = null;
		xmlHttp = null;
	}
}

//获取经纪人权限列表
//type=3 //经纪人权限
function loadBrokerRight(type,Refreshflg){
	userinfo = getSysUser();
	result = null;	
	sqsid = userinfo[2];
	sbid = userinfo[0];
	var odata;
	if (Refreshflg == false)
	{
		odata = client_data_load("MR:" + type.toLowerCase() + ":" + sqsid.toLowerCase() + ":" + sbid.toLowerCase(),"0");
		if (odata != null)
		{
			var now = new Date();
			var df=(now.getTime()-odata.TimeStamp.getTime())/60/1000; 
			if (df < REFRESHTIME)
			{
				try
				{
					result = eval('('+ odata.dValue +')');
				}
				catch (e)
				{
					result = null;
				}
				odata = null;
				xmlHttp = null;
				return result;
			}
		}
	}
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	var url = BASEPATH +"/inter/qurbroker.do?qsid=" + sqsid.toLowerCase() + "&bid=" + sbid.toLowerCase() + "&type=" + type + "&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		odata = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			odata = null;
			xmlHttp = null;
			return null;
		}       
	}
	var data=xmlHttp.responseText;
	client_data_save("MR:" + type.toLowerCase() + ":" + sqsid.toLowerCase() + ":" + sbid.toLowerCase(),"1",data,"0");
	try
	{
		result = eval('('+ data +')'); 
	}
	catch (e)
	{
		result = null;
	} 
	try{
		return result;
	}finally{
		data = null;
		url = null;
		odata = null;
		xmlHttp = null;
	}
}

//获取用户详细信息
//type=3
function loadCustomerBase(type,Refreshflg){
	userinfo = getSysUser();
	result = null;	
	sqsid = userinfo[2];
	sbid = userinfo[0];
	var odata;
	if (Refreshflg == false)
	{
		odata = client_data_load("MK:" + type.toLowerCase() + ":" + sqsid.toLowerCase() + ":" + sbid.toLowerCase(),"0");
		if (odata != null)
		{
			var now = new Date();
			var df=(now.getTime()-odata.TimeStamp.getTime())/60/1000; 
			if (df < REFRESHTIME)
			{
				try
				{
					result = eval('('+ odata.dValue +')');
				}
				catch (e)
				{
					result = null;
				}
				odata = null;
				xmlHttp = null;
				return result;
			}
		}
	}
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	var url = BASEPATH +"/inter/qurcustomer.do?qsid=" + sqsid.toLowerCase() + "&cid=" + sbid.toLowerCase() + "&type=" + type + "&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		odata = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			odata = null;
			xmlHttp = null;
			return null;
		}       
	}
	var data=xmlHttp.responseText;
	client_data_save("MK:" + type.toLowerCase() + ":" + sqsid.toLowerCase() + ":" + sbid.toLowerCase(),"1",data,"0");
	try
	{
		result = eval('('+ data +')'); 
	}
	catch (e)
	{
		result = null;
	} 
	try{
		return result;
	}finally{
		data = null;
		url = null;
		odata = null;
		xmlHttp = null;
	}
}

//获取经纪人的用户列表
//type=1全部,2名字id,3盯盘
function loadCustomer(type,qsid,bid){
	result = null;
	sqsid = qsid;
	sbid = bid;
	if (qsid == null || qsid == "") //如果传入的券商ID不为空则认为直接从远程获取信息，跳过检查本地缓存
	{
		userinfo = getSysUser();
		sqsid = userinfo[2];
		sbid = userinfo[0];
		var odata = client_data_load("MC:" + type.toLowerCase() + ":" + sqsid.toLowerCase() + ":" + sbid.toLowerCase(),"0");
		if (odata != null)
		{
			var now = new Date();
			var df=(now.getTime()-odata.TimeStamp.getTime())/60/1000; 
			if (df < REFRESHTIME)
			{
				try
				{
					result = eval('('+ odata.dValue +')');
				}
				catch (e)
				{
					result = null;
				}
				odata = null;
				xmlHttp = null;
				return result;
			}
		}
	}
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	var url = BASEPATH +"/inter/qurcustomerlist.do?qsid=" + sqsid.toLowerCase() + "&bid=" + sbid.toLowerCase() + "&type=" + type.toLowerCase() + "&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		odata = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			odata = null;
			xmlHttp = null;
			return null;
		}     
	}
	var data=xmlHttp.responseText;
	if (qsid == null || qsid == "") //如果传入的券商ID不为空则认为直接从远程获取信息，跳过保存本地缓存
	{
		client_data_save("MC:" + type.toLowerCase() + ":" + sqsid.toLowerCase() + ":" + sbid.toLowerCase(),"1",data,"0");
	}
	try
	{
		result = eval('('+ data +')'); 
	}
	catch (e)
	{
		result = null;
	}
	try{
		return result;
	}finally{
		data = null;
		url = null;
		odata = null;
		xmlHttp = null;
	}
}

//获取用户的经纪人列表
//type=1取得经纪人信息,2取得经纪人信息包括其服务包,3取得经纪人服务包
function load_BrokerData(type)
{
	userinfo = getSysUser();
	result = null;
	sqsid = userinfo[2];
	sbid = userinfo[0];
	var odata = client_data_load("MB:" + type.toLowerCase() + ":" + sqsid.toLowerCase() + ":" + sbid.toLowerCase(),"0");
	if (odata != null)
	{
		var now = new Date();
		var df=(now.getTime()-odata.TimeStamp.getTime())/60/1000; 
		if (df < REFRESHTIME)
		{
			try
			{
				result = eval('('+ odata.dValue +')');
			}
			catch (e)
			{
				result = null;
			}
			odata = null;
			xmlHttp = null;
			return result;
		}
	}
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	var url = BASEPATH +"/inter/qurbrokerlist.do?qsid=" + sqsid.toLowerCase() + "&bid=" + sbid.toLowerCase() + "&type=" + type + "&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		odata = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			odata = null;
			xmlHttp = null;
			return null;
		}         
	}
	var data=xmlHttp.responseText;	
	client_data_save("MB:" + type.toLowerCase() + ":" + sqsid.toLowerCase() + ":" + scid.toLowerCase(),"1",data,"0");
	try
	{
		result = eval('('+ data +')'); 
	}
	catch (e)
	{
		result = null;
	}
	try{
		return result;
	}finally{
		data = null;
		url = null;
		odata = null;
		xmlHttp = null;
	}
}

//返回权限定义，静态数据
function load_Base()
{
	var BaseData = loadBaseData();
	G_Rights = {};
	if (BaseData == null)
	{
		return;
	}
	var i = 0;
	if (typeof(BaseData.p) == "object")
	{
		G_Rights = BaseData.p;
		for (var key in BaseData.p)
		{
			G_Rights[key].img = key + ".gif";
			i++;
		}
	}
	i = 0;
	G_Actions = [];
	for (var key in BaseData.a)
	{
		G_Actions[i] = {};
		G_Actions[i].id= key;
		G_Actions[i].name = BaseData.a[key].nm;
		i = i + 1;
	}
	i = null;
	BaseData = null;
}

//获取当前登录用户信息
function getSysUser()
{
	var obj = client_core_interface();
	var ret = f_client_call("G_SYS_UserName", "");
	try{
		return ret.split("\r\n");
	}finally{
		ret = null;
		obj = null;
	}
}

//返回经纪人JSON数据
function load_BrokerData(type)
{
	var G_Broker_All = {}; //所有经纪人信息	
	G_Broker_All = loadData(type);//读取json数据	
	return G_Broker_All;
}

//返回客户JSON数据
function load_CustomerData(type,qsid,bid)
{
	var Customer_All = {}; //所有经纪人信息	
	Customer_All = loadCustomer(type,qsid,bid);//读取json数据	
	try{
		return Customer_All;
	}finally{
		Customer_All = null;
	}
}

//返回经纪人权限数据
function load_AllBrokerRight(type,Refreshflg)
{
	G_broker = {}; //经纪人权限信息	
	G_broker = loadBrokerRight(type,Refreshflg);//读取json数据	
	return G_broker;
}
function padLeft(str,lenght)
{
	if(str.length >= lenght)
	{
		return str;
	}
	else
	{
		return padLeft("0" + str, lenght);
	}
}
function load_AllUsers()
{
	G_users = [];
	var users = load_CustomerData("4","","");
	var StaticData = loadStaticData();
	G_users = users;
			
	var user_groups = load_users_groups();
	for (var i=G_users.length-1; i >=0; i--)
	{
		if (typeof(StaticData[G_users[i].id]) != "undefined")
		{
			G_users[i].interactLvl = typeof(StaticData[G_users[i].id].interactLvl) != "undefined" ? StaticData[G_users[i].id].interactLvl : "0";
			if (typeof(StaticData[G_users[i].id].act) != "undefined")
			{
				G_users[i]["act"] = StaticData[G_users[i].id].act;
			}
			if (typeof(user_groups[G_users[i].id]) != "undefined")
			{
				G_users[i]["group"] = user_groups[G_users[i].id];
			}
		}
		else
		{
			G_users[i].interactLvl = "0";
		}

		var tmpqp = "";
		var reString = GetOrderList(G_users[i].nm);
		var tmp1 = reString.split("|");
		for(var jj = 0; jj < tmp1.length; jj++)
		{
			var tmp2 = tmp1[jj].split(",");
			tmpqp += padLeft(tmp2[1], 5);
		}			
		G_users[i].qp = tmpqp;
		
	}
	try{
		return G_users;
	}finally{
		user_groups = null;
		StaticData = null;
		users = null;
	}
}

function load_groups()
{
	G_groups = [];
	var odata = client_data_load(CK_JJR_LABEL_USERS,"0");
	if (odata != null)
	{
		try
		{
			G_groups = eval('('+ odata.dValue +')');
		}
		catch (e)
		{
			G_groups = [];
		}
	}
	try{
		return G_groups;
	}finally{
		odata = null;
	}
}

function load_users_groups()
{
	var result = {};
	var odata = client_data_load(CK_JJR_USER_LABELS,"0");
	if (odata != null)
	{
		try
		{
			result = eval('('+ odata.dValue +')');
		}
		catch (e)
		{
			result = {};
		}
	}
	try{
		return result;
	}finally{
		odata = null;
		result = null;
	}
}


function checkRightShort(cid,procuids){
	userinfo = getSysUser();
	result = null;
	sqsid = userinfo[2];
	sbid = userinfo[0];
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	var url = BASEPATH +"/inter/checksprdt.do?qsid=" + sqsid.toLowerCase() + "&bid=" + sbid.toLowerCase() + "&cid=" + cid.toLowerCase() + "&pid=" + procuids.toLowerCase() + "&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			xmlHttp = null;
			return null;
		}        
	}	
	var data=xmlHttp.responseText;	
	try
	{
		result = eval('('+ data +')').scd;
	}
	catch (e)
	{
		result = null;
	}
	try{
		return result;
	}finally{
		data = null;
		url = null;
		xmlHttp = null;
	}
}

function setRightShort(cid,procuids,seq){
	userinfo = getSysUser();
	result = null;
	sqsid = userinfo[2];
	sbid = userinfo[0];
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	var url = BASEPATH +"/inter/sprdtcus.do?qsid=" + sqsid.toLowerCase() + "&bid=" + sbid.toLowerCase() + "&cid=" + cid.toLowerCase() + "&pid=" + procuids.toLowerCase() + "&mid=" + seq.toLowerCase() + "&sc="+ sc +"&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			xmlHttp = null;
			return null;
		}        
	}	
	var data=xmlHttp.responseText;	
	try
	{
		result = eval('('+ data +')').scd;
	}
	catch (e)
	{
		result = null;
	}
	try{
		return result;
	}finally{
		data = null;
		url = null;
		xmlHttp = null;
	}
}


//分配试用权限
//参数：qsid:劵商ID,bid:经纪人ID; cid:客户ID1,客户ID2; pid:服务包ID1,服务包ID2;返回数据：
function SetTrialRight(cid,procuids){
	userinfo = getSysUser();
	result = null;
	sqsid = userinfo[2];
	sbid = userinfo[0];
	try{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");	   
	}catch (e){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	var url = BASEPATH +"/inter/trycus.do?qsid=" + sqsid.toLowerCase() + "&bid=" + sbid.toLowerCase() + "&cid=" + cid.toLowerCase() + "&pid=" + procuids.toLowerCase() + "&time="+new Date().getTime();
	xmlHttp.open("GET",url,false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	try
	{
		xmlHttp.send(null);
	}
	catch (e)
	{
		url = null;
		xmlHttp = null;
		return null;
	}
	if(xmlHttp.status!=200) 
	{ 
		xmlHttp.open("GET",url,false);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		try
		{
			xmlHttp.send(null);
		}
		catch (e)
		{
			url = null;
			xmlHttp = null;
			return null;
		}        
	}	
	var data=xmlHttp.responseText;	
	try
	{
		result = eval('('+ data +')').scd;
	}
	catch (e)
	{
		result = null;
	}
	try{
		return result;
	}finally{
		data = null;
		url = null;
		xmlHttp = null;
	}
}