var uploading=false;var t;var formObj="";function warnuser(){return"Your upload will be aborted if you leave this page. If you do not want this, please hit cancel."}function sendupload(A){id="#"+A;error=id+"-error";toc=$(id+" :checked").val();des=$(id+" :text").val();inputFile=$(id+" :file").val();if(!des||des.length<=0){$(error).html("You must enter a description of the media you are uploading!");$(error).css("display","");return }if(!inputFile||inputFile.length<=0){$(error).html("You must select a media file to upload");$(error).css("display","");return }if(!toc||toc=="undefined"){$(error).html("You must agree to the terms and conditions before you can upload your file.");$(error).css("display","");return }ajax=loadAjax("/formvalidator.jsp?text="+encodeURIComponent(des));ajax.onreadystatechange=function(){if(ajax.readyState==4){switch(ajax.responseText){case"2":$(error).html("Your description contains invalid characters.  Please only use alphanumeric characters or  .&,:();[]{}'/-_!@?~=\"#^$%");$(error).css("display","");return ;default:uploading=true;window.onbeforeunload=warnuser;$(id+" :file").css("display","none");$(id+"-progressbar").css("display","block");f=ge(A);f.submit();formObj=A;t=setTimeout(updateupload,10)}}};ajax.send(null)}function stopCount(){clearTimeout(t)}function updateupload(){id="#"+formObj;error=id+"-error";progress=id+"-progressbar";comp=id+"-completed";ncomp=id+"-notcompleted";ajax=loadAjax("/checkupload.jsp");ajax.onreadystatechange=function(){if(ajax.readyState==4){try{firstChild=ajax.responseXML.getElementsByTagName("status")[0].firstChild.data;if(firstChild=="100"){window.onbeforeunload=null;uploading=false;utype=$(id+"-utype").val();switch(parseInt(utype)){case 0:ajaxSimple("/collection.jsp","profilebobbles");break;case 1:ajaxSimple("/collectionInline.jsp","profilebobbles");mediaId=ajax.responseXML.getElementsByTagName("uploadid")[0].firstChild.data;menuAddMedia(mediaId);break;case 2:window.location.reload();document.getElementById("uploaderform").reset();break;case 3:document.getElementById("uploaderformAC").reset();hidepopup(cpop.id);mediaId=ajax.responseXML.getElementsByTagName("uploadid")[0].firstChild.data;createLink(mediaId,8);break}removeLoading();$(progress).css("display","none")}else{if(firstChild=="-1"){window.onbeforeunload=null;$(error).html("Unable to upload File");$(error).css("display","");$(progress).css("display","none");$(id+" :file").css("display","");$(comp).css("width","0");$(ncomp).css("width","100%")}else{if(uploading==false){window.onbeforeunload=null;firstChild="0";$(progress).css("display","none")}else{if(firstChild=="-2"){login("/engage.jsp")}else{if(firstChild=="-3"){window.onbeforeunload=null;$(error).html("File is too large");$(error).css("display","");$(progress).css("display","none");$(id+" :file").css("display","");$(comp).css("width","0");$(ncomp).css("width","100%")}else{var A=parseInt(firstChild);$(comp).css("width",A+"%");$(ncomp).css("width",(100-A)+"%");$(id+"-percent").html(A+"%");t=setTimeout(updateupload,500)}}}}}}catch(B){window.onbeforeunload=null;uploading=false;$(progress).css("display","none");$(id+" :file").css("display","");$(comp).css("width","0");$(ncomp).css("width","100%");clearTimeout(t)}}};ajax.send(null)}function linkitInline(){var B=document.getElementById("link").value;var D=document.getElementById("linkdesc").value;var A=ge("bookmarkErr");var C=loadAjax("/createlinker.jsp?path="+encodeURIComponent(B)+"&desc="+encodeURIComponent(D));C.onreadystatechange=function(){if(C.readyState==4){var G;try{G=C.responseXML.getElementsByTagName("status")[0].firstChild.data;if(G=="100"){var E="/collectionInline.jsp?id="+ge("userId").value;var I="profilebobbles";ge("bookmarkHelpText").innerHTML="Thanks, we're currently taking a snapshot of the page you bookmarked.  It takes about 10 seconds for us to download and process. Afterwards you will be redirected to your media collection. If it's still not available, you can refresh your media until it appears.";ge("bookmarkHelpText").style.display="";var H=loadFade(E,I,delay);mediaId=C.responseXML.getElementsByTagName("id")[0].firstChild.data;menuAddMedia(mediaId);if(ge("loading")!=null){ge("loading").style.visibility="hidden"}}else{if(G=="-2"){A.innerHTML=C.responseXML.getElementsByTagName("desc")[0].firstChild.data;A.style.display="";if(ge("loading")!=null){ge("loading").style.visibility="hidden"}}else{A.innerHTML="Sorry, we could't add the bookmark. We tried getting a snapshot from the site, but couldn't contact it. Please double check to see if the URL you provided is valid.";A.style.display="";if(ge("loading")!=null){ge("loading").style.visibility="hidden"}}}}catch(F){if(ge("loading")!=null){ge("loading").style.visibility="hidden"}A.innerHTML="Your bookmark description and/or url are invalid, please correct them.";A.style.display=""}}};ajaxsend(C)}function addYouTubeInline(){var B=document.getElementById("ytlink").value;var A=document.getElementById("youTubeErr");var C=loadAjax("/addYouTubeVideo.jsp?path="+encodeURIComponent(B));C.onreadystatechange=function(){if(C.readyState==4){switch(C.responseText){case"-2":A.innerHTML="Sorry, you may not add this video by request of the video's owner";A.style.display="";if(ge("loading")!=null){ge("loading").style.visibility="hidden"}break;case"-1":A.innerHTML="There was a problem with your YouTube URL make sure it is correct.";A.style.display="";if(ge("loading")!=null){ge("loading").style.visibility="hidden"}break;default:var D="/collectionInline.jsp?id="+ge("userId").value;var E="profilebobbles";loadFade(D,E);mediaId=C.responseText;menuAddMedia(mediaId);break}}};C.send(null)}function menuAddMedia(A){addToEngageAttachments(A);loadEngageAttachments()}function menuRemoveMedia(A){removeFromEngageAttachments(A);loadEngageAttachments();ge("midlist").value=(ge("midlist").value).replace(A,"");ge("addToBobbleTicker").className="ui-state-success";ge("addToBobbleTicker").innerHTML="Removed from Bobble"}function setMainPic(A){setBobbleImage(A,"70","70","bobblemainpic","2");if(ge("lp_bobblemainpic")!=null){setBobbleImage(A,"70","70","lp_bobblemainpic","2")}loadEngageAttachments();ge("addToBobbleTicker").className="ui-state-success";ge("addToBobbleTicker").innerHTML="Media item was set as main picture"}function removeMainPic(){ge("addToBobbleTicker").style.display="none";setBobbleImage("2","70","70","bobblemainpic","3");if(ge("lp_bobblemainpic")!=null){setBobbleImage("2","70","70","lp_bobblemainpic","3")}loadEngageAttachments();ge("addToBobbleTicker").className="ui-state-success";ge("addToBobbleTicker").innerHTML="Default Image restored for main picture"}function setBobbleImage(C,A,E,G,D){var B=ge("mainpicMid");if(B!=null){B.setAttribute("value",C)}url="/replacemedia.jsp?mid="+C+"&height="+A+"&width="+E+"&type="+D;var F=loadFade(url,G)}function submitEngage(){copyiframe();if(checkBobbleSize(1)){if(ge("cccSubmit")!=null){ge("cccSubmit").style.display="none"}var F=ge("bobbletitle");var I=ge("bobblearg");var X=ge("mainpicMid");var V=ge("parent");var A=ge("feedmode").value;var B=ge("numAttached");var Y=ge("displayMid1");var W=ge("displayMid2");var S=ge("displayMid3");var R=ge("displayMid4");var P=ge("displayMid5");var O=ge("displayMid6");var N=ge("displayMid7");var K=ge("displayMid8");var J=ge("displayMid9");var Q=ge("displayMid10");var U=ge("tags");var h=ge("toc");var D=ge("selectCategory").value;var Z="-1";if(ge("rssMsgId")){Z=ge("rssMsgId").value}type=ge("type").value;var k=ge("groupPick")==null?"0":ge("groupPick").value;var M=encodeURIComponent(F.value);var E=encodeURIComponent(tinyMCE.get("bobblearg").getContent());var G="selectCategory="+D+"&advancedform=1&type="+type+"&rssMsgId="+encodeURIComponent(Z)+"&bobbletitle="+M+"&bobbleargument="+E+"&mainpicMid="+encodeURIComponent(X.value)+"&numAttached="+encodeURIComponent(B.value)+"&displayMid1="+encodeURIComponent(Y.value)+"&displayMid2="+encodeURIComponent(W.value)+"&displayMid3="+encodeURIComponent(S.value)+"&displayMid4="+encodeURIComponent(R.value)+"&displayMid5="+encodeURIComponent(P.value)+"&displayMid6="+encodeURIComponent(O.value)+"&displayMid7="+encodeURIComponent(N.value)+"&displayMid8="+encodeURIComponent(K.value)+"&displayMid9="+encodeURIComponent(J.value)+"&displayMid10="+encodeURIComponent(Q.value)+"&toc="+encodeURIComponent(h.value)+"&tags="+encodeURIComponent(U.value);var L=ge("pollingEnabled")==null?0:ge("pollingEnabled").value;if(L==1){var C="true";var H=encodeURIComponent(ge("pollname").value);var g=ge("pollMaxParts").value;var b=ge("pollMaxFields").value;G+="&pollingEnabled="+L+"&pollname="+H+"&insertPoll="+C;for(var e=0;e<g;e++){if(ge("poll_part"+e)!=null){G+="&poll_part_name"+e+"="+encodeURIComponent(ge("poll_part_name"+e).value);if(encodeURIComponent(ge("pollchoices"+e).value).length>0&&encodeURIComponent(ge("pollchoices"+e).value)>0){G+="&pollchoices"+e+"="+encodeURIComponent(ge("pollchoices"+e).value)}else{G+="&pollchoices"+e+"=1"}var d=0;for(d=0;d<b;d++){if(ge("pollfield"+e+"_"+d)!=null){G+="&pollfield"+e+"_"+d+"="+encodeURIComponent(ge("pollfield"+e+"_"+d).value);G+="&fieldType"+e+"_"+d+"=0"}else{break}}if(ge("fieldOther"+e).checked){G+="&pollfield"+e+"_"+d+"=Other";G+="&fieldType"+e+"_"+d+"=1"}}else{break}}}var c=(ge("groupsEnabled")==null)?0:parseInt(ge("groupsEnabled").value);if(c==1){var a=ge("groupType")==null?"0":(k=="0")?"0":ge("groupType").value;G+="&groupsEnabled="+c+"&groupType="+a+"&groups="+k}var T=loadPostAjax("/pbobble.jsp",G);T.onreadystatechange=function(){if(T.readyState==4){if(T.responseXML.getElementsByTagName("status")[0].firstChild.data=="1"){var j=T.responseXML.getElementsByTagName("bid")[0].firstChild.data;window.location="/loader.jsp?page=singleview.jsp&tb=1&id="+j}else{if(T.responseXML.getElementsByTagName("status")[0].firstChild.data=="2"){j=T.responseXML.getElementsByTagName("bid")[0].firstChild.data;window.location="/loader.jsp?page=singleview.jsp&id="+j+"&tb=1"}else{var l=T.responseXML.getElementsByTagName("error")[0].firstChild.data;if(!l){l="Unknown Error - code 6, please contact support with this message, if it persists."}document.getElementById("etErrorMsg").innerHTML=l;document.getElementById("etErrorMsg").style.display="";if(ge("cccSubmit")!=null){ge("cccSubmit").style.display=""}ge("loading").style.visibility="hidden";window.location.hash="#anError";window.location=window.location}}}};T.setRequestHeader("Content-type","application/x-www-form-urlencoded");T.setRequestHeader("Content-length",G.length);T.setRequestHeader("Connection","close");setloading();T.send(G)}}var attachedmedia;function clearattachedmedia(){var A=document.getElementById("mediaids");if(A!=null){A.value=""}}function inlineEngage(){if(ge("cccSubmit")!=null){ge("cccSubmit").style.display="none"}var F=ge("bobbletitle");var H=ge("bobblearg");var V=ge("mainpicMid");var T=ge("parent");var D=ge("groupsEnabled");var Z=ge("groupType");var c=ge("groupPick");var b=ge("parentfeed");var A=ge("feedmode").value;var B=ge("numAttached");var W=ge("displayMid1");var U=ge("displayMid2");var Q=ge("displayMid3");var P=ge("displayMid4");var N=ge("displayMid5");var M=ge("displayMid6");var L=ge("displayMid7");var J=ge("displayMid8");var I=ge("displayMid9");var O=ge("displayMid10");var S=ge("tags");var Y=ge("toc");type=getCheckedValue("ccc","cccType");var K=encodeURIComponent(F.value);var E=encodeURIComponent(tinyMCE.get("bobblearg").getContent());var a=0;if(D!=null){a=D.value}var C=0;if(Z!=null){C=Z.value}var X=0;if(c!=null){X=c.value}var G="category=1&advancedform=1&feedmode="+A+"&parentfeed="+b.value+"&type="+type+"&bobbletitle="+K+"&bobbleargument="+E+"&mainpicMid="+encodeURIComponent(V.value)+"&parent="+encodeURIComponent(T.value)+"&groupsEnabled="+encodeURIComponent(a)+"&groupType="+encodeURIComponent(C)+"&groups="+encodeURIComponent(X)+"&numAttached="+encodeURIComponent(B.value)+"&displayMid1="+encodeURIComponent(W.value)+"&displayMid2="+encodeURIComponent(U.value)+"&displayMid3="+encodeURIComponent(Q.value)+"&displayMid4="+encodeURIComponent(P.value)+"&displayMid5="+encodeURIComponent(N.value)+"&displayMid6="+encodeURIComponent(M.value)+"&displayMid7="+encodeURIComponent(L.value)+"&displayMid8="+encodeURIComponent(J.value)+"&displayMid9="+encodeURIComponent(I.value)+"&displayMid10="+encodeURIComponent(O.value)+"&toc="+encodeURIComponent(Y.value)+"&tags="+encodeURIComponent(S.value);var R=loadPostAjax("/pbobble.jsp",G);R.onreadystatechange=function(){if(R.readyState==4){if(R.responseXML.getElementsByTagName("status")[0].firstChild.data=="1"){removeLoading();window.location.hash="#";url="/loader.jsp?page=singleview.jsp&id="+T.value+"&tb=1";window.location=url}else{if(R.responseXML.getElementsByTagName("status")[0].firstChild.data=="2"){var d=R.responseXML.getElementsByTagName("bid")[0].firstChild.data;removeLoading();window.location.hash="#";window.location.reload("/loader.jsp?page=singleview.jsp&id="+d+"&tb=1")}else{var e=R.responseXML.getElementsByTagName("error")[0].firstChild.data;if(!e){e="Unknown Error - code 6, please contact support with this message, if it persists."}if(ge("engageerr")){ge("engageerr").innerHTML=e;ge("engageerr").style.display=""}if(ge("cccSubmit")!=null){ge("cccSubmit").style.display=""}removeLoading();window.location.hash="#anError";window.location=window.location}}}};R.setRequestHeader("Content-type","application/x-www-form-urlencoded");R.setRequestHeader("Content-length",G.length);R.setRequestHeader("Connection","close");setloading();R.send(G)}function getCheckedValue(C,B){if(!C||!B){return -2}rButtons=ge(C).elements[B];for(var A=0;A<rButtons.length;A++){if(rButtons[A].checked==true){return rButtons[A].value}}return -2}function changeCCC(A){setActiveClass("cccTypeContainer","div","cccType","cccTypeActive",A)}function setActiveClass(A,D,B,F,C){if(!A){return }A=ge(A);children=A.getElementsByTagName(D);for(var E=0;E<children.length;E++){children[E].className=(E==C)?F:B}}function copyiframe(){var A=ge("bobblearg");var B=ge("bobbleargument");B.value=encodeURIComponent(tinyMCE.get("bobblearg").getContent())}function wcCheck(D,B){var C=ge("wordcount");var A=D.length;if(A<=B){output="You've used "+A+" of "+B+" characters";C.innerHTML=output;return true}else{output="You've used over "+B+" characters.  Please reduce the size of your bobble by "+charsoverlimit+" characters.";C.innerHTML=output;return false}}function wcCheckIframe(E){var G=ge("wordcount");var B=0;var F=0;var A=0;text=tinyMCE.get("bobblearg").getContent();text=text.replace(/&nbsp;/g," ");limit=(ge("limit")==null)?0:ge("limit").value;for(i=0;i<text.length;i++){var C=text.charAt(i);if(A!=1){if(C=="<"){A=1}else{if(C==" "){F++;B++}else{if(C!="\n"){B++}}}}else{if(C==">"){A=0}}}if(B==F||B==0){G.innerHTML="&nbsp;";return 0}else{if(B<=limit){output="You've used "+B+" of "+limit+" characters";G.innerHTML=output;return B}else{var D=B-limit;output="You've used over "+limit+" characters.  Please reduce the size of your bobble by "+D+" characters.";G.innerHTML=output;return B}}}function checkStatus(B,C,A){url="checkMediaStatus.jsp?mid="+B;var D=loadAjax(url);D.onreadystatechange=function(){if(D.readyState==4){if(D.responseText){t=setTimeout(checkStatus,500)}}};D.send(null)}function copyPMiframe(){var A=ge("body");var B=ge("privateMessageBody");B.value=encodeURIComponent(tinyMCE.get("bobblearg").getContent())}function submitCompose(){copyPMiframe();if(checkPMValidity(1)){if(ge("cccSubmit")!=null){ge("cccSubmit").style.display="none"}var M=ge("privateMessageSubject");var C=ge("PMbody");var G=ge("parid");var B=ge("isParent");var H=encodeURIComponent(M.value);var F=encodeURIComponent(tinyMCE.get("bobblearg").getContent());var K=encodeURIComponent(G.value);var E=encodeURIComponent(B.value);var J=document.getElementById("bobble");var A="";for(var D=0;D<J.elements.length;D++){if(J.elements[D].getAttribute("name")=="userId"){A=A+(J.elements[D].getAttribute("value"))+","}}var L="privateMessageTo="+A+"&privateMessageSubject="+H+"&privateMessageBody="+F+"&parid="+K+"&isParent="+E+"&privateMessageTo="+A;var I=loadPostAjax("/pmessage.jsp",L);I.onreadystatechange=function(){if(I.readyState==4){if(I.responseXML.getElementsByTagName("status")[0].firstChild.data=="1"){var O=I.responseXML.getElementsByTagName("rootMsgId")[0].firstChild.data;window.location="/loader.jsp?page=privateMessageThread.jsp&msgid="+O}else{var N=I.responseXML.getElementsByTagName("error")[0].firstChild.data;if(!N){N="Unknown Error - code 6, please contact support with this message, if it persists."}document.getElementById("etErrorMsg").innerHTML=N;document.getElementById("etErrorMsg").style.display="";if(ge("cccSubmit")!=null){ge("cccSubmit").style.display=""}ge("loading").style.visibility="hidden";window.location.hash="#anError";window.location=window.location}}};I.setRequestHeader("Content-type","application/x-www-form-urlencoded");I.setRequestHeader("Content-length",L.length);I.setRequestHeader("Connection","close");setloading();I.send(L)}}function submitReply(){copyPMiframe();if(checkPMBodyValidity(1)){if(ge("cccSubmit")!=null){ge("cccSubmit").style.display="none"}var L=ge("privateMessageSubject");var B=ge("PMbody");var E=ge("parid");var A=ge("isParent");var I=ge("privateMessageTo");var F=encodeURIComponent(L.value);var D=encodeURIComponent(tinyMCE.get("bobblearg").getContent());var J=encodeURIComponent(E.value);var C=encodeURIComponent(A.value);var H=encodeURIComponent(I.value);var K="privateMessageTo="+H+"&privateMessageSubject="+F+"&privateMessageBody="+D+"&parid="+J+"&isParent="+C+"&privateMessageTo="+H;var G=loadPostAjax("/pmessage.jsp",K);G.onreadystatechange=function(){if(G.readyState==4){if(G.responseXML.getElementsByTagName("status")[0].firstChild.data=="1"){var N=G.responseXML.getElementsByTagName("rootMsgId")[0].firstChild.data;window.location="/loader.jsp?page=privateMessageThread.jsp&msgid="+N}else{var M=G.responseXML.getElementsByTagName("error")[0].firstChild.data;if(!M){M="Unknown Error - code 6, please contact support with this message, if it persists."}document.getElementById("etErrorMsg").innerHTML=M;document.getElementById("etErrorMsg").style.display="";if(ge("cccSubmit")!=null){ge("cccSubmit").style.display=""}ge("loading").style.visibility="hidden";window.location.hash="#anError";window.location=window.location}}};G.setRequestHeader("Content-type","application/x-www-form-urlencoded");G.setRequestHeader("Content-length",K.length);G.setRequestHeader("Connection","close");setloading();G.send(K)}}function changePMState(D){var E=document.getElementById("frm1");var B="&state="+D+"&msgid=";for(var A=0;A<E.elements.length;A++){if(E.elements[A].getAttribute("id")=="privateMessage"){if(E.elements[A].checked==true){B=B+(E.elements[A].getAttribute("value"))+","}}}var C=loadPostAjax("/umessage.jsp",B);C.onreadystatechange=function(){if(C.readyState==4){window.location="/loader.jsp?page=privateMessageInbox.jsp"}};C.setRequestHeader("Content-type","application/x-www-form-urlencoded");C.setRequestHeader("Content-length",B.length);C.setRequestHeader("Connection","close");setloading();C.send(B)}function changePMSenderState(D){var E=document.getElementById("frm1");var B="&state="+D+"&msgid=";for(var A=0;A<E.elements.length;A++){if(E.elements[A].getAttribute("id")=="privateMessage"){if(E.elements[A].checked==true){B=B+(E.elements[A].getAttribute("value"))+","}}}var C=loadPostAjax("/uSmessage.jsp",B);C.onreadystatechange=function(){if(C.readyState==4){window.location="/loader.jsp?page=privateMessageSent.jsp"}};C.setRequestHeader("Content-type","application/x-www-form-urlencoded");C.setRequestHeader("Content-length",B.length);C.setRequestHeader("Connection","close");setloading();C.send(B)}function updatePMUnreadCount(B){var A="&msgid="+B;var C=loadPostAjax("/omessage.jsp",A);C.onreadystatechange=function(){if(C.readyState==4){window.location="/loader.jsp?page=privateMessageThread.jsp&msgid="+B}};C.setRequestHeader("Content-type","application/x-www-form-urlencoded");C.setRequestHeader("Content-length",A.length);C.setRequestHeader("Connection","close");setloading();C.send(A)}function viewPreviousMessages(A,C){var B="&msgid="+C;var D=loadPostAjax("/previousMessages.jsp",B);D.onreadystatechange=function(){if(D.readyState==4){var E=D.responseText;$("#"+A+" > li#prev").remove();$("#"+A).prepend(E);ge("loading").style.visibility="hidden"}};D.setRequestHeader("Content-type","application/x-www-form-urlencoded");D.setRequestHeader("Content-length",B.length);D.setRequestHeader("Connection","close");setloading();D.send(B)}function viewGrandFatheredMessages(A,C){var B="&msgid="+C;var D=loadPostAjax("/grandfatheredMessages.jsp",B);D.onreadystatechange=function(){if(D.readyState==4){var E=D.responseText;$("#"+A+" > li#prev").remove();$("#"+A).prepend(E);ge("loading").style.visibility="hidden"}};D.setRequestHeader("Content-type","application/x-www-form-urlencoded");D.setRequestHeader("Content-length",B.length);D.setRequestHeader("Connection","close");setloading();D.send(B)};