dj.module.articleTabs={init:function(){var at_container="articleTabs";var at_config={core:{panelPrefix:"articleTabs_panel_",panels:["article","video","slideshow","interactive","map","comments"],enableBrowserHistory:true},tabs:{tabPrefix:"articleTabs_tab_",tabOnStyle:"selected",tabOffStyle:"deselected"}};this.panels=dj.widget.panels.PanelsFactory.create(at_container,at_config);}}; if(typeof dj=="undefined"){dj={};} if(typeof dj.widget=="undefined"){dj.widget={};} if(typeof dj.widget.article=="undefined"){dj.widget.article={};} if(typeof dj.widget.article.flash=="undefined"){dj.widget.article.flash={};} dj.widget.article.flash.ArticleTabFlash=Class.create({initialize:function(id,tabModule){this.parent=$(id);this.id=id;this.tabModule=tabModule;this.omniture={};this.omniture.ctype='flash';var apn=tabModule;var that=this;apn.observePanels(function(panelId,prevPanelId){if(!apn.hasPanel(panelId)){}else if(panelId==that.tabName){that.play();}else if(prevPanelId==that.tabName){if(dj.util.History.get("project")){dj.util.History.set("project","",false);} if(dj.util.History.get("s")){dj.util.History.set("s","",false);}}});},clear:function(flash){if(flash){flash.so=null;} while(this.parent.firstChild){this.parent.removeChild(this.parent.firstChild);} this.player=null;},makeid:function(p,s){if(p&&s){return p+'|'+s;} if(p){return p;}},redraw:function(flash){this.clear(this.flash);this.flash=flash;this.flash.load(flash.p,flash.s);},register:function(p,s){if(!this.flashes){this.flashes={};} var flash={};flash=this.newflash(this.id,p,s,true);flash.swfPrefix=this.swfPrefix;this.flashes[this.makeid(p,s)]=flash;},setdefault:function(p,s){this.flash=this.findflashbyids(p,s);if(!this.flash){this.flash=this.newflash(this.id,p,s,true);this.flash.swfPrefix=this.swfPrefix;this.flashes[this.makeid(p,s)]=this.flash;}},findflashbyids:function(p,s){if(!this.flashes){this.flashes={};} var fid=this.makeid(p,s);if(this.flashes[fid]){return this.flashes[fid];}else{return null;}},playbyid:function(p,s){this.p=p;this.s=s;this.flash=this.findflashbyids(this.p,this.s);if(this.flash){this.redraw(this.flash);return true;}else{return false;}},playdefault:function(){if(!this.flashes){return;} if(!this.flash){for(var f in this.flashes){if(this.flashes[f]){this.flash=this.flashes[f];} break;}} this.redraw(this.flash);},play:function(){var headlineDiv=$$('div.articleHeadlineBox');if(headlineDiv&&headlineDiv[0]){var parentOffset=headlineDiv[0].cumulativeOffset();var parentTop=parentOffset[1];var viewOffset=document.viewport.getScrollOffsets();var viewTop=viewOffset[1];if(parentTop-1)&&(el.href.split("#")[1].indexOf("articleTabs_")>-1)){ev.stop();}});} this.fixthumbhref=true;}},registervideothumbnail:function(id,v){this.videothumbs[id]={'v':v};},playflashes:function(){for(var id in this.flashes){if(this.flashes[id].flash){continue;} this.flashes[id].flash=new dj.widget.flash.Flash(id,this.flashes[id].p,this.flashes[id].s);}},playvideos:function(){for(var id in this.videos){if(this.videos[id].video){continue;} this.videos[id].video=new dj.widget.video.Video(id,this.videos[id].v,this.videos[id].w,this.videos[id].h,this.videos[id].c);}},playvideothumbs:function(){for(var id in this.videothumbs){if(this.videothumbs[id].videothumb){continue;} this.videothumbs[id].videothumb=new dj.widget.video.Video(id);this.videothumbs[id].videothumb.loadthumbnail(this.videothumbs[id].v,200,120,this.playObserver);}},pausevideos:function(){if(this.videos){for(var id in this.videos){try{this.videos[id].video.pauseMicroPlayer();}catch(e){}}}},play:function(dontscroll){if(!dontscroll){var headlineDiv=$$('div.articleHeadlineBox');if(headlineDiv&&headlineDiv[0]){var parentOffset=headlineDiv[0].cumulativeOffset();var parentTop=parentOffset[1];var viewOffset=document.viewport.getScrollOffsets();var viewTop=viewOffset[1];if(parentTop0){this.targetElements=$$('div.articlePage p');} this.initialState=new Array();this.refFontSize;this.increment=1;this.max=-1;this.min=4;this.menuButton=B;this.unit={'em':0.1,'px':1};return this;},init:function(B){if(B){$(this.idLarge).observe('click',function(e){this.makeItSo(true);Event.stop(e);this.menuButton.closeMenu();}.bind(this));$(this.idSmall).observe('click',function(e){this.makeItSo(false);Event.stop(e);this.menuButton.closeMenu();}.bind(this));this.targetElements.each(function(el,i){var fs=el.getStyle('fontSize');this.initialState[i]=fs;if(i==0){fs=fs.substring(0,fs.length-2);if(isFloat(fs)){this.refFontSize=parseFloat(fs);} else{this.refFontSize=parseInt(fs);}}}.bind(this));$(this.idMiddle).observe('click',function(e){this.clickHandlerMiddle();Event.stop(e);this.menuButton.closeMenu();}.bind(this));} else{this.hideIt();}},clickHandlerMiddle:function(){var x=this.initialState;this.targetElements.each(function(el,i){el.setStyle({'fontSize':''.concat(x[i])});});},makeItSo:function(larger){if(this.targetElements&&this.targetElements.length>0){var CF=this.targetElements[0].getStyle('fontSize'),CU=CF.substring(CF.length-2),F=this.unit[CU];CF=CF.substring(0,CF.length-2);var isf=isFloat(CF);if(isf){CF=parseFloat(CF);} else{CF=parseInt(CF);} var fsDiff=(CF-this.refFontSize);if(isf){fsDiff=fsDiff.toPrecision(2);} if((larger&&this.max!=-1&&fsDiff>=(this.max*F))||(!larger&&this.min!=-1&&fsDiff<=-(this.min*F))){return;} var inc=(larger?this.increment:-this.increment)*F;this.targetElements.each(function(el){var FS=el.getStyle('fontSize'),idx=FS.indexOf(CU);if(idx!=-1){FS=FS.substring(0,idx);if(isFloat(FS)){FS=parseFloat(FS);} else{FS=parseInt(FS);} el.setStyle({'fontSize':(FS+inc)+CU});}});}},hideIt:function(){$(this.idLarge).up().addClassName('hidden');}}); dj.module.comments={sbNumber:AT_VARS.baseDocId,postCommentUrl:'/community/public/leaveacomment.html',getCommentsUrl:'/community/public/ArticleComments.html',tabName:'comments',articleName:AT_VARS.articleHeadline,ajaxPost:function(postUrl,args,callback){this.ajaxRequest=new Ajax.Request(postUrl,{method:'post',parameters:args.toQueryString(),onException:function(transport,exception){console.error('Exception occured while posting posting Ajax Request : '+exception);},onComplete:function(transport,json){callback(transport,json);}});},ajaxUpdate:function(oElement,postUrl,args,callback){this.ajaxUpdater=new Ajax.Updater(oElement,postUrl,{method:'post',parameters:args.toQueryString(),onException:function(transport,exception){console.error('Exception occured during Ajax Request :'+exception);},onComplete:function(transport,json){callback(transport,json);}});},showComments:function(oContainer){var args=$H({sbNumber:this.sbNumber,index:'',sortIndex:1});dj.module.communityUser.ajaxUpdate(oContainer,this.getCommentsUrl,args,function(transport){if(transport.status==200){oContainer.show();var oElement=$('newcommentarea0');if(oElement!==null){var parentOffset=oElement.cumulativeOffset();var parentTop=parentOffset[1];var viewOffset=document.viewport.getScrollOffsets();var viewTop=viewOffset[1];if(parentTop");var args=$H({sbNumber:this.sbNumber,articleName:this.articleName,content:commentValue,replyToId:0,mode:0,firstName:null,lastName:null});this.clearComment(oComment);var that=this;dj.module.communityUser.ajaxPost(this.postCommentUrl,args,function(transport,json){if(transport.status==200){that.activateCommentsPanel();}else if(transport.status==305){oErrorMessage.innerHTML='The language you used does not comply with community standards. Please re-enter.';oErrorMessage.setStyle("display:block");oErrorMessage.focus();return false;}else if(transport.status==300){dj.module.communityUser.handleError300(that.postCommentUrl,args,json.FirstName,json.LastName,function(transport){if(transport.status==200){that.activateCommentsPanel();}else{console.error("Exception in callback of handle300");}});}else if(transport.status==301){dj.module.communityUser.handleError301(json.FirstName,json.LastName);}});},activateCommentsPanel:function(){var activePanel=dj.module.articleTabs.panels.getActivePanel();if(activePanel!==this.tabName){dj.module.articleTabs.panels.setActivePanel(this.tabName);}},replaceHTMLTags:function(strValue){strValue=strValue.replace(//g,'>');return strValue;},showCommentCount:function(config){var hasCommentCount=config=='off'?false:true;if(hasCommentCount){this.cElement=$$('#articleTabs_tab_comments a').first();var artId="/community/integration/ArticleCommentsTotalCount.html?sbNumber="+AT_VARS.baseDocId;var that=this;new Ajax.Request(artId,{method:'get',onSuccess:function(transport){var noc=parseInt(transport.responseText,10);if(!isNaN(noc)&&(noc>0)){that.cElement.update("Comments ("+transport.responseText+")");}}});}}}; function Mailbox(ajaxPath) {this._ajaxPath=ajaxPath;} Mailbox.prototype.__DeleteInboxMessage=function Mailbox_DeleteInboxMessage(idObject) {if(typeof(idObject)=='string'){this._idArray=new Array();this._idArray.push(idObject);}else{this._idArray=idObject;} var decreaseCnt=0;for(var cnt=0;cnt-1){decreaseCnt=decreaseCnt+1;}} var args=$H({messageThreadIds:this._idArray}) var siteroot='${siteroot}';new Ajax.Request(this._ajaxPath+'/member/deletemessages.sync',{parameters:args.toQueryString(),onSuccess:this.__DropOutMessages.bind(this)});var totDecreaseCnt=0;for(var cnt=0;cnt0) {this.__DecreaseMailboxCnt(decreaseCnt);}} Mailbox.prototype.__DeleteInboxSelected=function Mailbox_DeleteInboxSelected(totalMsgCount,form) {var idArr=this.__GetCheckedMessages(form);if(idArr.length>0) {this.__DeleteInboxMessage(idArr);} if(totalMsgCount==idArr.length) {document.getElementById("ulDeleteSelected").style.display='none';}} Mailbox.prototype.__InboxBlockMember=function Mailbox_InboxBlockMember(name,form) {if(!IgnoreSender()) return;var args=$H({name:name}) new Ajax.Request(this._ajaxPath+'/member/blockmembersilently.sync',{parameters:args.toQueryString()});var idArr=new Array();idArr=this.__GetMessagesByName(name);if(idArr.length>0) {this.__DeleteInboxMessage(idArr);}} Mailbox.prototype.__AcceptFriendInvite=function Mailbox_AcceptFriendInvite(idObject) {if(typeof(idObject)=='number') {this._idArray=new Array();this._idArray.push(idObject);} else {this._idArray=idObject;} var args=$H({friendInviteIds:this._idArray}) new Ajax.Request(this._ajaxPath+'/member/acceptfriendinvite.sync',{parameters:args.toQueryString(),onSuccess:this.__DropOutMessages.bind(this)});this.__DecreaseFriendListCnt(this._idArray.length);} Mailbox.prototype.__AcceptFriendInviteSelected=function Mailbox_AcceptFriendInviteSelected(form) {var idArr=this.__GetCheckedMessages(form);if(idArr.length>0) {this.__AcceptFriendInvite(idArr);}} Mailbox.prototype.__DeclineFriendInvite=function Mailbox_DeclineFriendInvite(idObject) {if(typeof(idObject)=='number') {this._idArray=new Array();this._idArray.push(idObject);} else {this._idArray=idObject;} var args=$H({friendInviteIds:this._idArray}) new Ajax.Request(this._ajaxPath+'/member/declinefriendinvite.sync',{parameters:args.toQueryString(),onSuccess:this.__DropOutMessages.bind(this)});this.__DecreaseFriendListCnt(this._idArray.length);} Mailbox.prototype.__DeclineFriendInviteSelected=function Mailbox_DeclineFriendInviteSelected(form) {var idArr=this.__GetCheckedMessages(form);if(idArr.length>0) {this.__DeclineFriendInvite(idArr);}} Mailbox.prototype.__AcceptGroupInvite=function Mailbox_AcceptGroupInvite(idObject) {if(typeof(idObject)=='number') {this._idArray=new Array();this._idArray.push(idObject);} else {this._idArray=idObject;} var args=$H({groupInviteIds:this._idArray}) new Ajax.Request(this._ajaxPath+'/member/acceptgroupinvite.sync',{parameters:args.toQueryString(),onSuccess:this.__DropOutMessages.bind(this)});this.__DecreaseGroupListCnt(this._idArray.length);} Mailbox.prototype.__AcceptGroupInviteSelected=function Mailbox_AcceptGroupInviteSelected(form) {var idArr=this.__GetCheckedMessages(form);if(idArr.length>0) {this.__AcceptGroupInvite(idArr);}} Mailbox.prototype.__DeclineGroupInvite=function Mailbox_DeclineGroupInvite(idObject) {if(typeof(idObject)=='number') {this._idArray=new Array();this._idArray.push(idObject);} else {this._idArray=idObject;} var args=$H({groupInviteIds:this._idArray}) new Ajax.Request(this._ajaxPath+'/member/declinegroupinvite.sync',{parameters:args.toQueryString(),onSuccess:this.__DropOutMessages.bind(this)});this.__DecreaseGroupListCnt(this._idArray.length);} Mailbox.prototype.__DeclineGroupInviteSelected=function Mailbox_DeclineGroupInviteSelected(form) {var idArr=this.__GetCheckedMessages(form);if(idArr.length>0) {this.__DeclineGroupInvite(idArr);}} Mailbox.prototype.__GetCheckedMessages=function Mailbox_GetCheckedMessages(form) {var idArr=new Array();$(form).getElementsBySelector('input[type="checkbox"]').each(function(checkBoxElt){if(checkBoxElt.checked){if(checkBoxElt.id.indexOf('check')!=-1){if(trim(checkBoxElt.id.substr(5))!=""&&trim(checkBoxElt.id.substr(5))!='all'){idArr.push(parseInt(checkBoxElt.id.substr(5)));}}}});return idArr;} Mailbox.prototype.__GetMessagesByName=function Mailbox_GetMessagesByName(name) {var idArr=new Array();var nameLength=name.length;elements=document.getElementsByClassName(name);for(i=0;i0&&errorMsg.indexOf('valid user')==-1){errorMsg="Message sent successfully";$('errorMsg').update(errorMsg);new Effect.Appear($('errorMsg'),{duration:0.7});setTimeout(HideSendMessageError,7000);fnClearMessageFields();}else{if($('errorMsg')&&errorMsg){$('errorMsg').update(errorMsg);$('errorRecipient').style.display='none';$('errorSubject').style.display='none';$('errorContent').style.display='none';new Effect.Appear($('errorMsg'),{duration:0.7});setTimeout(HideSendMessageError,7000);}}}});} function HideSendMessageError() {new Effect.Fade($('errorMsg'),{duration:0.7});} function Conversation(textAreaId,confirmCtrl,messageThreadId,lastMsgMemberId,messagesElt,ajaxPath) {this._textAreaId=textAreaId;this._messageThreadId=messageThreadId;this._lastMsgMemberId=lastMsgMemberId;this._messagesElt=messagesElt;this._ajaxPath=ajaxPath;this._confirmCtrl=confirmCtrl;} Conversation.prototype.__Reply=function Conversation_Reply() {if(trim($F(this._textAreaId))=="") {$('msgeditor').value="Type your personal message.";document.getElementById('errorContent').style.display='block';return;} var replyContent=fnReplaceHTMLTags($F(this._textAreaId));document.getElementById('errorContent').style.display='none';var args=$H({content:replyContent,messageThreadId:this._messageThreadId,lastMsgMemberId:this._lastMsgMemberId}) new Ajax.Updater({success:this._messagesElt},this._ajaxPath+'/member/conversationreply.sync',{method:'post',insertion:Insertion.Bottom,parameters:args.toQueryString(),evalScripts:true,onComplete:this.__OnComplete.bind(this)});} Conversation.prototype.__OnComplete=function Conversation_OnComplete(transport,json) {document.getElementById('msgsent').style.display='block';document.getElementById('msgsent').innerHTML=json.errorMsg;if(json.success=='True'){$(this._textAreaId).value="";} new Effect.Appear(this._confirmCtrl,{duration:1.0});setTimeout(this.__MessageTimerFired.bind(this),3000);} Conversation.prototype.__MessageTimerFired=function Conversation_MessageTimerFired() {if($(this._confirmCtrl).visible()) {new Effect.Fade(this._confirmCtrl,{duration:0.7});}} Conversation.prototype.__Delete=function Conversation_Delete(redirectPath) {var idArray=new Array();idArray.push(this._messageThreadId);var args=$H({messageThreadIds:idArray}) new Ajax.Request(this._ajaxPath+'/member/deletemessages.sync',{parameters:args.toQueryString(),onSuccess:function(){window.location=redirectPath;}});} function IgnoreSender() {return window.confirm("Are you sure you want to Ignore this user? Clicking OK will prevent this user from contacting you in the WSJ Journal Community. To allow contact from this user again, click the 'Allow' button on the user's profile.")} var mwSubject='';var theTopic='';function Init(sbNumber,fullsiteroot,contentroot) {var articleName='';if(typeof(theTopic)=='object')return;if(document.getElementById('hdCommentType')==null||document.getElementById('hdCommentType').value=='story') {if(sbNumber==null||sbNumber=='') sbNumber=AT_VARS.baseDocId;articleName=AT_VARS.articleHeadline;mwSubject=new Subject(sbNumber,articleName,'','story');theTopic=new Topic('synccomments',mwSubject,fullsiteroot,contentroot,document.getElementById('topicreplyarea'))}} GetYourPage = function(indx) { new Ajax.Updater(document.getElementById('dvAllMyGroups'), vw_siteroot + "/group/YourGroups.sync", { method: 'post', parameters: $H({pageIndex:indx}).toQueryString() }); } GetGroupsPage = function(indx,sortId){ //var sortId = document.getElementById('selectedsortorder').value; new Ajax.Updater(document.getElementById('browsegroups'), vw_siteroot + "/group/browse.sync", { method: 'post', parameters: $H({category: document.getElementById('hdnCategoryId').value,type:sortId,pageIndex:indx}).toQueryString() }); } //This function is for loading different tabs(Browse,My Groups and Search) function clearSearchTab() { document.getElementById('searchresults').innerHTML = ""; } function loadmyGroups() { //var LastKnownTime = '$!{commentLastKnownTime}'; new Ajax.Updater(document.getElementById('dvAllMyGroups'), vw_siteroot + "/group/yourgroups.sync", { method: 'post', parameters: $H({pageIndex:0}).toQueryString() }); } function SetCriteria(elm, linkText) { if (linkText == 'name') { document.getElementById('liNameLink').style.display = 'none'; document.getElementById('liNameText').style.display = 'block'; document.getElementById('liNewestLink').style.display = 'block'; document.getElementById('liNewestText').style.display = 'none'; document.getElementById('liPopularLink').style.display = 'block'; document.getElementById('liPopularText').style.display = 'none'; document.getElementById('liActiveLink').style.display = 'block'; document.getElementById('liActiveText').style.display = 'none'; } else if (linkText == 'newest' || linkText === '') { document.getElementById('liNameLink').style.display = 'block'; document.getElementById('liNameText').style.display = 'none'; document.getElementById('liNewestLink').style.display = 'none'; document.getElementById('liNewestText').style.display = 'block'; document.getElementById('liPopularLink').style.display = 'block'; document.getElementById('liPopularText').style.display = 'none'; document.getElementById('liActiveLink').style.display = 'block'; document.getElementById('liActiveText').style.display = 'none'; } else if (linkText == 'popular') { document.getElementById('liNameLink').style.display = 'block'; document.getElementById('liNameText').style.display = 'none'; document.getElementById('liNewestLink').style.display = 'block'; document.getElementById('liNewestText').style.display = 'none'; document.getElementById('liPopularLink').style.display = 'none'; document.getElementById('liPopularText').style.display = 'block'; document.getElementById('liActiveLink').style.display = 'block'; document.getElementById('liActiveText').style.display = 'none'; } else { document.getElementById('liNameLink').style.display = 'block'; document.getElementById('liNameText').style.display = 'none'; document.getElementById('liNewestLink').style.display = 'block'; document.getElementById('liNewestText').style.display = 'none'; document.getElementById('liPopularLink').style.display = 'block'; document.getElementById('liPopularText').style.display = 'none'; document.getElementById('liActiveLink').style.display = 'none'; document.getElementById('liActiveText').style.display = 'block'; } $('selectedsortorder').value = $(elm).id; var categoryId = document.getElementById('hdnCategoryId').value; GroupBrowse(document.getElementById('browsegroups'), categoryId, document.getElementById('selectedsortorder').value, 1, vw_siteroot); } function ShowAllGroup() { document.getElementById('hdnCategoryId').value = -1; var categoryId = document.getElementById('hdnCategoryId').value; GroupBrowse(document.getElementById('browsegroups'), categoryId, document.getElementById('selectedsortorder').value, 1, vw_siteroot); } function showSubmitError(msg) { $("popuperrorbody").innerHTML = msg; var dummy = $("popuperror").getElementsByClassName("popuperrordummybody")[0]; var body = $("popuperror").getElementsByClassName("popuperrorbody")[0]; $("popuperror").show(); if (dummy) { dummy.setStyle({height: Element.getHeight(body) + "px"}); } } function Subject(uri, display, href, typeName) { this['s.uri'] = uri; this['s.name'] = display; this['s.href'] = href; this['s.typeName'] = typeName; } function ScrollFriends(scrollamount, friendcount) { var topvalue = Element.getStyle('friendcontainer', 'margin-top'); var newmargin = parseInt(topvalue.split('px'), 10); newmargin += parseInt(scrollamount, 10); if (newmargin > 0 || newmargin <= (friendcount / 8) * -220) { return false; } $('friendcontainer').setStyle({'display': 'none'}); $('friendcontainer').setStyle({marginTop: newmargin + 'px'}); new Effect.Appear($('friendcontainer'), { duration: 0.5 }); } //--------------------------------------------XXXXXXXXXXXXXX--------------------------------------------// //--------------------------------------------Invite To Join--------------------------------------------// //--------------------------------------------XXXXXXXXXXXXXX--------------------------------------------// //To add from the autocompete textbox. function AddMembersToList(contentroot) { showInlineMessage("errorInviteeName", ""); var memberlist = document.getElementById("invitelist"); var input = document.getElementById("memberautocomplete"); var member_names_array = input.value.split(','); if (member_names_array == "Start typing a community member's name")//same text is in autocomplete/default.vm { return; } //memberlist.setAttribute('class', 'inviteesListUnit'); member_names_array.each(function (member_name_wt) { var member_name = trim(member_name_wt); var memberinlist = IsAlreadyExist(member_name); if (member_name !== "" && memberinlist === false) { var contentDiv = document.createElement("ul"); Element.extend(contentDiv); contentDiv.setAttribute('id', member_name + 'Invite'); //contentDiv.addClassName("inviterow"); AddToHiddenInput(member_name); contentDiv.innerHTML = '
  • ' + member_name + ' remove
  • '; memberlist.appendChild(contentDiv); } else { if (member_name !== "" && memberinlist === true) { showInlineMessage("errorInviteeName", "Can not enter duplicate user name."); } return; } document.getElementById("memberautocomplete").value = ""; }.bind(memberlist)); } //To add from the connections list function AddFriendToList(frienduri, friendname, contentroot) { showInlineMessage("errorInviteeName", ""); var memberlist = document.getElementById("invitelist"); var member_name = trim(friendname); if (IsAlreadyExist(member_name)) { showInlineMessage("errorInviteeName", "Can not enter duplicate user name."); return; } memberlist.setAttribute('class', 'inviteesListUnit'); var memberinlist = IsAlreadyExist(member_name); if (member_name !== "" && memberinlist === false) { var contentDiv = document.createElement("ul"); Element.extend(contentDiv); contentDiv.setAttribute('id', member_name + 'Invite'); //contentDiv.addClassName("inviterow"); AddToHiddenInput(member_name); contentDiv.innerHTML = '
  • ' + member_name + ' remove
  • '; memberlist.appendChild(contentDiv); } } //adds invitee name to the hidden input box function AddToHiddenInput(nm) { var inputName = document.getElementById("hdnMemberNameList"); if (inputName.value.length === 0) { inputName.value = nm; } else { inputName.value = inputName.value + ',' + nm; } } //checks whether name already exists in hidden list function IsAlreadyExist(newnm) { var res = false; var inputName = document.getElementById("hdnMemberNameList"); var member_names_array = inputName.value.split(','); member_names_array.each(function(member_name) { var nm = trim(member_name); if (newnm == nm) { res = true; } }); return res; } //To sent invite messages function SendInvites(groupname, sender, ajaxroot) { showInlineMessage("errorInviteeName", ""); var invitees = new Array(); var inputName = document.getElementById("hdnMemberNameList"); var member_names_array = inputName.value.split(','); member_names_array.each(function (member_name) { invitees.push(trim(member_name)); }); if (trim(inputName.value) === "") { showInlineMessage("errorInviteeName", "Please add some people to the invite list."); return; } var args = $H({groupname: groupname, sender: sender, invitees:invitees}); new Ajax.Request( ajaxroot + "/group/sendinvites.sync", { parameters: args.toQueryString(), onComplete: function(transport, json){ if(json != null) { this.SendInvitesCompleteWithInvalidUser(json.errorMsg); }else { this.SendInvitesComplete() } } }); } //After completion of sentinvite message function function SendInvitesComplete() { var msg = 'Your invitation has been sent successfully.'; showInlineMessage("errorInviteeName", msg); //showInlineMessage("errorInviteeName", strInviteMessage[0]); RemoveAllinvitees(); var autoinput = document.getElementById("memberautocomplete"); autoinput.value = "Start typing a community member's name"; // var senttext = document.getElementById("senttext"); // senttext.textContent = 'Your Invitations have been sent.'; // new Effect.Appear(senttext,{duration:0.1}); // new Effect.Fade(senttext, {duration:5.0}); } //After completion of sentinvite message function function SendInvitesCompleteWithInvalidUser(msg) { showInlineMessage("errorInviteeName", msg); RemoveAllinvitees(); var autoinput = document.getElementById("memberautocomplete"); autoinput.value = "Start typing a community member's name"; } //To remove specified name from invitee list function RemoveInvite(givenid) { var memberlist = document.getElementById("invitelist"); var deletedInvite = document.getElementById(givenid); for(var i = 0; i < memberlist.childNodes.length; i++) { var invite = memberlist.childNodes[i]; if (invite == deletedInvite) { memberlist.removeChild(invite); i--; } } var inputName = document.getElementById("hdnMemberNameList"); var member_names_array = inputName.value.split(','); inputName.value = ""; member_names_array.each(function(member_name) { var nm = trim(member_name); var id = nm + 'Invite'; if(id != givenid){ AddToHiddenInput(nm); } }); } //removes all invitees function RemoveAllinvitees() { var inputName = document.getElementById("hdnMemberNameList"); var memberlist = document.getElementById("invitelist"); for(var i = 0; i < memberlist.childNodes.length; i++) { var invite = memberlist.childNodes[i]; memberlist.removeChild(invite); i--; } inputName.value = ""; } //--------------------------------------------XXXXXXXXXXXXXX--------------------------------------------// //--------------------------------------------Invite To Join--------------------------------------------// //--------------------------------------------XXXXXXXXXXXXXX--------------------------------------------// function cancelComment(commentEntryId,ajaxRoot) { var args = $H({commentEntryId:commentEntryId}); var commentEntryElt = $('commententry' + commentEntryId); var commentEntryAnchor = $('comment' + commentEntryId); if (commentEntryElt) { commentEntryElt.remove(); } new Ajax.Updater( { success: commentEntryAnchor }, ajaxRoot + "/group/canceleditcomment.sync", { parameters: args.toQueryString(), evalScripts: true, insertion: Insertion.After, onComplete: this.PostEditCommentComplete }); } //////////////////////////////////////////////////////// // Topic: single object created to manager the comment on the page //////////////////////////////////////////////////////// function Topic(elt, subject, ajaxRoot, contentRoot, replyContainer) { this.ShowCommentsFancily = this.__ShowCommentsFancily.bind(this); this.HelpfulComplete = this.__HelpfulComplete.bind(this); this._commentsList = document.createElement("div"); Element.extend(this._commentsList); this._replyContainer = null; this._state = $H(); this._ajaxRoot = ajaxRoot; this._contentRoot = contentRoot; this._subject = subject; this._reply2Id = 0; this._replyContainer = replyContainer; } Topic.prototype.Post = function Topic_Post(comment) { showInlineMessage("errorOnPost", ""); if (comment.length == 0) { showInlineMessage("errorOnPost", strResourceMsg[0]); return false; } if ( comment.length >= 10000 ) { showInlineMessage("errorOnPost", strResourceMsg[1]); return false; } comment = fnReplaceHTMLTags(comment); comment = comment.replace(/\n/g, "
    "); var args = $H({content:comment,reply2id:this._reply2Id}).merge(this._subject); if ( this._reply2Id >1 ) { new Ajax.Updater( { success: this._commentsList }, this._ajaxRoot + "/group/postcomment.sync", { parameters: args.toQueryString(), evalScripts: true, onComplete: this.ShowCommentsFancily }); } else { new Ajax.Updater( { success: document.getElementById('topiccomments') }, this._ajaxRoot + "/group/postcomment.sync", { parameters: args.toQueryString(), evalScripts: true, onComplete: function(transport, json){ if(json.success == "False"){ document.getElementById('commentBody').value = comment; showInlineMessage("errorOnPost", json.errorMsg); } } }); } } Topic.prototype.PostArticleComment = function Topic_PostArticleComment(comment) { showInlineMessage("errorOnPost", ""); if (comment.length == 0) { showInlineMessage("errorOnPost", "Please enter your comment and then click post."); return false; } if ( comment.length >= 10000 ) { comment = comment.substring(0, 9999); //showInlineMessage("errorOnPost", "Description cannot exceed beyond 1000 chars."); //return false; } comment = fnReplaceHTMLTags(comment); comment = comment.replace(/\n/g, "
    "); var args = $H({content:comment,reply2id:this._reply2Id}).merge(this._subject); if ( this._reply2Id >1 ) { new Ajax.Updater( { success: this._commentsList }, this._ajaxRoot + "/group/postarticlecomment.sync", { parameters: args.toQueryString(), evalScripts: true, onComplete: this.ShowCommentsFancily }); } else { new Ajax.Updater( { success: document.getElementById('Commentsblock') }, this._ajaxRoot + "/group/postarticlecomment.sync", { parameters: args.toQueryString(), evalScripts: true, onComplete: function(transport,json){ if(json != null){ showInlineMessage("errorOnPost", json.errorMsg); var anchor_node = document.getElementById('newcommentarea0'); if( anchor_node != null ) { window.scrollTo(0, anchor_node.offsetTop - 200); } } } }); } } Topic.prototype.__ShowCommentsFancily = function Comments_ShowCommentsFancily(transport, json) { if(json.success == "False"){ showInlineMessage("errorOnPost", json.errorMsg); }else{ $('newcommentarea'+this._reply2Id).innerHTML += this._commentsList.innerHTML.replace('wrote:','replied:'); $($('newcommentarea'+this._reply2Id).parentNode).show(); //hide the old container if(this._replyContainer != null) this._replyContainer.hide(); //remember the new one this._replyContainer = $('topicreplyarea'); this._replyContainer.appendChild($('newcomment')); if($('commentBody')) { $('commentBody').value = ''; } this._replyContainer.show(); $('newcommenttitle').innerHTML = "Add a Comment"; this._reply2Id = 0; } } Topic.prototype.OpenReplyBox = function Topic_OpenReplyBox(targetElement, commentEntryId, reply2Name) { if(ismember == "False"){ document.getElementById('ProfileWizard').style.display = "block"; document.getElementById('hdnCommentId').value = commentEntryId; document.getElementById('hdnCalledMethod').value = "ReplyComment"; window.scroll(0,0); return false; }else{ if($('isGroupMember').value != 'Active'){ document.getElementById('joinGroup'+ commentEntryId).style.display = 'block'; return false; } showInlineMessage("errorOnPost", ""); this._reply2Id = commentEntryId; Topic.prototype.ReplyBox(targetElement, commentEntryId, reply2Name); } } Topic.prototype.ReplyBox = function Topic_ReplyBox(targetElement, commentEntryId, reply2Name) { showInlineMessage("errorOnPost", ""); this._reply2Id = commentEntryId; //hide the old container //if(this._replyContainer != null) // this._replyContainer.hide(); //remember the new one this._replyContainer = targetElement; this._replyContainer.appendChild($('newcomment')); if($('commentBody')) { $('commentBody').value = ''; } this._replyContainer.show(); if(reply2Name){ $('newcommenttitle').innerHTML = "Reply to " + reply2Name + "'s comment"; }else{ $('newcommenttitle').innerHTML = "Add a Comment"; } if($('commentBody')) $('commentBody').focus(); else $('newcomment').scrollTo(); } Topic.prototype.OpenMessageBox = function Topic_OpenMessageBox(targetElement, reply2Name) { if(this._replyContainer != null) this._replyContainer.hide(); //remember the new one this._replyContainer = targetElement; this._replyContainer.show(); } Topic.prototype.EditTopic = function Topic_EditTopic(groupName, topicName) { var args = $H({groupName: groupName, topicName: topicName}); $('editTopic').hide(); new Ajax.Updater( { success: $('topicBodyContainer') }, this._ajaxRoot + "/group/edittopic.sync", { parameters: args.toQueryString(), evalScripts: true }); } Topic.prototype.PostEditTopic = function Topic_PostEditTopic(groupName, topicName, topicBody) { document.getElementById('errEditTopic').style.display = 'none'; if ($("topicbody1120").value.length > 1000){ document.getElementById('errEditTopic').style.display = 'block'; showInlineMessage("errEditTopic", "Please limit your comments to each topic to 1000 characters."); return false; } var args = $H({groupName: groupName, topicName: topicName, topicBody: topicBody}); new Ajax.Updater( { success: $('topicBodyContainer') }, this._ajaxRoot + "/group/postedittopic.sync", { parameters: args.toQueryString(), evalScripts: true, onComplete : function(transport, json){ if(json.success == 'False'){ document.getElementById('errEditTopic').style.display = 'block'; document.getElementById('errEditTopic').innerHTML = json.errorMsg; document.getElementById('topicbody1120').value = json.topicBody; return false; }else{ $('editTopic').show(); } } }); } Topic.prototype.CancelEditTopic = function Topic_CancelEditTopic(groupName, topicName) { var args = $H({groupName: groupName, topicName: topicName}); $('editTopic').show(); new Ajax.Updater( { success: $('topicBodyContainer') }, this._ajaxRoot + "/group/canceledittopic.sync", { parameters: args.toQueryString(), evalScripts: true }); } Topic.prototype.EditComment = function Topic_EditComment(commentEntryId) { var args = $H({commentEntryId: commentEntryId}); var PrevEditcomment = $('commentarea'); if (PrevEditcomment) { var EditcommentEntryId = document.getElementById('EditcommentEntryId').value; cancelComment(EditcommentEntryId,this._ajaxRoot); } $('newcomment').style.display = 'none'; var commentEntryElt = $('commententry' + commentEntryId); var bodyElt; if (commentEntryElt) { bodyElt = commentEntryElt; //commentEntryElt.getElementsByClassName('body')[0]; } if (bodyElt) { $('editcomment' + commentEntryId).style.display = 'none'; this._bubbleContentHeight = bodyElt.offsetHeight; new Ajax.Updater( { success: bodyElt }, this._ajaxRoot + "/group/editcomment.sync", { parameters: args.toQueryString(), evalScripts: true }); } } Topic.prototype.PostEditComment = function Topic_PostEditComment(comment, commentEntryId) { comment = fnReplaceHTMLTags(comment); comment = comment.replace(/\n/g, "
    "); if ( comment == '' ){ showInlineMessage("errorOnEditPost", 'Please enter your comment and then click post.'); return false; }else if ( comment.length >= 10000 ){ showInlineMessage("errorOnEditPost", 'Comment should not be more than 10000 chars'); return false; } var args = $H({content:comment}).merge(this._subject).merge({commentEntryId:commentEntryId}); var commentEntryElt = $('commententry' + commentEntryId); var commentEntryAnchor = $('comment' + commentEntryId); new Ajax.Updater( { success: commentEntryAnchor }, this._ajaxRoot + "/group/posteditcomment.sync", { parameters: args.toQueryString(), evalScripts: true, insertion: Insertion.After, onComplete: function(transport,json){ if(json.success == "False"){ showInlineMessage("errorOnEditPost", json.errorMsg); }else{ if (commentEntryElt){ commentEntryElt.remove(); } $('newcomment').style.display = ''; //hide the old container if(this._replyContainer != null) this._replyContainer.hide(); //remember the new one this._replyContainer = $('topicreplyarea'); this._replyContainer.appendChild($('newcomment')); if($('commentBody')){ $('commentBody').value = ''; } this._replyContainer.show(); $('newcommenttitle').innerHTML = "Add a Comment"; this._reply2Id = 0; } }//this.PostEditCommentComplete }); } function sortComments(groupName,topicName,index,sortId) { document.getElementById('sortId').value = sortId; new Ajax.Updater(document.getElementById('discussionThreadBox'), vw_siteroot + "/group/sortComment.sync", { method: 'post', parameters: $H({groupname: groupName,topicname:topicName,index:index,sortIndex:sortId}).toQueryString() }); } Topic.prototype.__PostEditCommentComplete = function Topic_PostEditCommentComplete(transport, json) { // Update the "TimeAgo" and "EditComment" spans with their new elts var editCommentId = json.commentEntryId; var editSpanContext = this._editSpanManager.Find(editCommentId); if (editSpanContext) { editSpanContext._elt = $("editcomment" + editCommentId); } var timeAgoContext = this._agoSpanManager.Find(editCommentId); if (timeAgoContext) { timeAgoContext._elt = $("timeago" + editCommentId); $("timeago" + editCommentId).removeClassName("timeago"); } this._editSpanManager.Sweep(); this._agoSpanManager.Sweep(); this._editCommentEditor = null; this.BeginUpdating(); } Topic.prototype.CancelEditComment = function Topic_CancelEditComment(commentEntryId) { var args = $H({commentEntryId:commentEntryId}); var commentEntryElt = $('commententry' + commentEntryId); var commentEntryAnchor = $('comment' + commentEntryId); if (commentEntryElt) { commentEntryElt.remove(); } $('newcomment').style.display = '' //hide the old container if(this._replyContainer != null && this._replyContainer != 'undefined') { this._replyContainer.style.display = 'none'; //this._replyContainer.hide(); } //remember the new one this._replyContainer = $('topicreplyarea'); this._replyContainer.appendChild($('newcomment')); if($('commentBody')) { $('commentBody').value = ''; } this._replyContainer.style.display = 'block'; //this._replyContainer.show(); $('newcommenttitle').innerHTML = "Add a Comment"; this._reply2Id = 0; new Ajax.Updater( { success: commentEntryAnchor }, this._ajaxRoot + "/group/canceleditcomment.sync", { parameters: args.toQueryString(), evalScripts: true, insertion: Insertion.After, onComplete: this.PostEditCommentComplete }); } Topic.prototype.HelpfulComment = function Comments_HelpfulComment(commentEntryId) { var args = $H({commentEntryId: commentEntryId}); var elt = $('numhelpful' + commentEntryId); new Ajax.Updater( { success: elt }, this._ajaxRoot + "/group/helpfulcomment.sync", { parameters: args.toQueryString(), evalScripts: true, onComplete: this.HelpfulComplete(commentEntryId) }); } Topic.prototype.__HelpfulComplete = function Comments_HelpfulCompleteComplete(commentEntryId) { var numhelpfulElt = $('numhelpful' + commentEntryId); numhelpfulElt.show(); var washelpfulElt = $('washelpful' + commentEntryId); washelpfulElt.hide(); } function GroupSwitchMembersTabs(tab, ajaxFunction) { var localAjaxFunction = ''; switch(tab) { case 'tabbrowse': if ($('invitepeople')) $('invitepeople').hide(); $('browsepeople').show(); break; case 'tabinvite': if ($('browsepeople')) $('browsepeople').hide(); if ($('invitepeople')) $('invitepeople').show(); else localAjaxFunction += ajaxFunction; break; } if (localAjaxFunction != '') { new Ajax.Updater('peopleview', localAjaxFunction, { insertion: Insertion.Bottom, evalScripts: true } ); } } function GroupSwitchBrowseTabs(tab, ajaxFunction) { //if ($('groupnav').getElementsByClassName('selected').length > 0) // $('groupnav').getElementsByClassName('selected')[0].removeClassName('selected'); //$(tab).addClassName('selected'); var localAjaxFunction = ''; switch(tab) { case 'tabbrowse': $('browsegroups').show(); if ($('searchgroups')) $('searchgroups').hide(); break; case 'tabsearch': if ($('browsegroups')) $('browsegroups').hide(); if ($('searchgroups')) $('searchgroups').show(); else localAjaxFunction += ajaxFunction; break; } if (localAjaxFunction != '') { new Ajax.Updater('groupsview', localAjaxFunction, { insertion: Insertion.Bottom, evalScripts: true } ); } } function GroupBrowse(resultsElt, category, type,index, ajaxRoot) { var args = $H({category:category,type:type,pageIndex:index}) new Ajax.Updater( { success: resultsElt }, ajaxRoot + "/group/browse.sync", { parameters: args.toQueryString(), evalScripts: true }); } function SearchGroups(q, ajaxFunction) { if (q == 'Search For Groups') { q = ''; } if ($('groupnav').getElementsByClassName('selected').length > 0) { $('groupnav').getElementsByClassName('selected')[0].removeClassName('selected'); } $('tabsearch').addClassName('selected'); if ($('browsegroups')) { $('browsegroups').hide(); } if ($('searchgroups')) { $('searchgroups').remove(); } var args = {}; args = $H(args); args['q'] = q; new Ajax.Updater('groupsview', ajaxFunction, { parameters : args.toQueryString(), insertion: Insertion.Bottom, evalScripts: true } ); } function ReportAvatar(ajaxFunction) { if( ismember == "False") { document.getElementById('ProfileWizard').style.display = "block"; document.getElementById('hdnCalledMethod').value = "reportAvatar"; document.getElementById('hdnAjaxFunction').value = ajaxFunction; window.scroll(0,0); return false; } else { new Ajax.Request( ajaxFunction, { onComplete: function(transport, json) { var reported = json.reported; if (reported) { //$('reportpicture').update("Picture Reported"); document.getElementById("reportpicture").innerHTML = 'Image Reported'; } var alreadyreported = json.alreadyreported; if (alreadyreported) { document.getElementById("reportpicture").innerHTML= 'Image is already reported'; } } } ); } } function ReportDescription(ajaxFunction) { if( ismember == "False") { document.getElementById('ProfileWizard').style.display = "block"; document.getElementById('hdnCalledMethod').value = "ReportDescription"; document.getElementById('hdnAjaxFunction').value = ajaxFunction; window.scroll(0,0); return false; } else { new Ajax.Request( ajaxFunction, { onComplete: function(transport, json) { var reported = json.reported; if (reported) { document.getElementById("reportdescription").innerHTML= 'Description Reported'; } var alreadyreported = json.alreadyreported; if (alreadyreported) { document.getElementById("reportdescription").innerHTML= 'Description is already reported'; } } } ); } } //HMTSWR2008100301 function ReportGroup(ajaxFunction) { if( ismember == "False") { document.getElementById('ProfileWizard').style.display = "block"; document.getElementById('hdnCalledMethod').value = "ReportGroup"; document.getElementById('hdnAjaxFunction').value = ajaxFunction; window.scroll(0,0); return false; } else { new Ajax.Request( ajaxFunction, { onComplete: function(transport, json) { var reported = json.reported; if (reported) { document.getElementById("reportgroup").innerHTML= 'Group Reported'; } var alreadyreported = json.alreadyreported; if (alreadyreported) { document.getElementById("reportgroup").innerHTML= 'Group is already reported'; } } } ); } } function ReportTopic(ajaxFunction) { if(ismember == "False") { document.getElementById('ProfileWizard').style.display = "block"; document.getElementById('hdnCalledMethod').value = "ReportTopic"; document.getElementById('hdnAjaxFunction').value = ajaxFunction; window.scroll(0,0); return false; } else {new Ajax.Request( ajaxFunction, { onComplete: function(transport, json) { var reported = json.reported; var alreadyreported = json.alreadyreported; if (reported) { document.getElementById("reporttopic").innerHTML = "Topic Reported"; } if (alreadyreported) { document.getElementById("reporttopic").innerHTML = "Topic is already reported"; } } } ); } } function GetSearchGroupPage(q,pageIndex) { document.getElementById('searchresults').innerHTML = ""; if( q === '') { document.getElementById('message').style.display = 'block'; document.getElementById('message').innerHTML = validSearch; return false; } else if( q.length > 256) { document.getElementById('message').style.display = 'block'; document.getElementById('message').innerHTML = MoreThan256Char; return false; } else { document.getElementById('message').style.display = 'none'; document.getElementById('message').innerHTML = ""; } if(fnValidateString(q) == 'true') { document.getElementById('message').style.display = 'block'; document.getElementById('message').innerHTML = "Input text has special characters. \nThese are not allowed.\n Please remove them and try again."; return false; } var reg = new RegExp("/community?/[\\._A-Za-z0-9-]+", "i"); var ar = reg.exec(document.URL); if(document.URL.indexOf("group") != -1 ) { document.frmSearchGroup.action = siteroot + "/groups/SearchGroups?searchtxt="+q+"&requestedPage="+pageIndex + "#identifier"; } else { document.frmSearchGroup.action = siteroot + "/home/SearchGroups?searchtxt="+q+"&requestedPage="+pageIndex + "#identifier"; } document.frmSearchGroup.submit(); } //This method is for highlighting a sub category in the selected category. function HighLightSubCategory(parentElement,childElement) { if (document.getElementById(parentElement) !== null && document.getElementById(parentElement) != 'undefined') { var objArray = document.getElementById(parentElement).getElementsByTagName("li"); var childObj = document.getElementById(childElement); for(var i = 0; i0) {DISPLAYNAME_ERROR=true;if(displayName.search(/\.(?:rails|sync|png|css|js|aspx|svc|axd)$/)>=0) {showInlineMessage("errorGroupName","This is a reserved name and cannot be used.");} else {showInlineMessage("errorGroupName","");DISPLAYNAME_ERROR=false;}} else {DISPLAYNAME_ERROR=false;}}} function checkDisplayNameValidity() {var displayName=$("groupname").value.strip();if(displayName[0]=="."||displayName[0]=="-"||displayName[displayName.length-1]=="."||displayName[displayName.length-1]=="-") {DISPLAYNAME_ERROR=true;showInlineMessage("errorGroupNameAvailable",strResourceMsg[0]);} else if(displayName.length>=50) {DISPLAYNAME_ERROR=true;showInlineMessage("errorGroupNameAvailable",strResourceMsg[2]);} else if(displayName.length===0) {DISPLAYNAME_ERROR=true;showInlineMessage("errorGroupNameAvailable",strResourceMsg[1]);} else {DISPLAYNAME_ERROR=false;}} function checkGroupDescriptionNameValidity() {var groupName=$("description").value.strip();groupName=fnReplaceHTMLTags(groupName);if(groupName.length>1000) {GROUP_DESCRIPTION_ERROR=true;showInlineMessage("errorGroupDescription",strResourceMsg[4]);} else if(groupName.length===0) {GROUP_DESCRIPTION_ERROR=true;showInlineMessage("errorGroupDescription",strResourceMsg[3]);} else {GROUP_DESCRIPTION_ERROR=false;}} function checkDisplayDescriptionCompleted(transport,json) {if(json["ErrorMessage"]!=="") {showInlineMessage("errorGroupDescription","");showInlineMessage("errorGroupDescription2",json["ErrorMessage"]);GROUP_DESCRIPTION_ERROR=true;} else {showInlineMessage("errorGroupDescription2","");GROUP_DESCRIPTION_ERROR=false;}} function checkDisplayDescriptionForStopWords() {if(trim($("description").value)!="") {var args=$H({groupDescription:$("description").value});new Ajax.Updater({success:$("errorGroupDescription2")},vw_siteroot+"/group/CheckGroupDescription.sync",{method:'post',parameters:args.toQueryString(),evalScripts:true,onComplete:function(transport,json){if(json.ErrorMessage!==""){showInlineMessage("errorGroupDescription","");showInlineMessage("errorGroupDescription2",json.ErrorMessage);return false;}else{showInlineMessage("errorGroupDescription2","");}}});}} function showInlineMessage(eltId,msg) {document.getElementById(eltId).innerHTML=msg;if(msg!=="") {document.getElementById(eltId).style.visibility='visible';} else {document.getElementById(eltId).style.visibility='hidden';}} function clearInlineMessages() {showInlineMessage("errorGroupCategories","");showInlineMessage("errorGroupPicture","");showInlineMessage("errorGroupDescription","");showInlineMessage("errorGroupDescription2","");showInlineMessage("errorGroupName","");} function clearEditInlineMessages() {showInlineMessage("errorEditGroupPicture","");showInlineMessage("errorGroupDescription","");} function validateCreateGroup(evt) {checkDisplayNameValidity();if(!DISPLAYNAME_ERROR) {checkDisplayNameInUse();} checkDisplayDescriptionForStopWords();checkGroupDescriptionNameValidity();if(evt) {Event.stop(evt);} var avatar=$("avatar").value;var avatarext=avatar.substring(avatar.indexOf('.'),avatar.length).toLowerCase();if($("Category").value=="-1"||$("SubCategoryId").value=="-1") {showInlineMessage("errorGroupCategories",strResourceMsg[5]);GROUP_CATEGORY_ERROR=true;} else {GROUP_CATEGORY_ERROR=false;} if(avatarext!==""&&avatarext!=".png"&&avatarext!=".jpg"&&avatarext!=".gif") {showInlineMessage("errorGroupPicture",strResourceMsg[6]);GROUP_PICTURE_ERROR=true;} else {GROUP_PICTURE_ERROR=false;} if(DISPLAYNAME_ERROR||DISPLAYNAME_INUSE||GROUP_DESCRIPTION_ERROR||GROUP_PICTURE_ERROR||GROUP_CATEGORY_ERROR) {return false;} else {$("frmnewgroup").submit();}} function validateEditGroup(evt) {var groupName=$('groupName').value.strip();var description=$("description").value.strip();if(description.length>1000){showInlineMessage("errorGroupDescription",strResourceMsg[1]);GROUP_DESCRIPTION_ERROR=true;}else if(description.length===0){showInlineMessage("errorGroupDescription",strResourceMsg[0]);GROUP_DESCRIPTION_ERROR=true;} var avatar=$("avatar").value;var avatarext=avatar.substring(avatar.indexOf('.'),avatar.length).toLowerCase();if(avatarext!==""&&avatarext!=".png"&&avatarext!=".jpg"&&avatarext!=".gif"){showInlineMessage("errorEditGroupPicture",strResourceMsg[2]);GROUP_PICTURE_ERROR=true;} if(GROUP_DESCRIPTION_ERROR||GROUP_PICTURE_ERROR){return false;}else{$("frmmanagegroup").submit();}} function create_group() {if(ismember=="False") {document.getElementById('ProfileWizard').style.display="block";document.getElementById('hdnCalledMethod').value="group";window.scroll(0,0);return false;} else {document.location=vw_siteroot+'/groups/create';}} function join_group() {if(ismember=="False") {document.getElementById('ProfileWizard').style.display="block";document.getElementById('hdnCalledMethod').value="joingroup";window.scroll(0,0);return false;} else {document.frmJoinGroup.submit();}} function CreateTopic() {var groupName=$('groupName').value;var topicName=$("topicName").value;var topicBody=$("topicBody").value;document.getElementById('errorMessageTitle').style.display='none';document.getElementById('errorMessageBody').style.display='none';if($("topicName").value.length===0){showInlineMessage("errorTopicName","The Topic name cannot be blank. Please enter a valid value and try again.");return false;} if($("topicName").value.length>256){showInlineMessage("errorTopicName","Please limit your topic to 256 characters.");return false;} if($("topicBody").value.length>1000){showInlineMessage("errorTopicBody","Please limit your comments to each topic to 1000 characters.");return false;} new Ajax.Updater(document.getElementById('dvCreateNewTopic'),vw_siteroot+"/group/createnewtopic.sync",{method:'post',parameters:$H({groupName:groupName,topicName:topicName,topicBody:topicBody}).toQueryString(),onComplete:function(transport,json){if(json.success=='False'){if(json.errorIn=='Name'){document.getElementById('errorMessageTitle').style.display='block';document.getElementById('errorMessageTitle').innerHTML=json.errorMsg;document.getElementById('newtopic').style.display='block';document.getElementById('topicName').value=json.topicName;document.getElementById('topicBody').value=json.topicBody;}else if(json.errorIn=='Body'){document.getElementById('errorMessageBody').style.display='block';document.getElementById('errorMessageBody').innerHTML=json.errorMsg;document.getElementById('newtopic').style.display='block';document.getElementById('topicBody').value=json.topicBody;document.getElementById('topicName').value=json.topicName;}else{document.getElementById('errSaveTopic').style.display='block';document.getElementById('errSaveTopic').innerHTML=json.errorMsg;document.getElementById('newtopic').style.display='block';} return false;}else{document.getElementById('errSaveTopic').style.display='block';document.getElementById('errSaveTopic').innerHTML=json.errorMsg;document.location.href=vw_siteroot+"/groups/"+groupName+"/topics/"+json.SeoName;}}});} function ToggleNewTopic() {showInlineMessage("errorTopicName","");showInlineMessage("errorTopicBody","");document.getElementById('topicName').value="";document.getElementById('topicBody').value="";if(document.getElementById('newtopic').style.display=='none') {document.getElementById('newtopic').style.display='block';document.getElementById('liCreateTopic').className='button selectedTab';} else {document.getElementById('newtopic').style.display='none';document.getElementById('liCreateTopic').className='button buttonStyle-secondary';}} function SubmitFeedback(siteRoot) {var formInValid;showInlineMessage("errorFeedbackSenderName","");showInlineMessage("errorFeedbackEmailID","");showInlineMessage("errorFeedbackComments","");if(trim($("f.name").value)==""||trim($("f.name").value)=="Your Name"){showInlineMessage("errorFeedbackSenderName",strResourceMsg[0]);$("f.name").value="Your Name";formInValid=true;} if(trim($("f.email").value)==""||trim($("f.email").value)=="Your Email Address"){showInlineMessage("errorFeedbackEmailID",strResourceMsg[1]);formInValid=true;$("f.email").value="Your Email Address";}else if(trim($("f.email").value)!=""){var email=$("f.email").value;var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9])+\.)+([a-zA-Z0-9])+$/;if(!filter.test(email)){showInlineMessage("errorFeedbackEmailID",strResourceMsg[2]);formInValid=true;}} if(trim($("f.message").value)==""||trim($("f.message").value)=="Type your personal message."){showInlineMessage("errorFeedbackComments",strResourceMsg[3]);formInValid=true;$("f.message").value="Type your personal message.";} if(formInValid){return false;}else{$("submitFeedbackForm").action=siteRoot+"/submitfeedback";$("submitFeedbackForm").submit();}} function showSubmitError(msg) {$("popuperrorbody").innerHTML=msg;var dummy=$("popuperror").getElementsByClassName("popuperrordummybody")[0];var body=$("popuperror").getElementsByClassName("popuperrorbody")[0];var myWidth=document.documentElement.clientWidth;var myHeight=document.documentElement.clientHeight;$("popuperror").show();if(dummy) {dummy.setStyle({height:Element.getHeight(body)+"px"});} var scrolledX,scrolledY;if(self.pageYoffset) {scrolledX=self.pageXoffset;scrolledY=self.pageYoffset;}else if(document.documentElement&&document.documentElement.scrollTop) {scrolledX=document.documentElement.scrollLeft;scrolledY=document.documentElement.scrollTop;}else if(document.body) {scrolledX=document.body.scrollLeft;scrolledY=document.body.scrollTop;} var centerX,centerY;if(self.innerHeight) {centerX=self.innerWidth;centerY=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight) {centerX=document.documentElement.clientWidth;centerY=document.documentElement.clientHeight;}else if(document.body) {centerX=document.body.clientWidth;centerY=document.body.clientHeight;} var leftoffset=scrolledX+(centerX-document.getElementById("popuperror").clientWidth)/2;var topoffset=scrolledY+(centerY-document.getElementById("popuperror").clientHeight)/2;var o=document.getElementById("popuperror");var r=o.style;r.position='absolute';r.top=topoffset+'px';r.left=leftoffset+'px';r.display="block";} function $RF(el,radioGroup) {if($(el).type&&$(el).type.toLowerCase()=='radio') {radioGroup=$(el).name;var el=$(el).form;} else if($(el).tagName.toLowerCase()!='form') {return false;} var checked=$(el).getInputs('radio',radioGroup).find(function(re){return re.checked;});return(checked)?$F(checked):'';}/*eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+c+'\\b','g'),k[c])}}return p}('36={7:9(6,4,5,3){35(!6)34;4=4||\'\';5=5||\'\';3=3||\'\';33.32(\'31://30.29/28-27?26=2&6=\'+6+\'&4=\'+4+\'&5=\'+5+\'&3=\'+3,20 19().17(),\'21=1,22=1,15=0,13=1,25=1,11=1,18=23,14=12,10 = 24,8 =16\')}}',10,37,'|||topic|title|bodytext|url|remoteSubmit|top|function|left|resizable|360|statusbar|height|location|0|getTime|width|Date|new|toolbar|scrollbars|600|0|menubar|phase|submit|remote|com|digg|http|open|window|return|if|Digg'.split('|')))*/ Digg = { remoteSubmit: function(url, title, bodytext, topic) { if(!url) return; title = title || ''; bodytext = bodytext || ''; topic = topic || ''; window.open('http://digg.com/remote-submit?phase=2&url='+url+'&title='+title+'&bodytext='+bodytext+'&topic='+topic+'&s=d797e79292867d0b9369ab247c9fac9b', new Date().getTime(),'toolbar=1,scrollbars=1,location=0,statusbar=1,menubar=1,resizable=1,width=650,height=450'); } } /* Copyright 2000-2004 Clickability Inc. */ /* Clickability ButtonServer v4.01 */ /*Functions*/ function getRegionpartnerID(TrackType) { var regionCookie = dj.util.Cookie.getCookie('wsjregion'); var defaultETRegion = 398944; var defaultPVRegion = 399154; if (typeof regionCookie !== "string" || regionCookie.length === 0) { return ((TrackType == "ET") ? defaultETRegion : defaultPVRegion); } var regionid = regionCookie.split(','); var ET = {}; var PV = {}; if (TrackType == 'ET') { ET.na = defaultETRegion; ET.europe = 398949; ET.asia = 398954; ET.india = 398959; // console.log(ET[regionid[0]]); if(typeof regionid[1]!== "string") { return ET[regionid[0]]; } else { return ((regionid[1].toLowerCase()=="india") ? ET[regionid[1]] : ET[regionid[0]]); } } else { PV.na = defaultPVRegion; PV.europe = 399159; PV.asia = 399164; PV.india = 399169; // console.log(PV[regionid[0]]); if(typeof regionid[1]!== "string") { return PV[regionid[0]]; } else { return ((regionid[1].toLowerCase()=="india") ? PV[regionid[1]] : PV[regionid[0]]); } } } function ST () { window.open('http://www.savethis.clickability.com/st/saveThisApp?clickMap=saveThis'+commonLoc,'click',popWin); return false; } function STMouseOver () { window.status='SAVE THIS'; return true; } function STMouseOut () { window.status=''; return true; } function ET () { var _c=new Image(); var _qc='http://s.clickability.com/s?'; _qc+="&7="+regionpartnerID; _qc+="&8="+escape(getEmailURL()); _qc+="&10="+escape(getClickTitle()); _qc+="&19=40003"; _qc+="&21=1"; _qc+="&18="+Math.random(); _c.src=_qc; window.open('http://www.emailthis.clickability.com/et/emailThis?clickMap=create'+commonLoc,'click',popWin); return false; } function ETMouseOver () { window.status='EMAIL THIS'; return true; } function ETMouseOut () { window.status=''; return true; } function MP () { window.open('http://at.wsj.com/mostpopular','click',popWin); return false; } function MPMouseOver () { window.status='MOST POPULAR'; return true; } function MPMouseOut () { window.status=''; return true; } function getClickURL() { if (self.clickURL) return clickURL; return document.location.href; } function getEmailURL() { if (self.emailURL) return emailURL; return getClickURL(); } function getClickTitle() { if (self.clickTitle) return clickTitle; return document.title; } function getClickExpire() { if (self.clickExpire) return clickExpire; return ""; } //document.write('