
var XMember = function(wwwroot, cid, uid, sub_id)  {
  this.wwwroot = wwwroot;
  this.cid = cid;
  this.uid = uid;
  this.sub_id = sub_id;
};

XMember.prototype.showCommunityMemberProfileFirstTime = function(user_id, did, selection, unselect)  {
  document.getElementById(unselect).className = "";
  var geturl = this.wwwroot + '/member/showcommunityuserprofile?community_id=' + this.cid + '&user_id=' + user_id + '&sub_id=' + this.sub_id;
  var ret = getUrlResponseAndFillDiv(geturl, did, makeSelected, selection);
}; 

XMember.prototype.showCommunityMemberProfile = function(user_id, did)  {
  var geturl = this.wwwroot + '/member/showcommunityuserprofile?community_id=' + this.cid + '&user_id=' + user_id+ '&sub_id=' + this.sub_id;
  var ret = getUrlResponseAndFillDiv(geturl, did);
};

XMember.prototype.showFirstMemberList = function()  {
 
  var geturl = this.wwwroot + '/member/searchcommunitymemberdirectorybyrole?community_id='  + this.cid +  '&role=member&sub_id=' + this.sub_id;
  var ret = getUrlResponseAndFillDiv(geturl, 'communityMemberDirectoryContent'); 
  //document.getElementById('member').className ="selected"; 
};

XMember.prototype.showMemberDirectory = function(did, selection, unselect)  {
  document.getElementById(selection).className = "selected";
  document.getElementById(unselect).className = "";
  var geturl = this.wwwroot + '/member/showcommunitymemberdirectory?community_id=' + this.cid + '&user_id=' + this.uid + '&sub_id=' + this.sub_id;
  var params = new Array();
  params[0] = this.cid;
  params[1] = "member";
  params[2] = this.wwwroot;
  params[3] = this.sub_id;
  var ret = getUrlResponseAndFillDiv(geturl, did);
   
  return true;
  
};

function editCommunityMemberProfile (did, wwwroot, cid, uid, sub_id)  {
  var geturl = wwwroot + '/member/editcommunityuserprofile?community_id=' + cid + '&user_id=' + uid + '&sub_id=' + sub_id;
  //var ret = getUrlResponseAndFillDiv(geturl, did);
  $.ajax({
		type: "GET",
		url: geturl,
		success: function(msg){
			document.getElementById('first_block_ajax').innerHTML = msg;
		}
});
}

function makeSelected(xmlHttpRequest, did)  {
  document.getElementById(did).className ="selected";
}
XMember.prototype.xg_sortCommunityMembersByAlphabet = function(did, alphabet)  {
  var geturl = this.wwwroot + '/member/searchCommunityMemberDirectoryByAlphabet?community_id=' + this.cid + '&alphabet=' + alphabet + '&sub_id=' + this.sub_id;
  var ret = getUrlResponseAndFillDiv(geturl, did, makeSelected, alphabet);
};

XMember.prototype.xg_sortCommunityMembersByRole = function(did, role)  {
  var geturl = this.wwwroot + '/member/searchcommunitymemberdirectorybyrole?community_id=' + this.cid + '&role=' + role + '&sub_id=' + this.sub_id;
  var ret = getUrlResponseAndFillDiv(geturl, did, makeSelected, role);
};