function SAuth() {
    var obj = this;
	obj.num = 1;

    obj.auth = function(network) {
        obj.wnd = window.open('/sauth/'+network,'sauth_popup','width=680,height=500,scrollbars=no');
    }

    obj.complete = function(access_token,user_id,user_name,socail) {
		if (obj.num > 1) {
			document.getElementById(obj.flashid).sAuthComplete1(access_token,user_id,user_name,socail);
		}
		if (obj.num > 2) {
			document.getElementById(obj.flashid).sAuthComplete2(access_token,user_id,user_name,socail);
		}
        obj.wnd.close();
    }

    obj.setFlashId = function(flashid) {
        obj.flashid = flashid;
    }

    obj.getNum = function() {
		var res = obj.num;
		obj.num++;
		return res;
    }
	
    return obj;
}

sAuth = SAuth();
