function ReadCookie (name) { var namearg = name + "="; var nlen = namearg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + nlen; if (document.cookie.substring(i, j) == namearg) { var endpos = document.cookie.indexOf (";", j); if (endpos == -1) endpos = document.cookie.length; return unescape(document.cookie.substring(j, endpos)); } i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function WriteCookie(name, value,expireAtSession) { var expstr=""; var vals=new Array(name+"="+escape(value)); if(!expireAtSession){ var expdate=new Date(); // expire cookie in 10 years by default expdate.setTime(expdate.getTime()+10*365*24*60*60*1000); vals[vals.length]="expires="+expdate.toGMTString(); } vals[vals.length]="path=/"; vals[vals.length]="domain=.buzznet.com"; document.cookie=vals.join("; "); } function SetCookie(name,val){WriteCookie(name,val);} function DeleteCookie (name) { var expdate = new Date(); expdate.setTime (expdate.getTime() - 1); // Already gone! var cval = ReadCookie (name); document.cookie = name + "=" + cval + "; expires=" + expdate.toGMTString()+"; path=/; domain=.buzznet.com"; } function doSignUp(){ setValByName("users[user_name]",getValByName("username")); setValByName("password",""); findObj("signform").action="http://www.buzznet.com/www/subscribe/"; return true; } function doSignIn(){ var qs=getGet(new String(location.href)); if(typeof(qs["refer"])!='undefined') setValByName("refer",qs["refer"]); findObj("signform").action="/user/login/"; return true; } function isSignedIn(){ return (ReadCookie("USERNAME")!='' && ReadCookie("USERNAME")!='0' && ReadCookie("USERNAME")) } function clearLoginCookies(){ DeleteCookie("USERNAME"); DeleteCookie("PASSWORD"); DeleteCookie("PHPSESSID"); getUrl("/interface/post/clearlogin/"); } function toggleSearch(showBox){ if(!showBox)showBox="squick"; var boxes="squick speople".split(" "); for(i=0;i'+linktxt+''; } function getSwfFeedTag(type,feedurl,bgcolor,addl){ var ret=""; if(!addl)addl=""; var urlprefix="http://www.buzznet.com"; if(!type || !feedurl)return; if(type=="vert"){ var ret='
'+addl+'
'; }else if(type=="horiz"){ ret='
'+addl+'
'; }else if(type=="mini"){ ret='
'+addl+'
'; } return ret; } function getVideoTag(theurl, width, height,noautostart,previewImg){ var autostart=(noautostart?"&autoStart=false":""); var clip=(previewImg?"&clip="+previewImg:""); if(!width)width="470"; if(!height)height="352"; var ret= ''; return ret; } function getAudioTag(xmlUrl,type,autoStart){ if(!type)type="pop"; autoStart=autoStart?"yes":"no"; if(type=="button"){ width=60;height=60; }else{ width=202;height=120; } return ''; } function encaud(encUrl,type,autoStart){ return getAudioTag(encUrl.base64_decode(),type,autoStart); } function encaudbutton(encUrl,autostart){ return encaud(encUrl,'button',autostart); } function validateSignIn(){ var err=""; if(!getValByName("username")) err+="Please enter your username.\n"; if(!getValByName("password")) err+="Please enter your password\n"; if(err){ alert(err); return; } findObj("signinForm").submit(); } function isValidBnDomainName(name){ if(!name)return 0; if(name.match("/[^a-zA-Z0-9]/"))return 0; return 1; } function isValidVideoPath(path){ var types=".mov .mpg .mpeg .mp4 .avi .3gp .3g2 .wmv .flv".split(" "); for(i=0;i"+themsg+""; return msg; } HTML_CHUNKS=new Array();//---memory cache for reload area return...ugly i know function reloadArea(lObj,contentUrl,progressTxt,errTxt,cacheWithUrl){ if(!(lObj=getDomObj(lObj)))return false; if(!progressTxt)progressTxt=""; if(!errTxt)errTxt=""; if(!window.dojo)return false; if(!contentUrl)return false; setInnerHTML(lObj,progressTxt); if(cacheWithUrl){ if(typeof(HTML_CHUNKS[contentUrl])!='undefined'){ setInnerHTML(lObj,HTML_CHUNKS[contentUrl]); return false; } } dojo.io.bind({ "url":contentUrl, "mimetype":"text/html", "load":function(tp,html,e){ setInnerHTML(lObj,html); HTML_CHUNKS[contentUrl]=html; return; }, "error":function(tp,html,e){ setInnerHTML(lObj,errTxt+"
"+html); return; } }); return true; } function addBuzz(frmObj){ var val=lc(findObj("tags").value); if(!val){ alert("Please enter a Tag to add to this post"); return false; } var words=val.split(","); for(i=0;i6){ alert("Too many words. Make sure you separate your tags with commas"); return false; } } findObj("tags").value=words.join(", "); return true; } function submitBuzz(formObj){ /* referenced document elements in this function: addtagsmenu - the pop-up layer containing the tag form buzztable - the table containing the tag form buzzstatus - the layout outside the buzztable that appears telling the user it's thinking taglist - the list of links where the tags fill in tags - the form object containing the tags the user is submitting addtagsbut - the toolbar button the user clicks to open the menu w/ the form */ if(!addBuzz())return false; eid=formObj.elements["id"].value; lmode=formObj.elements["lmode"].value; setToOffsetSize("addtagsmenu"); toggleDisp("buzztable","none"); setInnerHTML("buzzstatus",progresstable("Please wait while Tags are added")); var kw = { mimetype: "text/plain", formNode: formObj, load: function(t,txt,e){ var msg=txt.split(":"); if(msg[0]=="false" || !msg[0]){ var error="Error adding tags: "+msg[1]; setInnerHTML("buzzstatus",error); toggleDisp("buzztable","block"); return; } if(msg[0]=="true"){ reloadTags("taglist",eid,lmode); setInnerHTML("buzzstatus","Tags added!"); formObj.elements["tags"].value=""; var funcs=new Array("toggleDisp('buzztable','block')"); funcs[funcs.length]="toggleMenu('addtagsmenu','addtagsbut')"; funcs[funcs.length]="setInnerHTML('buzzstatus','')"; setTimeout(funcs.join(";"),750); } }, error: function(t,e){ //toggleDisp("buzztable","block"); //setInnerHTML("buzzstatus","There was an error adding your tags"); return; } }; dojo.io.bind(kw); return false; } /*======== tag registration =======*/ function updateAvail(res){ /* document objects: usernamestatus - div that displays error text for user availability check usernamerow - table row containing the username */ if(typeof(username_error)=="undefined")username_error=0; if(!res["result"] && res["error"]){ setInnerHTML("usernamestatus",'*'+res["error"]+"*"); getDomObj("usernamerow").className="errorfield"; username_error=1; }else{ username_error=0; getDomObj("usernamerow").className=""; setInnerHTML("usernamestatus","buzznet.com"); } } function checkAvail(userval){ if(typeof(username_inited)=="undefined")username_inited=0; if(!userval)return; if(!username_inited)return; isUserNameAvailAsync(userval, updateAvail); } username_error=0; function validateBuzzSignup(mustAgree){ /* document objects: file - file upload field users[user_name] - form field users[email] - form field users[user_password] - form field postformcotnainer - div that contains the entire post form postformmsg - hidden div that appears and gives a status/progress message postform - the form that's being submitted */ var thisyear=new Date().getYear(); if(thisyear<1900)thisyear+=1900; if(!mustAgree)mustAgree=0; var err=""; //---validate file var path=getValByName("file"); if(!isValidPhotoPath(path) && !isValidVideoPath(path)) err+="The file posted is not a valid file type\n"; if(username_error || !isValidBnDomainName(getValByName("users[user_name]"))) err+="Please enter a different username. The name you chose may have invalid characters in it, or it may already be taken\n"; if(getValByName("users[user_password]").length<4) err+="Please enter a password with at least 4 characters\n"; if(!validEmailValue("users[email]")) err+="Please enter a valid email address\n"; var dob=getValByName("users[dob2]"); var dreg=/(\d{4})\-\d{2}\-\d{2}/; if(!(reg=dob.match(dreg))) err+="Please enter your birth date\n"; else{ if((thisyear-reg[1])<14) err+="You're too young to sign up for this website.\n"; } if(mustAgree){ if(!isChecked("agreed_terms")){ var agreetxt=getInnerHtml("agree_terms_title") if(!agreetxt){ agreetxt="Terms of Use"; } err+="You must agree to the "+agreetxt+"\n"; } } if(err.length){ alert(err); return; } toggleDisp("postformcontainer","none"); toggleDisp("postformmsg","block"); setInnerHTML("postformmsg",progresstable("Please wait while your file uploads...")); findObj("postform").submit(); } /*======== end tag registration =======*/ function sendToFriend(){ var err=""; if(!validEmailValue("fromemail")) err+="Please enter your email address\n"; if(!getValByName("toemail")) err+="Please enter your friend's email address or Buzznet user names\n"; if(err.length){ alert(err); return false; } return true; } function submitSendFriend(formObj) { if(!sendToFriend(formObj))return false; setToOffsetSize("sharemenu"); toggleDisp("sharecontainer","none"); var msg="" +"
"+img("/assets/indicator.gif")+"Please while we send this photo.
" setInnerHTML("sharestatus",msg); var kw = { mimetype: "text/plain", formNode: formObj, load: function(t,txt,e){ var msg=txt.split(":"); if(msg[0]=="false" || (msg[0]!="true"&&msg[0]!="false")){ var error="Error sending: "+msg[1]; setInnerHTML("sharestatus",error); toggleDisp("sharecontainer","block"); return; } if(msg[0]=="true"){ setInnerHTML("sharestatus","Message Sent!"); findObj("toemail").value=""; var funcs=new Array("toggleDisp('sharecontainer','block')"); funcs[funcs.length]="toggleMenu('sharemenu','sharebut')"; funcs[funcs.length]="setInnerHTML('sharestatus','')"; setTimeout(funcs.join(";"),750); } }, error: function(t,e){ toggleDisp("sharecontainer","block"); setInnerHTML("sharestatus","There was an error sending the message"); return; } }; dojo.io.bind(kw); return false; } function removeComment(comment_id,linkobj){ var msg="Are you sure you want to remove this comment?"; if(!confirm(msg)){ return false; } lObjName="com"+comment_id; if(!(lObj=getDomObj(lObjName)) || !(listObj=getDomObj("commentlist"))){ location.replace(linkobj.href); return false; } statusdiv=lObjName+"data"; //setInnerHTML(statusdiv,progresstable("Please wait while the comment is removed")); toggleDisp(lObj,"none"); dojo.io.bind({ "url":"/interface/post/comments/remove/?id="+comment_id, "mimetype":"text/html", "load":function(tp,html,e){ var msg=html.split(":"); if(msg[0]=="false"){ setInnerHTML(statusdiv,"ERROR:"+(msg[1]?msg[1]:"")); return; } toggleDisp(lObj,"none"); if((cc=getDomObj("commentcount"))){ val=parseInt(cc.innerHTML); if(!isNaN(val)){ setInnerHTML("commentcount",(val-1)); } } return; }, "error":function(tp,html,e){ var msg=html.split(":"); setInnerHTML(statusdiv,"There was an error removing the comment"); return; } }); } function submitcomform(formobj,loggedin,profilepic){ if(!validateComments(loggedin)){ return false; } if(!window.dojo){ formobj.submit(); return; } if(!findObj("commentlisttbody")){ formobj.submit(); return; } //--get username and user url from from elements var myname="";var myurl=""; if(findObj("myname").value){ myname=findObj("myname").value; }else if(findObj("com[name]")){ myname=findObj("com[name]").value; } if(findObj("myurl").value){ myurl=findObj("myurl").value } if(findObj("com[email]")){ myurl="mailto:"+findObj("com[email]").value; } toggleDisp("commentbuttons","none"); toggleDisp("addcommentstable","none"); toggleDisp("commentstatus","block"); msg=progresstable("Please wait while your comment is posted"); setInnerHTML("commentstatus",msg); dojo.io.bind({ "url":"/interface/post/comments/", "mimetype":"text/html",//---IE seems to be returned an empty object. ghetto sting parsing instead. gay "formNode":formobj, "load":function(tp,html,e){ var error=""; var stat=strfromto(html,'stat="','"'); if(stat=="ok"){ setInnerHTML("commentstatus",""); toggleDisp("commentstatus","none"); toggleDisp("commentbuttons","block"); var comment_id=strfromto(html,"",""); var removecomment="/_removecomment/?id="+comment_id+"&bounceback="+escape(location.href); var image=(profilepic?img(profilepic):img("http://www.buzznet.com/assets/profile-thumb.gif")); //--create the new comment row var tr=document.createElement("tr"); tr.setAttribute("valign","top"); tr.id="com"+comment_id; //label with avatar var td=createEl("td",{"class":"label"}); td.setAttribute("style","text-align:center"); td.innerHTML=image+(loggedin?'
[delete]':""); tr.appendChild(td); //quoted comments var body=nl2br(findObj("com[comments]").value); var reg=/\[(\/)quote\]/g; body=body.replace(reg,"<$1blockquote>"); reg=/\[quote=(\w+)\]/gi; body=body.replace(reg,'
$1 said:
'); //--comment data var td=createEl("td",{"class":"data","valign":"top","id":"com"+comment_id+"data"}) var cbody=myname.link(myurl)+" "+getDateTime() +"
"+body +'
NOTE: Your comment take a few minutes to appear permanently
'; td.innerHTML=cbody; //---display in list tr.appendChild(td); getDomObj("commentlisttbody").appendChild(tr); tr=td=ltxt=0; findObj("com[comments]").value=""; toggleDisp("addcommentstable","block"); //---update list count if((cc=getDomObj("commentcount"))){ val=parseInt(cc.innerHTML); if(!isNaN(val)){ setInnerHTML("commentcount",(val+1)); } } return; }else if(stat=="fail"){ var error=strfromto(html,"",""); if(!error)error="There was an error posting your comment"; }else{ error="There was an error. Your comment may not have been posted"; } if(error){ setInnerHTML("commentstatus",error); toggleDisp("commentbuttons","block"); toggleDisp("addcommentstable","block"); return false; } return false; } }); return false; } function quoteComment(comment_id){ if(!comment_id)return; if(!(combody=findObj("com[comments]")))return; var quoted=findObj("com"+comment_id+"body").innerHTML; //get person's name var user_name; if(obName=getDomObj("com"+comment_id+"name")){ if(a=obName.getElementsByTagName("a")){ a=a[0]; if(a.getAttribute("username")){ user_name=a.getAttribute("username"); } } } var reg=/
.*<\/blockquote>/g; quoted=quoted.replace(reg,""); var reg=//g; quoted=quoted.replace(reg,""); var quote="[quote"+(user_name?"="+user_name:"")+"]"+quoted+"[/quote]\n"; insertTextToInput(combody,strip_tags(quote)); combody.scrollIntoView(); } function removeUserNote(note_id,linkobj,username){ var msg="Are you sure you want to remove this note?"; if(!confirm(msg)){ return false; } lObjName="note"+note_id; if(!(lObj=getDomObj(lObjName)) || !(listObj=getDomObj("commentlist"))){ location.replace(linkobj.href); return false; } statusdiv=lObjName+"data"; setInnerHTML(statusdiv,progresstable("Please wait while the note is removed")); dojo.io.bind({ "url":"/interface/post/notes/delete/?id="+note_id+(user_name?"&user_name="+username:""), "mimetype":"text/html", "load":function(tp,html,e){ var stat=strfromto(html,'stat="','"');; if(stat=="fail"){ var err=strfromto(html,'',''); setInnerHTML(statusdiv,"ERROR: "+err); return; } toggleDisp(lObj,"none"); if((cc=getDomObj("notecount"))){ val=parseInt(cc.innerHTML); if(!isNaN(val)){ setInnerHTML("notecount",(val-1)); } } return; }, "error":function(tp,html,e){ setInnerHTML(statusdiv,"There was an error removing the note"); return; } }); } function addUserNote(formobj,username,profilepic){ //--'notelistbody' - object containing list of notes //--'commentlist' - object containing notelistbody //--'notescontainer' - contains the form field and the buttons //--'notestatus' - hidden layer containing status message while note is posting if(!username){ alert("Couldn't determine your username. Maybe you need to sign in."); return false; } if(!getValByName("note[message]")){ alert("You didn't write anything!"); return false; } if(!window.dojo){ formobj.submit(); return; } if(!findObj("notelistbody")){ formobj.submit(); return false; } //--username stuff myname=username; myurl="http://"+username+".buzznet.com/"; toggleDisp("notescontainer","none"); toggleDisp("notestatus","block"); msg=progresstable("Please wait while your note is posted"); setInnerHTML("notestatus",msg); dojo.io.bind({ "url":"/interface/post/notes/", "mimetype":"text/html",//---IE seems to be returned an empty object. ghetto sting parsing instead. gay "formNode":formobj, "load":function(tp,html,e){ var error=""; var stat=strfromto(html,'stat="','"'); if(stat=="ok"){ setInnerHTML("notestatus",""); toggleDisp("notestatus","none"); toggleDisp("notescontainer","block"); var note_id=strfromto(html,"",""); var removenote="/_note/delete/?id="+note_id+"&bounceback="+escape(location.href); var image=(profilepic?img(profilepic):" "); //--create the new comment row var tr=document.createElement("tr");tr.setAttribute("valign","top"); //label with avatar var td=document.createElement("td");td.className="label"; td.setAttribute("style","text-align:center"); td.innerHTML=image+'
[delete]'; tr.appendChild(td); //--comment data var td=document.createElement("td");td.className="data";td.setAttribute("valign","top"); var cbody=myname.link(myurl)+" "+getDateTime() +"
"+nl2br(findObj("note[message]").value) +'
Your note may take a minute to show up permanently
'; td.innerHTML=cbody; //---display in list tr.appendChild(td); ///getDomObj("notelistbody").appendChild(tr); var notebody=getDomObj("notelistbody"); notebody.insertBefore(tr,notebody.firstChild); tr=td=ltxt=0; findObj("note[message]").value=""; //--jump to top of notes list if(!endswith(location.href,"#notes")) location.href=location.href+"#notes" else location.href=location.href; //---update list count if((cc=getDomObj("notecount"))){ val=parseInt(cc.innerHTML); if(!isNaN(val)){ setInnerHTML("notecount",(val+1)); } } return false; }else if(stat=="fail"){ var error=strfromto(html,"",""); if(!error)error="There was an error posting your note"; }else{ error="There was an error. Your note may not have been posted"; } if(error){ setInnerHTML("notestatus",error); toggleDisp("notescontainer","block"); toggleDisp("commentlist","block"); return false; } return false; } }); return false; } function clearUnreadNotes(){ getUrl("/interface/post/notes/clearmine/"); return true; } function shoutoutEditSetup(containerId,contentDivId,user_name){ var url="/interface/post/profile/"+(user_name?"?user_name="+user_name:""); setUpEditableObject(url, "profile[shoutout]", containerId, contentDivId); } function setUpEditableObject(postUrl, fieldName, containerId, contentId){ /* posturl - url to send the contents of contentObject to fieldName - what to name the field that gets posted to posturl containerObject - object that contains the contentObject (should have dojoType and mode attrs) contentObject - editable text */ dojo.require("dojo.widget.*"); dojo.require("dojo.widget.InlineEditBox"); dojo.require("dojo.event.*"); djConfig["searchIds"].push(containerId);//object that contains the actual shoutout layer var onSaveFuncName=fieldName+"_onSave"; var onLoadFuncName=fieldName+"_onLoad"; window[onSaveFuncName]=function(newval, oldval){ if(newval==oldval) return; var ioargs={}; ioargs["url"]=postUrl; ioargs["method"]="POST"; ioargs["content"]={}; ioargs["content"][fieldName]=newval; ioargs["load"]=function(tp, html, e){ var stat=strfromto(html,'stat="','"'); if(stat!='ok'){ var err=strfromto(html,'',''); alert(err); return; } }; ioargs["error"]=function(tp, html, e){alert("unknown error")}; dojo.io.bind(ioargs); } window[onLoadFuncName]=function(){ dojo.widget.byId(contentId).onSave=window[onSaveFuncName]; } dojo.addOnLoad(window[onLoadFuncName]); } function reloadTags(lObj, entry_id,type){ if(!entry_id)return 0; if(!type)return 0; if(!(lObj=getDomObj(lObj)))return 0; if(!window.dojo)return; setInnerHTML(lObj,"Refreshing..."); dojo.io.bind({ "url":"/interface/post/gettags/?id="+entry_id+"&type="+type, "mimetype":"text/html", "load":function(tp,html,e){ setInnerHTML(lObj,html); } }); } function addAsFriend(linkObj,userName,errTxt){ //--return true will just cause user to navigate to link //--cannot rely on IE xml parsing so doing lame string parsing. ghet-toh if(!confirm("Add "+userName+" as a friend?"))return false; if(!(linkObj=getDomObj(linkObj)))return true; if(!userName)return true; if(!window.dojo)return true; if(!errTxt)errTxt="there was an error"; linkObj.href="#"; setInnerHTML(linkObj,progressimg()); linkObj.onclick=function(){return false;} dojo.io.bind({ "url":"/interface/post/addfriend/?user="+userName, "mimetype":"text/html", "load":function(tp,txt,e){ var status=strfromto(txt,'stat="','"'); if(status=="ok"){ var msg=strfromto(txt,"",""); setInnerHTML(linkObj,""+msg+""); if(linkObj.id){ setTimeout("toggleDisp('"+linkObj.id+"','none')",1500); } return; }else if(status=="fail"){ var msg=strfromto(txt,"",""); setInnerHTML(linkObj,""+msg+""); return; }else{ setInnerHTML(linkObj,""+errTxt+""); return; } } }); return false; } function removeFromFriends(linkObj,userName){ if(!userName)return; if(!confirm("Remove "+userName+" from your friends list?"))return; setInnerHTML(linkObj,"removed!"); linkObj.onclick=function(){return false;} dojo.io.bind({ "url":"/interface/post/removefriend/?user="+userName, "load":function(t,html,e){ if(getRspStat(html)=="ok"){ toggleDisp(linkObj,"none"); return; }else{ err=getRspError(html); if(!err)err="Error!"; setInnerHTML(linkObj,err); } } }); } function addAsFavorite(linkObj,type,typeval,errTxt){ //--return true will just cause user to navigate to link //--cannot rely on IE xml parsing so doing lame string parsing. ghet-toh if(!confirm("Add to your favorites?"))return false; if(!(linkObj=getDomObj(linkObj)))return true; if(!type)return true; if(!typeval)return true; if(!window.dojo)return true; if(!errTxt)errTxt="there was an error"; linkObj.href="#"; setInnerHTML(linkObj,progressimg()); linkObj.onclick=function(){return false;} dojo.io.bind({ "url":"/interface/post/addfav/?type="+type+"&typeval="+typeval, "mimetype":"text/html", "load":function(tp,txt,e){ var status=strfromto(txt,'stat="','"'); if(status=="ok"){ var msg=strfromto(txt,"",""); setInnerHTML(linkObj,""+msg+""); return; }else if(status=="fail"){ var msg=strfromto(txt,"",""); setInnerHTML(linkObj,""+msg+""); return; }else{ setInnerHTML(linkObj,""+errTxt+""); return; } } }); return false; } function removePhoto(linkObj,eid,callBackfunc,username){//--meant to just be a link. not a lot of UI if(!(linkObj=getDomObj(linkObj)))return true; if(!eid)return true; if(!window.dojo)return true; var errtxt="There was an error"; var url="/interface/post/removephoto/?entry_id="+eid; setInnerHTML(linkObj,progressimg()); linkObj.onclick=function(){return false;} dojo.io.bind({ "url":url, "mimetype":"text/html", "load":function(tp,txt,e){ var status=strfromto(txt,'stat="','"'); if(status=="ok"){ var msg="The photo was removed"; setInnerHTML(linkObj,""+msg+""); if(typeof(callBackfunc)=="function"){ callBackfunc(eid); } return; }else if(status=="fail"){ var msg=strfromto(txt,"",""); setInnerHTML(linkObj,""+msg+""); return; }else{ setInnerHTML(linkObj,""+errtxt+""); return; } } }); return false; } function sendPrivateMessage(panelobj,formname,linkobj){ //--return true will just cause user to navigate to link //--cannot rely on IE xml parsing so doing lame string parsing. ghet-toh if(!window.dojo)return true; if(!(panelobj=getDomObj(panelobj)))return true; if(!(formname.elements))return true; if(!(linkobj=getDomObj(linkobj)))return true; //--get vals from form | to_id, subject, body setToOffsetSize(panelobj); linkobj.onclick=function(){return false;} dojo.io.bind({ "url":"/interface/post/sendmessage/", "mimetype":"text/html", "formNode":formname, "load":function(tp,txt,e){ var status=strfromto(txt,'stat="','"'); toggleDisp(panelobj,'none'); if(status=="ok"){ var msg=strfromto(txt,"",""); setInnerHTML(linkobj,""+msg+""); return; }else if(status=="fail"){ var msg=strfromto(txt,"",""); setInnerHTML(linkobj,""+msg+""); return; }else{ setInnerHTML(linkobj,"error sending message"); return; } } }); //---swap out panel area with progress while it sends the request. setInnerHTML(panelobj,progresstable()); return false; } //---------------------upload from tags page function cancelTagsUpload(){ toggleMenu('postpanel','postbutton'); } function doTagsUpload(mustAgree){ if(!mustAgree)mustAgree=0; var filetypes=".jpg .jpeg .wmv .mov .mpg .mpeg .avi .3gp .mp4".split(" "); var err=""; if(!getValByName("new[caption]")) err+="Please give your post a title\n"; var thefile=getValByName("file").toLowerCase(); var typeok=0; if(thefile){ for(i=0;i',''); return id; } function isUserNameAvailAsync(username,callBackFunc){// //returns hash {result:[true|false],error:'error message'}. error emtpy, of course if result key is true //callback func should accept the result has as an arg if(typeof(callBackFunc)!='function' && typeof(callBackFunc)!='object') callBackFunc=false; if(!username){ res={result:false,error:"no args"}; if(callBackFunc) callBackFunc(res); return } //--check name format if(!isValidBnDomainName(username)){ res={ result:false, error:"name should have letters and numbers only" }; callBackFunc(res); return res; } dojo.io.bind({ "url":"/interface/post/checkavail/"+username+"/", "method":"GET", "mimetype":"text/html", "load":function(t,html,e){ var stat=strfromto(html,'stat="','"'); if(stat=="ok"){ if(callBackFunc){ res={result:true} callBackFunc(res); } return; }else{ if(callBackFunc){ var err=strfromto(html,"",""); res={result:false,"error":err}; callBackFunc(res); } return } }, "error":function(t,html,e){} }); } /*===== for rigthside friends list ======*/ function changeFriendView(posttype){ /* document objects: rightsidefriendposts - layer that will fill in with posts lvideos, lphotos, ljournals lall - ids of href links that get bolded when a given list is turned on */ if(!posttype)posttype="all"; var msgmap={ "videos":"getting videos...", "photos":"getting photos...", "journals":"getting journals...", "all":"getting posts..." }; if(!msgmap[posttype])posttype="all"; var msg=msgmap[posttype]; var url="/interface/post/rightfriends/"+posttype+"/"; msg='
'+progresstable(msg)+'
'; reloadArea("rightfriendposts",url,msg,"socket error",true);//last arg tells it to put url contents in mem SetCookie("rshow",posttype); //---make current link bold var idnames="lvideos lphotos ljournals lall".split(" "); for(i=0;i'+progresstable("Getting favorites...")+''); findObj("friendslatestlabel").className=""; findObj("favslatestlabel").className="on"; findObj("morelink").href=user_url+'/favorites/'; var favonload=function(t,html,e){ if(startswith(html,'')){ setInnerHTML("rightfollowlists",strfromto(html,'','')); return; } setInnerHTML("rightfollowlists",html) return; } getUrl("/interface/post/rightfavs/",favonload); return; } SetCookie("rshow","all"); setInnerHTML("rightfollowlists",'
'+progresstable("Getting friends' latest...")+'
'); findObj("friendslatestlabel").className="on"; findObj("favslatestlabel").className=""; findObj("morelink").href=user_url+'/friends/posts/'; var friendonload=function(t,html,e){ if(startswith(html,'')){ setInnerHTML("rightfollowlists",strfromto(html,'','')); return; } setInnerHTML("rightfollowlists",html); return; } getUrl("/interface/post/rightfriendswithnav/",friendonload); } /*========= generic get url =====*/ function getUrlContents(url){//synchronous if(!url)return; ret=""; dojo.io.bind({ "url":url, "method":"GET", "sync":true, "load":function(t,html,e){ret=html;} }); return ret; } function getUrl(url, loadCallBack, errorCallBack){//--asynchronous if(!url)return ""; if(typeof(loadCallBack)!='function' && typeof(loadCallBack)!='object') loadCallBack=function(t,html,e){void(0);} if(typeof(errorCallBack)!='function' && typeof(errorCallBack)!='object') errorCallBack=function(t,html,e){void(0);} dojo.io.bind({ "url":url, "method":"GET", "load":loadCallBack, "error":errorCallBack }); } function getRspStat(txt){ if(!txt)return ""; return strfromto(txt,'",""); } function getRspOk(txt){ if(!txt)return ""; return strfromto(txt,'',""); } function loadRightFollowBar(){ var loadcallback=function(t,html,e){ setInnerHTML("rightside",html); } getUrl("/interface/post/followbar/?_rui_="+escape(location.href),loadcallback); } /*============================= forums =========================*/ function SubmitNewReply(formObj){ var err=""; if(!getValByName("reply[body]")){ err+="Please enter a reply body\n"; } if(err.length){ alert(err); return false; } return true; } function DeleteReply(reply_id){ if(!reply_id)return; if(!confirm("Are you sure you want to delete this reply?"))return; var theurl="/interface/post/forum/deletereply/?id="+reply_id; var rrow="reply-"+reply_id+"-row"; var rcell="reply-"+reply_id+"-cell"; var rtable="replylist"; setInnerHTML(rcell,progresstable("Deleting reply...")); function drerror(errmsg){ if(!errmsg)errmsg=""; setInnerHTML(rcell,"There was a problem removing the reply. "+errmsg); return; } function drsuccess(t,html,e){ var stat=getRspStat(html); if(stat=="ok"){ document.getElementById(rtable).removeChild(document.getElementById(rrow)); }else{ drerror(getRspError(html)); } } getUrl(theurl,drsuccess,drerror); } function QuoteReply(reply_id,user_name){ if(!reply_id)return; if(!(repbody=findObj("reply[body]")))return; var quoted=findObj("reply-"+reply_id+"-body").innerHTML; var reg=/
.*<\/blockquote>/g; quoted=quoted.replace(reg,""); var reg=//g; quoted=quoted.replace(reg,""); var quote="[quote"+(user_name?"="+user_name:"")+"]"+quoted+"[/quote]\n"; insertTextToInput(repbody,strip_tags(quote)); repbody.scrollIntoView(); } function ReportTopic(formObj){ if(!(formObj=getDomObj(formObj)))return true; if(!window.dojo)return true; if(!getValByName("report[description]")){ alert("Please tell us why you think this topic should be removed"); return false; } setInnerHTML("reportstatus",progresstable("Please wait while your report is submitted")); toggleDisp("reportstatus","block"); toggleDisp("reportform","none"); dojo.io.bind({ formNode:formObj, "mimetype":"text/html", "load":function(t,html,e){ var stat=getRspStat(html); if(stat=="ok"){ setInnerHTML("reportstatus","Report Submitted"); setValByName("report[description]",""); findObj("reportlink").onclick=function(){}; setTimeout("toggleMenu('reportpanel','reportlink')",1000); return false; }else{ var err=getRspError(html); if(!err)err="there was a problem submitting your report"; setInnerHTML("reportstatus",'
'+err+'
'); toggleDisp("reportform","block"); return false; } } }); return false; } function SubmitNewTopic(){ var err=""; if(!getValByName("newtopic[subject]")){ err+="Please enter a subject for your topic\n"; } if(!getValByName("newtopic[body]")){ err+="Please enter a body for your topic\n"; } if(err.length){ alert(err); return; } findObj("theform").submit(); } function insertForumPic(path,destfieldname){ if(!isValidPhotoPath(path)){ alert("Invalid photo url"); return; } html=''+"\n\n"; insertTextToInput(destfieldname,html); } function hbmImages(imgs,lnks){ if(location.hostname.indexOf(".buzznet.com")!=-1){ alert("Can't do this inside Buzznet pages. The idea is to get pics INTO Buzznet from outside :)"); history.back(); return; } var reg=/\.jpe?g$/i; document.write(' Post Images To Buzznet', ' ', '
'); document.write(''); for(i=0;i'+"\n"); } if(typeof(lnks)!="undefined"){ for(i=0;i'+"\n"); } } document.write("         "); document.write(""); document.write("Please wait while these images are sent to Buzznet..."); document["webuploadform"].submit(); document.write(""); //document.webuploadform.submit(); } function trackLinkClick(linkObj,link_id,samewindow){ //wasn't passed link id. just follow link var clickurl="http://www.buzznet.com/linkview/"+link_id+"/"; if(stristr(".buzznet.com",linkObj.href)) samewindow=1; windowtarget=window; if(linkObj.target || document.getElementsByTagName("base").length){ if(!linkObj.target && document.getElementsByTagName("base").length){ if(document.getElementsByTagName("base")[0].getAttribute("target")) if(!linkObj.target) linkObj.target=document.getElementsByTagName("base")[0].getAttribute("target"); } wndName=linkObj.target; if(lc(wndName)=="_top") windowtarget=top; } else wndName="wlink"; if(!link_id){ if(samewindow) windowtarget.location.href=linkObj.href; else window.open(linkObj.href,wndName); return; } if(samewindow) windowtarget.location.href=clickurl; else window.open(clickurl,wndName); } function addClickTrackers(){ if(!document.getElementById)return;//can't get dom so most likely can't manipulate it. for(i=0;i0){ for (var i=1; i <= 5; i++){ document.getElementById('crank_' + i).src = star_off.src; } for (var i=1; i <= rank; i++){ document.getElementById('crank_' + i).src = star_on.src; } } } function submitRank(formObject){ setInnerHTML("yourranktxt","Submitting your rank..."); var kw = { mimetype: "text/plain", formNode: formObject, load: function(t,txt,e){ var ret=txt.split(":"); var rank=ret[0]; var votes=ret[1]; var score=ret[2]; var yourrank=ret[3]; drawCurrentRank(rank); setInnerHTML("ranktxt","Current Rank ("+votes+" votes)"); setInnerHTML("yourranktxt","Your Rank"); setInnerHTML("ystars"," "); drawStars(yourrank); }, error: function(t,e){} }; dojo.io.bind(kw); return false; } function toggleGroupsMenu(menuObj,linkObj,post_id){ if(!menuObj || !linkObj || !post_id)return; var url="/interface/post/groups/getsendtogrouplist/?post_id="+post_id; toggleMenu(menuObj,linkObj); if(typeof(MENU_ITEMS_GRABBED)!="undefined"){ if(MENU_ITEMS_GRABBED) return; } setInnerHTML(menuObj,progresstable("Please wait while we get your groups")); var doLoad=function(t,txt,e){ if(getRspStat(txt)=="ok"){ setInnerHTML(menuObj,getRspOk(txt)); hcode=""; }else{ alert(txt); setInnerHTML(menuObj,"Error: "+getRspError(txt)); } MENU_ITEMS_GRABBED=1; } var doError=function(t,txt,e){ setInnerHTML(menuObj,"There was an error"); } getUrl(url, doLoad, doError); } function sendToGroup(postId,groupId, setId){ /* document objects: addgroupmenu - div that gets filled in with user's group listing addgroupbut - button that opened the menu */ if(!postId || !groupId)return 0; if(!setId)setId=0; MENU_ITEMS_GRABBED=0; var url="/interface/post/groups/sendtogroup/?post_id="+postId+"&group_id="+groupId+"&set_id="+setId; setInnerHTML("addgroupmenu",progresstable("Please wait while we add the post...")); var doLoad=function(t,txt,e){ if(getRspStat(txt)=="ok"){ setInnerHTML("addgroupmenu","The post was added!"); setTimeout("toggleMenu('addgroupmenu','addgroupbut')",2000); }else{ setInnerHTML("addgroupmenu","Error: "+getRspError(txt)); setTimeout("toggleMenu('addgroupmenu','addgroupbut');",2000); } } var doError=function(t,txt,e){ setInnerHTML("addgroupmenu","Unspecified error"); setTimeout("toggleMenu('addgroupmenu','addgroupbut')",1500); } getUrl(url, doLoad, doError); } function removeFromGroup(postId,groupId){ /* document objects: addgroupmenu - div that gets filled in with user's group listing addgroupbut - button that opened the menu */ if(!postId || !groupId)return 0; MENU_ITEMS_GRABBED=0; var url="/interface/post/groups/removefromgroup/?post_id="+postId+"&group_id="+groupId setInnerHTML("addgroupmenu",progresstable("Please wait while we remove the post...")); var doLoad=function(t,txt,e){ if(getRspStat(txt)=="ok"){ setInnerHTML("addgroupmenu","The post was removed!"); setTimeout("toggleMenu('addgroupmenu','addgroupbut')",2000); }else{ setInnerHTML("addgroupmenu","Error: "+getRspError(txt)); setTimeout("toggleMenu('addgroupmenu','addgroupbut');",2000); } } var doError=function(t,txt,e){ setInnerHTML("addgroupmenu","Unspecified error"); setTimeout("toggleMenu('addgroupmenu','addgroupbut')",1500); } getUrl(url, doLoad, doError); } function submitVote(type,typeval,button,buttonObj,counterObj,keepStatus){ //keepstatus makes it not hide the "buzzed" text. var url="/interface/post/vote/?type="+type+"&typeval="+typeval; if(!type || !typeval){ return; } button.onclick=function(){void(0);} if(buttonObj) buttonObj=getDomObj(buttonObj); if(counterObj) counterObj=getDomObj(counterObj); //increment counter if(!isSignedIn()){ var msg="To buzz you must Sign Up or Sign In"; richAlert(msg,(button?button:(buttonObj?buttonObj:counterObj))); return; } if(counterObj.innerHTML){ oldcount=parseInt(counterObj.innerHTML); if(!isNaN(oldcount)){ setInnerHTML(counterObj,(oldcount+1)); }else{ oldcount=""; } } //show change button link text if(buttonObj){ setInnerHTML(buttonObj,"Buzz"); if(!keepStatus && buttonObj.id){ setTimeout("toggleDisp('"+buttonObj.id+"','none')",1000); } } var sLoad=function(t,txt,e){ if(getRspStat(txt)=="ok"){ //do nothing }else{ //roll back what was changed var err=getRspError(txt); if(counterObj && counterObj.innerHTML && typeof(oldcount)!="undefined"){//roll back counter setInnerHTML(counterObj,oldcount); } if(buttonObj) setInnerHTML(buttonObj,"Buzz"); if(err && buttonObj){ richAlert(err,buttonObj) }else{ err=(err?err:"There was an error"); alert(err); } return; } } getUrl(url,sLoad); return; } function removeTag(base64_tag,entry_id,entry_type){ if(!base64_tag || !entry_id || !entry_type)return; if(!confirm("Remove this tag?"))return; //doc object: tag-base64_tag var url="/interface/post/removetag/?tag="+base64_tag+"&entry_id="+entry_id+"&type="+entry_type; cont="tag-"+base64_tag+entry_id+entry_type; toggleDisp(cont,"none"); var doLoad=function(t,txt,e){ if(getRspStat(txt)=="ok"){ return; }else{ toggleDisp(cont,"inline") var err=getRspError(txt); if(err){ alert(err); }else{ alert("Problem removing tag"); } } } getUrl(url,doLoad); return; } function addToPlayList(audio_file_id,linkObj){ if(!audio_file_id)return; linkObj=dojo.byId(linkObj); var url="/interface/post/audio/playlist/additem/?id="+audio_file_id; if(linkObj){ setInnerHTML(linkObj,"-Playlist"); linkObj.onclick=function(){void(0);} } getUrl(url,function(t,txt,e){ if(getRspStat(txt)=="ok"){ if(linkObj){ linkObj.onclick=function(){ removeFromPlaylist(audio_file_id,linkObj); } linkObj.title="Remove from playlist"; } } }); } function removeFromPlaylist(audio_file_id,linkObj){ if(!audio_file_id)return; linkObj=dojo.byId(linkObj); var url="/interface/post/audio/playlist/removeitem/?id="+audio_file_id; if(linkObj){ setInnerHTML(linkObj,"+Playlist"); linkObj.onclick=function(){void(0);} } getUrl(url,function(t,txt,e){ if(getRspStat(txt)=="ok"){ if(linkObj){ linkObj.onclick=function(){ addToPlayList(audio_file_id,linkObj); } linkObj.title="Add to playlist"; }else{ //alert("no link obj"); } }else{ alert("Problem removing that from your playlist"); } }); } function popUserAudioPlayer(username){ if(!username)return; window.open("http://"+username+".buzznet.com/user/audio/popup/",'pwindow','width=300,height=122,scrollbars=no,resizable=yes,location=no,status=no'); } function delicious(titleObj,bodyObj){ var title="";var body=""; if(titleObj && (titleObj=getDomObj(titleObj))){ if(titleObj.innerHTML) title=strip_tags(titleObj.innerHTML); } if(!title)title=document.title; if(bodyObj && (bodyObj=getDomObj(bodyObj))){ if(bodyObj.innerHTML){ body=strip_tags(bodyObj.innerHTML); if(body){ if(body.length>250)body=body.substring(0,340); } } } if(getDomObj("taglist")){ var tags=getElementsByAttribute(getDomObj("taglist"),"a","rel","tag"); for(i=0;i250)body=body.substring(0,340); } } } window.open("http://digg.com/submit?phase=2&url="+escape(location.href)+"&title="+escape(title)+"&bodytext="+escape(body)); } function linkPostIt(username, titleObj,bodyObj){ //submit as link post to buzznet. tries to grab thumbnail out of content as well if(!username)return; var title="";var body=""; var theimage=""; var url=location.href; if(stristr('/photo',url) || stristr("/featured",url) || stristr("/cat",url)){//try to pull main image to post as a thumbnail for(i=0;i250)body=body.substring(0,340); } } } if(getDomObj("taglist")){ var tags=getElementsByAttribute(getDomObj("taglist"),"a","rel","tag"); for(i=0;i250)body=body.substring(0,340); body=nl2br(body); } } } var bodytext=""; if(theimage) bodytext="
"+img(theimage,url,'alt="Hosted on Buzznet"')+"
"; else bodytext=title.link(url)+"\n

"; bodytext+=body; myspacePrefillBlogForm(title,bodytext); } function myspacePrefillBlogForm(title,body){ var posturl="http://blog.myspace.com/index.cfm?fuseaction=blog.create&editor=true&safe=0"; var frm=document.createElement("form"); frm.action=posturl; frm.method="post"; frm.target="_blank"; var hid=document.createElement("input"); hid.type="hidden";hid.name="subject"; hid.value=title?title:"Untitled Post from Buzznet"; frm.appendChild(hid); hid=document.createElement("input");hid.type="hidden";hid.name="body"; hid.value=body?body:""; frm.appendChild(hid); document.body.appendChild(frm); frm.submit(); } function createVoteToolTip(typeval,browserIsHome){ return; if(typeof(DOJO_TOOLTIP_INIT)=="undefined"){//find dojo property for this dojo.require("dojo.widget.Tooltip"); DOJO_TOOLTIP_INIT=1; } document.write('
Buzz means you like this and would recommend it to someone'); if(browserIsHome) document.write('
Disable Buzz in Settings » Account Info
'); document.write('
'); djConfig["searchIds"].push("tt"+typeval); } function addEntryLabels(formObj,counter){ /* assumed dom objects: labelform, labelmsg, addlabelssmenu,addlabelsbut */ toggleDisp(formObj,"none"); var lmsg="labelmsg"+counter; var lbut="addlabelsbut"+counter; var lmen= "addlabelssmenu"+counter; setInnerHTML(lmsg,progresstable("Please wait...")); dojo.io.bind({ "formNode":formObj, "load":function(tp,html,e){ if(getRspStat(html)=="ok"){ setInnerHTML(lmsg,"Labels for the entry were saved"); setTimeout("hideOtherMenus('');toggleDisp('"+formObj.id+"','block')",1000); return; }else{ setInnerHTML(lmsg,getRspError(html)); toggleDisp(lbut,"block"); return; } }, "error":function(){ setInnerHTML(lmsg,"There was an error in editing that entry's labels"); return; } }); return false; } function addEmailUpdate(formObj){ /* assumed dom objects: eupdates, eupdatesform, eupdatesbut, eupdatesmsg,eupdates[email] */ if(!validEmailValue("eupdates[email]")){ alert("Please enter a valid email address"); return false; } toggleDisp(formObj,"none"); setInnerHTML("eupdatesmsg",progresstable("Please wait...")); dojo.io.bind({ formNode:formObj, load:function(type,html,e){ if(getRspStat(html)=="ok"){ setInnerHTML("eupdatesmsg","Subscription added!"); setTimeout("toggleDisp('eupdates','none');",1000); }else{ var err=getRspError(html); setInnerHTML("eupdatesmsg",err); toggleDisp(formObj,"block"); } return false; }, error:function(){ setInnerHTML("eupdatesmsg","There was a problem..."); return false; } }); return false; } function richAlert(msg,relativeObj,hideClose){ if(!getDomObj("AlertBox")){ var abox=document.createElement("div"); abox.id="AlertBox"; abox.className="clickmenu"; abox.style.border="1px #000 solid"; abox.style.borderRightWidth="3px"; abox.style.borderBottomWidth="3px"; abox.style.width="250px"; abox.style.padding="8px"; abox.innerHTML='
' +'' +(hideClose?'':'') +'
 
'; document.body.appendChild(abox); } setInnerHTML("AlertBoxText",msg); toggleMenu('AlertBox',relativeObj,"",1); } function altText(msg,relativeObj){ richAlert(msg,relativeObj,true); } function hideAltText(){ hideOtherMenus(); } function popLoginBox(relativeObj){ if(!getDomObj("loginbox")){ var lbox=document.createElement("div"); lbox.id="loginbox"; lbox.className="clickMenu"; lbox.style.border="1px #000 solid"; lbox.style.borderRightWidth="3px"; lbox.style.borderBottomWidth="3px"; lbox.style.width="250px"; lbox.style.padding="8px"; lbox.style.paddingTop="6px"; lbox.style.paddingRight="4px"; lbox.innerHTML='
' +' x 
' +'' +'
' +'
' +refer() +'' +'' +'' +'' +'' +'' +'' +'
' +'' +'Forget your password?' +'
' +'
'; document.body.appendChild(lbox); } toggleMenu("loginbox",relativeObj,"",1); } function doPopupSignIn(formObj){ //doc objects: loginbox, loginboxmsg, loginboxfields var err=""; if(!formObj.elements["username"].value || !formObj.elements["password"].value) err+="Invalid username/password"; if(err.length){ toggleDisp("loginboxmsg","block"); setInnerHTML("loginboxmsg",'
'+err+'
'); return false; } toggleDisp("loginboxfields","none"); toggleDisp("loginboxmsg","block"); setInnerHTML("loginboxmsg",progresstable("Signing in...")); dojo.io.bind({ "formNode":formObj, "load":function(typ,html,e){ if(getRspStat(html)=="ok"){ setInnerHTML("loginboxmsg","Signed in!"); setTimeout("toggleDisp('loginbox','none');location.replace(location.href);",1000); return; }else{ setInnerHTML("loginboxmsg",'
Invalid login
'); toggleDisp("loginboxfields","block"); formObj.elements["password"].value=""; return false; } } }); return false; } function getSignInOutLink(signInText,signOutText){ if(!signInText)signInText="Sign In"; if(!signOutText)signOutText="Sign Out"; if(isSignedIn()){ return ''+signOutText+''; }else{ return ''+signInText+''; } } var UserMessage={ //doc objects referenced panelId : "msgpanel", formId : "msgform", linkId : "msglink", popBox : function(relativeObj,toUserId){ if(!getDomObj("msgpanel")){ var mp=document.createElement("div"); mp.id=this.panelId; mp.className="clickMenu"; mp.style.width="300px"; mp.style.padding="8px"; mp.style.zIndex="3"; mp.innerHTML='
' +refer() +input_hidden("msg[to_id]",toUserId) +'Subject:
' +input_text("msg[subject]","",20,255,'style="width:100%"')+'
' +'Message
' +'' +'
'+input_button("Cancel","toggleDisp('"+this.panelId+"')") +input_button("Send","sendPrivateMessage('"+this.panelId+"',this.form,'"+this.linkId+"')")+'
' +'
'; document.body.appendChild(mp); } toggleMenu(this.panelId,relativeObj); }, getLink : function(toUserId,toUserName,addl){ if(!addl)addl=""; else addl=" "+addl; return 'Send Message'; } } function quitReload(){_NO_RELOAD=1;} function canReload(){return (_NO_RELOAD?0:1);} function InitRefresh(){ _NO_RELOAD=0; var objs=["comcomments note[message]", "newtopic[subject]" ,"newtopic[body]", "topic[reply]","topic[subject]","topic[body]"]; for(i=0;i' +'' +''+input_text("email",'',20,255)+'' +' ' +'' +''; }else{ str="Thanks for downloading!"; } document.write(str); } var jgallery={//pulls images from a document element and creates a pop-up window gallery fill : function(srcObj,titleObj){ if(getDomObj(titleObj)) this.title=getDomObj(titleObj).innerHTML; else this.title.document.title; this.imgs=getDomObj(srcObj).getElementsByTagName("img"); this.gimages=new Array(); for(i=0;i "+jgallery.title+"", '', 'curImage='+e.target.getAttribute("idx")+';nextImage='+jgallery.nextImage+';', 'if(gimages.length<2)document.write("");', 'window.focus();', '', ' ', '', '', '', '', '
« Prev'+jgallery.title+'Next »
', '
', '', '
', ""); wnd.document.close(); }); } }, nextImage : function(gback){//used in the context of the new window if(gback)curImage--; else curImage++; if(curImage>(gimages.length-1))curImage=0; if(curImage<0)curImage=(gimages.length-1); document.images["theimage"].src=gimages[curImage]; } } function removeBlockedSender(user_id,buttonObj){ if(!user_id)return; buttonObj=getDomObj(buttonObj); var url="/interface/post/blockedsenders/remove/?user_id="+user_id; setInnerHTML(buttonObj,"Please wait..."); dojo.io.bind({ "url":url, "load":function(t,html,e){ if(getRspStat(html)=="ok"){ if(buttonObj.id){ setTimeout("toggleDisp('"+buttonObj.id+"','none');",750); }else{ toggleDisp(buttonObj,"none"); } }else{ setInnerHTML(buttonObj,getRspError(html)); } }, "error":function(t,e){ setInnerHTML(buttonObj,"Connection error"); } }); } function addBlockedSender(user_id,deleteAll, buttonObj, progressObj,doneFunc){ if(!user_id)return; if(!deleteAll)deleteAll=0; var url="/interface/post/blockedsenders/add/?user_id="+user_id+"&delete_all="+deleteAll; setInnerHTML(buttonObj,"Please wait..."); dojo.io.bind({ "url":url, "load":function(t,html,e){ if(getRspStat(html)=="ok"){ toggleDisp(progressObj,"none"); toggleDisp(buttonObj,"block"); setInnerHTML(buttonObj,"Done!"); if(buttonObj.id){ setTimeout("toggleDisp('"+buttonObj.id+"','none');",1000); }else{ toggleDisp(buttonObj,"none"); } if(typeof(doneFunc)=="function")doneFunc(); }else{ var err=getRspError(html); toggleDisp(progressObj,"none"); toggleDisp(buttonObj,"block"); setInnerHTML(buttonObj,err); } }, "error":function(t,e){ setInnerHTML(progressObj,"Connection error"); } }); } function fullScreenVideo(){ var emb=getDomObj("vembedobj"); var vbg=getDomObj("vembg"); var vc; //create close button if(!getDomObj("vidclose")){ vc=createEl("input",{ type:"button",id:"vidclose","class":"buttoninput error",value:"<< exit", "style":"position:absolute;top:2px;left:3px;z-index:12" }); vc.onclick=returnFullScreenVideo; document.body.appendChild(vc); }else{ vc=getDomObj("vidclose"); } //create dimmed background layer if(!getDomObj("vidbg")){ vbg=createEl("div",{ id:"vidbg", "style":"position:absolute; left:0px; top:0px; width:100%;height:100%;"+ "background-color:#111111; z-index:9;opacity:0.8" } ); document.body.appendChild(vbg); }else{ vbg=getDomObj("vidbg"); } toggleDisp(vbg,"block"); toggleDisp(vc,"block"); //size and position the elements based on avail doc dimensions emb.style.zIndex=10; var factor=(document.body.clientHeight/emb.getAttribute("height")); emb.style.height=document.body.clientHeight; emb.style.width=Math.floor(parseInt(emb.getAttribute("width")*factor)); emb.style.position="absolute"; emb.style.top="0px"; emb.style.left="0px"; vc.style.left=parseInt(emb.style.width)+4+"px"; document.body.scrollTop=0; //emb.style.left=(Math.floor(emb.style.width/2)); //emb.style.left=Math.floor((document.body.clientWidth/2)-(parseInt(emb.style.width)/4)); } function returnFullScreenVideo(){ var emb=getDomObj("vembedobj"); toggleDisp("vidclose","none"); toggleDisp("vidbg","none"); emb.style.position="static"; emb.style.width=emb.getAttribute("width"); emb.style.height=emb.getAttribute("height"); } function sendChannelMsg(channel,wckey,name,email,subject,message,success,fail,ec){ if(!channel)return; if(!valid_email(email))return; if(!subject)return; if(!message)return; if(!wckey)return; var bparams={ content :{ "contact[subject]":subject, "contact[message]":message, "contact[name]":name, "contact[email]":email, "wckey":wckey, "ec":(ec?ec:"") }, url:"/web/"+channel+"/contact/mod/", method:"POST", mimeType:"text/html" }; bparams["load"]=function(t,html,e){ html=strfromto(html,'class="medlink">',""); if(stristr("message sent",html)){ if(typeof(success)=="function")success(); }else{ if(typeof(fail)=="function")fail(); } } if(typeof(fail)=="function")bparams["error"]=fail; dojo.io.bind(bparams); } function doOnLoad(){//runs at the bottom of the page if(document.all){//scale down images for ie. mozilla just need css max-width if(findObj("shoutout")){ dojo.addOnLoad(function(){ resizeImages("shoutout",290); }); } if(findObj("commentlist")){ dojo.addOnLoad(function(){ resizeImages("commentlist",400); }); } } dojo.addOnLoad(clearFooter); } function clearFooter(){ if( findObj("leftside") && findObj("rightside") && findObj("bodycontainer")){ var tw=807; var aw=getOffsetWidth("leftside"); if(aw>tw){ var add=(aw-tw); var mw=getOffsetWidth("bodycontainer");//need to figure this out for moz! findObj("bodycontainer").style.width=(mw+add)+"px"; if(findObj("maincontent"))findObj("maincontent").style.width=aw+"px"; if(findObj("bodycontent"))findObj("bodycontent").style.width=aw+"px"; if(findObj("header"))findObj("header").style.width=aw+"px"; if(findObj("topad"))findObj("topad").style.width=aw+"px"; } var tr=184; var atw=getOffsetWidth("rightside"); if(atw>tr){ var add=(atw-tr); var mw=getOffsetWidth("bodycontainer"); findObj("bodycontainer").style.width=(mw+add)+"px"; } } } function toggleRightBar(lObj){ if(typeof(_site_max)=="undefined")_site_max=0; if(!_site_max){ toggleDisp("rightside","none"); findObj("maincontent").style.width="100%"; if(findObj("headercontainer")) findObj("headercontainer").style.width="100%"; if(findObj("subnetheader")) findObj("subnetheader").style.width="100%"; setInnerHTML(lObj,"Show Right Bar»"); WriteCookie("sm",1); _site_max=1; }else{ findObj("maincontent").style.width="807px"; if(findObj("headercontainer")) findObj("headercontainer").style.width="807px"; toggleDisp("rightside","block"); setInnerHTML(lObj,"«Hide Right Bar"); _site_max=0; WriteCookie("sm",0); } } function toggleRightBarLink(){ if(typeof(_site_max)=="undefined")_site_max=0; var out=""; document.write('|'+(_site_max?"Show Right Bar»":"«Hide right bar")+''); } function answerPoll(pollId){ /* expects form - p-$poll_id-form progress - p-$poll_id-progress answers - p-$poll_id-ans checkbox tds class="answer-input" */ var frm="p-"+pollId+"-form"; var prog="p-"+pollId+"-progress"; var ans="p-"+pollId+"-ans"; if(!getValByName("answer",frm)){ alert("You didn't pick an answer"); return; } //hide answers and show progress toggleDisp(ans,"none"); setInnerHTML(prog,progresstable("Submitting your vote...")); dojo.io.bind({ "formNode":getDomObj(frm), "mimeType":"text/plain", "load":function(t,ret,e){ var stat=getRspStat(ret); var err=getRspError(ret); if(stat=="ok" || stristr("already voted",err)){ setInnerHTML(prog,""); toggleDisp(prog,"none"); toggleDisp(ans,"block"); reloadArea(ans,"/interface/post/polls/getresults/"+pollId+"/","Refreshing","",1); }else{ setInnerHTML(prog,err); toggleDisp(ans,"block"); } }, "error":function(typ,html,e){ setInnerHTML(prog,'
There was an error submitting your vote. Try again
'); toggleDisp(ans,"block"); return; } }); }