var baseserverurl="http://www.uploadthingy.com";var loadimage="<img src=http://49video.resources.s3.amazonaws.com/loading.gif width=16 height=16>";function displayDate(C,B,K){if(C.length<2){return""}var I=new Date();var A=Date.parse(C);var G=new Date(A);var L=new Date(G);L.setHours(23);L.setMinutes(59);var D=new Date(I);D.setHours(23);D.setMinutes(59);var J=Math.round((L-D.getTime())/86400000);var F="";if(J==0){F+="Today"}else{if(J==-1){F+="Yesterday"}else{if(J==1){F+="Tomorrow"}else{if(J<-90){F+=Math.round((-J/30))+" Months Ago on"}else{if(J<-1){F+=(-J)+" days ago on"}else{if(J>90){F+="in "+Math.round((J/30))+" Months on"}else{F+="in "+J+" Days on"}}}}}}if(K){F+="<br>"}else{F+=" "}F+=(G.getMonth()+1)+"/"+G.getDate()+"/"+G.getFullYear()+" ";var E=G.getHours();var H="am";if(E>12){E-=12;H="pm"}else{if(E==12){H="pm"}}F+=E+":";if(G.getMinutes()<10){F+="0"}F+=G.getMinutes()+H;if(B&&G<new Date()){F="<font color=red>"+F+"</font>"}return F}function setHTML(B,A){if(!$(B)){return}$(B).innerHTML=A}function d(A){A=unescape(A);return A.replace(/\+/g," ")}function doBRs(A){A=A.replace(/\n/g,"");return A.replace(/<br>/g,"\n")}function $(A){return document.getElementById(A)}function cd(){return document.createElement("div")}function n(A){A=d(A);return A.replace(/ /g,"_")}function l(A){return"<table width=100%><tr><td bgcolor=#"+A+"><img src=http://49video.resources.s3.amazonaws.com/images/transparent.gif height=1></td></tr><tr><td><img src=http://49video.resources.s3.amazonaws.com/images/transparent.gif height=6></td></tr></table>"}function getB(A){if(A>=1000000000){return Math.round(A/100000000)/10+"gb"}else{if(A>=1000000){return Math.round(A/100000)/10+"mb"}else{return Math.round(A/1000)+"kb"}}}function empty(A){if(!A){return}while(A.hasChildNodes()){A.removeChild(A.firstChild)}}function trim(A){return A.replace(/^\s+|\s+$/g,"")}var JSC_UPLOADSTATUS=0,JSC_FILELIST=1,JSC_CHANGESTATUS=2,JSC_GETSERVERUPLOAD=10,JSC_GETSERVERDOWNLOAD=11,JSC_DOWNLOADFILE=12,JSC_DELETEFILE=13,JSC_GETDISCUSSION=14,JSC_CPW=101,JSC_GETEMAILS=102,JSC_SAVEEMAILS=103,JSC_UPLOADPING=104,JSC_GETUPLOADPASSWORDS=105,JSC_SAVEUPLOADPASSWORDS=106;var currpw,curruploadpassword=".none.",currdomain,uploadmetadata,purchasedate,createdate,storefiles,mmd,md;var sorteduploadlist,uploadcompletehtml=null;var showblinks=true,trial=false;function handleJSON(command,json){if(json.s&&json.s=="badcode"){if(command==-1){sitecode=null;setHTML("downloadarea",getDownloadLogin());alert("Oops. That was not a valid domain")}else{var m="Ooops. The sitecode supplied with this page will not work with this domain. Please make sure you entered the correct domain when you grabbed the code for this uploadthingy at uploadthingy.com.";setHTML("uploadarea",m);setHTML("downloadarea",m)}return}if(command==JSC_UPLOADSTATUS){if(json.status=="done"||json.error!=null){var m="";if(json.error){if(json.error=="server"){m="Ooops. Server error uploading file. Please try again later."}else{if(json.error=="authcode"){m="Ooops. Invalid upload authorization. Please try again."}else{if(json.error=="video"){m="Ooops. That was not a valid file. Please try again."}else{if(json.error=="size"){m="Ooops. The size of the files you uploaded was larger than 1GB"}else{m="Ooops. There was some crazy server error: "+json.error}}}}setHTML("uploadarea",m)}else{var uploadrefcode=json.podcastid.substring(json.podcastid.lastIndexOf("$")+1);var nuc="/widget?c="+sitecode+"&a=newupload";if(uploadmetadata!=null){if(uploadmetadata.name!=null){nuc+="&name="+escape(uploadmetadata.name)}if(uploadmetadata.company!=null){nuc+="&company="+escape(uploadmetadata.company)}if(uploadmetadata.description!=null){nuc+="&description="+escape(uploadmetadata.description)}if(uploadmetadata.contact!=null){nuc+="&contact="+escape(uploadmetadata.contact)}if(uploadmetadata.sendtoemail!=null){nuc+="&sendtoemail="+escape(uploadmetadata.sendtoemail)}if(uploadmetadata.sendtotitle!=null){nuc+="&sendtotitle="+escape(uploadmetadata.sendtotitle)}for(i=0;i<5;i++){if(uploadmetadata["uploadfile"+i]!=null){var fn=uploadmetadata["uploadfile"+i];if(fn.lastIndexOf("\\")!=-1&&fn.lastIndexOf("\\")<fn.length-2){fn=fn.substring(fn.lastIndexOf("\\")+1)}if(fn.lastIndexOf("/")!=-1&&fn.lastIndexOf("/")<fn.length-2){fn=fn.substring(fn.lastIndexOf("/")+1)}nuc+="&uploadfile"+i+"="+escape(fn)}}nuc+="&refcode="+escape(uploadrefcode)+"&authcode="+uploadcode}sendCommand(baseserverurl,nuc);if(uploadmetadata.sendtoemail==null){if(uploadcompletehtml!=null){var ic=0;while((il=uploadcompletehtml.indexOf("<$refcode$>",ic))!=-1){m+=uploadcompletehtml.substring(ic,il)+uploadrefcode;ic=il+11}m+=uploadcompletehtml.substring(ic)}else{m="Your upload has successfully completed.<br>Use this code to reference your upload: <b>"+uploadrefcode+"</b>.<br><a href='javascript:authupload();'>Click here</a> to return to the upload form.<br><br>Powered by <a href=http://www.uploadthingy.com>uploadthingy</a>!"}}else{m="<img src=http://49video.resources.s3.amazonaws.com/loading.gif width=16 height=16> Sending email to "+uploadmetadata.sendtoemail+"... "}setHTML("uploadarea",m)}}else{var info="";var remainingtime=0;if(json.status=="reading"){info+=json.percentcomplete+"% complete";var elapsed=new Date().getTime()-uploadstart;if(eval(json.totalread)>0){remainingtime=elapsed/eval(json.totalread)*(eval(json.contentlength)-eval(json.totalread));remainingtime=remainingtime/1000;if(remainingtime>60){info+=", remaining time: "+Math.round(remainingtime/60)+" minutes"}else{info+=", remaining time: "+Math.round(remainingtime)+" seconds"}}}else{info+=json.status}clearTimeout(uploadtimer);var wait=500;if(uploadcnt>50&&remainingtime>20){wait=10000}else{if(uploadcnt>20){wait=5000}else{if(uploadcnt>5){wait=1000}}}uploadtimer=setTimeout("upload('go','"+info+"')",wait)}}else{if(command==JSC_GETSERVERUPLOAD){if(json.s=="ok"){uploadcode=json.c;videoserverurl=json.u;var h="<a name=widget_top></a><form method='post' action='";h+=json.u+"/cire?uploadcode="+json.c;h+="' enctype='multipart/form-data' id='uploadform' name='uploadform' target='uploadtarget' onsubmit=\"if (checkform()) {return upload('start');} else return false;\" >";h+=getUploadForm(json);h+="</form><br>";if(eval(json.mmd)<5000000000){trial=true;showblinks=true}if(location.href.indexOf("download")==-1&&showblinks){h+="<p><a href=http://www.uploadthingy.com style='font-size:10px'>get your uploadthingy</a> | <a href=http://www.uploadthingy.com/download="+sitecode+" style='font-size:10px'>download</a></p>"}setHTML("uploadarea",h)}else{if(json.s=="notactive"){setHTML("uploadarea","Ooops. This uploadthingy has been deactivated.")}else{if(json.s=="noauth"){var h="<form onsubmit=\"curruploadpassword=$('pw').value; authupload(); return false;\"><p>Please enter your password:<br><input type=password size=40 id=pw><input type=submit value='Login'> </form></p>";setHTML("uploadarea",h);if(curruploadpassword!=".none."){alert("Oops. That was not a correct password")}}else{if(json.s=="overlimit"){setHTML("uploadarea","Ooops. This uploadthingy has been temporarily deactivated because the maximum monthly transfer was exceeded.")}else{setHTML("uploadarea","Ooops. Could not connect to server. <a href=# onclick='window.location.reload();'>Please click here to try again.</a>")}}}}}else{if(command==JSC_GETSERVERDOWNLOAD){currdomain=json.d;if(sitecode==null||sitecode.length<2){sitecode=json.sc}if(currdomain){setHTML("domainname"," for "+currdomain)}if(json.s=="ok"){if(json.p){purchasedate=json.p}if(json.cd){createdate=json.cd}if(json.sf){storefiles=json.sf}mmd=json.mmd;md=json.md;videoserverurl=json.u;sendCommand(json.u,"/jsc?lf=widget$"+json.d+"&ac="+json.c+"&cb="+baseserverurl,"downloadarea");loadDiscussion(0)}else{if(json.s=="noserver"){setHTML("downloadarea",getDownloadLogin());alert("Ooops. Could not connect to server. Please try again.")}else{if(json.s=="noauth"){setHTML("downloadarea",getDownloadLogin());alert("Ooops. Wrong password or your session expired. Please try again.")}else{if(json.s=="notactive"){setHTML("downloadarea","Ooops. This uploadthingy has been deactivated. Please contact us at hello@uploadthingy.com.")}else{if(json.s=="overlimit"){setHTML("uploadarea","Ooops. This uploadthingy has been temporarily deactivated because the maximum monthly transfer was exceeded. Please contact us at hello@uploadthingy.com.")}else{message("Ooops. An unknow error occured")}}}}}}else{if(command==JSC_DELETEFILE){if(json.s=="ok"){videoserverurl=json.u;sendCommand(json.u,"/jsc?lf=widget$"+json.d+"&ac="+json.c+"&cb="+baseserverurl,"downloadarea")}else{if(json.s=="noserver"){message("Ooops. Could not connect to server. Please try again later.","downloadarea")}else{if(json.s=="noauth"){setHTML("downloadarea",getDownloadLogin());alert("Ooops. Wrong password or your session expired.","downloadarea")}else{message("Ooops. An unknow error occured")}}}}else{if(command==JSC_FILELIST){setHTML("downloadarea",loadimage+" Displaying...");var smd=Math.round(md/1000)+" KB";if(md>=1000000000){smd=Math.round(md/10000000)/100+" GB"}else{if(md>=1000000){smd=Math.round(md/10000)/100+" MB"}}var smmd=(mmd/1000)+" KB";if(mmd>=1000000000){smmd=Math.round(mmd/1000000000)+" GB"}else{if(mmd>=1000000){smmd=Math.round(mmd/1000000)+" MB"}}var h="";var over=eval(md)>eval(mmd);var evaldays=evalDays();var maxevaldays=14;if(Date.parse(createdate)>Date.parse("9/5/2008")){maxevaldays=7}if(evaldays>=0){if(evaldays<maxevaldays+1){h+="You are on day "+evaldays+" of your "+maxevaldays+" day free trial period and have transferred "+smd+". Click the <a href='javascript:getSubscribe();'>your subscription</a> link to purchase a subscription."}else{h+="Your "+maxevaldays+" day free trial period is over. Please click the <a href='javascript:getSubscribe();'>your subscription</a> link to purchase a subscription."}}else{if(over){h+="<font color=red><b>"}h+="You have transferred "+smd+" of your "+smmd+" monthly limit";if(over){h+="</b></font>"}h+=", all uploads are automatically deleted after "+storefiles+" month"+(storefiles>1?"s":"")+". Click the <a href='javascript:getSubscribe();'>your subscription</a> link to add to your monthly transfer limit or to keep your files longer."}h+="<br><br>";h+="<a href='javascript:authdownload();'>reload</a>";h+=" &nbsp;<a href='javascript:sendFiles();'>send files</a>";h+=" &nbsp;<a href='javascript:getEmails();'>email alerts</a>";h+=" &nbsp;<a href='javascript:getUploadPasswords();'>upload passwords</a>";h+=" &nbsp;<a href='javascript:changePassword();'>download password</a>";h+=" &nbsp;<a href='javascript:getSubscribe();'>your subscription</a>";h+=" &nbsp;<a href='javascript:downloadLogout();'>logout</a><br><br>";if(json.data.length==0){h+="<br><br>There are no uploads.<br><br>Please contact us if you have questions about receiving uploads... or any other questions - we'd love to help out!"}else{sorteduploadlist=json.data;h+=getDownloadList(json.data)}setHTML("downloadarea",h)}else{if(command==JSC_CPW){if(json.s=="ok"){setHTML("downloadarea","Your password has been changed. <a href='javascript:authdownload()'>Click here</a> to continue.")}else{if(json.s=="downloadarea"){setHTML("editwidget","Ooops. Your old password was not correct. <a href=# onclick='window.location.reload();'>Please click here to try again.</a>")}else{setHTML("downloadarea","Ooops. There was an error. <a href=# onclick='window.location.reload();'>Please click here to try again.</a>")}}}else{if(command==JSC_GETEMAILS){var h="Send alerts to the following emails when new uploads arrive:";h+="<br><br>Email 1: <br><input type=text style='width:260px' id=email0 value='"+json.email0+"'>";h+="<br><br>Email 2: <br><input type=text style='width:260px' id=email1 value='"+json.email1+"'>";h+="<br><br>Email 3: <br><input type=text style='width:260px' id=email2 value='"+json.email2+"'>";h+="<br><br>Email 4: <br><input type=text style='width:260px' id=email3 value='"+json.email3+"'>";h+="<br><br>Email 5: <br><input type=text style='width:260px' id=email4 value='"+json.email4+"'>";h+="<br><br><input type='checkbox' id='emaillinks'";if(json.emaillinks&&json.emaillinks=="y"){h+=" checked"}h+="> include file links in alert emails";h+="<br><br><input type=button value='Save' onclick=saveEmails();> &nbsp; <input type=button value='Cancel' onclick=authdownload();>";setHTML("downloadarea",h)}else{if(command==JSC_SAVEEMAILS){if(json.s=="ok"){setHTML("downloadarea","Your changes have been saved. <a href='javascript:authdownload()'>Click here</a> to continue.")}else{setHTML("downloadarea","Ooops. There was an error. <a href=# onclick='window.location.reload();'>Please click here to try again.</a>")}}else{if(command==JSC_GETUPLOADPASSWORDS){var h="Require any of the following passwords to access your upload form (leave all blank so your upload form will show immediately).";h+="<br><br>Password 1: <br><input type=text style='width:260px' id=up0 value='"+json.up0+"'>";h+="<br><br>Password 2: <br><input type=text style='width:260px' id=up1 value='"+json.up1+"'>";h+="<br><br>Password 3: <br><input type=text style='width:260px' id=up2 value='"+json.up2+"'>";h+="<br><br>Password 4: <br><input type=text style='width:260px' id=up3 value='"+json.up3+"'>";h+="<br><br>Password 5: <br><input type=text style='width:260px' id=up4 value='"+json.up4+"'>";h+="<br><br><input type=button value='Save' onclick=saveUploadPasswords();> &nbsp; <input type=button value='Cancel' onclick=authdownload();>";setHTML("downloadarea",h)}else{if(command==JSC_SAVEUPLOADPASSWORDS){if(json.s=="ok"){setHTML("downloadarea","Your changes have been saved. <a href='javascript:authdownload()'>Click here</a> to continue.")}else{setHTML("downloadarea","Ooops. There was an error. <a href=# onclick='window.location.reload()'>Please click here to try again.</a>")}}else{if(command==JSC_UPLOADPING){if(uploadmetadata.sendtoemail!=null){setHTML("downloadarea","An email has been sent to "+uploadmetadata.sendtoemail+" with links to the uploaded file(s).<br><a href='javascript:authdownload()'>Click here</a> to continue.")}}else{if(command==JSC_GETDISCUSSION){var h="<a name=discuss></a><span class=bold>Have a question or an idea? Post it here!</span><br>";if(!checkDemo(true)){h+="<br>Your name: <br><input type=name style='width:218px' id=discussname>";h+="<br><br>Your message: <br><textarea name=text id=discusstext style='width:218px; height:80px' onkeyup=\"setHTML('charcnt', 200-this.value.length);\"></textarea>";h+="<br><font size=-2><span id=charcnt>200</span> characters remaining.</font>";h+="<br><br><input type=button value='Post It!' onclick=discussionMessage();><br>"}else{h+="<span class=normal>We're posting updates, and discussing... well... uploadthingy... with you!<br>"}for(i=0;i<json.data.length;i++){if(i>4){break}h+="<br><p><span class=normal><a href=http://"+json.data[i].url+">"+d(json.data[i].name)+"</a>: "+d(json.data[i].text)+"</span><br><font size=-2>posted "+displayDate(json.data[i].create_date)+"</font></p>"}h+="<br><table width=180px><tr><td width=33%>";if(discussionstart>0){h+='<a href="#discuss" onclick="javascript:loadDiscussion('+(discussionstart-5)+');">&laquo; newer</a>'}h+='</td><td align=center width=33%><a href="#discuss" onclick="javascript:loadDiscussion(0);">refresh</a></td><td align=right width=33%>';if(json.data.length==6){h+='<a href="#discuss" onclick="javascript:loadDiscussion('+(discussionstart+5)+');">older &raquo;</a>'}h+="</td></tr></table>";setHTML("discussarea",h)}else{if(command==JSC_CHANGESTATUS){$("imagestatus"+json.nr).src="http://49video.resources.s3.amazonaws.com/images/status_"+sorteduploadlist[eval(json.nr)].status+".png";setHTML("editstatus"+json.nr,"")}else{setHTML("uploadarea","Ooops. There was an error: "+json.s+", command="+command+". Please contact us at info@uploadthingy.com.");setHTML("downloadarea","Ooops. There was an error: "+json.s+", command="+command+". Please contact us at info@uploadthingy.com.")}}}}}}}}}}}}}}var discussionstart=0;function loadDiscussion(A){discussionstart=A;sendCommand(baseserverurl,"/widget?c="+sitecode+"&a=getdiscussion&start="+discussionstart)}function discussionMessage(){var A=null;if($("discussname").value.length<2){A="Ooops. Please enter your name."}else{if($("discussname").value.length>20){A="Ooops. Please shorten your name to 20 characters."}else{if($("discusstext").value.length<2){A="Ooops. Please enter a message."}else{if($("discusstext").value.length>200){A="Ooops. Please shorten your message to 200 characters."}}}}if(A!=null){alert(A);return}if(confirm("Are you sure you want to post your message?")){var B="/widget?c="+sitecode+"&a=savediscussion";B+="&name="+escape($("discussname").value);B+="&text="+escape($("discusstext").value);sendCommand(baseserverurl,B,"discussarea")}}function getEmails(){sendCommand(baseserverurl,"/widget?c="+sitecode+"&a=getemails","downloadarea")}function saveEmails(){if(checkDemo()){return}for(i=0;i<5;i++){var B="email"+i;if($(B).value.length==0){continue}if($(B).value.length<7||$(B).value.indexOf("@")==-1||$(B).value.indexOf(".")==-1){alert("Ooops. One of the emails you entered is not valid.");return}}var A="/widget?c="+sitecode+"&a=saveemails";for(i=0;i<5;i++){A+="&e"+i+"="+escape($("email"+i).value)}A+="&e1="+escape($("email1").value);A+="&e2="+escape($("email2").value);A+="&e3="+escape($("email3").value);A+="&e4="+escape($("email4").value);if($("emaillinks").checked){A+="&emaillinks=y"}sendCommand(baseserverurl,A,"downloadarea")}function getUploadPasswords(){sendCommand(baseserverurl,"/widget?c="+sitecode+"&a=getuploadpasswords","downloadarea")}function saveUploadPasswords(){if(checkDemo()){return}var A="/widget?c="+sitecode+"&a=saveuploadpasswords";for(i=0;i<5;i++){A+="&up"+i+"="+escape($("up"+i).value)}sendCommand(baseserverurl,A,"downloadarea")}function sendFiles(){if(overLimit()){return}var A="<span id=uploadarea><p><img src=http://49video.resources.s3.amazonaws.com/loading.gif width=16 height=16>  Loading...</p></span>";setHTML("downloadarea",A);authupload()}function changePassword(){if(checkDemo()){return}var A="Use this form to change your password for this download and admin area.<br><br>Your new password: <br><input type=password style='width:260px' id=newpassword>";A+="<br><br>Confirm Your Password: <br><input type=password style='width:260px' id=confirmnewpassword>";A+="<br><br><input type=button value='Change It!' onclick=checkChangePassword();> &nbsp; <input type=button value='Cancel' onclick=authdownload();>";setHTML("downloadarea",A)}function checkChangePassword(){if(checkDemo()){return}var A=null;if($("newpassword").value.length<5){A="Ooops. Your new password must be at least 5 characters long."}else{if($("newpassword").value!=$("confirmnewpassword").value){A="Ooops. You did not confirm your password correctly."}}if(A!=null){alert(A)}else{var B=$("newpassword").value;sendCommand(baseserverurl,"/widget?c="+sitecode+"&a=newpw&pw="+escape(currpw)+"&npw="+escape($("newpassword").value)+"&cpw="+escape($("confirmnewpassword").value),"downloadarea");currpw=B}}function filelistsorter(B,A){var C=new Date(Date.parse(d(A.create_date)))-new Date(Date.parse(d(B.create_date)));return C}var commandcnt=Math.ceil(Math.random()*10000000),ccbase=new Date().getTime()-1231877000000,dataareacnt=0;var showwaitsave;function sendCommand(A,D,C){if(C){showwaitsave=$(C).innerHTML;setHTML(C,"<p>"+loadimage+" &nbsp;Loading...</p>")}var B=document.createElement("script");B.src=A+D+"&cnt="+ccbase+"."+commandcnt;if(++dataareacnt>3){dataareacnt=0}empty($("dataarea"+dataareacnt));$("dataarea"+dataareacnt).appendChild(B);commandcnt++}var uploadtimer,uploadcnt,uploadcode,videoserverurl;var uploadstart;function upload(C,B){if(C=="start"){uploadcnt=0;uploadstart=new Date().getTime();uploadtimer=setTimeout("upload('go')",500)}else{++uploadcnt;var A="<p class=49widget_p>Your files are uploading. Please do not refresh or navigate away from this page until the upload is complete.</p>";A+="<p>"+loadimage+" &nbsp;Uploading... ";if(B){A+=B}A+="</p>";setHTML("uploadarea",A);sendCommand(videoserverurl,"/jsc?uc="+uploadcode,null)}return true}function message(A,B){if(showwaitsave&&B){$(B).innerHTML=showwaitsave}if(A!=null){alert(A)}}function authupload(){sendCommand(baseserverurl,"/widget?c="+sitecode+"&a=authupload&up="+curruploadpassword,null)}function downloadLogout(){currpw=null;var A=new Date();A.setTime(A.getTime()-(24*60*60*1000));document.cookie="uploadthingy=; expires="+A.toGMTString()+"; path=/";setHTML("downloadarea",getDownloadLogin())}function downloadLogin(){var C="/widget?c=";if(sitecode!=null&&sitecode.length>2){C+=sitecode}else{sitecode=$("logindomain").value.toLowerCase();sitecode=trim(sitecode);if(sitecode.indexOf("http://")==0){sitecode=sitecode.substring(7)}if(sitecode.indexOf("www.")==0){sitecode=sitecode.substring(4)}var A=null;if(sitecode.length<5||sitecode.lastIndexOf(".")<2||sitecode.lastIndexOf(".")>sitecode.length-3||sitecode.indexOf(" ")!=-1){A="Ooops. That is not a valid domain.\nDomain example: mysite.com."}else{if(sitecode.indexOf("/")!=-1){A="Ooops. That is not a valid domain - you can't have a '/' in the domain.\nDomain example: mysite.com"}else{if(sitecode.indexOf("@")!=-1){A="Ooops. That is not a valid domain - you can't have a '@' in the domain.\nDomain example: mysite.com"}}}if(A!=null){alert(A);return}C+=escape(sitecode)}C+="&a=authdownload";C+="&pw="+escape($("pw").value);if($("rememberme").checked){var B=new Date();currpw=Math.random()+"."+B.getTime();B.setTime(B.getTime()+(360*24*60*60*1000));var D="uploadthingy=";if(sitecode!=null&&sitecode.length>2){D+=sitecode+":"}D+=currpw+"; expires="+B.toGMTString()+"; path=/";document.cookie=D;C+="&ck="+escape(currpw)}else{currpw=$("pw").value;var B=new Date();B.setTime(B.getTime()-(24*60*60*1000));document.cookie="uploadthingy=; expires="+B.toGMTString()+"; path=/"}sendCommand(baseserverurl,C,"downloadarea")}function authdownload(){var B=readCookie("uploadthingy");if(B&&B.length>3){var A=B.indexOf(":");if(A!=-1){sitecode=B.substring(0,A);B=B.substring(A+1)}currpw=B}if(sitecode==null||sitecode.length<2||currpw==null||currpw.length<3){setHTML("downloadarea",getDownloadLogin())}else{var C="/widget?c="+sitecode+"&a=authdownload";if(currpw){sendCommand(baseserverurl,C+"&pw="+currpw,"downloadarea")}else{setHTML("downloadarea",getDownloadLogin())}}}function getDownloadLogin(){var A="<form onsubmit='downloadLogin(); return false;'><br><table><tr valign=bottom><td>";if(sitecode==null||sitecode.length<2){A+="Your domain:<br>";A+="<input type=text style='width:160px;' id=logindomain></td><td> &nbsp; &nbsp; &nbsp;</td><td>";A+="Your password:<br>"}else{A+="Please enter your password:<br>"}A+="<input type=password style='width:160px;' id=pw></td><td> &nbsp; &nbsp; &nbsp;</td><td><input type=submit value='Login'></td></tr></table>";A+="<br><input type='checkbox' id='rememberme'> remember me";A+="</form>";A+="<br><br>Enter your uploadthingy ";if(sitecode==null||sitecode.length<2){A+="<a href='#none' onclick=\"ddrivetip(event, 'This is the domain your uploadthingy lives on. You entered it when you grabbed the code for your uploadthingy widget. Example: mysite.com','', 350);\" >domain</a> and "}A+="<a href='#none' onclick=\"ddrivetip(event, 'This is the password you created when you grabbed the code for your uploadthingy widget.','', 350);\" >password</a> and click 'Login' above to:";A+="<ul><li>View, download and delete the uploads from your uploadthingy widget</li>";A+="<li>Send files to others</li>";A+="<li>Enter email addresses for people that are to be notified when new uploads arrive</li>";A+="<li>Password protect your upload form</li>";A+="<li>Change your password</li>";A+="<li>Manage your subscription</li>";A+="</ul><br><a href=https://www.uploadthingy.com/download>Click here for the secure SSL encrypted download/admin page</a>. Requires subscription upgrade.";return A}function download(B,C){if(overLimit()){return}var D="";if(C>0){D="!"+C}var A=baseserverurl+"/widget?c="+sitecode+"&a=downloadfile&pw="+currpw+"&id="+sorteduploadlist[B].id+D+"&ndl=true";if(C==0){A+="&size="+sorteduploadlist[B]["filesize"]}else{A+="&size="+sorteduploadlist[B]["filesize"+C]}A+="&ext=";if(C==0){A+=sorteduploadlist[B].fileext+"&ofn="+d(sorteduploadlist[B].filename)}else{A+=sorteduploadlist[B]["fileext"+C]+"&ofn="+d(sorteduploadlist[B]["filename"+C])}document.location=A}function emaillink(B,D){if(overLimit()){return}if($("el"+B+"."+D).innerHTML.length>0){$("el"+B+"."+D).innerHTML=""}else{var E="";if(D>0){E="!"+D}var C=sorteduploadlist[B].id.substring(sorteduploadlist[B].id.lastIndexOf("$")+1);var A=baseserverurl+"/widget?c="+sitecode+"&el="+C+E;if(D==0){A+=sorteduploadlist[B].fileext}else{A+=sorteduploadlist[B]["fileext"+D]}$("el"+B+"."+D).innerHTML="<br>Click, copy and paste this link for access to this file:<br><input type=text style='border-color:#999999; border-width:1px; border-style:solid; background:#ffffff; width:220px; margin-top:3px; margin-bottom:10px;' onclick='this.select()' value='"+A+"'>"}}function deletefile(A){if(confirm("Are you sure you want to delete the upload submitted "+displayDate(d(sorteduploadlist[A].create_date),false)+"? ")){sendCommand(baseserverurl,"/widget?c="+sitecode+"&a=delete&pw="+currpw+"&id="+sorteduploadlist[A].id,"downloadarea")}}function selectfiles(B){var A=0;while(document.getElementById("udel"+A)){$("udel"+A).checked=B;A++}}function deletefiles(){var B="";var C="";var A=0;while(document.getElementById("udel"+A)){if($("udel"+A).checked){if(B.length>0){B+=","}B+=sorteduploadlist[A].id;if(C.length>0){C+=", "}C+=sorteduploadlist[A].id.substring(sorteduploadlist[A].id.lastIndexOf("$")+1)}A++}if(B.length==0){alert("Ooops. You didn't select any uploads to delete.")}else{if(confirm("Are you sure you want to delete the selected uploads with ref. codes "+C+"?")){sendCommand(baseserverurl,"/widget?c="+sitecode+"&a=delete&pw="+currpw+"&id="+B,"downloadarea")}}}function overLimit(){var maxevaldays=14;if(Date.parse(createdate)>Date.parse("9/5/2008")){maxevaldays=7}if(eval(md)>eval(mmd)){alert("Ooops. You are over your monthly transfer limit. Please click the 'your subscription' link to increase your monthly transfer limit.\n\nNote: Your upload widget has not been disabled!");return true}else{if(evalDays()>maxevaldays){alert("Ooops. Your "+maxevaldays+" day free trial period is over. Please click the 'your subscription' link to purchase your subscription.");return true}}return false}function evalDays(){if(purchasedate!=null&&purchasedate!="no"){return -1}if(Date.parse(createdate)<Date.parse("6/28/2008")){return -1}var A=Math.round((new Date().getTime()-Date.parse(createdate))/(24*60*60*1000));if(A<1){A=1}return A}function checkDemo(A){if(window.location.href.indexOf("dXBsb2FkdGhpbmd5LmNvbQ==")!=-1){if(!A){alert("Ooops. This is not available for this trial version.")}return true}return false}function readCookie(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length)}if(E.indexOf(D)==0){return E.substring(D.length,E.length)}}return null}var STATUS=new Array("New","In progress","Problem","Complete");function editStatus(i){var status=sorteduploadlist[i].status;if(status==null||status.length==0){status="0"}if($("editstatus"+i).innerHTML.length==0){var h=" <select id=selectstatus"+i+' onchange="saveStatus('+i+');">';for(j=0;j<STATUS.length;j++){h+="<option name=status"+j+" value="+j;if(j==eval(status)){h+=" selected"}h+=">"+STATUS[j]}h+="</select> ";setHTML("editstatus"+i,h)}else{setHTML("editstatus"+i,"")}}function saveStatus(A){var C=$("selectstatus"+A).value;sorteduploadlist[A].status=C;var B=d(sorteduploadlist[A].id);B=B.substring(B.lastIndexOf("$")+1);sendCommand(videoserverurl,"/jsc?ss="+B+"&status="+C+"&nr="+A);$("imagestatus"+A).src="http://49video.resources.s3.amazonaws.com/loading.gif";setHTML("editstatus"+A,"")};
