function toggleCollapsed(id){var a=document.getElementById('answer-'+id);if(a){if(a.className.indexOf('expanded')>-1)
a.className=a.className.replace('expanded','collapsed');else if(a.className.indexOf('collapsed')>-1)
a.className=a.className.replace('collapsed','expanded');}}
function filterPottyMouths(filters)
{var token='{{{POTTYMOUTH}}}',filterClass='filterPotty',answersBody=document.getElementById('answersBody'),toFilter=[],els,i;if(!filters||filters.length==0)
return;filters=new RegExp('(\\b'+filters.join('\\b)|(\\b').replace(/[*]/g,'[\\w-]*')+'\\b)','gim');function filterEl(el){if(el.innerHTML)
el.innerHTML=filterHTML(el.innerHTML);}
function filterHTML(html){if(html){var matches=html.match(filters),word;if(matches){html=html.replace(filters,token);while(word=matches.shift())
html=html.replace(token,censor(word));}}
return html;}
function censor(word){return word.substr(0,1)+Array(word.length).join('*');}
document.title=filterHTML(document.title);if(answersBody.getElementsByClassName)
toFilter=answersBody.getElementsByClassName(filterClass);else if(els=answersBody.getElementsByTagName('*'))
for(i=0;i<els.length;i++)
if(els[i].className&&els[i].className.indexOf(filterClass)>-1)
toFilter.push(els[i]);if(toFilter.length)
for(i=0;i<toFilter.length;i++)
filterEl(toFilter[i]);}
function displayOverlay(id){document.domain=document.domain.split('.').slice(-2).join('.');var dialog_url='/answers/includes/fb_submit_modal.php';if(id){dialog_url=dialog_url+'?id='+id;}
var fb_auth=document.getElementById('fb_auth').value;if(fb_auth==1){return true;}
else{simpleUI.modal.openURL(dialog_url,'','280','','');}
return false;}
function submitFormAction(id){if(!id){return;}
var el=document.getElementById(id);if(el.href){location.replace(el.href);}
else{pleaseWait('submitButton');document.getElementById(id).submit();}}
function displayLanding(creativeId){document.domain=document.domain.split('.').slice(-2).join('.');var dialog_url='/answers/includes/fb_landing_modal.php?creative_id='+creativeId;simpleUI.modal.openURL(dialog_url,'645','415','','');}
function displayRegLanding(creativeId,category_id){document.domain=document.domain.split('.').slice(-2).join('.');var dialog_url='/answers/includes/reg_landing_modal.php?creative_id='+creativeId+'&category_id='+category_id;simpleUI.modal.openURL(dialog_url,'645','415','','');}
function regCloseModal(redir){document.domain=document.domain.split('.').slice(-2).join('.');parent.location.replace(redir);}
