/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function report(episodeId){
    var episodeElementId = 'episode'+episodeId;
    var reportElement = $(episodeElementId);
    var message = new Element('div');
    var h2tags = reportElement.getElementsByTagName('h2');
    var title = $(h2tags.item(0)).clone();
    message.adopt(title);
    var reportForm = new Element('form',{'id':'reportForm','onSubmit':'void(0); return false;'});
    reportForm.adopt(new Element('h3').appendText("What's the problem?"));
    var selectElement = new Element('select',{'name':'problem'});
    selectElement.adopt(new Element('option',{'value':'404'}).appendText('File Not Found'));
    selectElement.adopt(new Element('option',{'value':'subtitle'}).appendText('Subtitles Missing'));
    selectElement.adopt(new Element('option',{'value':'language'}).appendText('Wrong Language'));
    selectElement.adopt(new Element('option',{'value':'episode'}).appendText('Episode Mismatch'));
    selectElement.adopt(new Element('option',{'value':'other'}).appendText('Other (State in comments)'));
    reportForm.adopt(selectElement);
    reportForm.adopt(new Element('h3').appendText("Additional Comments:"));
    reportForm.adopt(new Element('textarea',{'name':'comments'}));
    reportForm.adopt(new Element('input',{'type':'hidden','name':'episodeid','value':episodeId}));
    reportForm.set('send',{'url':'/actions/report.php'});
    message.adopt(reportForm);
    showConfirmDialog(message,function(){
	reportForm.send()
	alert("Thanks for reporting a problem with this episode.  You should receive an email as soon as this issue is resolved");
    });
    return false;
}