function Ajax(){this.url="";this.params="";this.method="GET";this.onSuccess=null;this.onError=function(msg){alert(msg)}}
removingElement=0;Ajax.prototype.doRequest=function(){if(!this.url){this.onError("There was no URL given. The request will be canceled.");return false;}
if(!this.method){this.method="GET";}else{this.method=this.method.toUpperCase();}
var _this=this;var xmlHttpRequest=getXMLHttpRequest();if(!xmlHttpRequest){alert("I couldn't create a XMLHttpRequest-Object.");return false;}
switch(this.method){case"GET":xmlHttpRequest.open(this.method,this.url+"?"+this.params,true);xmlHttpRequest.onreadystatechange=readyStateHandler;xmlHttpRequest.send(null);break;case"POST":xmlHttpRequest.open(this.method,this.url,true);xmlHttpRequest.onreadystatechange=readyStateHandler;xmlHttpRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlHttpRequest.send(this.params);break;}
function readyStateHandler(){if(xmlHttpRequest.readyState<4){return false;}
if(xmlHttpRequest.status==200||xmlHttpRequest.status==304){if(_this.onSuccess){_this.onSuccess(xmlHttpRequest.responseText,xmlHttpRequest.responseXML);}}else{if(_this.onError){_this.onError("["+xmlHttpRequest.status+" "+xmlHttpRequest.statusText+"] There was an error with the data transfer. Please try again in a few minutes.");}}}}
function getXMLHttpRequest()
{if(window.XMLHttpRequest){return new XMLHttpRequest();}else
if(window.ActiveXObject){try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){return null;}}}
return false;}
function switch_show(){if(document.getElementById('show_text').innerHTML=="Show"){document.getElementById('show_text').innerHTML="Hide";}else{document.getElementById('show_text').innerHTML="Show";}}
function addDropDown(){document.getElementById('dropdown').innerHTML="<div class='loading'>  Loading ...</div>";with(new Ajax()){url="http://next-episode.net/PAGES/misc/dropdown.inc.php";params="a=1";onSuccess=addD;doRequest();}}
function addDropBabes(cnt){document.getElementById('previousBabes').innerHTML="<div class='previousBabesDivLoading'>-- Previous Babes of the Day --  » sec</div>";with(new Ajax()){url="http://next-episode.net/dropdown_babes.inc.php";params="count="+cnt;onSuccess=addB;doRequest();}}
function addD(txt,xml){document.getElementById('drTD').style.padding="0";document.getElementById('searchf').style.width="100px";document.getElementById('dropdown').innerHTML=txt;}
function addB(txt,xml){document.getElementById('previousBabes').innerHTML=txt;}
function subCombos(val1){nn=val1.options[val1.selectedIndex].text;nn=nn.replace(",","");nn=nn.replace("\+","plus");nn=nn.replace("&"," and ");nn=nn.replace("'","");nn=nn.replace("\("," ");nn=nn.replace("\)","");nn=nn.replace(":"," ");nn=nn.replace("  "," ");nn=nn.replace(" ","-");nn=nn.replace(" ","-");nn=nn.replace("--","-");nn=nn.replace("?","");nn=nn.replace(" ","-");nn=nn.replace("--","-");nn=nn.replace(" ","-");nn=nn.replace(" ","-");nn=nn.replace(" ","-");nn=nn.replace("/","-");nn=nn.replace("--","-");window.location.href="http://next-episode.net/"+nn.toLowerCase();return false;}
function goSearch2(str){window.location.href="http://next-episode.net/site-search-"+escape(urlencode(str.value))+".html";return false;}
function toggleLayer(whichLayer)
{if(document.getElementById)
{var style2=document.getElementById(whichLayer).style;style2.display=style2.display?"":"none";}
else if(document.all)
{var style2=document.all[whichLayer].style;style2.display=style2.display?"":"none";}
else if(document.layers)
{var style2=document.layers[whichLayer].style;style2.display=style2.display?"":"none";}}
function goArchive(str){if(str.value!=0){window.location.href="http://next-episode.net/news-date-"+str.value+".html";}}
function goSearch(str){if(str.value!=0){window.location.href="http://next-episode.net/news-search-"+str.value+".html";}
return false;}
loadingElement=0;function getSummary(id,url2,oldContent){if(document.getElementById("v"+id).value!=""){document.getElementById(id).innerHTML=document.getElementById("v"+id).value;document.getElementById("v"+id).value="";return;}
if(loadingElement!=1){loadingElement=1;toReplaceID=id;toReplaceOriginal=document.getElementById(toReplaceID).innerHTML;document.getElementById(toReplaceID).innerHTML=document.getElementById(toReplaceID).innerHTML+'<br><br>'+"Loading...";with(new Ajax()){url="http://next-episode.net/admin/episode_overview.php";params="url="+url2;onSuccess=displaySummary;doRequest();}}}
function displaySummary(txt,xml){document.getElementById(toReplaceID).innerHTML='<b>'+toReplaceOriginal+'</b>'+'<br><br>'+txt+'<br><br>';document.getElementById("v"+toReplaceID).value=toReplaceOriginal;loadingElement=0;}
function getSummary2(id,url2){if(loadingElement!=1){loadingElement=1;toReplaceID=id;document.getElementById(toReplaceID).innerHTML="Loading...";with(new Ajax()){url="http://next-episode.net/admin/episode_overview.php";params="url="+url2;onSuccess=displaySummary2;doRequest();}}}
function displaySummary2(txt,xml){document.getElementById(toReplaceID).innerHTML=txt;loadingElement=0;}
function getComments(user,kk){if(document.getElementById('commentsDiv').innerHTML!=""){toggleLayer('commentsDiv');return;}
with(new Ajax()){url="http://next-episode.net/PAGES/inc/news_ajax/getComments.php";params="u="+user+"&kk="+kk;onSuccess=printComments;doRequest();}}
function printComments(txt,xml){document.getElementById('commentsDiv').innerHTML=txt;}
function urlencode(str) {return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');}