var EventsComments={CodeBehindParams:{ItemsPerPage:null,EventId:null,ShowingXtoYofZText:null,GotoPageText:null,SessionTimeOutErrorMessage:null,AddingCommentText:null,DeletingCommentText:null,CommentTextBoxId:"",WebServicePath:"",LoadingImageUrl:"",AddCommentButtonId:"btnAddComment",AnErrorOccurredMessage:null},LocalParams:{BottomPagerName:"PagerBottomComments",PagerDiv:"eventComments",PagerCssClass:"EventCommentsPagerDiv",TopPagerName:"PagerTopComments",TotalItems:null,CommentId:0,AddCommentButtonId:"btnAddComment",AddCommentInnerHtml:"",DeleteButtonsOnClickStates:new Array()},Init:function(itemsPerPage,eventId,showingXtoYofZText,gotoPageText,sessionTimeoutErrorMessage,noCommentsFoundText,addingCommentText,deletingCommentText,commentTextBoxId,webServicePath,loadingImageUrl,anErrorOccurredMessage){with(EventsComments.CodeBehindParams){EventId=eventId;ItemsPerPage=itemsPerPage;NoCommentsFoundText=noCommentsFoundText;ShowingXtoYofZText=showingXtoYofZText;GotoPageText=gotoPageText;AddingCommentText=addingCommentText;DeletingCommentText=deletingCommentText;CommentTextBoxId=commentTextBoxId;SessionTimeOutErrorMessage=sessionTimeoutErrorMessage;WebServicePath=webServicePath;LoadingImageUrl=loadingImageUrl;AnErrorOccurredMessage=anErrorOccurredMessage}Events.BrowserDetect.init();EventsComments.RenderPager()},Pager:{AjaxPager:null,AjaxPagerAssociated:null,AjaxPagerPrimary:null,PagerDiv:null,PageNumber:1,Events:{OnPageNumberChanged:null},Render:function(A,D,B,E,G,H,F,C){EventsComments.Pager.PagerDiv=D;EventsComments.Pager.Events.OnPageNumberChanged=A;if(G!=""){EventsComments.Pager.AjaxPagerPrimary=$create(MySpaceEvents.AtlasControls.Pager,{_layout:"",_clientInstanceName:"EventsComments.Pager.AjaxPagerPrimary",_itemsPerPage:B,_ajaxLoadingGifUrl:EventsComments.CodeBehindParams.LoadingImageUrl,_linksElementCSSClass:E,_associatedPagerDOMElementsList:H,_showingXtoYofZFormatString:F,_gotoPageString:C},null,null,$get(G));EventsComments.Pager.AjaxPagerPrimary.add_pageChangedEventHandler(EventsComments.Pager.Events.OnPageNumberChanged)}if(H!=""){EventsComments.Pager.AjaxPagerAssociated=$create(MySpaceEvents.AtlasControls.Pager,{_layout:"",_clientInstanceName:"EventsComments.Pager.AjaxPagerAssociated",_itemsPerPage:B,_ajaxLoadingGifUrl:EventsComments.CodeBehindParams.LoadingImageUrl,_linksElementCSSClass:E,_associatedPagerDOMElementsList:G,_showingXtoYofZFormatString:F,_gotoPageString:C},null,null,$get(H));EventsComments.Pager.AjaxPagerAssociated.add_pageChangedEventHandler(EventsComments.Pager.Events.OnPageNumberChanged)}EventsComments.Pager.AjaxPagerPrimary.firePageStartEvent()}},PagerEvents:{OnPageNumberChanged:function(A,B){if(B!=null){EventsComments.Pager.PageNumber=B.pageNumber}EventsComments.GetComments(A)},OnCommentsLoadComplete:function(B,A){var C=$get(EventsComments.LocalParams.PagerDiv);C.innerHTML=B[1];EventsComments.LocalParams.TotalItems=B[0];A.render(B[0])},OnTimeOut:function(B,A){var C=$get(EventsComments.Pager.PagerDiv);Events.Utilities.DisplayAjaxError(C,EventsComments.CodeBehindParams.SessionTimeOutErrorMessage);A.resetOnWebServiceError()}},RenderPager:function(){with(EventsComments){Pager.Render(PagerEvents.OnPageNumberChanged,LocalParams.PagerDiv,CodeBehindParams.ItemsPerPage,LocalParams.PagerCssClass,LocalParams.BottomPagerName,LocalParams.TopPagerName,CodeBehindParams.ShowingXtoYofZText,CodeBehindParams.GotoPageText)}},GetComments:function(A){var B=new Object();B.cipheredEventId=EventsComments.CodeBehindParams.EventId;B.currentPageString=String(EventsComments.Pager.PageNumber);B.itemsPerPageString=String(EventsComments.CodeBehindParams.ItemsPerPage);B.totalItemsString=String(EventsComments.LocalParams.TotalItems);B.browser=Events.BrowserDetect.browser;Sys.Net.WebServiceProxy.invoke(EventsComments.CodeBehindParams.WebServicePath,"GetCommentsPaged",false,B,EventsComments.PagerEvents.OnCommentsLoadComplete,EventsComments.PagerEvents.OnTimeOut,A,30000)},AddComment:function(){EventsComments.ToggleAllDeleteLinks(0);if(MySpace.ClientContext.UserId==-1){window.location="http://www.myspace.com"}var A=$get(EventsComments.CodeBehindParams.CommentTextBoxId).value;if(A.length>0){EventsComments.LocalParams.AddCommentInnerHtml=$get("addCommentDiv").innerHTML;$get("addCommentDiv").innerHTML="<div class='addComment'><img src='"+EventsComments.CodeBehindParams.LoadingImageUrl+"' width='22px' height='21px'>&nbsp;"+EventsComments.CodeBehindParams.AddingCommentText+"</div>";var B=new Object();B.cipheredEventId=EventsComments.CodeBehindParams.EventId;B.commentText=A;B.hash=Events.HashManager.HashValue;Sys.Net.WebServiceProxy.invoke(EventsComments.CodeBehindParams.WebServicePath,"AddComment",false,B,EventsComments.CommentsAdd_OnComplete,EventsComments.CommentsAdd_OnTimeOut,null,30000)}},CommentsAdd_OnComplete:function(B,A){$get("addCommentDiv").innerHTML=EventsComments.LocalParams.AddCommentInnerHtml;if(B){var C=$get(EventsComments.CodeBehindParams.CommentTextBoxId).value;$get(EventsComments.CodeBehindParams.CommentTextBoxId).value="";var A=EventsComments.Pager.AjaxPagerAssociated;EventsComments.GetComments(A)}else{commentsList=$get(EventsComments.Pager.PagerDiv);Events.Utilities.DisplayAjaxError(commentsList,EventsComments.CodeBehindParams.SessionTimeOutErrorMessage)}EventsComments.ToggleAllDeleteLinks(0)},CommentsAdd_OnTimeOut:function(C,B){var A=$get("addCommentDiv");Events.Utilities.DisplayAjaxError(commentsList,EventsComments.CodeBehindParams.SessionTimeOutErrorMessage)},DeleteComment:function(A){EventsComments.ToggleAllDeleteLinks(A);EventsComments.LocalParams.CommentId=A;var B=$get("C"+String(EventsComments.LocalParams.CommentId));B.innerHTML="<div class='deleteComment'><img src='"+EventsComments.CodeBehindParams.LoadingImageUrl+"' width='22px' height='21px'>&nbsp;"+EventsComments.CodeBehindParams.DeletingCommentText+"</div>";var C=new Object();C.cipheredEventId=String(EventsComments.CodeBehindParams.EventId);C.commentIdString=String(A);C.hash=Events.HashManager.HashValue;Sys.Net.WebServiceProxy.invoke(EventsComments.CodeBehindParams.WebServicePath,"DeleteComment",false,C,EventsComments.DeleteComment_OnComplete,EventsComments.DeleteComment_OnTimeOut,null,30000)},DeleteComment_OnComplete:function(B,A){var C=$get("C"+String(EventsComments.LocalParams.CommentId));C.innerHTML="";C.style.display="none";EventsComments.ToggleAllDeleteLinks(EventsComments.LocalParams.CommentId);if(B){EventsComments.Pager.AjaxPagerPrimary.dataSetItemRemoved()}else{commentsList=$get(EventsComments.Pager.PagerDiv);Events.Utilities.DisplayAjaxError(commentsList,EventsComments.CodeBehindParams.SessionTimeOutErrorMessage)}return false},DeleteComment_OnTimeOut:function(B,A){var C=$get("C"+String(EventsComments.LocalParams.CommentId));C.style.display="none";EventsComments.ToggleAllDeleteLinks(EventsComments.LocalParams.CommentId)},ToggleAllDeleteLinks:function(C){var A=$get("eventComments");var D=A.getElementsByTagName("a");if(EventsComments.LocalParams.DeleteButtonsOnClickStates.length==0){for(var B=0;B<D.length;B++){if((D[B].className=="deleteCommentLink")&&(D[B].id!="DC"+String(C))){EventsComments.LocalParams.DeleteButtonsOnClickStates.push(D[B].onclick);D[B].onclick="return false;"}}}else{var E=0;for(var B=0;B<D.length;B++){if(D[B].className=="deleteCommentLink"){D[B].onclick=EventsComments.LocalParams.DeleteButtonsOnClickStates[E++]}}EventsComments.LocalParams.DeleteButtonsOnClickStates=new Array()}}};