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.php?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 = (media_type==2 ? 'Embed this Video' : 'Embed this Audio')+"";
var contents = "
\
"+(media_type==1 ? 'You have chosen to Embed this Audio track on an external site' : 'You have chosen to Embed this 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 = (media_type==2 ? 'Share this Video' : 'Share this Audio')+"";
var contents = "
"+(media_type==1?'You have chosen to share this Audio track by email':'You have chosen to share this Video by email')+": Artist: "+artist_name+" "+(media_type==2 ? 'Video' : 'Audio')+": "+media_title+"
";
contents += '
';
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 email 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 email address.");
}
else
{
if(document.getElementById('subject').value=="") {
alert("You must supply a valid email subject.");
}
else
{
if(document.getElementById('body').value=="") {
alert("You must supply a valid email 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 = (media_type==2 ? 'Flag this Video' : 'Flag this Audio')+"";
var contents = "
";
}
else if(data['status']==2)
{
contents += ""+(media_type==1 ? "You have already flagged this audio" : "You have already flagged this video")+". Thank you for your feedback!
\
";
}
else if(data['status']==-1)
{
contents += ""+(media_type==1?"Please register or log in to flag this audio":"Please register or log in to flag this 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 = ""+(media_type==1?'Your flags were received for this audio':'Your flags were received for this 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 = "
"+(media_type==1 ? 'Submit your comment for this audio track' : (media_type==5 ? 'Submit your comment for this slideshow' : 'Submit your comment for this video'))+": Artist: "+artist_name+" "+(media_type==2 ? 'Video' : (media_type==5 ? 'Slideshow' : 'Audio'))+": "+media_title+" ";
contents += '\
\
\
\
';
}
else if(data['status']==-1)
{
contents = "
"+(media_type==1 ? 'Please register or log in to comment on this audio' : (media_type==5 ? 'Please register or log in to comment on this slideshow' : 'Please register or log in to comment on this video'))+".
\
";
}
var window_id = 'gadget_window';
var win = Windows.getWindow(window_id);
if(win && win.close)
{
win.close();
}
var window_title = (media_type==2 ? 'Comment on this Video' : (media_type==5 ? 'Comment on this slideshow' : 'Comment on this 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(!win) {
add_media_comment_clicked = true; var contents = '\
\
\
\
\
';
var window_title = (media_type==2 ? 'Comment on this Video' : (media_type==5 ? 'Comment on this slideshow' : 'Comment on this 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);
}
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 = ""+(media_type==1 ? 'Your comment was received for this audio track.' : (media_type==5 ? 'Your comment was received for this slideshow.' : 'Your comment was received for this 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.