function embedMediaPrompt(media_id, media_type) { new Ajax.Request('/ajax/gadgets.php?action=get_media_info&media_id='+media_id+'&media_type='+media_type, { asynchronous: true, onSuccess: function(transport) { if(transport.responseText.isJSON()) { var data = transport.responseText.evalJSON(); if(data['status']==1) { var media_id = data['media_id']; var media_type = data['media_type']; var media_title = data['media_title']; var artist_id = data['artist_id']; var artist_name = data['artist_name']; var object_tag = ''; var remote_url_encoded = URLEncode("http://www.famecast.com/backstage/artist_id="+artist_id+"&"+(media_type==1?"audio_id":"video_id")+"="+media_id); var remote_title_encoded = URLEncode("FameCast.com - Artist: "+artist_name+" - "+(media_type==1?'Audio':'Video')+": "+media_title); var window_title = "Embed this "+(media_type==2 ? 'Video' : 'Audio')+""; var contents = "
\ You have chosen to Embed this "+(media_type==1?'Audio track':'Video')+" on an external site:
\ Artist:  "+artist_name+"
\ "+(media_type==2 ? 'Video' : 'Audio')+":  "+media_title+"

\ \ \ \ \ \ \
Embed:  
\
\
\ \ \ \ \ \ \ \ \ \ \
"; var window_id = 'gadget_window'; var win = Windows.getWindow(window_id); if(win && win.close) { win.close(); } win = new Window({id: window_id, className: "famecast", width:302, height:150, zIndex: 1001, resizable: false, title: window_title, showEffect: Element.show, hideEffect: Element.hide, draggable:true, wiredDrag: false, minimizable: false, maximizable: false, destroyOnClose: true, recenterAuto: false, onClose: function(){ } }) ; win.getContent().innerHTML = contents; win.showCenter(true); } } } }); } function shareMediaPrompt(media_id, media_type) { new Ajax.Request('/ajax/gadgets.php?action=get_media_info&media_id='+media_id+'&media_type='+media_type, { asynchronous: true, onSuccess: function(transport) { if(transport.responseText.isJSON()) { var data = transport.responseText.evalJSON(); if(data['status']==1) { var media_id = data['media_id']; var media_type = data['media_type']; var media_title = data['media_title']; var artist_id = data['artist_id']; var artist_name = data['artist_name']; var window_title = "Share this "+(media_type==2 ? 'Video' : 'Audio')+""; var contents = "
You have chosen to Share this "+(media_type==1?'Audio track':'Video')+" by E-mail:
Artist:  "+artist_name+"
"+(media_type==2 ? 'Video' : 'Audio')+":  "+media_title+"

"; contents += '
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
To:
From:
Subject:
Body:
  
\ \ \ \ \
'; var window_id = 'gadget_window'; var win = Windows.getWindow(window_id); if(win && win.close) { win.close(); //if(win.destroy) win.destroy(); } win = new Window({id: window_id, className: "famecast", width:332, height:282, zIndex: 1001, resizable: false, title: window_title, showEffect: Element.show, hideEffect: Element.hide, draggable:true, wiredDrag: false, minimizable: false, maximizable: false, destroyOnClose: true, recenterAuto: false, onClose: function(){ } }) ; win.getContent().innerHTML = contents; win.showCenter(true); } } } }); } function ValidateEmail() { var to_emails = document.getElementById('to_emails').value; if(to_emails=="" || to_emails.length < 6 || to_emails.indexOf('@')==-1) { alert('You must supply at least one valid To E-mail address.'); } else { var from_email = document.getElementById('from_email').value; if(from_email=="" || from_email.length < 6 || from_email.indexOf('@')==-1 || from_email.indexOf('@')!=from_email.lastIndexOf('@')) { alert('You must supply a valid From E-mail address.'); } else { if(document.getElementById('subject').value=="") { alert('You must supply a valid E-mail Subject.'); } else { if(document.getElementById('body').value=="") { alert('You must supply a valid E-mail Body.'); } else { return true; } } } } return false; } function flagMediaPrompt(media_id, media_type, show_wrong_stage) { new Ajax.Request('/ajax/gadgets.php?action=get_media_info&media_id='+media_id+'&media_type='+media_type+'&flag=1', { asynchronous: true, onSuccess: function(transport) { if(transport.responseText.isJSON()) { var data = transport.responseText.evalJSON(); if(data['status']==1 || data['status']==2 || data['status']==-1) { var media_id = data['media_id']; var media_type = data['media_type']; var media_title = data['media_title']; var artist_id = data['artist_id']; var artist_name = data['artist_name']; var fk = data['fk']; var window_title = "Flag this "+(media_type==2 ? 'Video' : 'Audio')+""; var contents = "
\ Artist:  "+artist_name+"
\ "+(media_type==2 ? 'Video' : 'Audio')+":  "+media_title+"

\
"; if(data['status']==1) { contents += "\ \ \ \ \
\
\
 Plagiarized
\
 Pornographic
\
 Explicit
\
\
\
 Corrupt/Broken
\
\
 Wrong Stage/Genres
\
\
\
\
\
\
 \ \
\
"; } else if(data['status']==2) { contents += "You have already flagged this "+(media_type==1?'audio':'video')+".
Thank you for your feedback!


\ "; } else if(data['status']==-1) { contents += "Please register or\ log in to flag this "+(media_type==1?'audio':'video')+"

\ "; } contents += "
"; var window_id = 'gadget_window'; var win = Windows.getWindow(window_id); if(win && win.close) { win.close(); } win = new Window({id: window_id, className: "famecast", width:302, height:180, zIndex: 1001, resizable: false, title: window_title, showEffect: Element.show, hideEffect: Element.hide, draggable:true, wiredDrag: false, minimizable: false, maximizable: false, destroyOnClose: true, recenterAuto: false, onClose: function(){ } }) ; win.getContent().innerHTML = contents; win.showCenter(true); } } } }); } function flagMedia(media_id, media_type, fk) { var fpl = ($('flag_plagiarized').checked ? 1:0); var fpo = ($('flag_pornographic').checked ? 1:0); var fex = ($('flag_explicit').checked ? 1:0); var fcr = ($('flag_corrupt').checked ? 1:0); var fws = ($('flag_wrong_stage').checked ? 1:0); var fsid = $('flag_select_stage_id').value; new Ajax.Request('/ajax/gadgets.php', { asynchronous: true, parameters: {action:'flag_media', mid:media_id, mt:media_type, fk:fk, fpl:fpl, fpo:fpo, fex:fex, fcr:fcr, fws:fws, fsid:fsid }, onSuccess: function(transport) { var window_id = 'gadget_window'; var win = Windows.getWindow(window_id); if(transport.responseText.isJSON()) { var data = transport.responseText.evalJSON(); if(data['status']==1) { var media_id = data['media_id']; var media_type = data['media_type']; var media_title = data['media_title']; var artist_id = data['artist_id']; var artist_name = data['artist_name']; var contents = "Your flags were received for this "+(media_type==1?'audio':'video')+".
Thank you for your feedback!


\ \ "; $('flag_box_form_contents').innerHTML = contents; } else { if(win && win.close) win.close(); } } else { alert('Failed to submit flags. Please try again later.'); if(win && win.close) win.close(); } } }); } var add_media_comment_clicked = false; var media_comment_callback_function = ""; function addMediaCommentPrompt(media_id, media_type, callback_function) { if(!add_media_comment_clicked) { add_media_comment_clicked = true; media_comment_callback_function = callback_function; new Ajax.Request('/ajax/gadgets.php?action=get_media_info&media_id='+media_id+'&media_type='+media_type+'&comment=1', { asynchronous: true, onSuccess: function(transport) { if(transport.responseText.isJSON()) { var data = transport.responseText.evalJSON(); var media_id = data['media_id']; var media_type = data['media_type']; var media_title = data['media_title']; var artist_id = data['artist_id']; var artist_name = data['artist_name']; if(data['status']==1) { var ck = data['ck']; var contents = "
Submit your comment for this "+(media_type==1?'audio track':'video')+":
Artist:  "+artist_name+"
"+(media_type==2 ? 'Video' : 'Audio')+":  "+media_title+"
"; contents += '\
\
\ \ \ \ \ \ \ \ \ \
Message:
  
\
\
\
'; } else if(data['status']==-1) { contents = "
Please register or\ log in to comment on this "+(media_type==1?'audio':'video')+".

\
"; } var window_id = 'gadget_window'; var win = Windows.getWindow(window_id); if(win && win.close) { win.close(); } var window_title = "Comment on this "+(media_type==2 ? 'Video' : 'Audio')+""; win = new Window({id: window_id, className: "famecast", width:332, height:222, zIndex: 1001, resizable: false, title: window_title, showEffect: Element.show, hideEffect: Element.hide, draggable:true, wiredDrag: false, minimizable: false, maximizable: false, destroyOnClose: true, recenterAuto: false, onClose: function(){ add_media_comment_clicked = false; } }) ; win.getContent().innerHTML = contents; win.showCenter(true); } } }); } } function addMediaComment(media_id, media_type, ck) { var comment_message = $('comment_message').value; new Ajax.Request('/ajax/gadgets.php', { asynchronous: true, parameters: {action:'add_media_comment', mid:media_id, mt:media_type, ck:ck, message:comment_message }, onSuccess: function(transport) { var window_id = 'gadget_window'; var win = Windows.getWindow(window_id); if(transport.responseText.isJSON()) { var data = transport.responseText.evalJSON(); if(data['status']==1 || data['status']==2 || data['status']==3) { var media_id = data['media_id']; var media_type = data['media_type']; var media_title = data['media_title']; var artist_id = data['artist_id']; var artist_name = data['artist_name']; if(data['status']==1) { var contents = "Your comment was received for this "+(media_type==1?'audio track':'video')+".
"; if(data['approved']==0) contents += "This artist must approve your comment
before it may be displayed.
"; contents += "Thank you for your feedback!


\ \ "; $('comment_box_form_contents').innerHTML = contents; var eval_str = media_comment_callback_function+"("+media_id+","+media_type+")"; eval(eval_str); } else if(data['status']==2) { var contents = "You have posted this comment already. Please try posting your comment again.

\ \ "; $('comment_box_form_contents').innerHTML = contents; } else if(data['status']==3) { var contents = "Your comment message must not be blank. Please try posting your comment again.

\ \ "; $('comment_box_form_contents').innerHTML = contents; } } else { if(win && win.close) win.close(); } } else { alert('Failed to submit comment. Please try again later.'); if(win && win.close) win.close(); } } }); }