var cpop=null;function loadAjax(A){var B;try{B=new XMLHttpRequest()}catch(C){try{B=new ActiveXObject("Msxml2.XMLHTTP")}catch(C){try{B=new ActiveXObject("Microsoft.XMLHTTP")}catch(C){div.innerHTML="Your Browser is not supported.  Please visit <a href='http://www.mozilla.org'>Mozilla</a> to download a compatible browser.";return }}}var D=new Date();if(A.indexOf("?")!=-1){A+="&time="+D.getTime()}else{A+="?time="+D.getTime()}B.open("GET",A,true);return B}function adjustloading(){var C=ge("loading");if(!C){return }if(C.style.visibility!="visible"){window.onscroll=null}var B=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var A=document.all?B.scrollTop:pageYOffset;C.style.top=A+"px";C.style.left="0px"}function setloading(){var C=createDivIfNExists("loading");C.style.position="absolute";C.style.display="";var B=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var A=document.all?B.scrollTop:pageYOffset;C.style.top=A+"px";window.onscroll=adjustloading}function ajaxsend(A){setloading();A.send(null)}function loadPostAjax(A,B){var C;try{C=new XMLHttpRequest()}catch(D){try{C=new ActiveXObject("Msxml2.XMLHTTP")}catch(D){try{C=new ActiveXObject("Microsoft.XMLHTTP")}catch(D){div.innerHTML="Your Browser is not supported.  Please visit <a href='http://www.mozilla.org'>Mozilla</a> to download a compatible browser.";return }}}var E=new Date();if(A.indexOf("?")!=-1){A+="&time="+E.getTime()}else{A+="?time="+E.getTime()}C.open("POST",A,true);return C}function loadFade(B,D,A){setloading();var C=loadAjax(B);C.onreadystatechange=function(){if(C.readyState==4){var E=document.getElementById(D);E.style.visibility="visible";E.style.display="block";E.innerHTML=C.responseText;removeLoading();if(A!=null){A()}if(B.indexOf("ccc.jsp")>=0){tinyMCE.execCommand("mceAddControl",false,"bobblearg")}}};ajaxsend(C)}function loadpopup(A){var B=loadAjax(A);B.onreadystatechange=function(){if(B.readyState==4){var C=createDivIfNExists("newpopup");C.innerHTML=B.responseText;C.style.display="";showpopup(C);$(C).bgIframe();$("#showimage").bgIframe();removeLoading();if(A.indexOf("loginform.jsp?page=")>=0){focusEmailField()}}};ajaxsend(B)}function loadQuickFade(A,C){var B=loadAjax(A);B.onreadystatechange=function(){if(B.readyState==4){var D=document.getElementById(C);D.style.visibility="visible";D.style.display="block";D.innerHTML=B.responseText;ge("loading").style.visibility="hidden"}};ajaxsend(B)}function ajaxSimple(A,C){setloading();var B=loadAjax(A);B.onreadystatechange=function(){if(B.readyState==4){var D=document.getElementById(C);D.innerHTML=B.responseText;removeLoading()}};ajaxsend(B)}function createDivIfNExists(A){var B=document.getElementById(A);if(B==null){newdiv=document.createElement("div");newdiv.setAttribute("id",A);newdiv.setAttribute("style","display: none;");document.body.appendChild(newdiv);B=newdiv}return B}function showpopup(E){if(cpop!=null){ge(cpop.id).style.display="none"}cpop=E;var D=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var A=document.all?D.scrollTop:pageYOffset;var C=(getWindowHeight()/2+A-(E.offsetHeight/2));var B=((getWindowWidth()/2)-(E.offsetWidth/2));if(C<0){C=0}if(B<0){B=0}$(E).css("display","").css("position","absolute").css("top",C+"px").css("left",B+"px").css("visibility","visible").bgIframe();makeDraggable(E)}function hidepopup(A){if(A==null){return }player=document.getElementById("playerContainer");if(player){player.innerHTML=""}if(ge("screen")!=null){ge("screen").style.visibility="hidden"}if(ge(A)!=null){ge(A).style.display="none";ge(A).innerHTML=""}}function killPopup(A){if(A){A.parentNode.removeChild(A)}}function removeLoading(){if(ge("loading")==null){return }var A=document.getElementById("loading");A.parentNode.removeChild(A)}function makeDraggable(A){$(A).draggable({delay:350,zIndex:10000,distance:30,iframeFix:true})}function ge(A){return document.getElementById(A)}function hideMe(){window.status="";return true}function rollover(B,A){e=document.getElementById(B);if(e){e.src=A}}function disableEnterKey(B){var A;if(window.event){A=window.event.keyCode}else{A=B.which}return(A!=13)}function getScrollXY(){var B=0,A=0;if(typeof (window.pageYOffset)=="number"){A=window.pageYOffset;B=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){A=document.body.scrollTop;B=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){A=document.documentElement.scrollTop;B=document.documentElement.scrollLeft}}}return[B,A]}function menu(E,G){var A;if(A==null){A=createDivIfNExists("sm")}if(A.style.display!="none"){A.style.display="none"}A.innerHTML="";makeDraggable(A);setloading();var B;var F=G;if(F.indexOf("media")!=-1){mid=F.substring(5,F.length);if(ge("currentpage")!=null&&((ge("currentpage").value).indexOf("engage")!=-1||(ge("currentpage").value).indexOf("singleview")!=-1)&&(ge("displayMid1")!=null)){mids="";for(var C=1;C<=10;C++){value=ge("displayMid"+C).value;if(value!=-1){mids+=value+","}}mids=mids.substring(0,mids.length-1);B="/mediaMenu.jsp?mid="+mid+"&mode=2&mids="+mids+"&mp="+ge("mainpicMid").value}else{B="/mediaMenu.jsp?mid="+mid+"&mode=1"}}else{B="/socialmenu.jsp?id="+G}var D=loadAjax(B);D.onreadystatechange=function(){if(D.readyState==4){A.innerHTML=D.responseText;if(ge("playerContainer")!=null){var H=DetectFlashVer(requiredMajorVersion,requiredMinorVersion,requiredRevision);if(H){playVideo()}else{if(ge("mMsg")!=null){ge("mMsg").innerHTML="<span class='ui-text-main-lite bold'>This content requires the Adobe Flash Player.<br><a href='http://www.adobe.com/go/getflash/' target='_blank' class='ui-link-action'>Download and Install Flash here.</a></span><div class='divider'></div>"}}}$(A).bgIframe();if(ge("loading")!=null){ge("loading").style.visibility="hidden"}}};D.send(null);offset=getScrollXY();if(ge("mWidth")!=null){A.style.left=(getWindowWidth()/2-ge("mWidth").value)+"px"}else{A.style.left=(getWindowWidth()/2-220)+"px"}A.style.top=(getWindowHeight()/2-100+offset[1])+"px";A.style.display="inline";A.style.zIndex="17";A.style.position="absolute";A.style.visibility="visible"}function hideSocialMenu(){if(ge("sm")!=null){ge("sm").innerHTML="";ge("sm").style.display="none"}}function showAttachMenu(F,B){bm=ge("sm");if(bm!=null){bm.style.display="none";bm.innerHTML=""}else{bm=createDivIfNExists("sm")}mids="";for(var C=1;C<=10;C++){value=ge("displayMid"+C).value;if(value!=-1){mids+=value+","}}mids=mids.substring(0,mids.length-1);var A="/mediaMenu.jsp?mid="+B+"&mode=3&mids="+mids+"&mp="+ge("mainpicMid").value;var E=loadAjax(A);E.onreadystatechange=function(){if(E.readyState==4){bm.innerHTML+=E.responseText;if(ge("loading")!=null){ge("loading").style.visibility="hidden"}}};E.send(null);var D=F.scrollHeight;var G=curtop=0;if(F.offsetParent){G=F.offsetLeft;curtop=F.offsetTop;while(F=F.offsetParent){G=G+F.offsetLeft;curtop=curtop+F.offsetTop}}bm.style.top=curtop+D+"px";bm.style.left=(G-80)+"px";bm.style.width="420px";bm.style.position="absolute";bm.style.display="block";bm.style.visibility="visible"}function getWindowHeight(){var A=0;if(typeof (window.innerHeight)=="number"){A=window.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){A=document.documentElement.clientHeight}else{if(document.body&&document.body.clientHeight){A=document.body.clientHeight}}}return A}function getWindowWidth(){var A=0;if(typeof (window.innerWidth)=="number"){A=window.innerWidth}else{if(document.documentElement&&document.documentElement.clientWidth){A=document.documentElement.clientWidth}else{if(document.body&&document.body.clientWidth){A=document.body.clientWidth}}}return A}function trim(C){var C=C.replace(/^\s\s*/,""),A=/\s/,B=C.length;while(A.test(C.charAt(--B))){}return C.slice(0,B+1)}function delay(){var B=new Date();var A=null;do{A=new Date()}while(A-B<7000)}function GetWidth(){var A=0;if(self.innerHeight){A=self.innerWidth}else{if(document.documentElement&&document.documentElement.clientHeight){A=document.documentElement.clientWidth}else{if(document.body){A=document.body.clientWidth}}}return A}function featureMedia(E,D,C){var B=E;var A="/mkfeat.jsp";A+="?iid="+E;A+="&type="+C;if(D=="false"){A+="&isfeat=false"}else{A+="&isfeat=true"}ajaxSimple(A,"featuringLink"+E);if(ge("featuredMediaRefresh")!=null){ajaxSimple("/adminFeaturedMedia.jsp","featuredMediaRefresh")}removeLoading()}function featureThisMedia(B,D,A,C){var E=document.getElementById(B).checked;if(E>0){alert("This media has been featured!");makefeat(A,C)}else{if(!E){alert("Make Featured must be checked!")}}}function reloadPage(A){setTimeout("window.location.reload(true);",A)}function displayInviteEdit(A,C){var D=ge("inviteInlineEdit"+A);var B="<input type='text' id='inviteEdit"+A+"' value='"+C+"' />";B+="<input type='button' value='submit' onclick='inviteInlineEdit("+A+")' />";D.innerHTML=B}function inviteInlineEdit(D){ge("manageInvitesError").innerHTML="";ge("manageInvitesError").style.display="none";if(ge("unmakeYellow").value!=""){var C=ge("unmakeYellow").value;ge("tableRow"+C).style.fontWeight="";ge("tableRow"+C).style.backgroundColor="";ge("unmakeYellow").value=""}var G=ge("inviteInlineEdit"+D);var A=ge("inviteEdit"+D).value;var B="/inviteInlineEdit.jsp";var E="id="+D+"&newInvites="+A;var F=loadPostAjax(B,E);F.onreadystatechange=function(){if(F.readyState==4){switch(F.responseText){case"-2":ge("manageInvitesError").innerHTML="Error with submitting value. Please contact the SpeechBobble Team";ge("manageInvitesError").style.display="";removeLoading();break;case"-1":ge("manageInvitesError").innerHTML="The number of invites is not valid";ge("manageInvitesError").style.display="";removeLoading();break;default:var H=ge("tableRow"+D);if(H){H.style.fontWeight="bold";H.style.backgroundColor="yellow";ge("unmakeYellow").value=D}var I="<a onclick='displayInviteEdit("+D+", "+F.responseText+")'>"+F.responseText+"</a>";ge("inviteInlineEdit"+D).innerHTML=I;ge("inviteUpdateMsg").innerHTML="<p>Number of remaining invites of User with ID: "+D+" has been updated to "+F.responseText+"!</p>";removeLoading();break}}};F.setRequestHeader("Content-type","application/x-www-form-urlencoded");F.setRequestHeader("Content-length",E.length);F.setRequestHeader("Connection","close");setloading();F.send(E)}function emptyContents(A){ge(A).innerHTML=""}function hideElement(A){ge(A).style.display="none"}function selectUserInfo(B,A){document.getElementById(B).value=A}function autoSearch(B,G,O,M,I,K,C,H){var E=K*1;var D=M.value.length*1;if(D==0||D<E){ge(G).style.display="none";return }var B=B;B+="?search="+O;B+="&str="+M.value;B+="&searchType="+I;B+="&start="+C;B+="&count="+H;B+="&returnDiv="+M.id;var L=loadAjax(B);L.onreadystatechange=function(){if(L.readyState==4){var Q=document.getElementById(G);var P=L.responseText;if(P.length==0||P==""){Q.innerHTML="<table><tr><td>No suggestions...</td></tr></table>";ge(G).style.display="block"}else{Q.innerHTML=P;ge(G).style.display="block"}}};ajaxsend(L);removeLoading();var N="#"+G;var F=$(M);var J=F.position();var A=$(N);A.css("top",(J.top+F.innerHeight())+"px").css("left",(J.left)+"px").css("width",F.innerWidth()).bgIframe()}function closeUploadDiv(A){ge(A).style.display="none"}function toggleElement(A){$(A).toggle()}function blank(A){ge(A).value=""}function showElement(A){ge(A).style.display="block"}function setTagValue(B,A){ge(B).value=A}function setActiveColor(B,E,D,C,H,G){var F=ge(E).getElementsByTagName(B);if(G=="true"){for(var A=0;A<F.length;A++){F[A].style.backgroundColor=C}ge(D).style.backgroundColor=H}else{for(var A=0;A<F.length;A++){F[A].style.color=C}ge(D).style.color=H}}function clearCurrentRowColor(A){var D=document.getElementById(A);var B=D.getElementsByTagName("table")[0];var C=B.getElementsByTagName("tr");C[currentRow].style.backgroundColor="transparent"}function setCurrentRowNumber(A){currentRow=A.rowIndex}function createPrivateMessageToList(A,O,L,B){var J=document.createElement("span");J.setAttribute((document.all?"className":"class"),"recipient");J.setAttribute("id","recipient"+L);var H=document.createElement("span");J.appendChild(H);var G=document.createElement("span");H.appendChild(G);var F=document.createElement("span");G.appendChild(F);var E=document.createElement("span");F.appendChild(E);var I=document.createTextNode(O);E.appendChild(I);var M=document.createElement("span");var K="pm"+L;M.onclick=function(){document.getElementById(A).removeChild(document.getElementById("recipient"+L));document.getElementById("bobble").removeChild(document.getElementById(K))};E.appendChild(M);var N=document.createTextNode(" ");M.appendChild(N);var D=document.createTextNode(" ");E.appendChild(D);document.getElementById(A).insertBefore(J,document.getElementById("privateMessageInput"));var C=document.createElement("input");C.setAttribute("type","hidden");C.setAttribute("value",L);C.setAttribute("name","userId");C.setAttribute("id",K);document.getElementById(B).appendChild(C);document.getElementById("privateMessageInput").value=""}function processkey(I,D,F,C){var B=document.getElementById(D);var L=B.getElementsByTagName("table")[0];var G=L.rows.length;var E=(window.event)?event.keyCode:I.keyCode;var K=L.getElementsByTagName("tr");switch(E){case 9:case 13:if(C=="privateMessage"){var J=K[currentRow].getElementsByTagName("input")[0].value;createPrivateMessageToList("privateMessageToList",J,K[currentRow].firstChild.id,"bobble")}else{if(C=="manageUser"){var H=K[currentRow].getElementsByTagName("a")[0];selectUserInfo(L.getElementsByTagName("input")[0].value,H.childNodes[0].nodeValue);L.getElementsByTagName("input")[0].blur()}}document.getElementById(D).style.display="none";I.preventDefault();I.stopPropagation();var A=document.getElementById("autoComplete");A.removeChild(A.firstChild);currentRow=0;break;case 38:if(parseInt(currentRow)==parseInt(0)){return true}else{K[currentRow].style.backgroundColor="transparent";currentRow=parseInt(currentRow-1)}break;case 40:if(parseInt(currentRow)==parseInt(G-1)){return true}else{K[currentRow].style.backgroundColor="transparent";currentRow=parseInt(currentRow+1)}break;default:return true}K[currentRow].style.backgroundColor=F;return false}function changeText(B,A){$("#"+B).text(A)}function manageGroupsInline(C,G,F,E,B){var A;if(C=="title"){if(G>0){E=ge("inputGroup"+F).value}A="/admin/adminModPrivateGroupInline.jsp?type="+C+"&gid="+F+"&info="+E+"&op="+G+"&initial="+B;var D=loadAjax(A);D.onreadystatechange=function(){if(D.readyState==4){if(D.responseText.indexOf('input type="hidden"')!=-1){if(G==1){if(D.responseText.indexOf('value="0"')!=-1){ge("msgDiv").innerHTML="<div class='ui-state-success'>Success: Renamed group.</div>"}else{if(D.responseText.indexOf('value="1"')!=-1){ge("msgDiv").innerHTML="<div class='ui-state-success'>Note: New group title is the same as it was before.</div>"}else{if(D.responseText.indexOf('value="2"')!=-1){ge("msgDiv").innerHTML="<div class='ui-state-error'>Error: Group name contains unsupported characters.</div>"}else{if(D.responseText.indexOf('value="3"')!=-1){ge("msgDiv").innerHTML="<div class='ui-state-error'>Error: Group name already exists.</div>"}}}}}}else{ge("msgDiv").innerHTML=""}ge("inlineGroup"+F).innerHTML=D.responseText}};ajaxsend(D)}else{if(C=="viewers"){if(G>0){E=ge("newGroup").value}A="/singleviewGroup.jsp?type="+C+"&bid="+F+"&info="+E+"&op="+G+"&initial="+B;ajaxSimple(A,"groupViewable")}}removeLoading()};