var _comblock = [];
var _comon = true;
var _comlive = false;
var _comratingon = false;
var _comtotal = 0;
var _comincrement = 50;
var _comeid = 0;
var _comformchange = false;
var _comswf = 'http://www.pbs.org/wgbh/pages/frontline/includes/swf/commentbridge.swf';
function talk_rendercallback (inhash) {
_comblock = inhash.discussion;
_comon = (inhash.enabled == "1")? true:false;
_comlive = (inhash.islive == "1")? true:false;
_comtotal = inhash.total;
_comeid = inhash.eid;
talk_renderpage(0);
}
function talk_commentrate (isup,idx){
_comblock[idx].israted = true;
if(isup){
_comblock[idx].rs = parseInt(_comblock[idx].rs) + 1;
} else {
_comblock[idx].rs = parseInt(_comblock[idx].rs) - 1;
}
var thisrate = parseInt(_comblock[idx].rs);
if(-9 > thisrate){
document.getElementById('flcom'+idx).className = (_comblock[idx].rt == '')? '_comment _commentbad':'_comment_r _commentbad';
} else {
document.getElementById('flcom'+idx).className = (_comblock[idx].rt == '')? '_comment':'_comment_r';
}
var output = ' Rating (';
if(thisrate > 0){
output += '+';
}
output += thisrate + ')';
document.getElementById('flcomrt'+idx).innerHTML = output;
}
function talk_intrender (idx){
var output = '
';
return output;
}
function talk_brwork (intext) {
var outtext = new String();
if(intext.indexOf('\n') != -1){
var elp = intext.split('\n');
for(var x = 0; x < elp.length; x++){
outtext += elp[x];
if(x != (elp.length - 1)){
outtext += '
';
}
}
} else {
outtext = intext;
}
return outtext;
}
function talk_renderpage (offset) {
var activateform = false;
if(document.getElementById('commentarea')){
var output = '';
document.getElementById('commentarea').innerHTML = output;
if(_comon){
talk_addform('comment_top',false);
}
}
}
function talk_addform (targetdiv,isreply,idx) {
proceed = true;
if(document.getElementById('_commentform')){
if(_comformchange){
if(!confirm('Are you sure you want to start a new comment?')){
proceed = false;
}
}
if(proceed){
$("#_commentform").remove();
}
}
if(proceed){
_comformchange = false;
var formdiv = document.createElement("div");
formdiv.setAttribute("id","_commentform");
document.getElementById(targetdiv).appendChild(formdiv);
var output = ''
$("#_commentform").html(output);
$("#_commentform").css( { display:"none" });
$("#_commentform").fadeIn();
}
}
function talk_overlay (ison) {
if(ison){
var overlaydiv = document.createElement("div");
overlaydiv.className ="_comment_overlay";
overlaydiv.setAttribute("id","_commentover");
document.body.appendChild(overlaydiv);
$("#_commentover").css( { display:"none", height: $(document).height() });
$("#_commentover").fadeIn();
} else {
$("#_commentover").fadeOut("slow", function () {
$("#_commentover").remove();
});
}
}
function talk_addcomment () {
var pass = true;
var errmsg = '';
if(document.getElementById("_comemail").value.length < 3 || document.getElementById("_comemail").value.indexOf("@") == -1){
pass = false;
errmsg = 'Please verify your e-mail address.';
}
if(document.getElementById("_commessage").value.length < 1){
pass = false;
if(errmsg.length > 0){
errmsg += '\n';
}
errmsg += 'Please enter a message.';
}
if(pass){
var overlaydiv = document.createElement("div");
overlaydiv.className ="_comment_overlay";
overlaydiv.setAttribute("id","_commentover");
document.getElementById('_commentfrmouter').appendChild(overlaydiv);
$("#_commentover").html('
');
$("#_commentover").css( { marginTop: (0 - $('#_commentfrmouter').height()) - 9, height: $('#_commentfrmouter').height(), width: $('#_commentfrmouter').width() });
$("#_comloadimg").css( { marginTop: ($('#_commentfrmouter').height() / 2) - 16 });
$(window).resize( function () {
$("#_commentover").css( { width: $('#_commentfrmouter').width() });
});
talk_transmit();
} else {
alert('Please correct the following:\n' + errmsg);
}
return false;
}
function talk_transmit(){
var overlaydiv = document.createElement("div");
overlaydiv.setAttribute("id","_commentbridge");
document.body.appendChild(overlaydiv);
overlaydiv.innerHTML = 'sending comment...';
var e = {};
_comformchange = false;
e.centryid = _comeid;
e.sendnow = true;
e.cname = encodeURIComponent(document.getElementById('_comauthor').value);
e.cemail = encodeURIComponent(document.getElementById('_comemail').value);
e.cbody = encodeURIComponent(document.getElementById('_commessage').value);
_papobject.embedSWF('http://www.pbs.org/wgbh/pages/frontline/includes/swf/commentmt.swf',"_commentbridge","10","10","9",null,e,{allowScriptAccess:"always",wmode:"opaque"},{ id:'combridgeid',name:'_combridgena' });
}
function talkreceived (stat) {
$("#_commentover").html("We appreciate your comment. Please be aware that not all comments are posted.<\/p>");
var x = setTimeout(talkfade,10000);
document.getElementById('_comauthor').value = '';
document.getElementById('_comemail').value = '';
document.getElementById('_commessage').value = '';
}
function talkfade () {
$("#_commentover").fadeOut("slow", function (){
document.getElementById('_commentfrmouter').removeChild(document.getElementById('_commentover'));
});
}
' + talk_brwork(elresponse) + ''; } output += ''; if(_comblock[idx].rt == '' && _comon && _comblock[idx].cc != "1"){ output += 'Respond'; } if(_comratingon){ output += ''; if(!_comblock[idx].israted){ output += ' '; } output += ' Rate This ('; if(thisrate > 0){ output += '+'; } output += thisrate + ')'; } output += '