var nMembersOnline;var nModalShowing=0;var nProfileWin;var sChatWindowTemplate;var nTemp,sTempMediaID;var sModalURL='';var sNotifyHTML='';var sNotifyTag='';var sNotifyCmd='';var nActiveTimer=0;var sBGColor;var sAuthKey='';var nInterval=0;var sHTMLChatUsers='';var sSelectorColor;var aPos=new Array(1,1,1,1);var aNum=new Array(0,0,0,0);function go(sExplanation){} function display_toggle(sWin1,sWin2){$('#'+sWin2).hide('slow');$('#'+sWin1).show('slow');} function open_profile(sUUsername){if(nSPopProfile==1){nProfileWin=window.open('/profile/'+sUUsername+'/','DesiPlanet_Profile','left=50, top=50, height=600, width=820, resizable=yes, scrollbars=yes');if(nProfileWin){nProfileWin.focus();return false;}else{location.href='/profile/'+sUUsername+'/';}}else{location.href='/profile/'+sUUsername+'/';}} function rowhighlight(){$('.row').mouseover(function(){sBGColor=$(this).css('background-color');$(this).css('background-color','#EEEEEE');}).mouseout(function(){$(this).css('background-color',sBGColor);});};function page_permalink(){var sURL=$('#idQuickLink').attr('href');if(prompt('Great! You can link directly to this page with this URL:'+"\n"+'(Click OK to reload webpage to the permalink and cancel to return.)',sURL)){location.href=sURL;}} function spam_show(nCID){$('#idSpamNotice'+nCID).hide();$('#idSpam'+nCID).show();} function AJAX(url,sResponseFunction){$.ajax({url:"/ajax/",type:(url.length>300?'POST':'GET'),data:'user='+sUser+'&'+url,cache:false,success:function(sResponse){var nPos=sResponse.indexOf('|');var nPos2=sResponse.indexOf('|',nPos+1);var sResult=sResponse.substr(nPos+1,nPos2-nPos-1);var sResponseData=sResponse.substr(nPos2+1);try{var sEval=sResponseFunction+'("'+sResult+'","'+sResponseData+'");';if(sResponseFunction!='')eval(sEval);}catch(e){if(nJSFeatures&8)alert("AJAX ERROR\n\n"+sResponse+"\n\nTried:\n"+sEval);}}});};function chat_init(sUUsername){if(nSUID<1){if(confirm('You need to log into DP to chat. Would you like to login?')) location.href='/index/';}else{AJAX('op=chat_initiate&sUUsername='+sUUsername,'chat_init_result');};};function chat_init_result(nResult,sResponse){if(nResult==-1){if(sResponse=='status') alert('Sorry they are in `Away` status mode, and not accepting chats.');else if(sResponse=='offline') alert('Sorry they are offline now.');else alert('Sorry they are not accepting chat requests right now.');}else{var chatwin=window.open('/chat/'+sResponse,nResult,'left=50, top=50, height=300, width=400, resizable=yes, scrollbars=yes,fullscreen=0,location=no,menubar=0,status=no,titlebar=0,toolbar=0');if(chatwin){chatwin.focus();}else{AJAX('op=chat_prevented&nStarter=1&sChatSession='+sResponse,'');if(confirm("You CANNOT chat with popups turned off. For help on turning DP browser popups on, click on OK.")) location.href="/help-popups/";};};};function chat_open(nResult,sResponse){var chatwin=window.open('/chat/'+sResponse,nResult,'left=50, top=50, height=300, width=400, resizable=yes, scrollbars=yes,fullscreen=0,location=no,menubar=0,status=no,titlebar=0,toolbar=0');if(chatwin){chatwin.focus();}else{if(sHTMLChatUsers.indexOf("'"+nResult+"'")<4){sHTMLChatUsers+=(sHTMLChatUsers!=''?', ':'') +""+nResult+" ";if(sHTMLChatUsers.length>20)$('#idHeaderChatBox').css('font-size','11pt');$('#idHeaderChatBox').html(sHTMLChatUsers+"wanted to chat with you.").show();};AJAX('op=chat_prevented&sChatSession='+sResponse,'');};};function change_status(nStatus){AJAX('op=users_changestatus&nStatus='+nStatus,'');} function update_membercount(nResult,sResponse){if(nResult!=-1){if(nResult>0)$('#nUsersOnline').html(nResult);if(sResponse.substr(0,1)==0&&nSUID>0){location.href='/index/&sError=You_Were_Logged_Out';}else if(sResponse.substr(0,1)==1&&sResponse.length>1){sResponse=unescape(sResponse.substr(1,sResponse.length-1));var aResponse=sResponse.split('|');var sCmd='';var sData='';var nQueuePos=0;var nQueueCnt=aResponse.length-1;do{sCmd=aResponse[nQueuePos];sData=aResponse[nQueuePos+1];if(sCmd=='chat'){var aTemp=sData.split('/');chat_open(aTemp[0],sData);}else if(sCmd=='chatstart'){var aTemp=sData.split('/');chat_init(aTemp[0],sData);}else if(sCmd=='chatping'){var aTemp=sData.split('/');var sChatUser=aTemp[0];if(sHTMLChatUsers.indexOf("'"+sChatUser+"'")<4){sHTMLChatUsers+=(sHTMLChatUsers!=''?', ':'') +""+sChatUser+"";$('#idHeaderChatBox').html(sHTMLChatUsers+" wanted to chat with you.").show();};}else if(sCmd=='newmail'){$('#idNewMail').addClass('activeNewMail');$('#idHeaderAnnounceBox').html(sData).show();clearInterval(nInterval);nInterval=setInterval("$('#idHeaderAnnounceBox').hide('slow');",8000);}else if(sCmd=='sound'){$('#idSound').html("");};nQueuePos=nQueuePos+2;}while(nQueuePos0){var sPrevTag=sNotifyTag;sNotifyHTML=$(idTagAlert).html();sNotifyTag=idTagAlert;sNotifyCmd=sCompleteCmd;$(idTagAlert).html(sHTMLAlert);if(nActiveTimer)clearInterval(nActiveTimer);nActiveTimer=setInterval('show_result_done();',nTime);};};function show_result_done(){if(sNotifyTag!=''){$(sNotifyTag).html(sNotifyHTML);sNotifyHTML='';sNotifyTag='';if(sNotifyCmd!='')eval(sNotifyCmd);sNotifyCmd='';};};function insert_editor(idSelected){$('#editortogglebar_'+idSelected).hide();editor_init(idSelected,'style color hilite bold italic');};function insert_editorToggle(idSelector){var nHeight=parseInt($('#'+idSelector).css('height'))-12;var nWidth=parseInt($('#'+idSelector).css('width'));if(nHeight>40&&$('#editortogglebar_'+idSelector).length<1){$('#'+idSelector).before("
[Use HTML Editor]");$('#'+idSelector).after("
");};};function htmleditor_gettext(idBox,nClear){try{editor_synctext(idBox,nClear);}catch(e){}};function htmleditor_appendtext(idBox,sText){try{editor_html_set(idBox,sText,1);}catch(e){}};function htmleditor_settext(idBox,sText){try{editor_html_set(idBox,sText,0);}catch(e){}};function htmleditor_focus(idBox){try{editor_focus(idBox);}catch(e){}};function htmleditor_resize(idBox){try{editor_resize(idBox);}catch(e){}};function get_checkeditems(){var sIDSet='';$("input[@type='checkbox']").each(function(){if($(this)[0].checked&&parseInt($(this).attr('id').substring(5))>0)sIDSet=sIDSet+$(this).attr('id').substring(5)+',';});return(sIDSet!=''?sIDSet.substring(0,sIDSet.length-1):'');};function select_all(){nCheck=!nCheck;$("input[@type='checkbox']").check(nCheck);};function search_clear_textbox(oBox){if(oBox.value.substr(0,7)=='Search ')oBox.value='';};function show_media(sMediaInfo,idMedia){sTempMediaID=idMedia;show_modal('sAction=show_media&sMediaInfo='+sMediaInfo,'');};function show_media_result(nResult,sResponse){if(nResult==1) $('#'+sTempMediaID).html(unescape(sResponse))};function hide_media(sMediaInfo,idMedia){$('#'+idMedia).replaceWith("[Show Media]");$('#hide_'+idMedia).hide();};function hide_all_media(){$('.embedInlineVideo,.embedInlineImage').each(function(){var sID=$(this).attr('id');eval($('#hide_'+sID).attr('href'));});};function add_person(sUsername,nUID){show_modal('sAction=add_relationship&sUUsername='+sUsername+'&nUUID='+nUID,'');};function block_person(sUsername,nUID){if(confirm('Are you sure you want to block '+sUsername+'? (you can unblock them from your [Network] page later)')) AJAX('op=relationship_block&sUUsername='+sUsername+'&nUUID='+nUID,'');};function write_message(sUsername){if(nSUID>0){show_modal('sAction=write_message&sUUsername='+sUsername,'');}else{if(confirm('You need to log into DP to write messages. Would you like to login?')) location.href='/index/';};};function pagenav_init(sSelectorBar,nIdx,nSelectorItems,nSelectorPerPage){var nPageMax=Math.ceil(nSelectorItems/nSelectorPerPage);var sHTML='Page: ';if(nPageMax>1){if(nPageMax>5){if(aPos[nIdx]>2) sHTML+="Prev ";var nStart=(aPos[nIdx]>1?aPos[nIdx]-1:1);var nEnd=((aPos[nIdx]+1)>=nPageMax?nPageMax:aPos[nIdx]+1);if(aPos[nIdx]>2) sHTML+="1 .. ";for(i=nStart;i<=nEnd;i++) sHTML+=""+(aPos[nIdx]==i?''+i+'':i)+" ";if((nPageMax*nSelectorPerPage)>=500) sHTML+='.. ';else if(aPos[nIdx]<(nPageMax-3)&&aPos[nIdx]<=2) sHTML+=".. "+nPageMax+" ";if(aPos[nIdx]<(nPageMax-1)) sHTML+="Next ";}else{for(i=1;i<=nPageMax;i++) sHTML+=""+(aPos[nIdx]==i?''+i+'':i)+" ";};$('#'+sSelectorBar+'Top').html(sHTML).show();$('#'+sSelectorBar+'Bottom').html(sHTML).show();$('#'+sSelectorBar+'RowBottom').show();}else{$('#'+sSelectorBar+'Top').html(' ').show();$('#'+sSelectorBar+'Bottom').hide();};};function post_delete(nCID,sDiv){if(confirm('Are you sure you want to delete this?')) AJAX('op=post_delete&sAuthKey='+sAuthKey+'&nCID='+nCID+'&sDiv='+sDiv,'comment_delete_result');};function comment_delete_result(nResult,sResponse){if(nResult!=-1) $('#'+nResult).hide();else alert('Sorry could not delete it.');};function checktoggle(id){$('#'+id).check(!$('#'+id)[0].checked);};$.fn.check=function(mode){return this.each(function(){this.checked=mode;});};$.fn.getLabel=function(){var a;this.each(function(){if(this.tagName=='SELECT'){var selectElement=this;a=selectElement.options[selectElement.options.selectedIndex].text;}});return a;};function feedback_send(){htmleditor_gettext('idFeedback',1);AJAX('op=feedback_send&sAuthKey='+sAuthKey+'&sSubject='+escape($('#idFeedbackSubject').val())+'&nType='+$('#idType').val() +'&nOID='+$('#idOID').val()+'&sCIDSet='+$('#idCIDSet').val() +'&sMessage='+escape($('#idFeedback').val()),'feedback_send_result');};function feedback_send_result(nResult,sResponse){if(nResult!=-1){if(nResult==1) show_result('idFeedbackButton',1000,"sent. ","feedback_done();");$('#idCIDSet').val('');$('#idFeedback').val('');}else{show_result('idFeedbackButton',3000,"Problems: "+sResponse+"",'');};};function feedback_post_report(nCID,sURL){scroll(0,0);$('#idFeedbackTab').click();$('#idCIDSet').val($('#idCIDSet').val()+','+nCID);try{$('#idFeedback')[0].focus();}catch(e){};var sMsg="\nReported URL: http://"+sURL+"\n\nThis post ... (explain)"+$('#idFeedback').val();$('#idFeedback').val(sMsg);};$.timer(15000,function(timer){AJAX('op=usersonline','update_membercount');});function tab_show(selectedID){if(selectedID!=undefined){selectedID='#'+selectedID;var tabBarID='#'+$(selectedID).parent('.boxTabMenu').attr('id');var activeID='#'+$(tabBarID+' .currentTab').attr('id');$(activeID).removeClass('currentTab').addClass('tabNav');$(activeID+'Box').hide();$(selectedID).removeClass('tabNav').addClass('currentTab');if($(selectedID+'Box').attr('id')){$(selectedID+'Box').show();};};};$(document).ready(function(){$('.boxTabMenu A').each(function(intIndex){$(this).bind('click',function(){var selectedID=$(this).attr('id');tab_show(selectedID);});});$('.txtHeadingClickable').each(function(intIndex){$(this).bind('click',function(){var selectedID='#'+$(this).attr('id')+'Box';$(selectedID).toggle(400);});});if(location.href.indexOf('#')>1){var tabID=location.href.substr(location.href.indexOf('#')+1);if(parseInt(tabID)<100){try{$('#id'+tabID+'Tab').click();}catch(e){};try{$('#'+tabID+'Box').show();}catch(e){};};};$('TEXTAREA').each(function(intIndex){var idTA=$(this).attr('id');if(idTA!=undefined){if(nSHTMLEditorOn==1&&$(this).val().match(/<([^>]+)>/)){insert_editor(idTA);}else{insert_editorToggle(idTA);}}});});