function monitorMaxLength(elmt,max){if(typeof (elmt)==="string"){elmt=document.getElementById(elmt)}var counter=document.getElementById(elmt.id+"_counter");var monitor=function(){$(counter).html(this.value.length+"/"+max+" characters");if(this.value.length>max){$(counter).addClass("jx_field_exceeded_label")}else{$(counter).removeClass("jx_field_exceeded_label")}};$(elmt).keyup(monitor);$(elmt).keydown(monitor);$(elmt).change(monitor)}function monitorTextMessage(){monitorMaxLength("jaxtr_dialog_textme_text",120)}function resetCountMonitor(){var counterTxt=$("#jaxtr_dialog_textme_text_counter").html();var slashPos=counterTxt.indexOf("/");var smsVO=getSmsValCache();$("#jaxtr_dialog_textme_text_counter").html(smsVO.length+counterTxt.substring(slashPos)).removeClass("jx_field_exceeded_label")}function openDialog(dlg,requireLogin){closeDialogs();if(requireLogin&&!loggedIn()){var editor_body=document.getElementById("jaxtr_editor_body");var editor_submit=document.getElementById("jaxtr_editor_submit");editor_body.innerHTML="";var status=document.createElement("p");status.id="jaxtr_editor_status";status.style.display="none";editor_body.appendChild(status);editor_body.appendChild(loginForm());editor_submit.onclick=function(){var username=document.getElementById("jaxtr_widget_screen_name").value;var password=document.getElementById("jaxtr_widget_password").value;var success_handler=function(){closeEditor();openDialog(dlg,true)};var error_handler=function(){var status=document.getElementById("jaxtr_editor_status");status.className="jaxtr_editor_status_error";status.style.display="block";status.innerHTML="Invalid Screen Name or Password"};login(username,password,success_handler,error_handler)};editor_submit.value="Login";openEditor("profile_contact_topics","Please Login")}else{var dlg_elmt=document.getElementById("jaxtr_dialog_"+dlg);dlg_elmt=dlg_elmt.parentNode.removeChild(dlg_elmt);var link=document.getElementById("profile_contact_topics");var left=findPosX(link);var top=findPosY(link);dlg_elmt.style.left=left+"px";dlg_elmt.style.top=top+"px";document.body.appendChild(dlg_elmt);dlg_elmt.style.display="block"}}function closeDialogs(){closeEditor();var dialogs=new Array("callme","textme","pingme");for(var i=0;i<dialogs.length;i++){var dialog=document.getElementById("jaxtr_dialog_"+dialogs[i]);dialog.style.display="none"}document.getElementById("jaxtr_dialog_overlay").style.display="none";document.getElementById("jaxtr_dialog_dial_status").innerHTML="";var text=document.getElementById("jaxtr_dialog_textme_text");var smsVO=getSmsValCache();text.value=smsVO.name;text.className=""}function getUserEmail(){var loggedIn=readCookie("jaxtr1");if(loggedIn){if(loggedIn[loggedIn.length-1]=='"'){loggedIn=loggedIn.substring(0,loggedIn.length-1)}var components=loggedIn.split("*");return components[2]}}function send_ping(){var pings=document.getElementById("jaxtr_dialog_pingme_list");var ping=pings[pings.selectedIndex].value;var email=getUserEmail();dialog_show_overlay("Pinging","jaxtr_dialog_pingme_body");jQuery.get("callcontrol",{act:"sendtext",text:ping,email:email,hide:"1",destctx:CJ_OWNER},function(){dialog_hide_overlay();closeDialogs()},"xml")}function sleep(ms){var date=new Date();var curDate=null;do{curDate=new Date()}while(curDate-date<ms)}function openWhy(){document.getElementById("jaxtr_dialog_dial_why_message").style.display="block"}function closeWhy(){document.getElementById("jaxtr_dialog_dial_why_message").style.display="none"}function createWhyMessage(msg){var why_message=document.createElement("div");why_message.id="jaxtr_dialog_dial_why_message";why_message.style.display="none";why_message.innerHTML=msg;var why=document.createElement("div");why.id="jaxtr_dialog_dial_why";var why_target=document.createElement("span");why_target.className="fakelink";why_target.onclick=openWhy;why_target.innerHTML="Why?";why.appendChild(why_target);why.appendChild(why_message);return why}function isNoTermLN(ln){return(-1!=ln.indexOf("00000"))}function dialog_show_overlay(msg,parent){if(msg){document.getElementById("jaxtr_dialog_overlay_message").innerHTML=msg}var overlay=document.getElementById("jaxtr_dialog_overlay");if(parent){overlay=overlay.parentNode.removeChild(overlay);parent_elmt=document.getElementById(parent);parent_elmt.appendChild(overlay)}overlay.style.display="block"}function dialog_hide_overlay(){setTimeout("document.getElementById('jaxtr_dialog_overlay').style.display = 'none'",1000)}function show_dial_results(){dialog_show_overlay("Loading","jaxtr_dialog_dial_body");var form=document.getElementById("jaxtr_dialog_dial_form");form.style.display="none";var results=document.getElementById("jaxtr_dialog_dial_results");results.style.display="block";var submit=document.getElementById("jaxtr_dialog_dial_submit");submit.disabled=true;dialog_hide_overlay()}function show_dial_form(){dialog_show_overlay("Loading","jaxtr_dialog_dial_body");var results=document.getElementById("jaxtr_dialog_dial_results");results.style.display="none";var form=document.getElementById("jaxtr_dialog_dial_form");form.style.display="block";var countries=document.getElementById("jaxtr_dial_country");setCountryPhoneCode(countries.options[countries.selectedIndex].value);var submit=document.getElementById("jaxtr_dialog_dial_submit");submit.disabled=false;dialog_hide_overlay()}function resetTextMeError(){$("#text_me_error").html("").css({display:"none"})}function send_text_message(){var text=document.getElementById("jaxtr_dialog_textme_text").value;if(text.length==0){$("#text_me_error").html("Please enter a message").css({color:"red",display:"block",height:"23px","font-size":"9px"});$("#jaxtr_dialog_textme_text").click(function(){resetTextMeError()});return false}if(text.length>120){$("#text_me_error").html("Please don't exceed 120 characters").css({color:"red",display:"block",height:"23px","font-size":"9px"});$("#jaxtr_dialog_textme_text").click(function(){resetTextMeError()});return false}var email=getUserEmail();dialog_show_overlay("Sending Text Message","jaxtr_dialog_textme_body");jQuery.get("callcontrol",{act:"sendtext",text:text,email:email,hide:"1",destctx:CJ_OWNER},function(){dialog_hide_overlay();closeDialogs()},"xml")}function toggleSidebarBoxCollapse(domid){var box=document.getElementById(domid);box.style.display=box.style.display=="block"?"none":"block"}function toggleProfileTopics(){var box=document.getElementById("profile_contact_topics");var height=box.style.height=="160px"?"360px":"160px";var overflow=box.style.overflow=="hidden"?"scroll":"hidden";box.style.overflow=overflow;box.style.height=height}function addFriend(jaxtrid){try{AjaxRequest.get({url:"/user/AddFriend",parameters:{jid:jaxtrid,method:"addFriend",cafe:"true"},onSuccess:function(response){var xmlDoc=response.responseXML;var result=xmlDoc.getElementsByTagName("response");if(result.length>0){var value=result[0].childNodes[0].nodeValue;if(value=="1"||value=="2"){if(document.getElementById("add_friend")){document.getElementById("add_friend").innerHTML='<img src="'+cdnURL+'/user/img/icons/available_nodown_arrow.gif" alt="friend added"/>'}if(document.getElementById("add_friend_button")){document.getElementById("add_friend_button").innerHTML=""}}}}})}catch(e){}}function cafejaxtr_init(){var lists=document.getElementsByTagName("ul");for(var i=0;i<=lists.length;i++){if(lists[i]&&lists[i].className=="topic_list"){var list_items=lists[i].getElementsByTagName("li");for(var j=0;j<=list_items.length;j++){if(list_items[j]){}}}}if(document.getElementById("profile_contact_actions_list")){var comm_links=document.getElementById("profile_contact_actions_list").getElementsByTagName("li");for(var i=0;i<=comm_links.length;i++){if(comm_links[i]){comm_links[i].onmouseover=showActiveCommLink;comm_links[i].onmouseout=hideActiveCommLink}}}if(typeof cafejaxtr_init_custom!="undefined"){cafejaxtr_init_custom()}}function showActiveCommLink(){this.style.backgroundImage="url("+cdnURL+"'/user/img/cafejaxtr/bg/communication_link_active.png')";this.style.cursor="pointer"}function hideActiveCommLink(){this.style.backgroundImage="url("+cdnURL+"'/user/img/cafejaxtr/bg/communication_link.gif')";this.style.cursor="default"}function showTopicLinks(li){alert(li)}function hideTopicLinks(li){alert(li)}function addTopic(topicid){}function removeTopic(topicid){}function editPicture(message){var html="";if(typeof message!="undefined"){html+='<span style="color: red">'+message+"</span>"}html+='<form enctype="multipart/form-data" name="photoform" action="CafePhoto" method="post">';html+='<input type="file" name="mugShot" id="mugShot" />';html+="</form>";var editor_body=document.getElementById("jaxtr_editor_body");editor_body.innerHTML=html;var editor_submit=document.getElementById("jaxtr_editor_submit");editor_submit.onclick=function(){dialog_show_overlay("Uploading picture","jaxtr_editor_body");document.forms.photoform.submit()};editor_submit.value="Upload";openEditor("profile_attributes","Add a Picture")}function checkEnter(e){var characterCode;if(e&&e.which){e=e;characterCode=e.which}else{e=event;characterCode=e.keyCode}if(characterCode==13){processSuggestTopic();return false}else{return true}}function processSuggestTopic(){var topic=document.getElementById("suggested_topic").value;AjaxRequest.post({url:"impctl",onSuccess:function(request){document.getElementById("jaxtr_editor_body").innerHTML="<p>Thanks for your suggestion. We'll look into it.</p>";document.getElementById("jaxtr_editor_submit").style.display="none";setTimeout("closeEditor()",5000)},parameters:{act:"suggesttopic",topic:topic}})}function suggestTopic(tgt){var p=document.createElement("p");p.appendChild(document.createTextNode("What would you like to talk about?"));p.appendChild(document.createElement("br"));var input=document.createElement("input");input.id="suggested_topic";input.type="text";input.maxlength=40;p.appendChild(input);var editor_body=document.getElementById("jaxtr_editor_body");editor_body.innerHTML="";editor_body.appendChild(p);input.onchange=input.onkeyup=function(){document.getElementById("jaxtr_editor_submit").disabled=false};input.onkeypress=checkEnter;var submit=document.getElementById("jaxtr_editor_submit");submit.onclick=processSuggestTopic;submit.value="Suggest";openEditor(tgt,"Suggest a topic");submit.disabled=true}var widget_collapsed=true;function toggleWidgets(){var list=document.getElementById("jaxtr_widgets_list");var link=document.getElementById("jaxtr_widgets_list_toggle");if(widget_collapsed==true){widget_collapsed=false;list.style.height="auto";list.style.overflow="auto";link.innerHTML="<span class='toggle_accent'><</span> <span class='toggle_main'>less</span>"}else{widget_collapsed=true;list.style.height="70px";list.style.overflow="hidden";link.innerHTML="<span class='toggle_main'>more</span> <span class='toggle_accent'>></span>"}}var topics_collapsed=true;function toggleUserTopics(){if(document.getElementById("profile_contact_topics_toggle_link")){var profile=document.getElementById("profile");var wrapper=document.getElementById("profile_contact_topics");var list=document.getElementById("profile_contact_topics_list");var link=document.getElementById("profile_contact_topics_toggle_link");if(topics_collapsed==true){topics_collapsed=false;profile.className="expanded";list.style.height="200px";wrapper.style.height="245px";list.style.overflowY="scroll";link.innerHTML="<span class='toggle_accent'><</span> <span class='toggle_main'>less</span>"}else{topics_collapsed=true;profile.className="collapsed";wrapper.style.height="145px";list.style.height="100px";list.style.overflow="hidden";list.scrollTop=0;link.innerHTML="<span class='toggle_main'>more</span> <span class='toggle_accent'>></span>"}}}function reportUser(){var editor_body=document.getElementById("jaxtr_editor_body");var editor_submit=document.getElementById("jaxtr_editor_submit");var loggedIn=readCookie("jaxtr1");if(!loggedIn&&typeof CJ_VIEWER!="undefined"){loggedIn=CJ_VIEWER}if(loggedIn){editor_body.innerHTML="<p>Select the reason why you consider the content inappropriate, so that we can review it and determine whether or not it violates our community guidelines:</p><select id='report_abuse_reasons'><option value='0'>Sexual content</option><option value='1'>Hateful or abusive behaviour</option><option value='2'>Infringes copyright</option></select>";editor_submit.onclick=function(){var reasons=document.getElementById("report_abuse_reasons");var reason=reasons[reasons.selectedIndex].value;AjaxRequest.post({url:"impctl",onSuccess:function(request){var xmlText=request.responseText;var reSuccess=new RegExp("success");var reError=new RegExp("error");if(reSuccess.test(xmlText)){s_or_err="success"}else{if(reError.test(xmlText)){s_or_err="error"}}if(s_or_err=="success"){document.getElementById("jaxtr_editor_body").innerHTML="Thank you. We will review the content.";setTimeout("closeEditor()",5000)}else{if(s_or_err=="error"){}}},parameters:{act:"flagcontent",rptBy:CJ_VIEWER,rptFor:CJ_OWNER,reason:reason}})};editor_submit.value="Report"}else{editor_body.innerHTML="";var status=document.createElement("p");status.id="jaxtr_editor_status";status.style.display="hidden";editor_body.appendChild(status);editor_body.appendChild(loginForm());editor_submit.onclick=function(){var username=document.getElementById("jaxtr_widget_screen_name").value;var password=document.getElementById("jaxtr_widget_password").value;var success_handler=function(){reportUser()};var error_handler=function(){var status=document.getElementById("jaxtr_editor_status");status.className="jaxtr_editor_status_error";status.style.display="block";status.innerHTML="Invalid Screen Name or Password"};login(username,password,success_handler,error_handler)};editor_submit.value="Login"}openEditor("profile_actions","Report a Problem")}function addTopic(id,i){var topicsAjax={url:"/user/updatetopics",parameters:{debug:"false",fmt:"json",act:"addTopic",id:id,jid:i},onSuccess:function(response){if(response.responseText!=null&&response.responseText!=""){var topicsJSON=eval("("+response.responseText+")");if(document.getElementById("plus_"+id)){document.getElementById("plus_"+id).innerHTML=""}SELECTED_TOPICS.add(id);refreshTopicList(topicsJSON)}}};var editor_body=document.getElementById("jaxtr_editor_body");if(editor_body){editor_body.innerHTML="Are you sure you want to add this topic to your page?"}openEditor("popular_topics","Confirm?",false,true);var editor_submit=document.getElementById("jaxtr_editor_submit");if(editor_submit){editor_submit.value="OK";editor_submit.onclick=function(){try{AjaxRequest.get(topicsAjax)}catch(e){}closeEditor()}}}function removeTopic(id){var topicsAjax={url:"/user/updatetopics",parameters:{debug:"false",fmt:"json",act:"removeTopic",id:id},onSuccess:function(response){if(response.responseText!=null&&response.responseText!=""){SELECTED_TOPICS.remove(id);var topicsJSON=eval("("+response.responseText+")");refreshTopicList(topicsJSON)}}};var editor_body=document.getElementById("jaxtr_editor_body");if(editor_body){editor_body.innerHTML="Are you sure you want to remove this topic from your page?"}openEditor("profile_contact_topics_list","Confirm?",false,true);var editor_submit=document.getElementById("jaxtr_editor_submit");if(editor_submit){editor_submit.value="OK";editor_submit.onclick=function(){try{AjaxRequest.get(topicsAjax)}catch(e){}closeEditor()}}}function findPosX(obj){var curleft=0;if(obj.offsetParent){while(1){curleft+=obj.offsetLeft;if(!obj.offsetParent){break}obj=obj.offsetParent}}else{if(obj.x){curleft+=obj.x}}return curleft}function findPosY(obj){var curtop=0;if(obj.offsetParent){while(1){curtop+=obj.offsetTop;if(!obj.offsetParent){break}obj=obj.offsetParent}}else{if(obj.y){curtop+=obj.y}}return curtop}function openEditor(parent,label,close,showCancel){var editor_label=document.getElementById("jaxtr_editor_label");editor_label.innerHTML=label;var editor_close=document.getElementById("jaxtr_editor_close");if(close){editor.onclick=close}else{editor_close.onclick=closeEditor}var editor_elmt=document.getElementById("jaxtr_editor");editor_elmt=editor_elmt.parentNode.removeChild(editor_elmt);var parent_elmt=document.getElementById(parent);var left=findPosX(parent_elmt);var top=findPosY(parent_elmt);editor_elmt.style.left=left+"px";editor_elmt.style.top=top+"px";document.body.appendChild(editor_elmt);editor_elmt.style.display="block";var submit=document.getElementById("jaxtr_editor_submit");submit.style.display="inline";submit.disabled=false;if(showCancel){var cancel=document.getElementById("jaxtr_editor_cancel");cancel.style.display="inline";cancel.onclick=closeEditor;cancel.value="Cancel"}else{var cancel=document.getElementById("jaxtr_editor_cancel");cancel.style.display="none"}}function closeEditor(){var editor_elmt=document.getElementById("jaxtr_editor");if(editor_elmt){editor_elmt.style.display="none"}}function startclock(){var thetime=new Date();var nhours=thetime.getHours();var nmins=thetime.getMinutes();var nsecn=thetime.getSeconds();var nday=thetime.getDay();var nmonth=thetime.getMonth();var ntoday=thetime.getDate();var nyear=thetime.getYear();var AorP=" ";if(nhours>=12){AorP="pm"}else{AorP="am"}if(nhours>=13){nhours-=12}if(nhours==0){nhours=12}if(nsecn<10){nsecn="0"+nsecn}if(nmins<10){nmins="0"+nmins}if(nday==0){nday="Sunday"}if(nday==1){nday="Monday"}if(nday==2){nday="Tuesday"}if(nday==3){nday="Wednesday"}if(nday==4){nday="Thursday"}if(nday==5){nday="Friday"}if(nday==6){nday="Saturday"}nmonth+=1;if(nyear<=99){nyear="19"+nyear}if((nyear>99)&&(nyear<2000)){nyear+=1900}if(document.getElementById("clockspot")){document.getElementById("clockspot").innerHTML=nhours+":"+nmins+" "+AorP}setTimeout("startclock()",1000)}function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString()}else{var expires=""}document.cookie=name+"="+value+expires+"; path=/user"}function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf(nameEQ)==0){return c.substring(nameEQ.length,c.length)}}return null}function eraseCookie(name){createCookie(name,"",-1)}function loggedIn(){var cookie=readCookie("jaxtr1");if(cookie=="zap"){cookie=null}if(typeof CJ_VIEWER!="undefined"||cookie){return true}return false}function login(username,password,success_handler,error_handler){var date=new Date();var tzOffsetHours=date.getTimezoneOffset()/60;if(username==""){var status=document.getElementById("jaxtr_editor_status");status.className="jaxtr_editor_status_error";status.style.display="block";status.innerHTML="Please enter your screen name";return }if(password==""){var status=document.getElementById("jaxtr_editor_status");status.className="jaxtr_editor_status_error";status.style.display="block";status.innerHTML="Please enter your password";return }if(username&&username!=""&&password&&password!=""){AjaxRequest.post({url:"callcontrol",parameters:{act:"login",screenName:username,password:password,tzOffset:tzOffsetHours},onSuccess:function(req){var response=req.responseXML;var code=response.getElementsByTagName("code")[0].firstChild.nodeValue;if(code=="ok"){var cookie=response.getElementsByTagName("cookie")[0].firstChild.nodeValue;createCookie("jaxtr1",cookie,7);AjaxRequest.get({url:"/user/login.jsp"});success_handler()}else{error_handler()}}})}}function loginForm(username,password){var div=document.createElement("div");div.id="jaxtr_widget_login_form";div.innerHTML+="<p>Please log in to use this feature</p>";div.innerHTML+="<p><label>Email:</label> <input type='text' id='jaxtr_widget_screen_name' size='10' /></p>";div.innerHTML+="<p><label>Password:</label> <input type='password' id='jaxtr_widget_password' size='10' /></p>";div.innerHTML+="<p><a href='/user/registration.jsp'>No account? Get jaxtr!</a></p>";return div}function capitalize(val){var s=val.substring(0,1).toUpperCase()+val.substring(1,val.length).toLowerCase();return s}function getFlash(movieName){var isIE=navigator.appName.indexOf("Microsoft")!=-1;return(isIE)?window[movieName]:document[movieName]}function voiceBlastClick(){var flash=getFlash("voiceblast");if(flash.vbclick){flash.vbclick()}}function voiceBlastMouseOver(){var flash=getFlash("voiceblast");if(flash.vbmouseover){flash.vbmouseover()}}function voiceBlastMouseOut(){var flash=getFlash("voiceblast");if(flash.vbmouseout){flash.vbmouseout()}}function switchTheme(theme){if(theme){PROFILETHEME=theme;topics_collapsed=false;toggleUserTopics();document.getElementById("profile_widgets_icon").src=cdnURL+"/user/img/cafejaxtr/themes/"+theme+"/icon_widgets.png";document.getElementById("profile_popular_icon").src=cdnURL+"/user/img/cafejaxtr/themes/"+theme+"/icon_popular.png";if(document.getElementById("profile_friends_icon")){document.getElementById("profile_friends_icon").src=cdnURL+"/user/img/cafejaxtr/themes/"+theme+"/icon_friends.png"}if(document.getElementById("profile_recent_icon")){document.getElementById("profile_recent_icon").src=cdnURL+"/user/img/cafejaxtr/themes/"+theme+"/icon_visitors.png"}var i,a,main;for(i=0;(a=document.getElementsByTagName("link")[i]);i++){if(a.getAttribute("rel").indexOf("style")!=-1&&a.getAttribute("title")){a.disabled=true;if(a.getAttribute("title")==theme){a.disabled=false}}}AjaxRequest.post({url:"SaveTheme.action",parameters:{themeName:theme}})}};
