var GROUP_COUNT=20;var gSelectedArray=new Array();var ArrayRecruitsSelected=new Array();var SELECTED_NAMES='';var SELECTED_IDS='';var loadingPic;var noLoadPic;if(document.images){loadingPic=new Image(64,15);loadingPic.src='/images/misc/loading.gif';noLoadPic=new Image(64,15);noLoadPic.src='/images/spacer.gif';}function Group_HidePopUp(){document.getElementById('divGroupHeaderPopup').style.display='none';}function Group_LoadReportGroupForm(divId,groupId){var objWindows=document.getElementById(divId);var url="/group/reportgroup.aspx?gid="+groupId;ToggleImage('idLoadingImg',loadingPic);ShowDivById(divId);ShowDivById('divGroupHeaderLoading');AjaxCall(url,Group_UpdateGroupReportForm);}function Group_UpdateGroupReportForm(){if(req.readyState==4){updateAjaxControl('divGroupHeaderPopup','There was an error loading the report group form.<br><br>Please try again later.');ShowDivById('divGroupHeaderPopup');HideDivById('divGroupHeaderLoading');ToggleImage('idLoadingImg',noLoadPic)}}function Group_SendReportGroup(groupId){if(document.getElementById('cbOther').checked&&document.getElementById('txtReportInfo').value.length<=0){alert('If you are reporting a other issue, you must provide additional information in the textarea provided.');return;}ShowDivById('divGroupHeaderLoading');var url='gid='+groupId;if(document.getElementById('cbOther').checked)url+='&o=1';if(document.getElementById('cbReportHate').checked)url+='&r=1';if(document.getElementById('cbReportPorn').checked)url+='&p=1';url+='&t='+escape(document.getElementById('txtReportInfo').value.substr(0,1000));AjaxPostCall("/group/addReportGroup.ashx",url,updateAjaxResponse);HideDivById('divGroupHeaderPopup');HideDivById('divGroupHeaderLoading');}function Group_LoadSelectUserVids(divId,groupId,pageId,videoAlbum){var objWindows=document.getElementById(divId);var url="/group/selectUserVideos.ashx?mv="+videoAlbum+"&p="+pageId+"&g="+groupId;ToggleImage('idLoadingImg',loadingPic);ShowDivById(divId);ShowDivById('divGroupHeaderLoading');AjaxCall(url,Group_UpdateGroupVids);}function Group_UpdateGroupVids(){if(req.readyState==4){updateAjaxControl('divGroupHeaderPopup','There was an error loading your videos.<br><br>Please try again later.');ShowDivById('divGroupHeaderPopup');HideDivById('divGroupHeaderLoading');ToggleImage('idLoadingImg',noLoadPic)}}function Group_AddVideos(idGroup,rootElement,objectCount){var selectedIds=Group_GetIds(rootElement,objectCount);var url="/group/AddVideos.ashx";var qs="?gid="+idGroup;qs+="&mids="+selectedIds;window.location.href=url+qs;}function Group_UpdateVidsList(ignore,groupId,pageSize,view,colCount,pageId){var url="/group/UpdateVideos.aspx?grp="+groupId+"&p="+pageId+"&size="+pageSize+"&view="+view+"&cols="+colCount;AjaxCall(url,Group_UpdateVidsListDiv);}function Group_UpdateVideoSelection(){var obj;var objName='';var rootElement='idGroup';var indexCounter=0;var userIds='';var userNames='';for(indexCounter;indexCounter<GROUP_COUNT;indexCounter++){objName=rootElement+String(indexCounter);obj=document.getElementById(objName);if(obj!=undefined){if(gSelectedArray[obj.name]!=undefined){obj.checked=true;}}}}function Group_UpdateVidsListDiv(){if(req.readyState==4){updateAjaxControl('divGroupVids','Failed to update videos.');}}function Group_UpdateAddVideos(){if(req.readyState==4){updateAjaxControl('divGroupHeaderPopup','Failed to add videos.');}}function Group_DeleteVideo(uid,gid,mid,divId,divLoadingId){if(confirm('Are you sure that you want to remove this video from the group?')){currProfileControlId=divId;currProfileSectionStr="<b><font color=red>Removed</font></b>";ShowDivById(divLoadingId);var qs="uid="+uid+"&gid="+gid+"&mid="+mid;AjaxPostCall("/group/removevideo.ashx",qs,updateProfileSection);HideDivById(divLoadingId);}}function Group_LoadSelectUserPhotos(divId,groupId,pageId){ToggleImage('idLoadingImg',loadingPic);ShowDivById(divId);ShowDivById('divGroupHeaderLoading');var url="/group/selectUserPhotos.ashx?p="+pageId+"&g="+groupId;AjaxCall(url,Group_UpdateGroupPhotos);}function Group_UpdateGroupPhotos(){if(req.readyState==4){updateAjaxControl('divGroupHeaderPopup','There was an error loading your photos.<br><br>Please try again later.');ShowDivById('divGroupHeaderPopup');HideDivById('divGroupHeaderLoading');ToggleImage('idLoadingImg',noLoadPic)}}function Group_AddPhotos(idGroup,rootElement,objectCount){var selectedIds=Group_GetIds(rootElement,objectCount);var url="/group/AddPhotos.ashx";var qs="?gid="+idGroup;qs+="&pids="+selectedIds;window.location.href=url+qs;}function Group_UpdatePicsList(ignore,groupId,pageSize,view,colCount,pageId){var url="/group/UpdatePhotos.aspx?grp="+groupId+"&p="+pageId+"&size="+pageSize+"&view="+view+"&cols="+colCount;AjaxCall(url,Group_UpdatePicsListDiv);}function Group_UpdatePicsListDiv(){if(req.readyState==4){updateAjaxControl('divGroupPics','');}}function Group_UpdateAddPhotos(){if(req.readyState==4){updateAjaxControl('divGroupHeaderPopup','Failed to add photos.');}}function Group_DeletePhoto(uid,gid,pid,divId,divLoadingId){if(confirm('Are you sure that you want to remove this photo from the group?')){currProfileControlId=divId;currProfileSectionStr="<b><font color=red>Removed</font></b>";ShowDivById(divLoadingId);var qs="uid="+uid+"&gid="+gid+"&pid="+pid;AjaxPostCall("/group/removephoto.ashx",qs,updateProfileSection);HideDivById(divLoadingId);}}function Group_SetChannelPhoto(uid,gid,pid,divId,divLoadingId){if(confirm('Are you sure that you want to make this your group icon?')){currProfileControlId=divId;currProfileSectionStr="<b><font color=red>Success</font></b>";ShowDivById(divLoadingId);var qs="uid="+uid+"&gid="+gid+"&pid="+pid;AjaxPostCall("/group/usephotoicon.ashx",qs,updateProfileSection);HideDivById(divLoadingId);}}function Group_JoinGroup(divId,groupId){ToggleImage('VCLoadingImage',loadingPic);ShowDivById(divId);var url="/group/joinGroup.ashx?g="+groupId;AjaxCall(url,Group_UpgradeJoinGroup);}function Group_UpgradeJoinGroup(){if(req.readyState==4){updateAjaxControl('divGroupHeaderPopup','There was an error loading the requested videos.<br><br>Please try again later.');ShowDivById('divGroupHeaderPopup');HideDivById('divVCLoad');ToggleImage('VCLoadingImage',noLoadPic)}}function Group_LeaveGroup(divId,groupId){ToggleImage('VCLoadingImage',loadingPic);ShowDivById(divId);ShowDivById('divVCLoad');var url="/group/leaveGroup.ashx?g="+groupId;AjaxCall(url,Group_UpdateLeaveGroup);}function Group_UpdateLeaveGroup(){if(req.readyState==4){updateAjaxControl('divVideosCanvas','There was an error loading the requested videos.<br><br>Please try again later.');ShowDivById('divVideosCanvas');HideDivById('divVCLoad');ToggleImage('VCLoadingImage',noLoadPic)}}function Group_SwitchUserRecruitImage(divIdToReplace,username,userimage){var objReplace=document.getElementById(divIdToReplace);var newHtml=userimage;newHtml+="&nbsp;&nbsp;&nbsp;<span class=pagetitle>";newHtml+=username;newHtml+="</span>";objReplace.innerHTML=newHtml;}function Group_RecruitOutsideNow(gid){if(document.getElementById('idTextEmail').value.length>5){if(document.getElementById('txtFriend1').value.length>5){ShowDivById('divRecruitOutsideLoading');ShowDivById('divEmail');currProfileControlId='divAjaxResponse';currProfileSectionStr="<br /><b>Email sent out successfully</b><br />";var addresses="";var url="sn="+escape(document.getElementById('idTextName').value);url+="&se="+escape(document.getElementById('idTextEmail').value);if(document.getElementById('idTxtAreaFriends').value.length==0){addresses=GetFriendsFromList();}else{addresses=document.getElementById('idTxtAreaFriends').value;}url+="&re="+escape(addresses);url+="&msg="+escape(document.getElementById('idtxtMessage').value);url+="&gid="+gid;if(document.getElementById('idChkCopy').checked==true){url+="&cpy=1";}else{url+="&cpy=0";}AjaxPostCall("/group/recruitOutside.ashx",url,updateAjaxResponse);HideDivById('divRecruitOutsideLoading');}else{alert("Please enter a valid email address for Friend 1");}}else{alert("Please enter your valid email address");}}function Group_RecruitNow(gId){var obj;var objName='';var rootElement='idGroup';var indexCounter=0;var userIds='';var userNames='';var first=true;var nArrayLength=0;var errorIn=0;var errorOut=0;var qs='';var addresses='';Group_AddNewRecruitSelection();for(name in ArrayRecruitsSelected){nArrayLength++;}if(nArrayLength){for(value in ArrayRecruitsSelected){if(first!=true){userIds+=",";userNames+=",";}userIds+=ArrayRecruitsSelected[value];userNames+=value;first=false;}}else{errorIn=1;}if(document.getElementById('idTextEmail').value.length>5){if(document.getElementById('txtFriend1').value.length>5){currProfileControlId='divAjaxResponse';currProfileSectionStr="<br /><b>Email sent out successfully</b><br />";if(document.getElementById('idTxtAreaFriends').value.length==0){addresses=GetFriendsFromList();}else{addresses=document.getElementById('idTxtAreaFriends').value;}}else{errorOut=1;}}else{errorOut=2;}if((errorIn!=0)&&(errorOut!=0)){alert("Please select a friend or enter a valid email address.");}else{qs+="&uids="+userIds;qs+="&unms="+userNames;qs+="&sn="+escape(document.getElementById('idTextName').value);qs+="&se="+escape(document.getElementById('idTextEmail').value);qs+="&re="+escape(addresses);qs+="&msg="+escape(document.getElementById('idtxtMessage').value);qs+="&gid="+gId;if(document.getElementById('idChkCopy').checked==true){qs+="&cpy=1";}else{qs+="&cpy=0";}GenericAjaxLink("divRecruitLoading","divRecruitMembers","/group/recruit.ashx",qs,"Error loading group recruit list.<br>Please try again later.","",0);}}function Group_SendFriendSuggestionNow(gId){var obj;var objName='';var rootElement='idGroup';var indexCounter=0;var userIds='';var userNames='';var first=true;var nArrayLength=0;Group_AddNewRecruitSelection();for(name in ArrayRecruitsSelected){nArrayLength++;}if(nArrayLength){for(value in ArrayRecruitsSelected){if(first!=true){userIds+=",";userNames+=",";}userIds+=ArrayRecruitsSelected[value];userNames+=value;first=false;}Group_SuggestToSelectedFriends(gId,userIds,userNames);}else{alert("Please select at least one friend");}}function Group_SuggestToSelectedFriends(gId,userIds,userNames){var idName="divFriendSuggestionsLoading";var objSuggestion=document.getElementById(idName);var url="/group/recruitInside.ashx";var qs="gid="+gId;qs+="&uids="+userIds;qs+="&unms="+userNames;objSuggestion.innerHTML='<img src=/images/misc/loading.gif>';ShowDivById('divSendSuggestion');AjaxPostCall(url,qs,updateMediaSuggestionDiv);}function Group_LoadInvitation(divId,groupId,pageId){ToggleImage('idLoadingImg',loadingPic);ShowDivById(divId);ShowDivById('divGroupHeaderLoading');var url="/group/selectRecruitList.aspx?p="+pageId+"&g="+groupId;AjaxCall(url,Group_UpdateGroupPhotos);}function Group_UpdateRecruitSelection(){var obj;var objName='';var rootElement='idGroup';var indexCounter=0;var userIds='';var userNames='';for(indexCounter;indexCounter<GROUP_COUNT;indexCounter++){objName=rootElement+String(indexCounter);obj=document.getElementById(objName);if(obj!=undefined){if(ArrayRecruitsSelected[obj.name]!=undefined){obj.checked=true;}}}}function Group_UpdateFriendsList(ignore,pageId){var el=document.getElementById('ddlFriendSuggestionId');var sIndex=el.selectedIndex;var friendGroupId=el.options[sIndex].value;var url="/group/UpdateFriendsList.aspx?fcatid="+friendGroupId+"&p="+pageId;AjaxCall(url,Group_UpdateFriendsListDiv);return false;}function Group_UpdateFriendsListDiv(){if(req.readyState==4){updateAjaxControl('divFriendListSuggestion','');Group_UpdateRecruitSelection();}}function Group_AddNewRecruitSelection(){var obj;var objName='';var rootElement='idGroup';var indexCounter=0;var userIds='';var userNames='';var arrRemove=new Array();var arrNew=new Array();for(indexCounter;indexCounter<GROUP_COUNT;indexCounter++){objName=rootElement+String(indexCounter);obj=document.getElementById(objName);if(obj!=undefined){if(obj.checked==true){if(ArrayRecruitsSelected[obj.name]==undefined){ArrayRecruitsSelected[obj.name]=obj.value;}}else{if(ArrayRecruitsSelected[obj.name]!=undefined){arrRemove[obj.name]=obj.value;}}}}for(name in ArrayRecruitsSelected){if(arrRemove[name]==undefined){arrNew[name]=ArrayRecruitsSelected[name];}}ArrayRecruitsSelected=null;ArrayRecruitsSelected=new Array();ArrayRecruitsSelected=arrNew;}function Group_UpdateRecruitSelection(){var obj;var objName='';var rootElement='idGroup';var indexCounter=0;var userIds='';var userNames='';for(indexCounter;indexCounter<GROUP_COUNT;indexCounter++){objName=rootElement+String(indexCounter);obj=document.getElementById(objName);if(obj!=undefined){if(ArrayRecruitsSelected[obj.name]!=undefined){obj.checked=true;}}}}function Group_UpdateRecruitList(ignore,groupId,pageSize,view,colCount,pageId){var url="/group/UpdateVideos.aspx?grp="+groupId+"&p="+pageId+"&size="+pageSize+"&view="+view+"&cols="+colCount;AjaxCall(url,Group_UpdateVidsListDiv);}function Group_UpdateRecruitListDiv(){if(req.readyState==4){updateAjaxControl('divGroupVids','Failed to update videos.');}}function Group_UpdateNews(loadingId,pageSize,groupId,pageId){ShowLoadingGraphic(loadingId);var url="/group/updateNews.ashx?p="+pageId+"&sz="+pageSize+"&gid="+groupId;AjaxCall(url,Group_UpdateNewsDiv);}function Group_UpdateNewsDiv(){if(req.readyState==4){updateAjaxControl('divIdGroupNews','Error loading news.<br>Please try again later.');}}function Group_UpdateComments(loadingId,pageSize,groupId,pageId){ShowLoadingGraphic(loadingId);var url="/group/updateComments.ashx?p="+pageId+"&sz="+pageSize+"&gid="+groupId;AjaxCall(url,Group_UpdateCommentsDiv);}function Group_UpdateCommentsDiv(){if(req.readyState==4){updateAjaxControl('divUserComments','Error loading news.<br>Please try again later.');}}function Group_DeleteComments(gid,cid,oid,uid,divId,divLoadingId){if(confirm('Are you sure that you want to remove this comment from the group?')){currProfileControlId=divId;currProfileSectionStr="<b><font color=red>Removed</font></b>";ShowDivById(divLoadingId);var qs="uid="+uid+"&gid="+gid+"&oid="+oid+"&cid="+cid;AjaxPostCall("/group/removecomment.ashx",qs,updateProfileSection);HideDivById(divLoadingId);}}function Group_AddComments(gid,rows){var commentText=document.getElementById('sGroupCommentText');ShowDivById('divSavingComment');var ctext2=ReplaceAll(commentText.value,' ','');if(ctext2.length<=0){alert('Please enter a text comment');}else{var qs="gid="+gid+"&r="+rows+"&t="+escape(commentText.value.substr(0,2500));AjaxPostCall("/group/addComments.ashx",qs,updateCommentControl);HideDivById('idGroupCommentForm');}HideDivById('divSavingComment');commentText.value="";var charsLeftEle=document.getElementById('commentCounter');charsLeftEle.innerHTML='<b>2500</b>';}function updateCommentControl(){if(req.readyState==4){updateAjaxControl('divUserComments','There was an error loading the profile comments.<br><br>Please try again later.');}}function Group_ShowCommentForm(){ShowDivById('idGroupCommentForm');}function Group_AddTopics(controlId,gid){var topicText=document.getElementById('idTxtTopic');ShowDivById('divSavingComment');var ctext2=ReplaceAll(topicText.value,' ','');if(ctext2.length<=0){alert('Please enter a text topic');}else{var qs="gid="+gid+"&t="+escape(topicText.value.substr(0,2500));AjaxPostCall("/group/addTopics.ashx",qs,updateTopicsControl);}HideDivById('divSavingComment');topicText.value="";var charsLeftEle=document.getElementById('commentCounter');charsLeftEle.innerHTML='<b>2500</b>';}function updateTopicsControl(){if(req.readyState==4){updateAjaxControl('divUserComments','There was an error loading the profile comments.<br><br>Please try again later.');}}function Group_UpdateTopicList(ignore,groupId,pageSize,view,colCount,pageId){var url="/group/UpdateTopics.aspx?gid="+groupId+"&p="+pageId+"&size="+pageSize+"&view="+view+"&cols="+colCount;AjaxCall(url,Group_UpdateTopicListDiv);}function Group_UpdateTopicListDiv(){if(req.readyState==4){updateAjaxControl('divGroupTopics','Failed to update topics.');}}function Group_DeleteResponse(uid,tid,did,divId,divLoadingId){if(confirm('Are you sure that you want to delete this response to the discussion topic?')){currProfileControlId=divId;currProfileSectionStr="<b><font color=red>Response Deleted</font></b>";ShowDivById(divLoadingId);var qs="uid="+uid+"&tid="+tid+"&did="+did;AjaxPostCall("/group/removeDiscussion.ashx",qs,updateProfileSection);HideDivById(divLoadingId);}}function Group_UpdateDiscussionsList(ignore,topicId,pageSize,view,colCount,pageId){var url="/group/UpdateDiscussions.aspx?tid="+topicId+"&p="+pageId+"&size="+pageSize+"&view="+view+"&cols="+colCount;AjaxCall(url,Group_UpdateDiscussionListDiv);}function Group_UpdateDiscussionListDiv(){if(req.readyState==4){updateAjaxControl('divGroupDiscussions','Failed to update discussions.');}}function Group_DeleteTopic(uid,gid,tid,divId,divLoadingId){if(confirm('Are you sure that you want to remove this topic from the group?')){currProfileControlId=divId;currProfileSectionStr="<b><font color=red>Removed</font></b>";ShowDivById(divLoadingId);var qs="uid="+uid+"&gid="+gid+"&tid="+tid;AjaxPostCall("/group/removetopic.ashx",qs,updateProfileSection);HideDivById(divLoadingId);}}function Group_UpdateMembersList(ignore,groupId,pageSize,view,colCount,pageId){var url="/group/UpdateMembersListView.aspx?grp="+groupId+"&p="+pageId+"&size="+pageSize+"&view="+view+"&cols="+colCount;AjaxCall(url,Group_UpdateMembersListDiv);}function Group_UpdateMembersListDiv(){if(req.readyState==4){updateAjaxControl('divGroupMembers','Failed to update members.');}}function Group_DeleteMember(uid,gid,mid,divId,divLoadingId){if(confirm('Are you sure that you want to remove this member from the group?')){currProfileControlId=divId;currProfileSectionStr="<b><font color=red>Removed</font></b>";ShowDivById(divLoadingId);var qs="uid="+uid+"&gid="+gid+"&mid="+mid;AjaxPostCall("/group/removemember.ashx",qs,updateProfileSection);HideDivById(divLoadingId);}}function Group_RefreshRoles(divInput,redirect){var objInputName=document.getElementById(divInput);if(objInputName!=undefined){var valInputName=objInputName.value;if(valInputName.length>0){window.location=redirect+"&mname="+valInputName;}else{alert("Please enter a name to continue.");}}return false;}function Group_CheckMemberName(idTextBox){var objName=document.getElementById(idTextBox);if(objName.value.length==0){alert("Please enter the member's username");return false;}}function Group_UpdateGroupList(ignore,catId,sortId,pageSize,view,colCount,pageId){var url="/group/UpdateGroupsListView.aspx?cat="+catId+"&sort="+sortId+"&p="+pageId+"&size="+pageSize+"&view="+view+"&cols="+colCount;AjaxCall(url,Group_UpdateGroupsListDiv);}function Group_UpdateGroupsListDiv(){if(req.readyState==4){updateAjaxControl('divGroupList','Failed to update groups.');}}function Group_UpdateGroupSearch(ignore,tag,pageSize,view,colCount,pageId){var url="/group/UpdateGroupSearchView.aspx?tag="+tag+"&upd=1&p="+pageId+"&size="+pageSize+"&view="+view+"&cols="+colCount;AjaxCall(url,Group_UpdateGroupsListDiv);}function Group_SelectAllCheckboxes(checked,rootElement,count){var obj;var objName='';var indexCounter=0;var selectcounter=0;var unselected=0;for(indexCounter;indexCounter<count;indexCounter++){objName=rootElement+String(indexCounter);obj=document.getElementById(objName);if(obj!=undefined){if(checked){obj.checked=true;selectcounter++;}else{obj.checked=false;unselected++;}}}}function Group_ClearAllSelected(){gSelectedArray=null;gSelectedArray=new Array();Group_SelectAllCheckboxes(false);Group_UpdateVideoSelection();}function Group_AddNewSelection(rootElement,objectCount){var obj;var objName='';var indexCounter=0;var userIds='';var userNames='';var arrRemove=new Array();var arrNew=new Array();for(indexCounter;indexCounter<objectCount;indexCounter++){objName=rootElement+String(indexCounter);obj=document.getElementById(objName);if(obj!=undefined){if(obj.checked==true){if(gSelectedArray[obj.value]==undefined){gSelectedArray[obj.value]=obj.value;}}else{if(gSelectedArray[obj.value]!=undefined){arrRemove[obj.value]=obj.value;}}}}for(name in gSelectedArray){if(arrRemove[name]==undefined){arrNew[name]=gSelectedArray[name];}}gSelectedArray=null;gSelectedArray=new Array();gSelectedArray=arrNew;}function Group_GetIds(rootElement,objectCount){var obj;var objName='';var indexCounter=0;var selectedIds='';var first=true;var nArrayLength=0;Group_AddNewSelection(rootElement,objectCount);for(name in gSelectedArray){nArrayLength++;}if(nArrayLength){for(value in gSelectedArray){if(first!=true){selectedIds+=",";}selectedIds+=gSelectedArray[value];first=false;}}else{alert("Please select at least one friend");}return selectedIds;}