
function confirmDelete(delUrl){if(confirm("Zeker weten dat je dit wilt verwijderen?")){document.location=delUrl;}}
function confirmDeleteNOURL(){return confirm("Zeker weten dat je dit wilt verwijderen?");}
function AddToFavs(id){$.post("/ajax",{action:"AddToFavorites",showid:id},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){document.getElementById('AddToFavs').className='invisible';document.getElementById('RemoveFromFavs').className='';RefreshFavorites();}});}
function RemoveFav(id){$.post("/ajax",{action:"RemoveFromFavorites",showid:id},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){document.getElementById('AddToFavs').className='';document.getElementById('RemoveFromFavs').className='invisible';}});}
function StringtoXML(text){if(window.ActiveXObject){var doc=new ActiveXObject('Microsoft.XMLDOM');doc.async='false';doc.loadXML(text);}else{var parser=new DOMParser();var doc=parser.parseFromString(text,'text/xml');}
return doc;}
function GetCode(data){var doc=StringtoXML(data);var root=doc.getElementsByTagName('xml')[0];var obj=root.getElementsByTagName('code')[0];return obj.childNodes[0].nodeValue;}
function GetMessage(data){var doc=StringtoXML(data);var root=doc.getElementsByTagName('xml')[0];var obj=root.getElementsByTagName('message')[0];return obj.childNodes[0].nodeValue;}
function RefreshFavorites(){$.post("/ajax",{action:"GetFavorites"},function(data)
{var pulldown=document.getElementById("FavsPullDown");pulldown.innerHTML='<option value="">Mijn Shows</option>'+data;});}
function VoteForShow(showid){var value=$('#VoteValue').val();$.post("/ajax",{action:"VoteForShow",value:value,showid:showid},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){var grade=GetGrade(data);var inhtml=GetMessage(data);document.getElementById("ShowGrade").innerHTML=grade;document.getElementById("ShowVotes").innerHTML=inhtml;}else{alert("Er ging even wat mis:\n"+GetMessage(data));}});}
function VoteForEpisode(episodeid){var value=$('#VoteValue').val();$.post("/ajax",{action:"VoteForEpisode",value:value,episodeid:episodeid},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){var grade=GetGrade(data);var inhtml=GetMessage(data);document.getElementById("ShowGrade").innerHTML=grade;document.getElementById("ShowVotes").innerHTML=inhtml;}else{alert("Er ging even wat mis:\n"+GetMessage(data));}});}
function GetGrade(data){var doc=StringtoXML(data);var root=doc.getElementsByTagName('xml')[0];var obj=root.getElementsByTagName('grade')[0];return obj.childNodes[0].nodeValue;}
function SetSeen(epid,single){$.post("/ajax",{action:"SetSeen",epid:epid,single:single},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){var tempobj=document.getElementById("seen-"+epid);temp=tempobj.src;if(temp.substr(temp.length-8)!="reen.png"){tempobj.src=temp.substr(0,temp.length-8)+"green.png";}
SetAquired(epid);}else{alert("Er ging even wat mis:\n"+GetMessage(data));}});}
function SetAquired(epid){$.post("/ajax",{action:"SetAquired",epid:epid},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){var tempobj=document.getElementById("aquired-"+epid);temp=tempobj.src;if(temp.substr(temp.length-8)!="reen.png"){tempobj.src=temp.substr(0,temp.length-8)+"green.png";}}else{alert("Er ging even wat mis:\n"+GetMessage(data));}});}
function SetUnSeen(epid){$.post("/ajax",{action:"SetUnSeen",epid:epid},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){var tempobj=document.getElementById("seen-"+epid);temp=tempobj.src;if(temp.substr(temp.length-8)!="grey.png"){tempobj.src=temp.substr(0,temp.length-9)+"grey.png";}}else{alert("Er ging even wat mis:\n"+GetMessage(data));}});}
function SetUnAquired(epid){$.post("/ajax",{action:"SetUnAquired",epid:epid},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){var tempobj=document.getElementById("aquired-"+epid);temp=tempobj.src;if(temp.substr(temp.length-8)!="grey.png"){tempobj.src=temp.substr(0,temp.length-9)+"grey.png";}
SetUnSeen(epid);}else{alert("Er ging even wat mis:\n"+GetMessage(data));}});}
function SwitchAquired(epid){var tempobj=document.getElementById("aquired-"+epid);if(tempobj==null){alert("episode tags not found");return;}
temp=tempobj.src;if(temp.substr(temp.length-8,8)=="grey.png"){SetAquired(epid,false);}else{SetUnAquired(epid);}}
function SwitchSeen(epid){var tempobj=document.getElementById("seen-"+epid);if(tempobj==null){alert("episode tags not found");return;}
temp=tempobj.src;if(temp.substr(temp.length-8,8)=="grey.png"){SetSeen(epid,true);HideEpisode(epid);}else{SetUnSeen(epid);}}
function HideEpisode(epid)
{$('#episode-'+epid).fadeOut('slow');}
function AddEpisodeItem(){var step=2;var item=document.getElementById("itembox").value;var type=document.getElementById("EpisodeItemType").value;var epid=document.getElementById("episodeid").value;$.post("/thickbox/add_episode_item",{episodeid:epid,type:type,item:item},function(data){document.getElementById("ThickBoxContentId").innerHTML=data});}
function GetRadioValue(){for(var i=0;i<document.ShowSelectForm.ShowValue.length;i++){if(document.ShowSelectForm.ShowValue[i].checked){var rad_val=document.ShowSelectForm.ShowValue[i].value;}}
return rad_val;}
function SetSeenEpInfo(epid,single){$.post("/ajax",{action:"SetSeen",epid:epid,single:single},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){document.getElementById('AddToSeen').className='invisible';document.getElementById('RemoveFromSeen').className='';SetAquiredEpInfo(epid);}});}
function SetAquiredEpInfo(epid){$.post("/ajax",{action:"SetAquired",epid:epid},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){document.getElementById('AddToAquired').className='invisible';document.getElementById('RemoveFromAquired').className='';}});}
function SetUnSeenEpInfo(epid){$.post("/ajax",{action:"SetUnSeen",epid:epid},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){document.getElementById('AddToSeen').className='';document.getElementById('RemoveFromSeen').className='invisible';}});}
function SetUnAquiredEpInfo(epid){$.post("/ajax",{action:"SetUnAquired",epid:epid},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){document.getElementById('AddToAquired').className='';document.getElementById('RemoveFromAquired').className='invisible';SetUnSeenEpInfo(epid);}});}
function SetAllAquired(){var allPageTags=document.getElementsByTagName("img");var i=0;for(i=0;i<allPageTags.length;i++){if(allPageTags[i].className=='AquiredItem'){SetAquired(allPageTags[i].id.substr(8));}}}
function SetAllSeen(){var allPageTags=document.getElementsByTagName("img");var i=0;for(i=0;i<allPageTags.length;i++){if(allPageTags[i].className=='SeenItem'){SetSeen(allPageTags[i].id.substr(5),false);}}}
function GetQuote(type,id){$.post("/ajax",{action:"GetQuote",qid:id,type:type},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){document.getElementById('replybox').value=document.getElementById('replybox').value+GetMessage(data);}else{}});}
function AddSUBReply(id){$.post("/ajax",{action:"AddReply",action2:"sub",subid:id,message:document.getElementById('replybox').value},function(data){document.getElementById('SUBreplies').innerHTML=data;})}
function AddWIPReply(id){$.post("/ajax",{action:"AddReply",action2:"wip",wipid:id,message:document.getElementById('replybox').value},function(data){document.getElementById('WIPreplies').innerHTML=data;})}
function submitDelSUB(){var subid=document.getElementById('subid').value;$.post("/ajax",{action:"deleteSUB",subid:subid},function(data){document.getElementById("result").innerHTML=data;});}
function submitDelWIP(){var wipid=document.getElementById('wipid').value;$.post("/ajax",{action:"deleteWIP",wipid:wipid},function(resdata){document.getElementById("result").innerHTML=resdata;});}
function submitEditSUB(){var subid=document.getElementById('subid').value;var NewFileName=document.getElementById('EditFileName').value;var Pnewid=document.getElementById("newid");var newid=Pnewid.options[Pnewid.selectedIndex].value;var Ptaal=document.getElementById("language");var taal=Ptaal.options[Ptaal.selectedIndex].value;$.post("/ajax",{action:"editSUB",subid:subid,filename:NewFileName,newid:newid,taal:taal},function(data){document.getElementById("result").innerHTML=data;});}
function setCookie(cname,cvalue,cexpire){document.cookie=cname+'='+escape(cvalue)+
(typeof cexpire=='date'?'expires='+cexpire.toGMTString():'')+',path=/;domain=bierdopje.com';}
function getCookie(c_name)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1)
{c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
return"";}
function hasCookie(c_name)
{koekje=getCookie(c_name);if(koekje!=null&&koekje!="")
{return true;}
return false;}
function del_cookie(name){document.cookie=name+'=; expires=Thu, 01-Jan-70 00:00:01 GMT;';}
function ToggleCheckboxes(){var inputlist=document.getElementsByTagName("input");for(i=0;i<inputlist.length;i++){if(inputlist[i].getAttribute("type")=='checkbox'){if(inputlist[i].checked)inputlist[i].checked=false
else inputlist[i].checked=true;}}}
function editPost(postid)
{var thepost=document.getElementById("post-"+postid);$('#post-'+postid).css('display','none');thepost.innerHTML='<textarea id="editbox-'+postid+'" cols="30" rows="10" name="post-'+postid+'"></textarea>';thepost.innerHTML+='<br /><a class="imgbutton" href="javascript:updatePost('+postid+');"><img src="'+window.ImgURL+'/g/if/icons_png/disk.png" alt="" border="0"/><span>Opslaan</span></a>';$.post("/ajax",{action:"GetPost",id:postid},function(data){setEditContent(postid,data);});}
function setEditContent(postid,content)
{document.getElementById('editbox-'+postid).value=content;$('#post-'+postid).css('display','inline');$('#editbox-'+postid).markItUp(myBbcodeSettings);}
function updatePost(postid)
{var re=/^\s{1,}$/g;var value=document.getElementById('editbox-'+postid).value;value=value.replace(/^\s+/,'');value=value.replace(/\s+$/,'');if(value.length<5||value==null||value.search(re)>-1)
return alert('Een bericht moet minimaal 5 tekens bevatten.');$.post("/ajax",{action:"EditPost",id:postid,message:document.getElementById('editbox-'+postid).value},function(data){document.getElementById('post-'+postid).innerHTML=data;})}
function deletePost(postid)
{$.post("/ajax",{action:"DeletePost",id:postid,message:postid},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){$('#replyheader-'+postid).fadeOut('slow');$('#replyside-'+postid).fadeOut('slow');$('#replyspacer-'+postid).fadeOut('slow');}})}
function CheckForAdvertBlocking()
{if(document.getElementById('AdVert127')!=null){if(document.getElementById('AdVert127').clientHeight<80){$.post("/ajax",{action:"CheckForAdvertBlocking",result:"1",location:document.location.href},function(data){})}else{$.post("/ajax",{action:"CheckForAdvertBlocking",result:"2",location:document.location.href},function(data){})}}else{$.post("/ajax",{action:"CheckForAdvertBlocking",result:"3",location:document.location.href},function(data){})}}
function DoWip(epid){var answer=confirm("Weet je zeker dat je deze aflevering echt gaat vertalen?\nEr wordt van je geacht dit ook daadwerkelijk te doen\n\nMisbruik van dit systeem wordt niet geduld.")
if(answer){$.post("/ajax",{action:"SetWip",epid:epid},function(data)
{var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){window.location.reload();}});}}
function AddToBasket(type,itemid){$.post("/ajax",{action:"AddToBasket",type:type,itemid:itemid},function(data){var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}});}
function RequestUpdate(id)
{$.post("/ajax",{action:"RequestUpdate",showid:id},function(data)
{var code=GetCode(data);if(code==401)
{fb('/user/action/login/?msg='+GetMessage(data));return;}
if(code==200){document.getElementById("RequestUpdate").innerHTML='<b>Aangevraagd</b>';}else{alert("Aanvragen mislukt. Rapporteer deze fout aan de admins!");}});}
function AddTag(itemid,itemtype){$.post("/ajax",{action:"AddTag",itemid:itemid,itemtype:itemtype,tag:document.getElementById('itemtag').value},function(data){document.getElementById("result").innerHTML=data;});}
function DeleteTag(tagid,itemid,itemtype){$.post("/ajax",{action:"deleteTag",tagid:tagid,itemid:itemid,itemtype:itemtype},function(data){document.getElementById("result").innerHTML=data;});}
function el(element){return document.getElementById(element);}
function toggle(objectname){if(el("body_"+objectname).style.display!="none"){el("body_"+objectname).style.display="none";el("toggle_"+objectname).innerHTML="<img src='"+window.ImgURL+"/g/if/plus.gif' border='1px'>";}
else{el("body_"+objectname).style.display="";el("toggle_"+objectname).innerHTML="<img src='"+window.ImgURL+"/g/if/min.gif' border='1px'>";}}
function light_switch()
{licht=getCookie('dark');if(licht[0]=="D")
{set_light(false);}else
{set_light(true);}}
function logmein()
{$("#errormsg").css('display','none');$("#loginbox").css('display','none');$("#box_loading").css('display','block');$.post("/user/login/",{username:$('#username').val(),password:$('#password').val(),ip_lock:$('#ip_lock').val(),rand:Math.random()},function(data)
{if(data.substr(0,3)=="OK!")
{$("#box_loading").css('display','none');$("#errormsg").css('display','none');$("#redirecting").css('display','block');window.location.reload();}
else
{$("#box_loading").css('display','none');$("#loginbox").css('display','block');$("#password").val('').focus();if(data.substr(0,4)!="<div")
{$("#errormsg").css('display','block').html(data);}else{$("#errormsg").css('display','block').text("Er is een fout opgetreden tijdens het inloggen");}}});}
function resetpassword()
{$("#errormsg").css('display','none');$("#forgotbox").css('display','none');$("#box_loading").css('display','block');$.post("/user/resetpassword/",{emailadres:$('#emailadres').val(),rand:Math.random()},function(data)
{if(data.substr(0,3)=="OK!")
{$("#box_confirmed").css('display','block');$("#box_loading").css('display','none');$("#errormsg").css('display','none');}
else
{$("#forgotbox").css('display','block');$("#emailadres").val('').focus();if(data.substr(0,4)!="<div")
{$("#errormsg").css('display','block').html(data);}else{$("#errormsg").css('display','block').text("Kan je account niet vinden.");}
$("#box_loading").css('display','none');$("#box_confirmed").css('display','none');}});}
function registerme()
{$("#errormsg").css('display','none');$("#registerbox").css('display','none');$("#box_loading").css('display','block');$.post("/user/register/",{username:$('#username').val(),password:$('#password').val(),password2:$('#password2').val(),email:$('#email').val(),TermsAgreed:$('#TermsAgreed:checked').val(),rand:Math.random()},function(data)
{if(data.substr(0,3)=="OK!")
{$("#box_confirmed").css('display','block');$("#box_loading").css('display','none');$("#errormsg").css('display','none');}
else
{$("#registerbox").css('display','block');if(data.substr(0,4)!="<div")
{$("#errormsg").css('display','block').html(data);}else{$("#errormsg").css('display','block').text("Ik kan je account niet aanmaken.");}
$("#box_loading").css('display','none');$("#box_confirmed").css('display','none');}});}
function resendactivation()
{$("#errormsg").css('display','none');$("#resendactivationbox").css('display','none');$("#box_loading").css('display','block');$.post("/user/resendactivation/",{username:$('#username').val(),rand:Math.random()},function(data)
{if(data.substr(0,3)=="OK!")
{$("#box_confirmed").css('display','block');$("#box_loading").css('display','none');$("#errormsg").css('display','none');}
else
{$("#resendactivationbox").css('display','block');$("#username").val('').focus();if(data.substr(0,4)!="<div")
{$("#errormsg").css('display','block').html(data);}else{$("#errormsg").css('display','block').text("Kan je account niet vinden.");}
$("#box_loading").css('display','none');$("#box_confirmed").css('display','none');}});}
function set_light(donker)
{if(donker)
{document.getElementById('background').className='GODARK';document.getElementById('lightbulb').src=window.ImgURL+'/g/if/icons_png/lightbulb_off.png';document.getElementById('lightbulb').alt='Lichten aan!';setCookie('dark',"DONKER",1249255901);}else{document.getElementById('background').className='';document.getElementById('lightbulb').src=window.ImgURL+'/g/if/icons_png/lightbulb.png';document.getElementById('lightbulb').alt='Lichten uit!';setCookie('dark',"LICHT",1249255901);}}
function fb(url){jQuery.facebox({ajax:url})}
var new_window=false;function open_content(id_field)
{if(new_window)
{new_window.close();}
data=document.getElementById(id_field).innerHTML;new_window=window.open('','code_window','location=no,menubar=no,resizable=yes,scrollbars=yes,status=0,toolbar=no');new_window.document.write('<html><head><title>Code weergave</title></head><body><nobr>'+data+'</nobr></body></html>');}
function timeDiff(starttime){return((new Date().getTime()-starttime)/1000).toString().replace('.',',')}
function checkAllSessions()
{var form=document.getElementById('sessionForm');if(form)
{for(var i=0,l=form.elements.length;i<l;i++)
{if(form.elements[i].type.toLowerCase()=='checkbox')
form.elements[i].checked=true;}}}
function clearText(thefield){if(thefield.defaultValue==thefield.value)
thefield.value=""}
function openfacebox(url)
{jQuery.facebox({iframe:url});}
function openSubReplies(id)
{openfacebox("/modalbox/subreplies/"+id+"/");}
function addSubNL(id)
{openfacebox("/modalbox/add_episode_sub/"+id+"/nl/");}
function addSubEN(id)
{openfacebox("/modalbox/add_episode_sub/"+id+"/en/");}
function editSub(id)
{openfacebox("/modalbox/editsub/"+id+"/");}
function delSub(id)
{openfacebox("/modalbox/delsub/"+id+"/");}
function closeFB()
{jQuery(document).trigger('close.facebox');$("#opaque").hide();}
function AddToField(fieldid,value)
{$("#"+fieldid).val($("#"+fieldid).val()+" "+value);return false;}