
function stlLoginCallback(successCallback, failureCallback, successArgument, failureArgument){
	
	var url = stl_url_ss + '/PageService.aspx?type=IsLogin';
	
	new Ajax.Request(url, {
	  method: 'get',
	  onSuccess: function(x) {
		var result = stlGetNodeText(x.responseXML.documentElement);
		if (result == 'true')
		{
			try{
				if (successCallback){
					eval(successCallback + "(" + successArgument + ")");
				}
			}
			catch(e){}
		}
		else
		{
			try{
				if (failureCallback){
					eval(failureCallback + "(" + failureArgument + ")");
				}
			}
			catch(e){}
		}
	  }
	});

}


function stlOpenLoginWindow(successCallback, successArgument){

	var windowUrl = stl_url_ss + '/login/loginFrame.aspx?successCallback=' + successCallback + '&successArgument=' + successArgument;
	stlOpenWindow(windowUrl, 373, 279);

}


function stlOpenSendMailWindow(charset, pageTitle){

	var windowUrl = stl_url_ss + '/mail/default.aspx?publishmentSystemID=' + stl_site_id + '&pageUrl=' + location.href + '&charset=' + charset + '&pageTitle=' + pageTitle;
	stlOpenWindow(windowUrl, 520, 180);

}


function stlCommentFirstLogin(redirectUrl){
	setTimeout("JSONscriptQuery('"+url+"');", 1);
}


//检查是否登陆

function check_is_login(){

	try {

		var usrname = getCookie('usrname');

		if (usrname == "") {

			global_login_frm_show(this,true,window.location.href,1);

			return false;

		}

		else{

			return true;

		}

	} catch (e) {}

}

var login_success_callback_function = '';

//需要回调的登陆

function check_is_login_callback(){

	var ref_flag = 1;

	if(arguments.length==1){

		login_success_callback_function = arguments[0];

		ref_flag = 0;

	}

	try {

		var usrname = getCookie('usrname');

		if (usrname == "") {

			

			global_login_frm_show(this,true,window.location.href,ref_flag);

			return false;

		}

		else{

			if(arguments.length>=1){

				login_success_eval_callback(1);

			}

			else{

				return true;

			}

		}

	} catch (e) {}

}



//执行登陆的回调的回调

function login_success_eval_callback(flag){

	if(typeof(login_success_callback_function)!='undefined'){

		if(typeof(login_success_callback_function)=='function'){

			login_success_callback_function(flag);

		}

		else if(typeof(login_success_callback_function)=='string'){

			try{

				eval(login_success_callback_function);

			}

			catch(e){}

		}

	}

	login_success_callback_function = '';

}



//登陆过后的回调

function login_success_callback(json){

	update_user_status();

	login_success_eval_callback(0);//执行回调的回调

}