
var activeBlock="";var fanActive=false;var lastJournalMoodID=0;var history_lastPage=null;var PMAC_Call;var PMAC_Tabbing=false;var PMAC_HasFocus=true;var PMAC_LastValue="";var PMAC_NumActive=0;var PMAC_ActiveID=0;var PMAC_ValidUser=false;function editProfileBlock(id){if(id=="Error: -3"){alert("Access Denied.  Make sure you're logged in before continuing.");if(activeBlock!=""&&activeBlock!="Error: -3")editProfileBlock(activeBlock);return;}
var content=document.getElementById(id+'-content');var editLink=document.getElementById(id+'-editLink');if(editLink.style.display=="none"){content.innerHTML="<div style=\"padding: 3px 8px;\">"+ajaxLoadingText+"</div>";getAjaxContent(id+'-content',"profileView-"+id,CURRENT_USERNAME);editLink.style.display="";activeBlock="";}else{content.innerHTML="<div style=\"padding: 3px 8px;\">"+ajaxLoadingText+"</div>";getAjaxContent(id+'-content',"profileEdit-"+id,CURRENT_USERNAME);editLink.style.display="none";activeBlock=id;}
return;}
function saveProfileBlock(id){var sendStr=id;var elems=document.getElementById(id+'-form').elements;for(var i=0;i<elems.length;i++){if(elems[i].id==""||elems[i].className!="ajaxEdit")
continue;if(elems[i].selectedIndex!=null)
sendStr+="|#|"+elems[i].id+"="+elems[i].options[elems[i].selectedIndex].value;else
sendStr+="|#|"+elems[i].id+"="+elems[i].value;elems[i].disabled=true;}
document.getElementById(id+'-save').style.display="none";document.getElementById(id+'-cancel').style.display="none";document.getElementById(id+'-saveStatus').innerHTML="Saving, please wait...";ajaxPutGet("saveProfileBlock",CURRENT_USERNAME,sendStr);return;}
function deleteProfileComment(commentid){if(!confirm('Are you sure you want to delete this profile comment?'))return;document.getElementById('profileDeleteCommentX-'+commentid).innerHTML="<img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" />";setTimeout(function(){ajaxPutGet("deleteProfileComment",commentid,"");},500);return;}
function handleDeleteProfileComment(ret){ret=ret.split("\n")
if(ret[0]=="Error"||ret[0]<0)return;document.getElementById('profileDeleteCommentX-'+ret[0]).style.display='none';if(ret[1]=="AccessDenied"){alert("You do not have permission to delete this comment.  Make sure you're logged in, and try again.");return;}else if(ret[1]=="Success"){document.getElementById('profileCommentBlock-'+ret[0]).style.display='none';return;}
return;}
function handle_profileAddComment(ret){ret=ret.split("\n")
var msgObj=document.getElementById('profileNewComment');var workingObj=document.getElementById('profileNewComment-working');msgObj.disabled=false;msgObj.value="";switch(ret[0]){case"Success":window.location="#ProfileComments";location.reload();break;case"Blocked":alert("The Desktop Nexus member '"+ret[1]+"' has added you to their ignore list, choosing to not accept comments from your account.\n\nThis is their choice, and any attempts to circumvent this block will result in your account being banned by the administration.");workingObj.innerHTML="";break;default:workingObj.innerHTML="";break;}
return;}
function loadForumActivity(userid,type,page){document.getElementById('recent'+type+'-content').innerHTML=ajaxLoadingText;window.location='#recent'+type+'-top';getAjaxContent('recent'+type+'-content','profileView-forumActivity',userid+'-'+type+'-'+page);return;}
function loadRecentActivity(divid,userid,page,type,modules){document.getElementById(divid+'-content').innerHTML=ajaxLoadingText;if(type=="single")
window.location='#'+divid+'-top';getAjaxContent(divid+'-content','profileView-recentActivity',userid+':'+type+':'+modules+'-'+page);return;}
function loadProfileComments(userid,page){document.getElementById('profileCommentsWrapper').innerHTML=ajaxLoadingText;window.location='#profileComments-top';getAjaxContent('profileCommentsWrapper','profileView-profileComments',userid+'-'+page);return;}
function addFan(userid){if(fanActive==true)return;document.getElementById('fanStatusIcon-'+userid).innerHTML="<img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" />";fanActive=true;ajaxPutGet('addFan',userid,"add");return;}
function removeFan(userid){if(fanActive==true)return;document.getElementById('fanStatusIcon-'+userid).innerHTML="<img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" />";fanActive=true;ajaxPutGet('addFan',userid,"remove");return;}
function handleAddFan(ret){ret=ret.split("\n")
if(ret[0]!="add"&&ret[0]!="remove"&&ret[0]!="self")return;if(ret[1]<1)return;if(fanActive==false)return;if(ret[0]=="add"){document.getElementById('fanButtonLink-'+ret[1]).onclick=function(){removeFan(ret[1]);};document.getElementById('fanButtonIcon-'+ret[1]).src="http://cdn.desktopnexus.com/images/stop-being-a-fan.gif";document.getElementById('fanButtonIcon-'+ret[1]).alt="Stop Being a Fan";}else if(ret[0]=="remove"){document.getElementById('fanButtonLink-'+ret[1]).onclick=function(){addFan(ret[1]);};document.getElementById('fanButtonIcon-'+ret[1]).src="http://cdn.desktopnexus.com/images/become-a-fan.gif";document.getElementById('fanButtonIcon-'+ret[1]).alt="Become a Fan";}else if(ret[0]=="self"){alert("We know you're proud of your work, but unfortunately you cannot become a fan of yourself!");}else if(ret[0]=="max"){alert("Unfortunately due to the complexities of the fan activity system, you can only be a fan of 200 other members.\n\nPlease choose your top two hundred favorite members to follow.");}
setTimeout("document.getElementById('fanStatusIcon-"+ret[1]+"').innerHTML = '';",500);fanActive=false;return;}
function profileHideUpdate(aid){var linkobj=document.getElementById('profileActivityBlockHide-'+aid);linkobj.onclick=function(){};linkobj.innerHTML=linkobj.innerHTML+" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" alt=\"\" border=\"0\" />";ajaxPutGet('profileHideUpdate',CURRENT_USERID,aid);return;}
function handleProfileHideUpdate(aid){if(!aid||aid<1)return;setTimeout("document.getElementById('profileActivityBlock-"+aid+"').style.display = 'none';",1000);return;}
function profileMemberIgnoreRemove(id){document.getElementById('profileMemberIgnoreLinkStatus-'+id).innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" alt=\"\" border=\"0\" />";ajaxPutGet('profileMemberIgnoreRemove',id,'');return;}
function handleProfileMemberIgnoreRemove(ret){ret=ret.split('\n');if(ret[0]!="Success")return;var countBlock=document.getElementById('profileMemberIgnoreCount');var IMBlock=document.getElementById('ignoreMember-'+ret[1]);IMBlock.style.display='none';IMBlock.innerHTML='';IMBlock.id='';countBlock.innerHTML=parseInt(countBlock.innerHTML)-1;if(countBlock.innerHTML=="0")
document.getElementById('profileMemberIgnoreList').innerHTML="<span style=\"font-size: 8pt; color: #666; font-weight: normal;\">You are not currently ignoring any members.</span>";return;}
function profileMemberIgnoreAdd(){var objIM=document.getElementById('newIgnoreMember');if(objIM.disabled==true)return;if(objIM.value=="")return;document.getElementById('profileMemberIgnoreStatus').innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" alt=\"\" border=\"0\" />";objIM.disabled=true;ajaxPutGet('profileMemberIgnoreAdd',objIM.value,'');return;}
function handleProfileMemberIgnoreAdd(ret){document.getElementById('newIgnoreMember').disabled=false;document.getElementById('profileMemberIgnoreStatus').innerHTML='';document.getElementById('newIgnoreMember').focus();if(ret=="Self"){alert("Sorry, you cannot ignore yourself.  For the voices in your head, we recommend perphenazine.");return;}
if(ret=="NoSuchAccount"){alert("We could not find a member with that account name on Desktop Nexus.\n\nPlease double-check the spelling and try again.");return;}
if(ret=="Moderator"){alert("Sorry, you cannot ignore a moderator or administrator account.");return;}
if(ret=="Duplicate")return;ret=ret.split('-');if(ret.length!=2)return;var objBlock=document.getElementById('profileMemberIgnoreList');var countBlock=document.getElementById('profileMemberIgnoreCount');if(countBlock.innerHTML==0)
objBlock.innerHTML="";var newDiv=document.createElement('div');newDiv.id='ignoreMember-'+ret[0];newDiv.innerHTML="<a href=\"http://my.desktopnexus.com/"+ret[1]+"/\">"+ret[1]+"</a> <a class=\"delLink\" href=\"javascript:void(0);\" onclick=\"javascript: profileMemberIgnoreRemove('"+ret[0]+"');\">[Del]</a>"+" <span id=\"profileMemberIgnoreLinkStatus-"+ret[0]+"\"></span>"+"<br />";objBlock.appendChild(newDiv);document.getElementById('newIgnoreMember').value="";countBlock.innerHTML=parseInt(countBlock.innerHTML)+1;return;}
function savePersonalPreferences(){document.getElementById('personalPrefStatus').innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" />";var defWallObj=document.getElementById('defWallResolution');var cFObj=document.getElementById('contentFilter');var iMObj=document.getElementById('invisibleMode');var sTPObj=document.getElementById('hideThumbPopup');var iM=0;if(iMObj.checked)iM=1;var sTP=0;if(sTPObj.checked)sTP=1;var cF=0;if(cFObj.checked)cF=1;var sendStr="contentFilter##"+cF+"||";sendStr=sendStr+"invisibleMode##"+iM+"||";sendStr=sendStr+"hideThumbPopup##"+sTP+"||";sendStr=sendStr+"defWallResolution##"+defWallObj.options[defWallObj.selectedIndex].value;cFObj.disabled=true;iMObj.disabled=true;sTPObj.disabled=true;defWallObj.disabled=true;ajaxPutGet("savePersonalPreferences",CURRENT_USERNAME,sendStr);return;}
function handleSavePersonalPreferences(ret){var defWallObj=document.getElementById('defWallResolution');var cFObj=document.getElementById('contentFilter');var iMObj=document.getElementById('invisibleMode');var sTPObj=document.getElementById('hideThumbPopup');var statusObj=document.getElementById('personalPrefStatus');cFObj.disabled=false;iMObj.disabled=false;sTPObj.disabled=false;defWallObj.disabled=false;if(ret>0)statusObj.innerHTML=" <span style=\"color: #090;\">Saved!</span>";else statusObj.innerHTML=" <span style=\"color: #A00;\">An unknown error has occurred.</span>";return;}
function checkHash(){var hashStr=document.location.hash;hashStr=hashStr.replace("#","");if(hashStr=="")hashStr="recentActivity";history_lastPage=hashStr;var newDiv=document.createElement('div');newDiv.className='profileMyLoadBox';newDiv.appendChild(document.createTextNode("Loading content..."));document.getElementById('profileHomeWrapper').innerHTML="";document.getElementById('profileHomeWrapper').appendChild(newDiv);getAjaxContent('profileHomeWrapper','profileHomeContent',hashStr);return;}
function timedCheckLocation(){if(history_lastPage==null)return;var hashStr=document.location.hash;hashStr=hashStr.replace("#","");if(history_lastPage==hashStr)
return;if(history_lastPage=="recentActivity"&&hashStr=="")
return;checkHash();return;}
function profileRedir(page){window.location='#'+page;checkHash();return;}
function newJournalEntry(){var jTitle=document.getElementById('journalTitle').value;var jMood=document.getElementById('journalMood').value;var jContent=document.getElementById('journalContent').value;var jResponseLoc=document.getElementById('responseToLoc').value;var jEditID=document.getElementById('journalEditID').value;if(jTitle==""){alert("Please choose a title for your journal entry before saving.");return;}
if(jMood=="0"){alert("Please select your current mood by clicking on one of the smiley faces.");return;}
if(jContent==""){alert("You can't submit a blank journal entry.\n\nPlease compose your entry in the large textarea above before saving.");return;}
if(document.getElementById('responseToChk').checked==false)
jResponseLoc='';document.getElementById('newJournalEntrySaveBtn').onclick=function(){};document.getElementById('newJournalEntry-saving').innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" /> <span style=\"font-size: 11pt; font-weight: bold; color: #6A89B0;\">Saving...</span>";ajaxPutGet('newJournalEntry',jMood+"|"+jEditID+"|"+jResponseLoc+"|"+jTitle,jContent);return;}
function handleNewJournalEntry(ret){ret=ret.split('\n');if(ret[0]!="Success"){switch(ret[0]){case"BadResponseDomain":case"MalformedResponse":case"InvalidResponseID":case"InvalidResponseOwnership":alert("You checked that this post is a response to another journal entry, but we could not validate the URL that you entered.\n\nPlease make sure the entry you're responding to is located on DesktopNexus.com, and make sure the location is in the format: http://my.desktopnexus.com/Username/journal/example-entry-000/");document.getElementById('responseToLoc').focus();break;default:alert("Sorry!  An unknown error has occurred.  Please save your post and try again later.");break;}
document.getElementById('newJournalEntry-saving').innerHTML="";document.getElementById('newJournalEntrySaveBtn').onclick=newJournalEntry;return;}
window.location=ret[1];return;}
function modifyPassword(){var curPass=document.getElementById('currentPassword');var newPass1=document.getElementById('newPassword1');var newPass2=document.getElementById('newPassword2');if(curPass.value==""){alert("Error: Please enter your current password!");curPass.focus();return;}
if(newPass1.value==""){alert("Error: Please enter a new password!");newPass1.focus();return;}
if(newPass2.value==""){alert("Error: Please retype your new password!");newPass2.focus();return;}
if(newPass1.value!=newPass2.value){alert("Error: Your new passwords do not match! Please try again.");newPass1.value="";newPass2.value="";newPass1.focus();return;}
document.getElementById('modifyPassword-saving').innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" /> <span style=\"font-size: 11pt; font-weight: bold; color: #6A89B0;\">Saving...</span>";curPass.disabled=true;newPass1.disabled=true;newPass2.disabled=true;ajaxPutGet('modifyPassword',curPass.value,newPass1.value);return;}
function handleModifyPassword(ret){var curPass=document.getElementById('currentPassword');var newPass1=document.getElementById('newPassword1');var newPass2=document.getElementById('newPassword2');var statusObj=document.getElementById('modifyPassword-saving');curPass.value='';curPass.disabled=false;newPass1.disabled=false;newPass2.disabled=false;if(ret=="InvalidCurrent"){statusObj.innerHTML="";alert("Invalid current password.  Please try again.");curPass.focus();return;}
newPass1.value='';newPass2.value='';if(ret=="Success")
statusObj.innerHTML=" <span style=\"font-size: 12pt; color: #090;\">Saved!</span>";else
statusObj.innerHTML=" <span style=\"font-size: 12pt; color: #A00;\">An unknown error occurred. Please try again later.</span>";return;}
function saveEmailNotifications(){var boxes=['newsletter','site','pms','wallpaper','journal','profile','fan'];var retStr="";var tempObj=null;for(i=0;i<boxes.length;i++){if(retStr!="")retStr=retStr+":";tempObj=document.getElementById('emailNotifications-'+boxes[i]);if(tempObj.checked==true)
retStr=retStr+boxes[i]+"-"+"1";else
retStr=retStr+boxes[i]+"-"+"0";tempObj.disabled=true;}
document.getElementById('emailNotifications-saving').innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" /> <span style=\"font-size: 11pt; font-weight: bold; color: #6A89B0;\">Saving...</span>";ajaxPutGet('saveEmailNotifications',retStr,'');return;}
function handleSaveEmailNotifications(ret){var boxes=['newsletter','site','pms','wallpaper','journal','profile','fan'];var statusObj=document.getElementById('emailNotifications-saving');for(i=0;i<boxes.length;i++){document.getElementById('emailNotifications-'+boxes[i]).disabled=false;}
if(ret=="Success")
statusObj.innerHTML=" <span style=\"font-size: 12pt; color: #090;\">Saved!</span>";else
statusObj.innerHTML=" <span style=\"font-size: 12pt; color: #A00;\">An unknown error occurred. Please try again later.</span>";return;}
function journalMoodSelect(moodid){document.getElementById('journalMood').value=moodid;if(lastJournalMoodID!="0")
document.getElementById('journalMoodIcon'+lastJournalMoodID).className="journalMoodIcon";document.getElementById('journalMoodIcon'+moodid).className="journalMoodIcon journalMoodIconActive";lastJournalMoodID=moodid;return;}
function profileJournalResponseChkClk(){var blkObj=document.getElementById('responseToBlock');if(document.getElementById('responseToChk').checked==true)
blkObj.style.display='block';else
blkObj.style.display='none';return;}
function profileJournalResponseLocFocus(){var locObj=document.getElementById('responseToLoc');locObj.style.color='#000';locObj.value='';locObj.onfocus=function(){};return;}
function deleteJournalEntry(entryID){if(!confirm('Are you sure you wish to permanently delete this journal entry?\n\nThere is no recovery after it is deleted.'))return;document.getElementById('deleteEntryLink').onclick=function(){};ajaxPutGet('deleteJournalEntry',entryID,'');return;}
function handleDeleteJournalEntry(ret){ret=ret.split('\n');if(ret[0]!="Success")return;window.location="http://my.desktopnexus.com/"+ret[1]+"/journal/";return;}
function profilePMsMassCheck(){var inputs=document.getElementById('PMMessageList').getElementsByTagName("input");var valToSet=document.getElementById('msgchk-all').checked;var counter=0;for(var i=0;i<inputs.length;i++){if(inputs[i].getAttribute("type")=="checkbox"&&inputs[i].id!=""&&inputs[i].id!="msgchk-all"){inputs[i].checked=valToSet;counter++;}}
if(valToSet==false)
counter=0;profilePMUpdateNumSelected(counter);return;}
function profilePMsToggleDisabled(isdisabled){if(isdisabled!=true&&isdisabled!=false)return;var inputs=document.getElementById('PMMessageList').getElementsByTagName("input");for(var i=0;i<inputs.length;i++){if(inputs[i].getAttribute("type")=="checkbox"&&inputs[i].id!=""){inputs[i].disabled=isdisabled;}}
document.getElementById('PMMessageListTop-MassDelete').disabled=isdisabled;document.getElementById('PMMessageListTop-MassRead').disabled=isdisabled;document.getElementById('PMMessageListTop-MassUnread').disabled=isdisabled;document.getElementById('PMMessageListBottom-MassDelete').disabled=isdisabled;document.getElementById('PMMessageListBottom-MassRead').disabled=isdisabled;document.getElementById('PMMessageListBottom-MassUnread').disabled=isdisabled;return;}
function profilePMsGetChecked(justCount){var inputs=document.getElementById('PMMessageList').getElementsByTagName("input");var ret="";var parts=null;var counter=0;for(var i=0;i<inputs.length;i++){if(inputs[i].getAttribute("type")=="checkbox"&&inputs[i].id!=""&&inputs[i].id!="msgchk-all"&&inputs[i].checked==true){if(justCount==false){parts=inputs[i].id.split("-");if(parts.length!=2)continue;if(ret=="")ret=parts[1];else ret=ret+","+parts[1];}
counter++;}}
if(justCount==true)
return counter;else
return ret;}
function profilePMUpdateNumSelected(numChecked){if(numChecked<1)
numChecked=profilePMsGetChecked(true);var selectedObj=document.getElementById('PMMessageList-NumSelected');if(numChecked<1)
selectedObj.innerHTML="";else
selectedObj.innerHTML=" ("+numChecked+" Selected)";return;}
function profilePMAction(action,option){if(action!="read"&&action!="unread"&&action!="delete")return;if(option=="mass")
option=profilePMsGetChecked(false);if(option=="")return;if(action=="delete"){var num=option.split(",");var question="";if(num.length==1||option!="mass")
question="Are you sure you want to delete this message?";else
question="Are you sure you want to delete these "+num.length+" messages?";if(confirm(question)==false)return;}
if(option=="mass"){profilePMsToggleDisabled(true);document.getElementById('PMMessageList-top-saving').innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" />";document.getElementById('PMMessageList-bottom-saving').innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" />";}
ajaxPutGet('PMAction',action,option);return;}
function handle_profilePMAction(ret){if(ret=="Error")return;var ids="";var isSingle=false;var linkObj;ret=ret.split("\n");if(ret[0]=="single"){window.location="#PM/inbox";checkHash();return;}
ids=ret[1].split(",");for(i=0;i<ids.length;i++){linkObj=document.getElementById('PMSubjectLink-'+ids[i]);if(ret[0]=="read"){linkObj.style.fontWeight='normal';linkObj.style.paddingLeft='0';linkObj.style.background='';}else if(ret[0]=="unread"){linkObj.style.fontWeight='bold';linkObj.style.paddingLeft='20px';linkObj.style.backgroundImage="url('http://cdn.desktopnexus.com/images/pm-envelope.gif')";linkObj.style.backgroundRepeat='no-repeat';linkObj.style.backgroundPosition='0 1px';}else if(ret[0]=="delete"){linkObj.style.fontWeight='normal';linkObj.style.color='#888';linkObj.style.textDecoration='line-through';linkObj.onclick=function(){};document.getElementById('msgchk-'+ids[i]).disabled=true;document.getElementById('msgchk-'+ids[i]).id="";}}
profilePMsToggleDisabled(false);document.getElementById('PMMessageList-top-saving').innerHTML="";document.getElementById('PMMessageList-bottom-saving').innerHTML="";return;}
function composePMUp(e){var toObj=document.getElementById('ComposePMTo');var evt=(e)?e:(window.event)?window.event:null;if(evt)keyCode=(evt.charCode)?evt.charCode:((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0));if(keyCode<0)return;if(keyCode==40||keyCode==38){composePMHighlightEnd(toObj.value.length-PMAC_LastValue.length);return;}
if(!(keyCode>65&&keyCode<90)&&!(keyCode>48&&keyCode<57)&&!keyCode==190&&!keyCode==189)
return;if(toObj.value==PMAC_LastValue)return;PMAC_LastValue=toObj.value;if(toObj.value==""){document.getElementById('PMACDiv').style.display='none';return;}
if(PMAC_Call)
clearTimeout(PMAC_Call);document.getElementById('PMAC-working').innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" align=\"top\" >";PMAC_Call=setTimeout(function(){ajaxPutGet('composePMAC',document.getElementById('ComposePMTo').value,'');},250);return;}
function parseComposePMAC(raw_uns){var PMACDiv=document.getElementById('PMACDiv');var toTextbox=document.getElementById('ComposePMTo');var workingDiv=document.getElementById('PMAC-working');var usernames=eval(raw_uns);var newIH="";var toValueLower=toTextbox.value.toLowerCase();workingDiv.innerHTML="";if(usernames.length>0){workingDiv.innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/accept.gif\" border=\"0\" alt=\"\" align=\"top\" >";PMAC_ValidUser=true;}else{workingDiv.innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/red_x.gif\" border=\"0\" alt=\"\" align=\"top\" >";PMAC_ValidUser=false;}
if(usernames.length<1)
newIH="<div style=\"padding: 12px 18px 12px 8px; font-style: italic;\">No matching members found!</div>";if(PMAC_HasFocus==false){PMACDiv.style.display='none';return;}
for(i=0;i<usernames.length;i++){if(i==0){if(toValueLower==usernames[i].toLowerCase().substr(0,toTextbox.value.length)){toTextbox.value=usernames[i];composePMHighlightEnd(toTextbox.value.length-PMAC_LastValue.length);}}
newIH=newIH+"<a id=\"PMAC_Link_"+(i+1)+"\" href=\"javascript:void(0);\" onclick=\"javascript:composePMSelect();\" onmouseover=\"javascript:composePMToMouseOver('"+(i+1)+"');\">"+usernames[i]+"</a>";}
PMAC_NumActive=usernames.length;PMACDiv.innerHTML=newIH;PMACDiv.style.display='block';return;}
function composePMHighlightEnd(numChars){if(numChars<0)return;var toTextbox=document.getElementById('ComposePMTo');if(toTextbox.setSelectionRange){toTextbox.focus();toTextbox.setSelectionRange(toTextbox.value.length-numChars,toTextbox.value.length);}else if(toTextbox.createTextRange){toTextbox.focus();var r=toTextbox.createTextRange();r.collapse(true);r.moveStart('character',toTextbox.value.length-numChars);r.moveEnd('character',toTextbox.value.length);r.select();}
return;}
function composePMDown(e){var toTextbox=document.getElementById('ComposePMTo');var toDiv=document.getElementById('PMACDiv');var keyCode=-1;var evt=(e)?e:(window.event)?window.event:null;if(evt)keyCode=(evt.charCode)?evt.charCode:((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0));if(keyCode<0)return;if(keyCode!=9)PMAC_HasFocus=true;switch(keyCode){case 40:PMAC_MoveSelect('down');break;case 38:PMAC_MoveSelect('up');break;case 9:PMAC_Tabbing=true;case 13:composePMSelect();break;}
return;}
function PMAC_MoveSelect(way){if(PMAC_NumActive<1)return;if(way!="up"&&way!="down")return;if(PMAC_ActiveID>0)
document.getElementById('PMAC_Link_'+PMAC_ActiveID).className="";if(way=="up")PMAC_ActiveID--;else PMAC_ActiveID++;if(PMAC_ActiveID<0)PMAC_ActiveID=PMAC_NumActive;if(PMAC_ActiveID>PMAC_NumActive)PMAC_ActiveID=0;if(PMAC_ActiveID==0)return;document.getElementById('PMAC_Link_'+PMAC_ActiveID).className="active";return;}
function composePMSelect(){var toTextbox=document.getElementById('ComposePMTo');var subjectTextbox=document.getElementById('ComposePMSubject');var toDiv=document.getElementById('PMACDiv');if(PMAC_NumActive>=0&&PMAC_ActiveID>0){toTextbox.value=document.getElementById('PMAC_Link_'+PMAC_ActiveID).innerHTML;}
toDiv.style.display="none";if(PMAC_Tabbing==false)
subjectTextbox.focus();PMAC_Tabbing=false;PMAC_HasFocus=false;PMAC_ActiveID=0;return;}
function composePMToMouseOver(id){if(PMAC_ActiveID>0){var oldObj=document.getElementById('PMAC_Link_'+PMAC_ActiveID);if(oldObj)oldObj.className='';}
document.getElementById('PMAC_Link_'+id).className='active';PMAC_ActiveID=id;return;}
function profileAddComment(who){if(who=="")return;var messageObj=document.getElementById('profileNewComment');if(messageObj.disabled==true)return;if(messageObj.value==""){alert("Error: Please enter a message to post.");messageObj.focus();return;}
messageObj.disabled=true;document.getElementById('profileNewComment-working').innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" />";ajaxPutGet('profileAddComment',who,messageObj.value);return;}
function profileSendPM(){var threadidObj=document.getElementById('ComposePMThreadID');var toObj=document.getElementById('ComposePMTo');var subjectObj=document.getElementById('ComposePMSubject');var messageObj=document.getElementById('ComposePMMessage');if(subjectObj.disabled==true)return;if(toObj.value==""){alert("Please enter a Desktop Nexus member to receive this PM.");toObj.focus();return;}
if(subjectObj.value==""){alert("Please enter a subject for this PM.");subjectObj.focus();return;}
if(messageObj.value==""){alert("Please enter a message body for this PM");messageObj.focus();return;}
if(PMAC_ValidUser==false){alert("The recipient you have entered does not exist on Desktop Nexus.\n\nPlease double-check the username and try again.");toObj.focus();return;}
toObj.disabled=true;subjectObj.disabled=true;messageObj.disabled=true;ajaxPutGet('sendPM',toObj.value,threadidObj.value+"\n"+subjectObj.value+"\n"+messageObj.value);return;}
function handle_profileSendPM(ret){var toObj=document.getElementById('ComposePMTo');var subjectObj=document.getElementById('ComposePMSubject');var messageObj=document.getElementById('ComposePMMessage');ret=ret.split("\n");switch(ret[0]){case"NoSuchUser":alert("The recipient you have entered does not exist on Desktop Nexus.\n\nPlease double-check the username and try again.");workingDiv.innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/red_x.gif\" border=\"0\" alt=\"\" align=\"top\" >";PMAC_ValidUser=false;toObj.focus();break;case"InvalidData":alert("An invalid subject and/or message was entered.  Please double-check your input and try again.");subjectObj.focus();break;case"RateLimit":if(ret[1]!="1")sIns="s";else sIns="";alert("You are trying to send private messages too fast and have hit our rate limit.\n\nPlease try again in "+ret[1]+" second"+sIns+".");break;case"Blocked":alert("The Desktop Nexus member '"+ret[1]+"' has added you to their ignore list, choosing to not accept Private Messages from your account.\n\nThis is their choice, and any attempts to circumvent this block will result in your account being banned by the administration.");break;case"Success":window.location="http://my.desktopnexus.com/#PM/view/"+ret[1];checkHash();return;default:case"UnknownError":alert("An unknown error has occurred. This is likely an internal issue with Desktop Nexus.  Please try again later.\n\nIf the problem persists, please use our 'Contact Us' form and alert us to the issue.");break;}
toObj.disabled=false;subjectObj.disabled=false;messageObj.disabled=false;return;}
function sendPMViolationReport(){var idObj=document.getElementById('PMViolationID');var reasonObj=document.getElementById('PMViolationReason');var commentsObj=document.getElementById('PMViolationComments');reasonObj.disabled=true;commentsObj.disabled=true;document.getElementById('PMViolation-working').innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" align=\"top\" />";ajaxPutGet('PMViolation',idObj.value,reasonObj.value+"\n"+commentsObj.value);return;}
function handle_sendPMViolationReport(ret){if(ret>0){alert("This PM violation has been successfully reported to the administration.\n\nIf action against the offending user is deemed necessary, we will act accordingly.\n\nThank you for reporting this issue.");window.location="#PM/view/"+ret;}else{alert("An unknown error occurred while reporting this PM.  If this continues, please contact support.");window.location="#PM/inbox";}
checkHash();return;}
function profileMyDNLogin(){var unObj=document.getElementById('MyDNLogin-Username');var pwObj=document.getElementById('MyDNLogin-Password');var workingObj=document.getElementById('MyDNLogin-working');if(unObj.disabled==true)return;if(unObj.value==""){alert("Please enter your username.");return;}
if(pwObj.value==""){alert("Please enter your password.");return;}
unObj.disabled=true;pwObj.disabled=true;workingObj.innerHTML=" <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" align=\"top\" />";ajaxPutGet('MyDNLogin',unObj.value,pwObj.value);return;}
function handle_profileMyDNLogin(ret){var unObj=document.getElementById('MyDNLogin-Username');var pwObj=document.getElementById('MyDNLogin-Password');var workingObj=document.getElementById('MyDNLogin-working');unObj.disabled=false;pwObj.disabled=false;workingObj.innerHTML="";if(ret=="1"){ajaxqueue.push(lastAjaxRequest);process_ajaxqueue();shadeDivMouseDown();}else{alert("Invalid username and/or password.\n\nPlease try again.");}
return;}
function postStatusUpdate(){var statusObj=document.getElementById('statusUpdate');if(statusObj.disabled==true)return;if(statusObj.value==""){alert("Error: Please type a status update before submitting.");return;}
statusObj.disabled=true;document.getElementById('statusUpdate-status').innerHTML=" Saving...";ajaxPutGet('postStatusUpdate',statusObj.value,'');return;}
function handle_postStatusUpdate(){document.getElementById('statusUpdate-status').innerHTML=" Updating...";window.location.reload(false);return;}
function fanFeedCustomizeView(){var boxes=["uploads","favorites","wallcomments","profilecomments","forum","journals","fans","currentwall"];var ret="";document.getElementById('fanFeed-customizeView-status').innerHTML="  <img src=\"http://cdn.desktopnexus.com/images/working-blue.gif\" border=\"0\" alt=\"\" /> <span style=\"font-size: 11pt; font-weight: bold; color: #6A89B0;\">Saving...</span>";for(var i in boxes){var tempObj=document.getElementById('fanFeed-'+boxes[i]);tempObj.disabled=true;if(tempObj.checked==true){if(ret=="")
ret=boxes[i]+"-1";else
ret=ret+"="+boxes[i]+"-1";}}
if(ret==""){alert("Please check at least one criteria to view!");for(var i in boxes)
document.getElementById('fanFeed-'+boxes[i]).disabled=false;document.getElementById('fanFeed-customizeView-status').innerHTML="";return;}
ajaxPutGet('fanFeedCustomizeView',ret,'');return;}
function handle_fanFeedCustomizeView(results){shadeDivMouseDown();checkHash();return;}
setInterval("timedCheckLocation();",250);
