var REQUIRED_videotitle="Please enter title";var REQUIRED_audiotitle="Please enter track";var REQUIRED_videogenre="Please select video genre";var REQUIRED_audiogenre="Please select audio genre";var REQUIRED_genre="Please select genre";var VALID_tag="Each tag length must be of minimum 3 characters and  each tag must be separated by blank space.(you can enter maximum 5 tags.)";var REQUIRED_video_file="Please upload a video";var REQUIRED_audio_file="Please upload an audio file";var REQUIRED_file="Please upload video(avi,mov,wmv) or audio file(mp3)";var REQUIRED_uploadtype="Please select upload type";var VALID_video_file="Please upload a video file this is a: avi,mov or wmv.";var VALID_audio_file="Please upload a mp3 file";var VALID_file="Please upload a valid media file";var VALID_image="Please upload a valid piece of album art that is a jpeg,gif or png.";function validate(form){var err=0;var genre_error="";var valid_file_error="";var required_file_error="";with(form){if(isEmpty(elements["title"].value)){if(elements["mediatype"].value=="V"){writeError(elements["title"],REQUIRED_videotitle)}else{writeError(elements["title"],REQUIRED_audiotitle)}err=1}if(!isEmpty(elements["tag"].value)){var tagArray=elements["tag"].value.split(" ");var tagres=checkTagLength(elements["tag"].value);if(tagres=="false"||tagArray.length>5){writeError(elements["tag"],VALID_tag);err=1}}if(isEmpty(elements["genre"].value)){if(elements["mediatype"].value=="V"){genre_error=REQUIRED_videogenre}else{if(elements["mediatype"].value=="A"){genre_error=REQUIRED_audiogenre}else{genre_error=REQUIRED_genre}}writeError(elements["genre"],genre_error);err=1}if(elements["usage_type"]){if(isEmpty(elements["usage_type"].value)){writeError(elements["usage_type"],REQUIRED_uploadtype);err=1}}if(elements["myfile_thumb"]){if(isEmpty(elements["myfile"].value)){if(elements["mediatype"].value=="V"){required_file_error=REQUIRED_video_file}else{if(elements["mediatype"].value=="A"){required_file_error=REQUIRED_audio_file}else{required_file_error=REQUIRED_file}}writeError(elements["myfile"],required_file_error);err=1}else{var filename=elements["myfile"].value;if(elements["mediatype"].value=="V"){if(isVideo(filename)){writeError(elements["myfile"],VALID_video_file);err=1}}else{if(elements["mediatype"].value=="A"){if(isAudio(filename)){writeError(elements["myfile"],VALID_audio_file);err=1}}else{if(isVideo(filename)&&isAudio(filename)){writeError(elements["myfile"],VALID_file);err=1}}}}}if(elements["myfile_thumb"]){if(!isEmpty(elements["myfile_thumb"].value)){var path=elements["myfile_thumb"].value;if(isImage(path)){writeError(elements["myfile_thumb"],VALID_image);err=1}}}if(err==1){return false}else{return true}}return true}function deletevideo(vid){var url=CONFIG_HOME_URL+"urVIDEOS/delete&id="+vid;return display_confirmMessage("Are you sure you want to delete?",url)}function validatespam(mode,action,id,moduletype){itemid=id;comments=document.getElementById("spamcomment"+id).value;var result=addspam(mode,action,itemid,moduletype,comments);if(result!=false){document.getElementById("link"+id).innerHTML="Marked as spam";d=document.getElementById("textComment"+id);d.style.display="none"}}function chngeDispComment(id,charcount_id){var d;d=document.getElementById("textComment"+id);if(d.style.display=="none"){d.style.display="block";document.getElementById("spamcomment"+id).value=""}else{d.style.display="none"}if(charcount_id){document.getElementById("remain"+id).innerHTML="Characters left : 250"}}function addToFavorite(mode,action,id,type,module){var data=new Array();data["id"]=id;data["type"]=type;data["module_name"]=module;var result=serverCall(mode,action,data);return result}function addVideosToFavorite(mode,action,id,type,module){var result=addToFavorite(mode,action,id,type,module);document.getElementById("spread_panel").style.display="none";document.getElementById("spamPanel").style.display="none";document.getElementById("messagepanel").style.display="block";document.getElementById("messagepanel").innerHTML=result}function addToMyCategory(mode,action,id,module,type){var data=new Array();data["id"]=id;data["module"]=module;data["type"]=type;var result=serverCall(mode,action,data);return result}function urVideosAddToMyCategory(mode,action,id,module,type){var result=addToMyCategory(mode,action,id,module,type);document.getElementById("messagepanel").innerHTML=result}function showMyGroups(mode,action,type,module_name){var data=new Array();data["module"]=type;data["module_name"]=module_name;var result=serverCall(mode,action,data);document.getElementById("spread_panel").style.display="none";document.getElementById("spamPanel").style.display="none";document.getElementById("messagepanel").style.display="block";document.getElementById("messagepanel").innerHTML=result}function addToMyGroup(mode,action,module,type,module_name){if(document.getElementById("group").value==""){alert("Please select the group.");return false}else{var data=new Array();var item_id=document.getElementById("group").value;data["id"]=document.getElementById("video_id").value;data["item_id"]=item_id;data["module"]=module;data["type"]=type;data["module_name"]=module_name;var result=serverCall(mode,action,data);document.getElementById("spamPanel").style.display="none";document.getElementById("messagepanel").style.display="block";document.getElementById("messagepanel").innerHTML=result;return result}}function voteThisVideo(mode,action,id){var data=new Array();data["item_id"]=id;var result=serverCall(mode,action,data);document.getElementById("vote_panel").innerHTML=result}function textCounter(field,maxlimit){var err_msg="";if(field.value.length>maxlimit){var left_charecter=field.value.length-maxlimit;document.getElementById("remain").innerHTML="0";if(left_charecter==1){err_msg="The comment must be less than "+maxlimit+" characters, "+left_charecter+" character is exceeded."}else{err_msg="The comment must be less than "+maxlimit+" characters, "+left_charecter+" characters are exceeded."}}else{var left_charecter=maxlimit-field.value.length;document.getElementById("remain").innerHTML=left_charecter}return display_errorMessage(err_msg)}function getgenrewisevideos_toprated(mode,action,type,module){var data=new Array();data["type"]=type;data["module"]=module;var result=serverCall(mode,action,data);if(typeof result[1]=="undefined"){document.getElementById("video_tpl").innerHTML=result}else{display_errorMessage("Can not proceed due to invalid data.")}}function getgenrewisevideos_recent(mode,action,type,module,mediatype){var data=new Array();data["type"]=type;data["module"]=module;data["mediatype"]=mediatype;var result=serverCall(mode,action,data);if(typeof result[1]=="undefined"){document.getElementById("video_tpl").innerHTML=result}else{display_errorMessage("Can not proceed due to invalid data.")}}function getgenrewisevideos_topvoted(mode,action){var data=new Array();var result=serverCall(mode,action,data);document.getElementById("video_tpl").innerHTML=result}function addvideocomment(mode,action,comment,item_id,type,page,rowsperpage){var errormessage="";var err=0;if(comment==""||comment.length>5000){errormessage="Please enter comments of length less than 5000 characters.";writeError(document.getElementById("comment"),errormessage);err=1}else{errormessage="";display_errorMessage(errormessage);highlightErrorField("comment","unhighlight","")}if(err==1){return false}else{var cr=addcomments(mode,action,comment,item_id,type,page,rowsperpage);if(typeof cr.error!="undefined"){alert(cr.error)}else{document.getElementById("messagepanel").className="vvajaxpanel";if(typeof cr[2]=="undefined"){document.getElementById("commentdet").innerHTML=cr[1];document.getElementById("messagepanel").innerHTML=cr[0];document.getElementById("messagepanel").className="vvajaxpanel"}else{display_errorMessage("Can't proceed due to invalid data.")}document.getElementById("comment").value="";document.getElementById("remain").innerHTML="Characters left : 5000";document.getElementById("setfocus").focus()}}}function getvideocomment(mode,action,item_id,type,page,rowsperpage){var ratings=document.getElementById("comment_rating_value").value;var result=getcomments(mode,action,item_id,type,page,rowsperpage,null,null,ratings);document.getElementById("commentdet").innerHTML=result[0];document.getElementById("comment").value="";document.getElementById("comment_rating_value").focus()}function suscrbeVideoOwner(mode,action,item_id,module_type,type,user_type){var result=subscribe(mode,action,item_id,module_type,type,user_type);document.getElementById("messagepanel").innerHTML=result;document.getElementById("messagepanel").className="vvajaxpanel"}function displayMessage(message){document.getElementById("messagepanel").className="vvajaxpanel";document.getElementById("message_alert").innerHTML=message;document.getElementById("messagepanel").innerHTML=document.getElementById("alertmessage").innerHTML}function checkTagLength(tag){var tagArray=tag.split(" ");for(var i=0;i<tagArray.length;i++){if(tagArray[i].length<3){if(tagArray[i]!=""){return"false"}}}return"true"}function checkAllowedPanel(){var usage_type=document.getElementById("usage_type").value;if(usage_type=="AUDITION"){document.getElementById("allowed_to").style.display="none";document.getElementById("allowed_to1").style.display="block"}else{document.getElementById("allowed_to1").style.display="none";document.getElementById("allowed_to").style.display="block"}}function funChange(frm,id){var frm;frm.method="post";frm.action=CONFIG_HOME_URL+"urVIDEOS/reordersharevideo&id="+id;frm.submit()}function funChange1(frm,id){var frm;frm.method="post";var url;if(document.getElementById("viewall").value!=""){url=url+"&v="+document.getElementById("viewall").value}if(document.getElementById("profilelink").value!=""){url=url+"&f="+document.getElementById("profilelink").value}if(document.getElementById("pageid").value!=""){url=url+"&page="+document.getElementById("pageid").value}frm.action=CONFIG_HOME_URL+"urVIDEOS/reordervideo&id="+id+url;frm.submit()}function funvali(frm){var genre=trimAll(frm.genre.value);var tag=trimAll(frm.tags.value);var type=trimAll(frm.music_type.value);var media_type=trimAll(frm.m_type.value);var sortby="";for(i=0;i<4;++i){if(frm.sortby[i].checked==true){sortby=frm.sortby[i].value}}var owner=trimAll(frm.owner.value);if((genre=="")&&(tag=="")&&(type=="")&&(sortby=="")&&(media_type=="")){var module=trimAll(frm.module_type.value);if(module!=""){if(owner!="GROUPS"){if(module=="AUDITION"){module="AUDITIONS"}if(module=="MUSIC"){module="SESSIONS"}if(module=="CONCERT"){module="urCONCERT"}var url=CONFIG_HOME_URL+module+"/search"}else{var group_name=trimAll(frm.group_name.value);var url=CONFIG_HOME_URL+"urGROUPS/browsevideo/"+group_name}}else{var url=CONFIG_HOME_URL+"urVIDEOS/browse";if(frm.username.value!=""){url=url+"/"+frm.username.value}}frm.action=url;frm.submit()}else{var module=trimAll(frm.module_type.value);if(module!=""){if(owner!="GROUPS"){if(module=="AUDITION"){module="AUDITIONS"}if(module=="MUSIC"){module="SESSIONS"}if(module=="CONCERT"){module="urCONCERT"}var url=CONFIG_HOME_URL+module+"/search"}else{var group_name=trimAll(frm.group_name.value);var url=CONFIG_HOME_URL+"urGROUPS/browsevideo/"+group_name}}else{var url=CONFIG_HOME_URL+"urVIDEOS/browse";if(frm.username.value!=""){url=url+"/"+frm.username.value}}if(genre!=""){url=url+"/"+genre}if(tag!=""){url=url+"?tags="+tag}if(sortby!=""){url=url+"%26sortby="+sortby}if(type!=""){url=url+"%26music_type="+type}if(media_type!=""){url=url+"%26m_type="+media_type}frm.action=url;frm.submit()}}function DisplaySpamarea(){if(document.getElementById("spamarea").style.display=="none"){document.getElementById("spamarea").style.display="block"}else{document.getElementById("spamarea").style.display="none"}}function fnAddSpam(mode,action,video_id){var fldname="spamComment";var errmsg="";var comments=document.getElementById("spamComment").value;if(comments==""){errmsg="Please enter the comment.";writeError(document.getElementById(fldname),errmsg);return false}else{if(comments.length>250){errmsg="Please enter the comments of length less than 250 characters.";writeError(document.getElementById(fldname),errmsg);return false}else{var data=new Array();data["video_id"]=video_id;data["dynspam"]=document.getElementById("spamComment").value;d=document.getElementById("spamarea");d.style.display="none";var result=serverCall(mode,action,data);document.getElementById("spamComment").value="";display_errorMessage(result);document.getElementById("remai").innerHTML="Characters left : 250 ";document.getElementById("spamdiv").innerHTML="<span class='red11b'>Flagged as inappropriate &nbsp;&nbsp;</span>"}}}function fnAddSpamVideo(mode,action,video_id){var fldname="spamComment";var errmsg="";var data=new Array();data["video_id"]=video_id;data["dynspam"]=document.getElementById("spamComment").value;var result=serverCall(mode,action,data);document.getElementById("spamPanel").innerHTML=result}function togglemusictab(type){document.getElementById("relatedmedia").style.visibility="visible";document.getElementById("moremedia").style.visibility="visible";switch(type){case"MEMBER":document.getElementById("relatedmedia").style.display="none";document.getElementById("moremedia").style.display="block";break;case"RELATED":document.getElementById("moremedia").style.display="none";document.getElementById("relatedmedia").style.display="block";break}}function reoderDragVideo(mode,action,oldorder,neworder,video_id){var data=new Array();data["oldorder"]=oldorder;data["neworder"]=neworder;data["video_id"]=video_id;data["param_keys"]="oldorder,neworder,video_id";var result=serverCall(mode,action,data);return result[0]}function FlagPanel(){document.getElementById("spread_panel").style.display="none";document.getElementById("messagepanel").style.display="none";if(document.getElementById("spamPanel").style.display=="none"){document.getElementById("spamPanel").style.display="block"}else{document.getElementById("spamPanel").style.display="none"}}function show_spread_panel(){document.getElementById("spamPanel").style.display="none";document.getElementById("messagepanel").style.display="none";document.getElementById("spread_panel").style.display="block"}function show_share(type){YAHOO.urs.share("music",document.getElementById("video_id").value)}function macTest(status){macTst=navigator.platform.indexOf("Mac");if(macTst>-1&&navigator.appName=="Netscape"){document.getElementById("flashcontent").style.visibility=status}}function change_wmode(id,mode){switch(mode){case"transparent":document.getElementById(id).attributes.wmode.value="transparent";break;case"opaque":document.getElementById(id).attributes.wmode.value="opaque";break;case"window":document.getElementById(id).attributes.wmode.value="window";break}}function facebook_submit(title,summary,medialink,thumb){window.open("http://www.facebook.com/sharer.php?s=100&p[medium]=103&p[title]="+title+"&p[summary]="+summary+"&p[url]="+medialink+"&p[images][0]="+thumb,"facebook","toolbar=0,status=0,width=626,height=436");return false}function focus_call(){document.getElementById("panel_focus").focus()}function focus_call1(){document.getElementById("panel_focus1").focus()}function select_thumbnail(new_id){if(cur_id!=new_id){document.getElementById("thumbnail").value=new_id;var img="thumbimg"+cur_id;document.getElementById(img).className="inactive_border";var img="thumbimg"+new_id;document.getElementById(img).className="active_border";cur_id=new_id}}var ratingStarted="";function setRatingResult(){ratingStarted=setTimeout("showRatingResult()",200)}var updaterating=function(o){if(o.responseXML.documentElement.getElementsByTagName("error")[0]){document.getElementById("rating_success_message").innerHTML=o.responseXML.documentElement.getElementsByTagName("error")[0].firstChild.nodeValue}else{document.getElementById("rating_success_message").innerHTML="Rating Successful"}};var alreadyrated=0;function registerrateslider(){var slider=YAHOO.widget.Slider.getHorizSlider("rating_slide_bar","rating_bar_slider",0,50,1);slider.getRealValue=function(){return Math.round(this.getValue()*2)};slider.subscribe("slideEnd",function(){if(alreadyrated==0){YAHOO.util.Connect.asyncRequest("POST","/urRATING/rate",{success:updaterating},"direct=true&item_id="+document.getElementById("video_id").value+"&rate="+this.getRealValue());alreadyrated=1}document.getElementById("rating_slide_bar_highlight").style.cssText="width:"+(this.getRealValue()*0.6)+"px;";document.getElementById("rating_bar_slider").style.cssText="display:none;";this.lock();this.unreg()});slider.subscribe("change",function(offsetFromStart){document.getElementById("rating_value").innerHTML=slider.getRealValue()+"%";document.getElementById("rating_slide_bar_highlight").style.cssText="width:"+(offsetFromStart+5)+"px;";if(slider.getRealValue()<51){document.getElementById("rating_thumb").setAttribute("class","rating_thumb_poor");document.getElementById("rating_thumb").setAttribute("className","rating_thumb_poor");document.getElementById("rating_slide_bar_highlight").setAttribute("class","rating_slide_bar_highlight_poor");document.getElementById("rating_slide_bar_highlight").setAttribute("className","rating_slide_bar_highlight_poor")}else{document.getElementById("rating_thumb").setAttribute("class","rating_thumb_good");document.getElementById("rating_thumb").setAttribute("className","rating_thumb_good");document.getElementById("rating_slide_bar_highlight").setAttribute("class","rating_slide_bar_highlight");document.getElementById("rating_slide_bar_highlight").setAttribute("className","rating_slide_bar_highlight")}})};