var http_requests=new Array();
if(window.XMLHttpRequest){
var http_request=new XMLHttpRequest();
}else{
var http_request=false;
}
var loading_graphic="<img src='./images/loading_blue_small.gif' width='16' height='16' border='0'>&nbsp;";
function checkPage(_1,_2){
var _3=0;
if(eval(_2)){
for(i=0;i<_2.length;i++){
if(eval(document.getElementById(_2[i]))&&!isNaN(document.getElementById(_2[i]).offsetHeight)){
_3=_3+document.getElementById(_2[i]).offsetHeight;
}
}
}
var _4=document.body.clientHeight-_3;
document.getElementById(_1).style.height=_4+"px";
}
function build_HttpRequest(){
if(window.XMLHttpRequest){
var _5=new XMLHttpRequest();
if(_5.overrideMimeType){
_5.overrideMimeType("text/xml");
}
}else{
if(window.ActiveXObject){
try{
var _5=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
var _5=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
}
}
}
}
if(!_5){
alert("Cannot create an XMLHTTP instance");
return false;
}
return _5;
}
function makeRequest(_6,_7,_8){
http_request=build_HttpRequest();
var _9=new Date();
if(_6.indexOf("?")>0){
_6=_6+"&time="+_9.getTime();
}else{
_6=_6+"?time="+_9.getTime();
}
http_request.onreadystatechange=function(){
_7(_8);
};
http_request.open("GET",_6,true);
http_request.send(null);
}
function callback_from_cgi(fn){
var _b=readCookie("bsc_uid");
document.getElementById("myphoto").src="../screencasts/"+_b+"/"+fn;
document.getElementById("update-12").innerHTML="update my photo";
document.getElementById("update-14").innerHTML="";
}
function photo_to_db(){
var _c=readCookie("bsc_uid");
var pn=document.getElementById("photofname").value;
var fn=document.getElementById("s_id").value;
var _f=pn.substring(pn.lastIndexOf(".")+1,pn.length);
var f=fn+"."+_f;
var _11="cmd=1&uid="+_c+"&arg=photo&val=./screencasts/"+_c+"/"+f;
var cb={success:function(o){
},failure:function(o){
alert(o.responseText);
}};
var _15=YAHOO.util.Connect.asyncRequest("POST","./php/get_login.php",cb,_11);
}
function proc_photo(val){
var uid=readCookie("bsc_uid");
if(val==2){
var _18="cmd=1&uid="+uid+"&arg=photo&val=./images/default_thumb.gif";
var cb={success:function(o){
},failure:function(o){
alert(o.responseText);
}};
var _1c=YAHOO.util.Connect.asyncRequest("POST","./php/get_login.php",cb,_18);
}
if(val==1){
path=uid;
var _1d=new Array();
var d=new Date();
var sid=hex_md5(d.toUTCString());
_1d.push("<form id='photoUpload' name='photoUpload' target='uploadPhotoFrame' method='post' enctype='multipart/form-data' action='./cgi-bin/upload_photo.cgi?sid="+sid+"'>");
_1d.push("<input type='hidden' name='path' value='"+path+"'>");
_1d.push("<input type='hidden' name='cmd'  value='3'>");
_1d.push("<input type='hidden' id='s_id'  value='"+sid+"'>");
_1d.push("<input type='file' size='0' id='photofname' name='photofname' onchange='this.form.submit();photo_to_db();'></form>");
document.getElementById("update-12").innerHTML=_1d.join("");
document.getElementById("update-14").innerHTML="cancel";
var frm=document.getElementById("photoUpload");
document.photoUpload.photofname.click();
}
}
function removeFileInput(val){
var e=document.getElementById("row_"+val);
e.parentNode.removeChild(e);
if(document.getElementById("row_n_"+val)!=null){
e=document.getElementById("row_n_"+val);
e.parentNode.removeChild(e);
}
for(var i=0;i<uploads.length;i++){
if(uploads[i]==val){
uploads.splice(i,1);
}
}
if(count>0){
count--;
}
if(count==0){
bg_color=true;
}
}
var thumbs=new Array();
function show_current_thumb(id){
if(thumbs[id]!=null){
document.getElementById("upthumb_"+id).src=thumbs[id];
}else{
document.getElementById("upthumb_"+id).src="./images/default_thumb.png";
}
}
function show_default_thumb(id){
document.getElementById("upthumb_"+id).src="./images/default_thumb.png";
}
function thumb_to_db(f,id,uid,nf){
thumbs[id]="http://bioscreencast.s3.amazonaws.com/"+uid+"/"+f;
document.getElementById("upthumb_"+id).src=thumbs[id];
var _2a="cmd=7&uid="+uid+"&file="+nf+"&tn="+f;
var cb={success:function(o){
},failure:function(o){
alert(o.responseText);
}};
var _2e=YAHOO.util.Connect.asyncRequest("POST","./php/proc_db.php",cb,_2a);
}
function upload_thumbnail(id){
var _30=document.getElementById("thumb_upload_form_"+id);
_30.submit();
}
function modifyFiles(){
var f=new Object();
var _32;
var uid=readCookie("bsc_uid");
var _34="cmd=4&uid="+uid;
var cb={success:function(o){
if(o.responseText!="null"){
eval("f="+o.responseText);
_32=f["arr"];
var _37=new Array();
for(var i=0;i<_32.length;i++){
var ext=_32[i].FILENAME.substring(_32[i].FILENAME.lastIndexOf(".")+1,_32[i].FILENAME.length);
var _3a;
if(_32[i].THUMBNAME=="default_thumb.png"){
_3a="./images/default_thumb.png";
thumbs[i]=_3a;
}else{
_3a="http://bioscreencast.s3.amazonaws.com/"+uid+"/"+_32[i].THUMBNAME;
thumbs[i]=_3a;
}
var _3b;
if(_32[i].REVIEWED==1){
_3b="approved.gif";
}else{
_3b="pending.gif";
}
var bg;
if((i%2)==1){
bg="#eaf4ff;";
}else{
bg="#ffffff;";
}
_37.push("<div id='row_"+i+"' style='clear:both;position:relative;height:110px;background:"+bg+"'>");
_37.push("<div style='float:left;height:10px;width:10px;'></div><div style='float:left;margin-top:10px;'><img id='upthumb_"+i+"' src='"+_3a+"' style='border:1px solid #999999;' width='100' height='89'></div>");
_37.push("<div style='float:left;height:10px;width:15px;'></div><div style='float:left;margin-top:10px;height:32px;width:32px;'><img src='./images/icon_"+ext+"_32x32.gif'></div>");
_37.push("<div style='float:left;width:140px;margin:15px 0px 0px 15px;'>"+_32[i].FILENAME.substring(0,20)+"..</div>");
_37.push("<div style='float:left;margin:12px 0px 0px 15px;'><img src='./images/blue-divider.gif'></div>");
_37.push("<div style='float:left;margin:15px 0px 0px 15px;'>"+_32[i].FILESIZE+"</div>");
_37.push("<div style='float:left;margin:12px 0px 0px 15px;'><img src='./images/blue-divider.gif'></div>");
_37.push("<div style='float:left;margin:13px 0px 0px 15px;'><img src='./images/"+_3b+"'></div>");
_37.push("<div style='clear:both;position:absolute;top:50px;left:120px;border-top:1px dashed #ccc;height:20px;width:450px;'><div style='float:left;margin-top:5px;margin-left:10px;cursor:pointer;'><img onclick='delete_file(\""+_32[i].FILENAME+"\",\""+_32[i].VID+"\");' src='./images/trash.gif'></div><div style='float:left;margin-top:5px;'><img src='./images/blue-divider.gif'></div><div style='float:left;margin-top:5px;cursor:pointer;'><img id='edit_mov_"+i+"' onclick='edit_file(\""+_32[i].FILENAME+"\",\""+_32[i].FILESIZE+"\","+i+");' src='./images/edit.gif'></div></div></div>");
}
document.getElementById("ScrollBox").innerHTML=_37.join("");
}else{
createFileInput("");
}
},failure:function(o){
alert(o.responseText);
}};
document.getElementById("ScrollBox").innerHTML="<img src='images/loading_blue_small.gif'>";
var _3e=YAHOO.util.Connect.asyncRequest("POST","./php/proc_db.php",cb,_34);
}
function show_url_desc(){
if(document.getElementById("upload_url").value.length<=7){
document.getElementById("url_desc").style.display="none";
}else{
document.getElementById("url_desc").style.display="block";
}
}
function hideOthers(){
var val=document.getElementById("upload_only").checked;
if(val){
document.getElementById("upload_details").style.display="none";
}else{
document.getElementById("upload_details").style.display="block";
}
}
function createFileInput(_40){
document.getElementById("upload_info").innerHTML="<b>Quick Instructions on File Upload</b><br>"+"<div style='border-top:1px dashed #ccc;height:10px;width:185px;'></div>"+"Currently, we support the following file formats for upload: "+"<b>flv, swf, mov, wmv, asx, divx, avi, mpeg, mpg, rm, ram</b>"+"<br><br>"+"Think we should support another up & coming format too? Contact us!"+"<br><br>"+"<div style='border-top:1px dashed #ccc;height:10px;width:185px;'></div>"+"To upload a screencast, click <b>File Upload</b>, then select the 'Browse' button to select a file from "+"your disk drive."+"Once you have selected the file, fill in a few details about your screencast and "+"press the start upload button."+"<br><br>"+"Once the upload is complete, you have the option to 'delete' the screencast "+"or 'edit' the details for the screencast.<br><br>"+"By default, you "+"will also see a 'review pending' status next to your screencast. Once "+"your screencast is approved, the status will change to 'approved' and "+"your screencast will be available as part of the bioscreencast library. "+"Currently, the approval process takes anywhere from 1 to 4 hours."+"<br>";
var uid=readCookie("bsc_uid");
var acc=readCookie("bsc_access");
if((count>0)&&(parseInt(acc)>1)){
return;
}
var _43;
for(var i=0;i<cat_dataset.length;i++){
_43+="<option>"+cat_dataset[i].NAME+"</option>";
}
_40=uid;
var _45=new Array();
var d=new Date();
var sid=hex_md5(d.toUTCString());
if(uid==2){
_45.push("<form action='https://bioscreencast.s3.amazonaws.com/' method='post' enctype='multipart/form-data'>");
_45.push("<input type='hidden' name='key' value='${filename}'>");
_45.push("<input type='hidden' name='AWSAccessKeyId' value='0W98NEMDX19VD5KSV6R2'>");
_45.push("<input type='hidden' name='acl' value='public-read'>");
_45.push("<input type='hidden' name='success_action_redirect' value='http://bioscreencast.com'>");
_45.push("<input type='hidden' name='policy' value='eyJleHBpcmF0aW9uIjogIjIwMDktMDEtMDFUMDA6MDA6MDBaIiwNCiJjb25kaXRpb25zIjogWw0KeyJidWNrZXQiOiAiYmlvc2NyZWVuY2FzdCJ9LA0KWyJzdGFydHMtd2l0aCIsICIka2V5IiwgIiJdLA0KeyJhY2wiOiAicHVibGljLXJlYWQifSwNCnsic3VjY2Vzc19hY3Rpb25fcmVkaXJlY3QiOiAiaHR0cDovL2Jpb3NjcmVlbmNhc3QuY29tIn0sDQpbInN0YXJ0cy13aXRoIiwgIiRDb250ZW50LVR5cGUiLCAiIl0sDQpbImNvbnRlbnQtbGVuZ3RoLXJhbmdlIiwgMCwgMjA5NzE1MjAwXQ0KXQ0KfQ=='>");
_45.push("<input type='hidden' name='signature' value='YmNf/4TzsOPBpz5bdElB85mUsRA='>");
_45.push("<input type='hidden' name='Content-Type' value='text/html'>");
_45.push("<input name='file' type='file'>");
_45.push("<input type='submit' value='Upload File to S3'>");
}else{
_45.push("<form class='xupload' id='frmUpload_"+count+"' target='uploadForm' method='post' enctype='multipart/form-data' action='./cgi-bin/upload.cgi?sid="+sid+"'>");
_45.push("<input type='hidden' name='path' value='"+_40+"'>");
_45.push("<input type='hidden' name='s_id' value='"+sid+"'>");
_45.push("<div style='position:relative;'><div class='fileinputs'><input type='file' name='filename'></div></div></form>");
_45.push("<div style='position:relative;padding-left:10px;'><input type='checkbox' id='upload_only' onclick='hideOthers();'> Are you just replacing a previously uploaded file?</div><br>");
_45.push("<div style='position:relative;margin-top:10px;padding-left:20px;border-top:1px dashed #aaaaaa;width:300px;height:20px;'></div>");
_45.push("<div style='position:relative;padding-left:10px;'>");
_45.push("Add some tags to help locate the screencast (comma separated for multiple tags)<br>");
_45.push("<textarea rows='2' cols='72' id='upload_tags'></textarea><br><br>");
_45.push("Pick a category<br>");
_45.push("<div style='position:relative;'><select id='upload_category' style='border:1px solid #cccccc;font-size:11px;'>");
_45.push(_43);
_45.push("</select></div><br><br>");
_45.push("Add any relavant website<br>");
_45.push("<textarea rows='2' cols='72' id='upload_url' onchange='show_url_desc();'>http://</textarea><br><br>");
_45.push("<div id='url_desc' style='display:none;color:green;'>Add a short name to appear as the link for the above website<br>");
_45.push("<textarea rows='2' cols='72' id='upload_url_desc'></textarea><br><br></div>");
_45.push("Add a one line summary about the screencast<br>");
_45.push("<textarea rows='1' cols='72' id='upload_desc'></textarea><br><br>");
_45.push("Add more details about the screencast<br>");
_45.push("<textarea rows='4' cols='72' id='upload_details'></textarea><br><br>");
_45.push("</div>");
_45.push("<div style='position:relative;padding-left:10px;'><img style='cursor:pointer;' onclick='upload();' id='startupload' src='images/start_upload.png'></div><br>");
}
document.getElementById("ScrollBox").innerHTML=_45.join("");
uploads.push(count);
if(count!=0){
var _48=document.getElementById("frmUpload_"+count);
_48=null;
}
initFileUpload();
}
function createUrlInput(_49){
document.getElementById("upload_info").innerHTML="<b>Quick Instructions on URL Upload</b><br>"+"<div style='border-top:1px dashed #ccc;height:10px;width:185px;'></div>"+"Just Cut/Paste the URL to the movie (it can either be an html page that "+"embeds the movie or the direct link to the movie file (.swf, .flv etc)"+"<br><br>"+"Fill in a few details about your screencast and "+"press the start upload button."+"<br><br>"+"Once the upload is complete, you have the option to 'delete' the screencast "+"or 'edit' the details for the screencast.<br><br>"+"By default, you "+"will also see a 'review pending' status next to your screencast. Once "+"your screencast is approved, the status will change to 'approved' and "+"your screencast will be available as part of the bioscreencast library. "+"Currently, the approval process takes anywhere from 1 to 4 hours."+"<br>";
var uid=readCookie("bsc_uid");
var acc=readCookie("bsc_access");
var _4c;
for(var i=0;i<cat_dataset.length;i++){
_4c+="<option>"+cat_dataset[i].NAME+"</option>";
}
_49=uid;
var _4e=new Array();
var d=new Date();
var sid=hex_md5(d.toUTCString());
_4e.push("<input type='hidden' id='uid' value='"+_49+"'>");
_4e.push("<input type='hidden' id='s_id' value='"+sid+"'>");
_4e.push("<div style='position:relative;margin:10px;'>Add a link to the screencast web page<br><input type='text' size='76' id='urlname' name='urlname' value='http://'></div>");
_4e.push("<div style='position:relative;margin-top:10px;padding-left:20px;border-top:1px dashed #aaaaaa;width:300px;height:20px;'></div>");
_4e.push("<div style='position:relative;padding-left:10px;'>");
_4e.push("Add some tags to help locate the screencast (comma separated for multiple tags)<br>");
_4e.push("<textarea rows='2' cols='72' id='upload_tags'></textarea><br><br>");
_4e.push("Pick a category<br>");
_4e.push("<div style='position:relative;'><select id='upload_category' style='border:1px solid #cccccc;font-size:11px;'>");
_4e.push(_4c);
_4e.push("</select></div><br><br>");
_4e.push("Add any relavant website<br>");
_4e.push("<textarea rows='2' cols='72' id='upload_url' onchange='show_url_desc();'>http://</textarea><br><br>");
_4e.push("<div id='url_desc' style='display:none;color:green;'>Add a short name to appear as the link for the above website<br>");
_4e.push("<textarea rows='2' cols='72' id='upload_url_desc'></textarea><br><br></div>");
_4e.push("Add a one line summary about the screencast<br>");
_4e.push("<textarea rows='2' cols='72' id='upload_desc'></textarea><br><br>");
_4e.push("Add more details about the screencast<br>");
_4e.push("<textarea rows='3' cols='72' id='upload_details'></textarea><br><br>");
_4e.push("</div>");
_4e.push("<div style='position:relative;padding-left:10px;'><img style='cursor:pointer;' onclick='url_upload();' id='startupload' src='images/start_upload.png'></div><br>");
document.getElementById("ScrollBox").innerHTML=_4e.join("");
}
function checkFileExtentions(_51){
if(check_file_extentions==false){
return false;
}
var re=/(\.flv)|(\.swf)|(\.mov)|(\.wmv)|(\.asx)|(\.divx)|(\.avi)|(\.mpeg)|(\.mpg)|(\.rm)|(\.ram)$/i;
if(_51["filename"].value!=""){
if(_51["filename"].value.match(re)){
return false;
}else{
var _53=_51["filename"].value;
var _54=_53.lastIndexOf("\\");
if(_54<1){
_54=_53.lastIndexOf("/");
}
var _55=_53.slice(_54+1,_53.length);
var _56=_55.slice(_55.indexOf(".")).toLowerCase();
alert("Sorry, uploading a file with the extention \""+_56+"\" is not allowed.");
return true;
}
}
return false;
}
function grab_upload_info(){
var t=document.getElementById("upload_tags").value;
var c=document.getElementById("upload_category").value;
var u=document.getElementById("upload_url").value;
var ud=document.getElementById("upload_url_desc").value;
var d=document.getElementById("upload_desc").value;
var e=document.getElementById("upload_details").value;
if(document.getElementById("upload_only").checked){
document.getElementById("_uploadOnly").innerHTML="true";
return 0;
}
if(t.length<1){
document.getElementById("upload_tags").style.color="red";
document.getElementById("upload_tags").value="please enter at least one tag so it is easy to find this video";
return 1;
}else{
document.getElementById("_uploadTags").innerHTML=t;
}
document.getElementById("_uploadCategory").innerHTML=c;
if(u.length>7){
document.getElementById("_uploadUrl").innerHTML=u.substring(7,u.length);
if(ud.length<1){
document.getElementById("upload_url_desc").style.color="red";
document.getElementById("upload_url_desc").value="please add a description for the URL above";
return 1;
}else{
document.getElementById("_uploadUrlDesc").innerHTML=ud;
}
}else{
document.getElementById("_uploadUrl").innerHTML="-";
document.getElementById("_uploadUrlDesc").innerHTML="-";
}
if(d.length<1){
document.getElementById("upload_desc").style.color="red";
document.getElementById("upload_desc").value="please enter a one line description for your upload";
return 1;
}else{
document.getElementById("_uploadDesc").innerHTML=d;
}
if(e.length<1){
document.getElementById("upload_details").style.color="red";
document.getElementById("upload_details").value="please enter a short summary about your upload";
return 1;
}else{
document.getElementById("_uploadDetails").innerHTML=e;
}
return 0;
}
function url_upload(){
var uid=document.getElementById("uid").value;
var sid=document.getElementById("s_id").value;
var _5f=document.getElementById("urlname").value;
var _60=_5f.substring(0,_5f.indexOf("/",7));
if(_5f.length<8){
document.getElementById("urlname").style.color="red";
document.getElementById("urlname").value="please enter a valid url";
return;
}else{
document.getElementById("_uploadUrlName").innerHTML=_5f;
}
document.getElementById("_uploadUrlSrc").innerHTML=_60;
if(grab_upload_info()){
return;
}
document.getElementById("startupload").src="images/loading_blue_small.gif";
upload_to_db(1,uid,"",sid);
}
function upload(){
if(uploads.length>0){
form=document.getElementById("frmUpload_"+uploads[0]);
if(form["filename"].value==""){
alert("Please Choose a file to upload.");
}else{
if(grab_upload_info()){
return;
}
filename=form["filename"].value;
if(filename.lastIndexOf("\\")>0){
filename=filename.substring(filename.lastIndexOf("\\")+1,filename.length);
}else{
if(filename.lastIndexOf("/")>0){
filename=filename.substring(filename.lastIndexOf("/")+1,filename.length);
}
}
if(checkFileExtentions(form)){
return false;
}
var _61=form["s_id"].value;
makeRequest("bsc_upload_progress.php?sid="+_61+"&filename="+filename,progress,_61);
form.submit();
}
}
}
function progress(_62){
switch(http_request.readyState){
case 1:
checkCount++;
break;
case 4:
if(http_request.status==200){
if(debug){
status.innerHTML=checkCount+" - "+http_request.responseText;
}
response=http_request.responseText.split("|");
upload_cell=document.getElementById("ScrollBox");
switch(response[0]){
case "wait":
var _63=new Array();
var f=response[1].toLowerCase();
var ext=f.substring(f.lastIndexOf(".")+1,f.length);
_63.push("<div style='position:relative;width:450px;height:110px;'>");
_63.push("<div style='float:left;height:10px;width:10px;'></div><div style='float:left;margin-top:10px;'><img src='./images/icon_"+ext+"_32x32.gif'></div>");
_63.push("<div style='float:left;height:10px;width:15px;'></div><div style='float:left;margin-top:10px;font-size:11px;'>"+f+"</div>");
_63.push("<div style='clear:both;position:absolute;top:32px;left:57px;font-size:10px;color:#aaa;'>Waiting for Download to Start ("+checkCount+")</div>");
upload_cell.innerHTML=_63.join("");
makeRequest("bsc_upload_progress.php?sid="+_62,progress,_62);
break;
case "started":
makeRequest("bsc_upload_progress.php?sid="+_62,progress,_62);
break;
case "downloading":
var _63=new Array();
var f=response[1].toLowerCase();
var ext=f.substring(f.lastIndexOf(".")+1,f.length);
_63.push("<div style='position:relative;width:450px;height:110px;'>");
_63.push("<div style='float:left;height:10px;width:10px;'></div><div style='float:left;margin-top:10px;'><img src='./images/icon_"+ext+"_32x32.gif'></div>");
_63.push("<div style='float:left;height:10px;width:15px;'></div><div style='float:left;margin-top:10px;font-size:11px;'>"+f+"</div>");
_63.push("<div style='clear:both;position:absolute;top:32px;left:57px;width:450px;height:12px;'><div id='upload_bar'><img src='./images/safari/upload_bar_bg_on.gif' width='"+Math.floor((response[3]/100)*450)+"' height='12'></div></div>");
_63.push("<div style='clear:both;position:absolute;top:48px;left:57px;font-size:10px;color:#aaa;'>"+response[4]+" of "+response[5]+" ("+response[6]+"/s) "+response[2]+"</div>");
upload_cell.innerHTML=_63.join("");
makeRequest("bsc_upload_progress.php?sid="+_62,progress,_62);
break;
case "copying":
var _63=new Array();
var f=response[1].toLowerCase();
var ext=f.substring(f.lastIndexOf(".")+1,f.length);
_63.push("<div style='position:relative;width:450px;height:110px;'>");
_63.push("<div style='float:left;height:10px;width:10px;'></div><div style='float:left;margin-top:10px;'><img src='./images/icon_"+ext+"_32x32.gif'></div>");
_63.push("<div style='float:left;height:10px;width:15px;'></div><div style='float:left;margin-top:10px;font-size:11px;'>"+f+"</div>");
_63.push("<div style='clear:both;position:absolute;top:50px;left:57px;font-size:10px;color:#aaa;'>Copying file to destination directory</div>");
upload_cell.innerHTML=_63.join("");
makeRequest("bsc_upload_progress.php?sid="+_62,progress,_62);
break;
case "Success":
var uid=readCookie("bsc_uid");
var f=response[1].toLowerCase();
add_to_db(uid,f,response[2],response[3],req_id);
checkCount=0;
uploads.splice(0,1);
break;
default:
alert(http_request.responseText);
}
}else{
alert("There was a problem with the request.("+http_request.responseText+")");
}
break;
}
}
function cancelUpload(msg){
alert(msg);
}
function submit_mov(f,vid,uid){
var vl=document.getElementById("video_length").value;
var vd=document.getElementById("video_dimension").value;
var ct=document.getElementById("creator_tags").value;
var c=document.getElementById("category").value;
var ru=document.getElementById("related_urls").value;
var od=document.getElementById("oneline_desc").value;
var dd=document.getElementById("detailed_desc").value;
var nc;
if(document.getElementById("new_cat")!=null){
nc=document.getElementById("new_cat").value;
}
ru=ru.replace(/'|"/g,"");
od=od.replace(/'|"/g,"");
dd=dd.replace(/'|"/g,"");
if(ru.lastIndexOf(":")==-1){
ru="";
}else{
document.getElementById("related_urls").style.color="#666666";
}
if(document.getElementById("new_cat")!=null){
if(nc.length>0){
c=nc;
}
}
var _73="cmd=6&uid="+uid+"&vid="+vid+"&vl="+vl+"&vd="+vd+"&ct="+ct+"&c="+c+"&ru="+ru+"&od="+od+"&dd="+dd+"&file="+f;
var cb={success:function(o){
document.getElementById("submit_mov_result").innerHTML="success: "+o.responseText;
document.getElementById("submit_mov_dialogue").innerHTML="<img src='./images/save_btn.gif'>";
},failure:function(o){
document.getElementById("submit_mov_result").innerHTML="failure: "+o.responseText;
document.getElementById("submit_mov_dialogue").innerHTML="<img src='./images/save_btn.gif'>";
}};
document.getElementById("submit_mov_dialogue").innerHTML="<img src='images/loading_blue_small.gif'>";
var _77=YAHOO.util.Connect.asyncRequest("POST","./php/proc_db.php",cb,_73);
}
function show_new_category(){
var e=document.getElementById("new_category");
e.innerHTML="<input type='text' id='new_cat' size='18'>";
}
function show_upload_new_category(){
var e=document.getElementById("upload_new_category");
e.innerHTML="<input type='text' id='upload_new_cat' size='18'>";
}
function show_mov_dialogue(f,fsz,id){
var uid=readCookie("bsc_uid");
var ext=f.substring(f.lastIndexOf(".")+1,f.length);
function makeInvisible(){
document.getElementById("mov_dialogue_info_bg").style.visibility="hidden";
document.getElementById("mov_dialogue_info").innerHTML="";
document.getElementById("mov_dialogue_info").style.visibility="hidden";
document.getElementById("mov_dialogue").style.visibility="hidden";
}
function getForm(){
document.getElementById("mov_dialogue_info_bg").style.visibility="visible";
var _7f="cmd=5&uid="+uid+"&file="+f;
var cb={success:function(o){
if(o.responseText!="null"){
var f=new Object();
var _83;
eval("f="+o.responseText);
_83=f["arr"];
showForm(_83);
}else{
var f=new Object();
var _83;
var str="{'arr':[{'VIDEO_LENGTH':'','VIDEO_DIMENTION':'','CREATOR_TAGS':'','CATEGORY':'','RELATED_URLS':'','ONELINE_DESC':'','DETAILED_DESC':''}]}";
eval("f="+str);
_83=f["arr"];
_83[0].VIDEO_LENGTH="";
_83[0].VIDEO_DIMENSION="";
_83[0].CREATOR_TAGS="";
_83[0].CATEGORY="";
_83[0].RELATED_URLS="";
_83[0].ONELINE_DESC="";
_83[0].DETAILED_DESC="";
_83[0].REVIEWED="";
_83[0].VID="0";
showForm(_83);
}
},failure:function(o){
alert(o.responseText);
}};
var _86=YAHOO.util.Connect.asyncRequest("POST","./php/proc_db.php",cb,_7f);
}
function showForm(fd){
var _88;
for(var i=0;i<cat_dataset.length;i++){
_88+="<option>"+cat_dataset[i].NAME+"</option>";
}
var _8a;
if(fd[0].REVIEWED==1){
_8a="<img src='./images/approved.gif'>";
}else{
if(fd[0].REVIEWED==0){
_8a="<img src='./images/pending.gif'>";
}else{
_8a="";
}
}
document.getElementById("mov_dialogue_info").innerHTML="<div width='30' height='40' style='float:left;background-color:#ffffff;border-bottom:1px solid #cccccc;'><img src='./images/icon_"+ext+"_32x32.gif'></div><div style='float:left;width:155px;height:35px;background-color:#ffffff;padding:0px 0px 0px 10px;border-bottom:1px solid #cccccc;'>"+f+"<div>"+fsz+"</div></div><div style='float:left;height:35px;background-color:#ffffff;padding:0px 0px 0px 10px;border-bottom:1px solid #cccccc;'><img src='./images/blue-divider.gif'></div><div style='float:left;height:35px;background-color:#ffffff;padding:0px 0px 0px 10px;border-bottom:1px solid #cccccc;'>"+_8a+"</div><div style='clear:both;'></div><br>"+"<div style='float:left;'>Video Length <b>(mm:ss)</b><br><input id='video_length' name='video_length' type='text' size='19' value='"+fd[0].VIDEO_LENGTH+"' disabled></div><div style='float:left;width:20px;'><img src='./images/blue-divider.gif'></div><div style='float:left;'>Screencast Dimension <b>(WxH)</b><br><input id='video_dimension' name='video_dimension' type='text' size='31' value='"+fd[0].VIDEO_DIMENSION+"' disabled></div><div style='clear:both;'></div><br>"+"Tags (comma separated) <b>(eg: gene, genetic test)</b><br><input id='creator_tags' name='creator_tags' type='text' size='54' value='"+fd[0].CREATOR_TAGS+"'><br><br>"+"Category<br><div style='float:left;'><select id='category' name='category' style='border:1px solid #cccccc;font-size:11px;'><option>"+fd[0].CATEGORY+"</option>"+_88+"</select></div><div style='float:left;'>&nbsp;&nbsp;&nbsp;&nbsp;OR&nbsp;&nbsp;&nbsp;&nbsp;</div><div style='float:left;cursor:pointer;text-decoration:underline;' id='new_category'><a onclick='show_new_category();'>enter a new category</a></div><br><br>"+"Relevant URLs <b>(eg: cool website:bioscreencast.com, ...)</b><br><textarea id='related_urls' name='related_urls' cols='52' rows='3' style='border:1px solid #cccccc;'>"+fd[0].RELATED_URLS+"</textarea><br>"+"Short Summary<br><textarea id='oneline_desc' name='oneline_desc' cols='52' rows='2'>"+fd[0].ONELINE_DESC+"</textarea><br>"+"Detailed Description<br><textarea id='detailed_desc' name='detailed_desc' cols='52' rows='4' style='border:1px solid #cccccc;'>"+fd[0].DETAILED_DESC+"</textarea><br>"+"<div style='position:relative;'><div style='float:left;' id='submit_mov_dialogue' onclick='submit_mov(\""+f+"\",\""+fd[0].VID+"\","+uid+");' style='cursor:pointer;'><img src='./images/save_btn.gif'></div><div style='float:left;'><img id='exit_mov_dialogue' src='./images/cancel_btn.gif'></div>"+"<div style='float:left;position:absolute;top:7px;left:155px;' id='submit_mov_result' style='background-color:#dddddd;color:#333333;'></div></div>";
procExit();
}
function procExit(){
var _8b={width:{from:350,to:0},height:{from:430,to:0},opacity:{to:0}};
var _8c=new YAHOO.util.Motion("mov_dialogue",_8b,0.5,YAHOO.util.Easing.backOut);
_8c.onComplete.subscribe(makeInvisible);
YAHOO.util.Event.on(document.getElementById("exit_mov_dialogue"),"click",_8c.animate,_8c,true);
YAHOO.util.Event.on(document.getElementById("exit_mov_dialogue1"),"click",_8c.animate,_8c,true);
}
function makeVisible(){
document.getElementById("mov_dialogue").style.visibility="visible";
document.getElementById("mov_dialogue_info").innerHTML="<img src='./images/loading_blue_small.gif'>";
document.getElementById("mov_dialogue_info").style.visibility="visible";
}
var _8d={points:{from:[YAHOO.util.Dom.getX("edit_mov_"+id)+20,YAHOO.util.Dom.getY("edit_mov_"+id)],to:[YAHOO.util.Dom.getX("edit_mov_"+id)+20,YAHOO.util.Dom.getY("edit_mov_"+id)]},width:{from:0,to:350},height:{from:0,to:430},opacity:{to:1}};
var _8e=new YAHOO.util.Motion("mov_dialogue",_8d,0.5,YAHOO.util.Easing.backOut);
_8e.onStart.subscribe(makeVisible);
_8e.onComplete.subscribe(getForm);
_8e.animate();
}
function show_non_mov_dialogue(f,fsz,id){
var ext=f.substring(f.lastIndexOf(".")+1,f.length);
function makeInvisible(){
document.getElementById("mov_dialogue_info").innerHTML="";
document.getElementById("mov_dialogue_info").style.visibility="hidden";
document.getElementById("mov_dialogue").style.visibility="hidden";
}
function showForm(){
document.getElementById("mov_dialogue_info").innerHTML="<div width='30' height='40' style='float:left;background-color:#ffffff;border-bottom:1px solid #cccccc;'><img src='./images/icon_"+ext+"_32x32.gif'></div><div style='float:left;width:290px;height:35px;background-color:#ffffff;padding:0px 0px 0px 10px;border-bottom:1px solid #cccccc;'>"+f+"<div>"+fsz+"</div></div><div style='clear:both;'></div><br>"+"Short Summary<br><textarea id='oneline_desc' name='oneline_desc' cols='52' rows='2'></textarea><br>"+"<div style='position:relative;'><div style='float:left;' onclick='submit_non_mov();' style='cursor:pointer;'><img src='./images/save_btn.gif'></div><div style='float:left;'><img id='exit_mov_dialogue' src='./images/cancel_btn.gif'></div></div>";
procExit();
}
function procExit(){
var _93={width:{from:350,to:0},height:{from:200,to:0},opacity:{to:0}};
var _94=new YAHOO.util.Motion("mov_dialogue",_93,0.5,YAHOO.util.Easing.backOut);
_94.onComplete.subscribe(makeInvisible);
YAHOO.util.Event.on(document.getElementById("exit_mov_dialogue"),"click",_94.animate,_94,true);
YAHOO.util.Event.on(document.getElementById("exit_mov_dialogue1"),"click",_94.animate,_94,true);
}
function makeVisible(){
document.getElementById("mov_dialogue").style.visibility="visible";
document.getElementById("mov_dialogue_info").innerHTML="";
document.getElementById("mov_dialogue_info").style.visibility="visible";
}
var _95={points:{from:[YAHOO.util.Dom.getX("edit_mov_"+id)+20,YAHOO.util.Dom.getY("edit_mov_"+id)],to:[YAHOO.util.Dom.getX("edit_mov_"+id)+20,YAHOO.util.Dom.getY("edit_mov_"+id)]},width:{from:0,to:350},height:{from:0,to:200},opacity:{to:1}};
var _96=new YAHOO.util.Motion("mov_dialogue",_95,0.5,YAHOO.util.Easing.backOut);
_96.onStart.subscribe(makeVisible);
_96.onComplete.subscribe(showForm);
_96.animate();
}
function show_status(f,v){
alert("Your screencast will be reviewed within 24 hours");
}
function edit_file(f,fsz,v){
var nf=f;
if(nf.lastIndexOf("=")<0){
}else{
var a=nf.split(">");
var b=a[1].split("<");
nf=b[0];
}
show_mov_dialogue(nf,fsz,v);
}
function upload_to_db(cmd,uid,f,vid){
var ct=document.getElementById("_uploadTags").innerHTML;
var c=document.getElementById("_uploadCategory").innerHTML;
var u=document.getElementById("_uploadUrl").innerHTML;
var ud=document.getElementById("_uploadUrlDesc").innerHTML;
var od=document.getElementById("_uploadDesc").innerHTML;
var de=document.getElementById("_uploadDetails").innerHTML;
if(cmd==0){
var _a9="cmd=12&uid="+uid+"&vid="+vid+"&ct="+ct+"&c="+c+"&od="+od+"&de="+de+"&ur="+ud+":"+u+"&file="+f;
}else{
var url=document.getElementById("_uploadUrlName").innerHTML;
var _ab=document.getElementById("_uploadUrlSrc").innerHTML;
var _a9="cmd=13&uid="+uid+"&vid="+vid+"&ct="+ct+"&c="+c+"&od="+od+"&de="+de+"&ur="+ud+":"+u+"&url="+url+"&urlsrc="+_ab;
}
var cb={success:function(o){
if(cmd==1){
document.getElementById("startupload").src="images/start_upload.png";
}
modifyFiles();
},failure:function(o){
alert(o.responseText);
}};
var _af=YAHOO.util.Connect.asyncRequest("POST","./php/proc_db.php",cb,_a9);
}
function add_to_db(uid,f,z,vid,_b4){
var _b5="cmd=1&uid="+uid+"&file="+f+"&fsize="+z+"&vid="+vid+"&reqid="+_b4;
var cb={success:function(o){
if(document.getElementById("_uploadOnly").innerHTML=="false"){
upload_to_db(0,uid,f,vid);
}else{
modifyFiles();
}
},failure:function(o){
alert(o.responseText);
}};
var _b9=YAHOO.util.Connect.asyncRequest("POST","./php/proc_db.php",cb,_b5);
}
function rename_in_db(uid,f,fo){
var _bd="cmd=2&uid="+uid+"&file="+f+"&fold="+fo;
var cb={success:function(o){
},failure:function(o){
alert(o.responseText);
}};
var _c1=YAHOO.util.Connect.asyncRequest("POST","./php/proc_db.php",cb,_bd);
}
function delete_from_db(uid,fn,vid){
var _c5="cmd=3&uid="+uid+"&file="+fn+"&vid="+vid;
var cb={success:function(o){
modifyFiles();
},failure:function(o){
alert(o.responseText);
}};
var _c9=YAHOO.util.Connect.asyncRequest("POST","./php/proc_db.php",cb,_c5);
}
function delete_file(fn,vid){
var uid=readCookie("bsc_uid");
init_del_confirm(0,uid,fn,vid);
YAHOO.example.container.simpledialog1.show();
}
var W3CDOM=(document.createElement&&document.getElementsByTagName);
function initFileUpload(){
if(!W3CDOM){
return;
}
var _cd=document.createElement("div");
_cd.className="fakefile";
var _ce=document.createElement("div");
_ce.className="inpimg";
_ce.appendChild(document.createElement("input"));
_cd.appendChild(_ce);
var _cf=document.createElement("div");
_cf.className="fakeimg";
var _d0=document.createElement("img");
_d0.src="./images/browse.gif";
_cf.appendChild(_d0);
_cd.appendChild(_cf);
var x=document.getElementsByTagName("input");
for(var i=0;i<x.length;i++){
if(x[i].type!="file"){
continue;
}
if(x[i].getAttribute("noscript")){
continue;
}
if(x[i].parentNode.className!="fileinputs"){
continue;
}
x[i].className="file hidden";
var _d3=_cd.cloneNode(true);
x[i].parentNode.appendChild(_d3);
x[i].relatedElement=_d3.getElementsByTagName("input")[0];
if(x[i].value){
x[i].onchange();
}
x[i].onchange=x[i].onmouseout=function(){
var _d4;
if(this.value.length>32){
_d4="..."+this.value.substring(this.value.length-32);
}else{
_d4=this.value;
}
this.relatedElement.value=_d4;
};
}
}

