var rememberpannelmovies=new Array();
var rememberpannelon_hold=new Array();
var rememberpannelseason=new Array();
var rememberpannelepisode=new Array();
var rememberpannelpage=new Array();

var renkid=new Array();
var positive_renkid=new Array();


var lockdownlinkloading = 0;
var remembercommand = '';

var global_viewers_u = 0;
var global_ismod = 0;
var countries = 0;
function sholinkuss(moviez, div, on_hold, season, episode, page, viewers_u, ismod)
{
    if(flash_help_ready == 1)
    {
        if(lockdownlinkloading == 0)
        {
            global_viewers_u = viewers_u;
            global_ismod = ismod;
            var pagination_id = 'pagination_' + div;
            if(document.getElementById(pagination_id))
            {
                document.getElementById(pagination_id).innerHTML='loading...';
            }
            var pagination2_id = 'pagination2_' + div;
            if(document.getElementById(pagination2_id))
            {
                document.getElementById(pagination2_id).innerHTML='loading...';
            }
            rememberpannelmovies[div]=moviez;
            rememberpannelon_hold[div]=on_hold;
            rememberpannelseason[div]=season;
            rememberpannelepisode[div]=episode;
            rememberpannelpage[div]=page;
            var urlz = "xmllinkus?movie=" + moviez + "&div=" + div + "&on_hold=" + on_hold + "&season=" + season + "&episode=" + episode + "&page=" + page + "&sel=" + sel + "&pp=" + howmanylinksperpage + "&ms=" + thismovieorserie;
            loadXMLDoc235g5(urlz);
            lockdownlinkloading = 1;
            var t=setTimeout("unlocklinkloading()",1500);
        }
        else
        {
            remembercommand = 'sholinkuss(' + moviez + ', "' + div + '", "' + on_hold + '", ' + season + ', ' + episode + ', ' + page + ', ' + viewers_u + ', ' + ismod + ')';
        //alert(remembercommand);
        }
    }
    else
    {
        var execker = 'sholinkuss(' + moviez + ', "' + div + '", "' + on_hold + '", ' + season + ', ' + episode + ', ' + page + ', ' + viewers_u + ', ' + ismod + ')';
        var t=setTimeout(execker,100);
        countries++;
        if(countries == 200)
        {
            alert("problem loading links, make sure that your browser supports the latest version of flash");
        }
    }
}

function unlocklinkloading()
{
    lockdownlinkloading = 0;
    if(remembercommand != '')
    {
        eval(remembercommand);
        remembercommand = '';
    }
}


function close_panel(id)
{
    delete rememberpannelmovies[id];
    delete rememberpannelon_hold[id];
    delete rememberpannelseason[id];
    delete rememberpannelepisode[id];
    delete rememberpannelpage[id];
    document.getElementById(id).innerHTML='';
}


var req235g5;
function loadXMLDoc235g5(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req235g5 = new XMLHttpRequest();
        req235g5.onreadystatechange = processReqChange235g5;
        req235g5.open("GET", url, true);
        req235g5.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req235g5 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req235g5)
        {
            req235g5.onreadystatechange = processReqChange235g5;
            req235g5.open("GET", url, true);
            req235g5.send();
        }
    }
}

var rememberlinksarray=new Array();
var rememberlinknamesarray=new Array();
var rememberbannerurlsarray=new Array();
var rememberepisodesarray=new Array();
var rememberseasonsarray=new Array();

var clicksuisarray=new Array();


function processReqChange235g5() 
{
    if (req235g5.readyState == 4)
    {
        if (req235g5.status == 200)
        {
            response = req235g5.responseXML.documentElement;
            var totallinks = response.getElementsByTagName("totallinks")[0].firstChild.data;
            var thismovieidzzz = response.getElementsByTagName("thismovieid")[0].firstChild.data;
            var divname = response.getElementsByTagName("div")[0].firstChild.data;
            var theviewersUzzz = global_viewers_u;
            var ismod = global_ismod;
            var thispage = Math.abs(response.getElementsByTagName("thispage")[0].firstChild.data);
            var totalpages = Math.abs(response.getElementsByTagName("totalpages")[0].firstChild.data);
            var on_hold = response.getElementsByTagName("on_hold")[0].firstChild.data;
            var season = response.getElementsByTagName("season")[0].firstChild.data;
            var episode = response.getElementsByTagName("episode")[0].firstChild.data;
            var counttheselinks = 0;
            var thisdiv = document.getElementById(divname);
            if(totalpages>1)
            {
                //previous page button
                if(thispage>1)
                {
                    var previouspage = thispage - 1;
                    var previouspagebutton = '<a onclick="sholinkuss(' + thismovieidzzz + ', ' + "'" + divname + "'" + ', ' + "'" + on_hold + "'" + ', ' + season + ', ' + episode + ', ' + previouspage + ', ' + global_viewers_u + ', ' + global_ismod + ')" style="cursor:pointer;">previous page</a> | ';
                }
                else
                {
                    var previouspagebutton = '';
                }
                //first page button
                if(thispage>2)
                {
                    var firstpage = 1;
                    var firstpagebutton = '<a onclick="sholinkuss(' + thismovieidzzz + ', ' + "'" + divname + "'" + ', ' + "'" + on_hold + "'" + ', ' + season + ', ' + episode + ', ' + firstpage + ', ' + global_viewers_u + ', ' + global_ismod + ')" style="cursor:pointer;">first page</a> | ';
                }
                else
                {
                    var firstpagebutton = '';
                }
                //next page button
                if(thispage<totalpages)
                {
                    var nextpage = thispage + 1;
                    var nextpagebutton = ' | <a onclick="sholinkuss(' + thismovieidzzz + ', ' + "'" + divname + "'" + ', ' + "'" + on_hold + "'" + ', ' + season + ', ' + episode + ', ' + nextpage + ', ' + global_viewers_u + ', ' + global_ismod + ')" style="cursor:pointer;">next page</a>';
                }
                else
                {
                    var nextpagebutton = '';
                }
                //last page button
                if(thispage<(totalpages-1))
                {
                    var lastpage = totalpages;
                    var lastpagebutton = ' | <a onclick="sholinkuss(' + thismovieidzzz + ', ' + "'" + divname + "'" + ', ' + "'" + on_hold + "'" + ', ' + season + ', ' + episode + ', ' + lastpage + ', ' + global_viewers_u + ', ' + global_ismod + ')" style="cursor:pointer;">last page</a>';
                }
                else
                {
                    var lastpagebutton = '';
                }
                var pagination = '<div id="pagination_' + divname + '" class="effect">' + firstpagebutton + previouspagebutton + 'page ' + thispage + ' of ' + totalpages + nextpagebutton + lastpagebutton + '</div>';
                var pagination2 = '<div id="pagination2_' + divname + '" class="effect">' + firstpagebutton + previouspagebutton + 'page ' + thispage + ' of ' + totalpages + nextpagebutton + lastpagebutton + '</div>';
            }
            else
            {
                var pagination = '';
                var pagination2 = '';
            }
            thisdiv.innerHTML = pagination;
            while(counttheselinks < totallinks)
            {
                counttheselinks++;
                thislinknamus = "link-" + counttheselinks;
                thislink = Base64.decode(rabbajouvence(response.getElementsByTagName(thislinknamus)[0].firstChild.data,sel));
                thisbannerURLname = "bannerURL-" + counttheselinks;
                thisbannerURL = response.getElementsByTagName(thisbannerURLname)[0].firstChild.data;
                thislinknamename = "linkname-" + counttheselinks;
                thislinkname = response.getElementsByTagName(thislinknamename)[0].firstChild.data;
                thistimename = "time-" + counttheselinks;
                thistime = response.getElementsByTagName(thistimename)[0].firstChild.data;
                thispublicnamename = "publicname-" + counttheselinks;
                thispublicname = response.getElementsByTagName(thispublicnamename)[0].firstChild.data;
                thisuserIDname = "userID-" + counttheselinks;
                thisuserID = response.getElementsByTagName(thisuserIDname)[0].firstChild.data;
                thisuser_linkIDname = "user_linkID-" + counttheselinks;
                thisuser_linkID = Base64.decode(rabbajouvence(response.getElementsByTagName(thisuser_linkIDname)[0].firstChild.data,sel));
                tupname = "tup-" + counttheselinks;
                tup = response.getElementsByTagName(tupname)[0].firstChild.data;
                tdoname = "tdo-" + counttheselinks;
                tdo = response.getElementsByTagName(tdoname)[0].firstChild.data;
                thismypagecolorname = "mypagecolor-" + counttheselinks;
                mypagecolor = response.getElementsByTagName(thismypagecolorname)[0].firstChild.data;
                thismypagecolor2name = "mypagecolor2-" + counttheselinks;
                mypagecolor2 = response.getElementsByTagName(thismypagecolor2name)[0].firstChild.data;
                thisframecolorname = "framecolor-" + counttheselinks;
                framecolor = response.getElementsByTagName(thisframecolorname)[0].firstChild.data;
                thistextcolor1name = "textcolor1-" + counttheselinks;
                textcolor1 = response.getElementsByTagName(thistextcolor1name)[0].firstChild.data;
                thistextcolor2name = "textcolor2-" + counttheselinks;
                textcolor2 = response.getElementsByTagName(thistextcolor2name)[0].firstChild.data;
                thistextcolor3name = "textcolor3-" + counttheselinks;
                textcolor3 = response.getElementsByTagName(thistextcolor3name)[0].firstChild.data;
                thisclicksname = "clicks-" + counttheselinks;
                thisclicks = response.getElementsByTagName(thisclicksname)[0].firstChild.data;
                //fill raw info arrays
                rememberlinksarray[thisuser_linkID] = html_entity_decode(thislink);
                rememberlinknamesarray[thisuser_linkID] = html_entity_decode(thislinkname);
                rememberbannerurlsarray[thisuser_linkID] = html_entity_decode(thisbannerURL);
                rememberepisodesarray[thisuser_linkID] = episode;
                rememberseasonsarray[thisuser_linkID] = season;
                renkid[thisuser_linkID] = divname;
                if(season == 0 && episode == 0)
                {
                    positive_renkid[thisuser_linkID] = 'links';
                }
                else
                {
                    positive_renkid[thisuser_linkID] = 'links_' + season + '_' + episode;
                }
                clicksuisarray[thisuser_linkID] = thisclicks;
                //thumbs up button
                var explanation = "give a positive note to this link";
                var thumbsupbutton = "<span style='color:#00FF00;font-size:130%;font-weight:bold;' id='tup" + thisuser_linkID + "'><acronym title='" + explanation + "'><img style='cursor:pointer;' src='common_files/pics/thumbsup2.gif' alt='+' onmouseover='onbutton(" + '"tup' + counttheselinks + '", "common_files/pics/thumbsup1.gif"' + ");explain(" + '"' + explanation + '"' + ")' onmouseout='onbutton(" + '"tup' + counttheselinks + '", "common_files/pics/thumbsup2.gif"' + ");clearlegendmessage()' id='tup" + counttheselinks + "' onclick='thumb(" + thisuser_linkID + ',"up",' + theviewersUzzz + ")' /></acronym>" + tup + "</span>";
                explanation = "give a negative note to this link";
                //thumbs down button
                var thumbsdownbutton = "<span style='color:#FF0000;font-size:130%;font-weight:bold;' id='tdo" + thisuser_linkID + "'><acronym title='" + explanation + "'><img style='cursor:pointer;' src='common_files/pics/thumbsdown2.gif' alt='-' onmouseover='onbutton(" + '"tdo' + counttheselinks + '", "common_files/pics/thumbsdown1.gif"' + ");explain(" + '"' + explanation + '"' + ")' onmouseout='onbutton(" + '"tdo' + counttheselinks + '", "common_files/pics/thumbsdown2.gif"' + ");clearlegendmessage()' id='tdo" + counttheselinks + "' onclick='thumb(" + thisuser_linkID + ',"down",' + theviewersUzzz + ")' /></acronym>" + tdo + "</span>";
                explanation = "report a problem with this link";
                //report button
                var reportbutton = "<acronym title='" + explanation + "'><img style='cursor:pointer;' src='common_files/pics/error.gif' alt='!' onmouseover='onbutton(" + '"report' + counttheselinks + '", "common_files/pics/error2.gif"' + ");explain(" + '"' + explanation + '"' + ")' onmouseout='onbutton(" + '"report' + counttheselinks + '", "common_files/pics/error.gif"' + ");clearlegendmessage()' id='report" + counttheselinks + "' onclick='report_not_working(1," + thisuser_linkID + "," + thismovieidzzz + ")' /></acronym>";
                //erase button
                if(thisuserID == theviewersUzzz || theviewersUzzz == 25)
                {
                    explanation = "erase this link";
                    var thiserasebutton = "<acronym title='" + explanation + "'><img style='cursor:pointer;' src='common_files/pics/remove1.gif' alt='x' onmouseover='onbutton(" + '"drop' + counttheselinks + '", "common_files/pics/remove2.gif"' + ");explain(" + '"' + explanation + '"' + ")' onmouseout='onbutton(" + '"drop' + counttheselinks + '", "common_files/pics/remove1.gif"' + ");clearlegendmessage()' id='drop" + counttheselinks + "' onclick='new_droplink_func(" + thisuser_linkID + ")' /></acronym>";
                }
                else
                {
                    var thiserasebutton = "";
                }
                //hold button!!
                if(ismod == '1' || thisuserID == theviewersUzzz)
                {
                    if(on_hold=='yes')
                    {
                        explanation = "remove this link from hold";
                        var holdaction = 'dehold';
                    }
                    else if(on_hold=='no')
                    {
                        explanation = "put this link on hold";
                        var holdaction = 'hold';
                    }
                    var holdbutton = "<acronym title='" + explanation + "'><img style='cursor:pointer;' src='common_files/pics/hold1.gif' alt='h' onmouseover='onbutton(" + '"hold' + counttheselinks + '", "common_files/pics/hold2.gif"' + ");explain(" + '"' + explanation + '"' + ")' onmouseout='onbutton(" + '"hold' + counttheselinks + '", "common_files/pics/hold1.gif"' + ");clearlegendmessage()' id='hold" + counttheselinks + "' onclick='new_holdlink_func(" + thisuser_linkID + ", " + '"' + holdaction + '", "' + escape(thislink) + '", "' + escape(thislinkname) +  '", "' + escape(thisuserID) + '", "' + escape(thispublicname) + '"' + ")' /></acronym>";
                }
                else
                {
                    var holdbutton = "";
                }
                //rename button
                if(thisuserID == theviewersUzzz || ismod == '1')
                {
                    explanation = "click this button to open and close the edit link panel";
                    var renamebutton = " <acronym title='" + explanation + "'>(<a style='cursor:pointer;font-size:90%;font-weight:bold;' onmouseover='explain(" + '"' + explanation + '"' + ")' onmouseout='clearlegendmessage()' onclick='new_rename_func(" + thisuser_linkID + ")' />e</a>)</acronym>";
                }
                else
                {
                    var renamebutton = "";
                }
                //posters link
                if(thisuserID == 25)
                {
                    var posterslink = "";
                    var separator = "";
                }
                else
                {
                    explanation = 'link to poster&#39;s page';
                    var posterslink = "<a href='http://backstage." + myhappydomain + "/userpage?u=" + thisuserID + "' style='color:" + textcolor2 + ";' onmouseover='hovercolor(" + '"' + textcolor3 + '", "posterslink' + thisuser_linkID + '"' + ");explain(" + '"' + explanation + '"' + ")' onmouseout='hovercolor(" + '"' + textcolor2 + '", "posterslink' + thisuser_linkID + '"' + ");clearlegendmessage()' id='posterslink" + thisuser_linkID + "'>" + thispublicname + "</a>";
                    var separator = " - ";
                }
                //time
                if (thistime == 0)
                {
                    var displayabletime = "";
                }
                else
                {
                    var displayabletime = separator + "<span style='font-size:80%;'>" + (maketimus(thistime)) + "</span>";
                }
                //link name
                var thislinknamedisplayed = make_a_nice_linkname(thislinkname);
                //link (URL)
                var gothrougher = '';
                if(thismovieorserie!=0 && thismovieorserie!=1)
                {
                    gothrougher = '&go=yes';
                }
                else if((ismod == '1' && theviewersUzzz != 25) || thisuserID == theviewersUzzz)
                {
                    gothrougher = '&go=yesmam';
                }
                else if(theviewersUzzz != 0 && theviewersUzzz != 25)
                {
                    gothrougher = '&go=yesman';
                }
                explanation = 'link to content';
                var thisplaybuttonID = 'play' + thisuser_linkID;
                var linkURL = "http://anolink.com/linker?li=" + thisuser_linkID + gothrougher + "& link: " + thislink;
                var thislinkdisplayed = "<a href='" + linkURL + "' target='_blank' onmouseover='onbutton(" + '"' + thisplaybuttonID + '", "common_files/pics/play2.gif"' + ");hovercolor(" + '"' + textcolor3 + '", "linkz' + thisuser_linkID + '"' + ");explain(" + '"' + explanation + '"' + ")' onmouseout='onbutton(" + '"' + thisplaybuttonID + '", "common_files/pics/play1.gif"' + ");hovercolor(" + '"' + textcolor2 + '", "linkz' + thisuser_linkID + '"' + ");clearlegendmessage()' onclick='new_inc_clicks_func(" + thisuser_linkID + ")' style='color:" + textcolor2 + ";' id='linkz" + thisuser_linkID + "'>" + make_a_nice_link(thislink, thisplaybuttonID) + "</a> <acronym title='visited'><a href='" + linkURL + "' id='hasclicked_" + thisuser_linkID + "' class='visited_rememberer' style='color:" + textcolor1 + ";' target='_blank'><img src='common_files/pics/crazy_eye.gif' style='vertical-align:text-bottom' /></a></acronym>";
                //put it all togheter
                linehprct = 94;
                if(thisclicks==1)
                {
                    var elclicksS = '';
                }
                else
                {
                    var elclicksS = 's';
                }

                //var downloadbuttonpicid = "download_" + thisuser_linkID;
                //explanation = 'download';
                //var dowloadbutton = "<acronym title='download'><a href='gtgr' onmouseover='onbutton(" + '"' + downloadbuttonpicid + '"' + ", " + '"common_files/pics/download2.gif"' + ");explain(" + '"' + explanation + '"' + ")' onmouseout='onbutton(" + '"' + downloadbuttonpicid + '"' + ", " + '"common_files/pics/download1.gif"' + ");clearlegendmessage()'><img src='common_files/pics/download1.gif' id='" + downloadbuttonpicid + "' /></a></acronym>";
                var dowloadbutton = "";

                var myhappylink = "<div id='loader" + thisuser_linkID + "' style='width:100%;'><table style='width:100%;background-color:" + framecolor + ";color:" + textcolor1 + ";line-height:" + linehprct + "%;font-size:80%;'><tr><td style='width:86%;background-color:" + mypagecolor + ";line-height:" + linehprct + "%;'><span id='linkname_" + thisuser_linkID + "' style='font-weight:bold;color:" + textcolor1 + ";'>" + thislinknamedisplayed + "</span> " + posterslink + displayabletime + " <span style='font-size:80%;'>(<span id='clicks" + thisuser_linkID + "'>clicked " + thisclicks + " time" + elclicksS + "</span>)</span></td><td style='width:6%;background-color:#000000;line-height:" + linehprct + "%;text-align:center;'>" + thumbsupbutton + "</td><td style='width:4%;background-color:#000000;line-height:" + linehprct + "%;text-align:center;'>" + dowloadbutton + "</td><td style='width:4%;background-color:#000000;line-height:" + linehprct + "%;text-align:center;'>" + holdbutton + "</td></tr><tr><td style='width:86%;background-color:" + mypagecolor2 + ";line-height:" + linehprct + "%;'>" + thislinkdisplayed + " " + renamebutton + "</td><td style='width:6%;background-color:#000000;line-height:" + linehprct + "%;text-align:center;'>" + thumbsdownbutton + "</td><td style='width:4%;background-color:#000000;line-height:" + linehprct + "%;text-align:center;'>" + reportbutton + "</td><td style='width:4%;background-color:#000000;line-height:" + linehprct + "%;text-align:center;'>" + thiserasebutton + "</td></tr></table><div id='renamer" + thisuser_linkID + "'></div></div>";
                //output shit
                thisdiv.innerHTML = thisdiv.innerHTML + myhappylink;
            }
            thisdiv.innerHTML = thisdiv.innerHTML + pagination2;
            if(totallinks==0)
            {
                thisdiv.innerHTML = '<div style="width:100%;text-align:center;" class="effect">empty</div>';
            }
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req235g5.statusText);
        }
    }
}




function html_entity_decode(str) {
    var ta = document.createElement("textarea");
    ta.innerHTML=str.replace(/</g,"&lt;").replace(/>/g,"&gt;");
    toReturn = ta.value;
    ta = null;
    return toReturn
}



function make_a_nice_link(thislink, thisplaybuttonID)
{
    var thisfulllink = thislink;
    thislink = html_entity_decode(thislink);
    var acronymit = 0;
    var playicon = "<img src='common_files/pics/play1.gif' id='" + thisplaybuttonID + "' />";
    var maxlenghtiwantforthelink = 300;
    var lenghtofchoppedlink = maxlenghtiwantforthelink - 6;
    var lenghtoflink = thislink.length;
    if(lenghtoflink>maxlenghtiwantforthelink)
    {
        thislink = thislink.substring(0,lenghtofchoppedlink) + "..........";
        acronymit = 1;
    }
    var displayablelink = wordwrap(thislink, 1, '<span style="font-size:1px;"> </span>', true);
    if(acronymit == 1)
    {
        displayablelink = "<acronym title='" + thisfulllink + "'>" + displayablelink + "</acronym>";
    }
    var thislinkdisplayed = playicon + "&#160;" + displayablelink;
    return thislinkdisplayed;
}
function make_a_nice_linkname(thislinkname)
{
    var desired_word_length = 24;
    var linknamearray = thislinkname.split(" ");
    var xu;
    for (xu in linknamearray)
    {
        if(linknamearray[xu].length > desired_word_length)
        {
            linknamearray[xu] = "<acronym title='" + linknamearray[xu] + "'>" + linknamearray[xu].substr(0,desired_word_length) + "...</acronym>";
        }
    }
    thislinkname = linknamearray.join(" ");
    return thislinkname;
}


function new_rename_func(user_linkID)
{
    var renamerdivname = "renamer" + user_linkID;
    if(document.getElementById(renamerdivname).innerHTML == '')
    {
        var thislinknameraw = rememberlinknamesarray[user_linkID];
        var thislinkraw = rememberlinksarray[user_linkID];
        var thisbannerURLraw = rememberbannerurlsarray[user_linkID];
        var thisseason = rememberseasonsarray[user_linkID];
        var thisepisode = rememberepisodesarray[user_linkID];
        var renamemenu = "<div style='width:100%;background-color:#222222;'><table style='width:100%;background-color:#777777;'><tr><td>link name:</td><td><input type='text' id='newname" + user_linkID + "' value='" + htmlspecialchars(thislinknameraw) + "' style='width:450px;' /></td></tr><tr><td>link URL:</td><td><input type='text' id='newurl" + user_linkID + "' value='" + htmlspecialchars(thislinkraw) + "' style='width:450px;' /></td></tr><tr><td>banner URL (<a href='bannerURLhelp' target='_blank'>?</a>):</td><td><input type='text' id='newbanner" + user_linkID + "' value='" + htmlspecialchars(thisbannerURLraw) + "' style='width:450px;' /></td></tr><tr><td>&#160;</td><td>season:<input type='text' value='" + htmlspecialchars(thisseason) + "' id='newseason" + user_linkID + "' style='width:30px;' /> episode:<input type='text' value='" + htmlspecialchars(thisepisode) + "' id='newepisode" + user_linkID + "' style='width:30px;' />&#160;&#160;&#160;&#160;&#160;<input type='submit' value='update' onclick='new_renamelink_func(" + user_linkID + ")' /></td></tr></table></div>";
    }
    else
    {
        var renamemenu = "";
    }
    document.getElementById(renamerdivname).innerHTML = renamemenu;
}




function htmlspecialchars (string, quote_style) {
    // http://kevin.vanzonneveld.net
    // +   original by: Mirek Slugen
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Nathan
    // +   bugfixed by: Arno
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Ratheous
    // -    depends on: get_html_translation_table
    // *     example 1: htmlspecialchars("<a href='test'>Test</a>", 'ENT_QUOTES');
    // *     returns 1: '&lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;'
 
    var hash_map = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();
    
    if (false === (hash_map = this.get_html_translation_table('HTML_SPECIALCHARS', quote_style))) {
        return false;
    }
    
    hash_map["'"] = '&#039;';
    for (symbol in hash_map) {
        entity = hash_map[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
    
    return tmp_str;
}


function get_html_translation_table (table, quote_style) {
    // Returns the internal translation table used by htmlspecialchars and htmlentities 
    //
    // version: 908.406
    // discuss at: http://phpjs.org/functions/get_html_translation_table
    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: noname
    // +   bugfixed by: Alex
    // +   bugfixed by: Marco
    // +   bugfixed by: madipta
    // +   improved by: KELAN
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Frank Forte
    // +   bugfixed by: T.Wild
    // +      input by: Ratheous
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js, meaning the constants are not
    // %          note: real constants, but strings instead. Integers are also supported if someone
    // %          note: chooses to create the constants themselves.
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
     
    var entities = {}, hash_map = {}, decimal = 0, symbol = '';
    var constMappingTable = {}, constMappingQuoteStyle = {};
    var useTable = {}, useQuoteStyle = {};
     
    // Translate arguments
    constMappingTable[0]      = 'HTML_SPECIALCHARS';
    constMappingTable[1]      = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';
 
    useTable       = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
    useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT';
 
    if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
        throw new Error("Table: "+useTable+' not supported');
    // return false;
    }
 
    entities['38'] = '&amp;';
    if (useTable === 'HTML_ENTITIES') {
        entities['160'] = '&nbsp;';
        entities['161'] = '&iexcl;';
        entities['162'] = '&cent;';
        entities['163'] = '&pound;';
        entities['164'] = '&curren;';
        entities['165'] = '&yen;';
        entities['166'] = '&brvbar;';
        entities['167'] = '&sect;';
        entities['168'] = '&uml;';
        entities['169'] = '&copy;';
        entities['170'] = '&ordf;';
        entities['171'] = '&laquo;';
        entities['172'] = '&not;';
        entities['173'] = '&shy;';
        entities['174'] = '&reg;';
        entities['175'] = '&macr;';
        entities['176'] = '&deg;';
        entities['177'] = '&plusmn;';
        entities['178'] = '&sup2;';
        entities['179'] = '&sup3;';
        entities['180'] = '&acute;';
        entities['181'] = '&micro;';
        entities['182'] = '&para;';
        entities['183'] = '&middot;';
        entities['184'] = '&cedil;';
        entities['185'] = '&sup1;';
        entities['186'] = '&ordm;';
        entities['187'] = '&raquo;';
        entities['188'] = '&frac14;';
        entities['189'] = '&frac12;';
        entities['190'] = '&frac34;';
        entities['191'] = '&iquest;';
        entities['192'] = '&Agrave;';
        entities['193'] = '&Aacute;';
        entities['194'] = '&Acirc;';
        entities['195'] = '&Atilde;';
        entities['196'] = '&Auml;';
        entities['197'] = '&Aring;';
        entities['198'] = '&AElig;';
        entities['199'] = '&Ccedil;';
        entities['200'] = '&Egrave;';
        entities['201'] = '&Eacute;';
        entities['202'] = '&Ecirc;';
        entities['203'] = '&Euml;';
        entities['204'] = '&Igrave;';
        entities['205'] = '&Iacute;';
        entities['206'] = '&Icirc;';
        entities['207'] = '&Iuml;';
        entities['208'] = '&ETH;';
        entities['209'] = '&Ntilde;';
        entities['210'] = '&Ograve;';
        entities['211'] = '&Oacute;';
        entities['212'] = '&Ocirc;';
        entities['213'] = '&Otilde;';
        entities['214'] = '&Ouml;';
        entities['215'] = '&times;';
        entities['216'] = '&Oslash;';
        entities['217'] = '&Ugrave;';
        entities['218'] = '&Uacute;';
        entities['219'] = '&Ucirc;';
        entities['220'] = '&Uuml;';
        entities['221'] = '&Yacute;';
        entities['222'] = '&THORN;';
        entities['223'] = '&szlig;';
        entities['224'] = '&agrave;';
        entities['225'] = '&aacute;';
        entities['226'] = '&acirc;';
        entities['227'] = '&atilde;';
        entities['228'] = '&auml;';
        entities['229'] = '&aring;';
        entities['230'] = '&aelig;';
        entities['231'] = '&ccedil;';
        entities['232'] = '&egrave;';
        entities['233'] = '&eacute;';
        entities['234'] = '&ecirc;';
        entities['235'] = '&euml;';
        entities['236'] = '&igrave;';
        entities['237'] = '&iacute;';
        entities['238'] = '&icirc;';
        entities['239'] = '&iuml;';
        entities['240'] = '&eth;';
        entities['241'] = '&ntilde;';
        entities['242'] = '&ograve;';
        entities['243'] = '&oacute;';
        entities['244'] = '&ocirc;';
        entities['245'] = '&otilde;';
        entities['246'] = '&ouml;';
        entities['247'] = '&divide;';
        entities['248'] = '&oslash;';
        entities['249'] = '&ugrave;';
        entities['250'] = '&uacute;';
        entities['251'] = '&ucirc;';
        entities['252'] = '&uuml;';
        entities['253'] = '&yacute;';
        entities['254'] = '&thorn;';
        entities['255'] = '&yuml;';
    }
 
    if (useQuoteStyle !== 'ENT_NOQUOTES') {
        entities['34'] = '&quot;';
    }
    if (useQuoteStyle === 'ENT_QUOTES') {
        entities['39'] = '&#39;';
    }
    entities['60'] = '&lt;';
    entities['62'] = '&gt;';
 
 
    // ascii decimals to real symbols
    for (decimal in entities) {
        symbol = String.fromCharCode(decimal);
        hash_map[symbol] = entities[decimal];
    }
     
    return hash_map;
}




function new_renamelink_func(li)
{
    theboxid = "newname" + li;
    newurlboxid = "newurl" + li;
    newbannerboxid = "newbanner" + li;
    seasonboxid = "newseason" + li;
    episodeboxid = "newepisode" + li;
    newlinkname = document.getElementById(theboxid).value;
    newlink = document.getElementById(newurlboxid).value;
    newbanner = document.getElementById(newbannerboxid).value;
    newseason = document.getElementById(seasonboxid).value;
    newepisode = document.getElementById(episodeboxid).value;
    var url = "xmlrenamelink?li=" + li + "&newname=" + (encodeURIComponent(newlinkname)) + "&newurl=" + (encodeURIComponent(newlink)) + "&season=" + (encodeURIComponent(newseason)) + "&episode=" + (encodeURIComponent(newepisode)) + "&newbanner=" +  (encodeURIComponent(newbanner));
    loadXMLDoc14234231(url);
}

var req14234231;
function loadXMLDoc14234231(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req14234231 = new XMLHttpRequest();
        req14234231.onreadystatechange = processReqChange14234231;
        req14234231.open("GET", url, true);
        req14234231.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req14234231 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req14234231)
        {
            req14234231.onreadystatechange = processReqChange14234231;
            req14234231.open("GET", url, true);
            req14234231.send();
        }
    }
}
function processReqChange14234231() 
{
    if (req14234231.readyState == 4)
    {
        if (req14234231.status == 200)
        {
            response = req14234231.responseXML.documentElement;
            result = response.getElementsByTagName("result")[0].firstChild.data;
            if(result == "ok")
            {
                thenewname = (response.getElementsByTagName("newname")[0].firstChild.data).replace('"',"'");
                thenewlink = response.getElementsByTagName("newurl")[0].firstChild.data;
                thenewbanner = response.getElementsByTagName("newbanner")[0].firstChild.data;
                thenewseason = response.getElementsByTagName("newseason")[0].firstChild.data;
                thenewepisode = response.getElementsByTagName("newepisode")[0].firstChild.data;
                mustreprintlinks = response.getElementsByTagName("mustreprintlinks")[0].firstChild.data;
                linkid = response.getElementsByTagName("li")[0].firstChild.data;
                movieidz = response.getElementsByTagName("movieidz")[0].firstChild.data;

                rememberlinknamesarray[linkid] = thenewname;
                var linknameid = 'linkname_' + linkid;
                document.getElementById(linknameid).innerHTML = make_a_nice_linkname(thenewname);
                rememberlinksarray[linkid] = thenewlink;
                var htmlzlinkid = 'linkz' + linkid;
                document.getElementById(htmlzlinkid).innerHTML = make_a_nice_link(thenewlink);
                rememberbannerurlsarray[linkid] = thenewbanner;
                rememberseasonsarray[linkid] = thenewseason;
                rememberepisodesarray[linkid] = thenewepisode;

                if(mustreprintlinks=="yes")
                {
                    reloadpannel(renkid[linkid]);
                    var functioncallexpression = 'update_episodes(' + movieidz + ')';
                    var t=setTimeout(functioncallexpression,1000);
                    var newepisodetargetpannelid = 'links_' + thenewseason + '_' + thenewepisode;
                    var functioncallexpression = 'reloadpannel("' + newepisodetargetpannelid + '")';
                    var t=setTimeout(functioncallexpression,3000);
                }
            }
            else if(result == "unallowed_user")
            {
                alert('sorry, you are not currently allowed to modify the links from this user (and the reverse is also true) because of an ongoing situation. Please if you think that this link should be changed, inform me (envis) about it and i will take care of it and be very grateful for your help. thank you!');
            }
			
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req14234231.statusText);
        }
    }
}


function new_droplink_func(droppie)
{
    var thisactionsboxname = "loader" + droppie;
    var saveboxcontents = document.getElementById(thisactionsboxname).innerHTML;
    document.getElementById(thisactionsboxname).innerHTML = "...LOADING...";
    var makesure=confirm("this will erase the link, are you sure?");
    if (makesure==true)
    {
        var urlz = "xmldrop?li=" + droppie;
        loadXMLDoc23432412343(urlz);
    }
    else
    {
        document.getElementById(thisactionsboxname).innerHTML = saveboxcontents;
    }
}
var req23432412343;
function loadXMLDoc23432412343(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req23432412343 = new XMLHttpRequest();
        req23432412343.onreadystatechange = processReqChange23432412343;
        req23432412343.open("GET", url, true);
        req23432412343.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req23432412343 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req23432412343)
        {
            req23432412343.onreadystatechange = processReqChange23432412343;
            req23432412343.open("GET", url, true);
            req23432412343.send();
        }
    }
}
function processReqChange23432412343() 
{
    if (req23432412343.readyState == 4)
    {
        if (req23432412343.status == 200)
        {
            response = req23432412343.responseXML.documentElement;
            thepostingresult = response.getElementsByTagName("result")[0].firstChild.data;
            if (thepostingresult == "ok")
            {
                var dropped = response.getElementsByTagName("dropped")[0].firstChild.data;
                var mtponz = response.getElementsByTagName("mtpon")[0].firstChild.data;
                var movieidz = response.getElementsByTagName("movieidz")[0].firstChild.data;
                reloadpannel(renkid[dropped]);
                var functioncallexpression = 'update_episodes(' + movieidz + ')';
                var t=setTimeout(functioncallexpression,1000);
                if(mtponz == "yes")
                {
                    isonhold();
                }
            }
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req23432412343.statusText);
        }
    }
}
function reloadpannel(div)
{
    sholinkuss(rememberpannelmovies[div], div, rememberpannelon_hold[div], rememberpannelseason[div], rememberpannelepisode[div], rememberpannelpage[div], global_viewers_u, global_ismod);
}

function new_holdlink_func(droppie, action, link, linkname, userID, publicname)
{
    if(action == "hold")
    {
        var hold_reason_window_name = 'rfhl' + droppie;
        var url_hold = 'hold_reason?droppie=' + droppie + '&action=' + action + "&li=" + link + "&ln=" + linkname + "&ui=" + userID + "&pn=" + publicname;
        window.open(url_hold, hold_reason_window_name, "width=500,height=500,scrollbars=yes,toolbar=no,location=no,menubar=0,directories=no,resizable=yes,status=0");
    }
    else if(action == "dehold")
    {
        var reason = 'dehold';
        perform_hold(droppie, action, reason);
    }
}
function perform_hold(droppie, action, reason)
{
    thisactionsboxname = "loader" + droppie;
    document.getElementById(thisactionsboxname).innerHTML = "...LOADING...";
    url = "xmlfunhold?action=" + action + "&r=" + droppie + "&reason=" + escape(reason);
    loadXMLDoc09098n04(url);
}

var req09098n04;
function loadXMLDoc09098n04(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req09098n04 = new XMLHttpRequest();
        req09098n04.onreadystatechange = processReqChange09098n04;
        req09098n04.open("GET", url, true);
        req09098n04.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req09098n04 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req09098n04)
        {
            req09098n04.onreadystatechange = processReqChange09098n04;
            req09098n04.open("GET", url, true);
            req09098n04.send();
        }
    }
}
function processReqChange09098n04() 
{
    if (req09098n04.readyState == 4)
    {
        if (req09098n04.status == 200)
        {
            response = req09098n04.responseXML.documentElement;
            //method = response.getElementsByTagName("method")[0].firstChild.data;
            result = response.getElementsByTagName("result")[0].firstChild.data;
            action = response.getElementsByTagName("action")[0].firstChild.data;
            broken_linkID = response.getElementsByTagName("broken_linkID")[0].firstChild.data;
            mtpon = response.getElementsByTagName("mtpon")[0].firstChild.data;
            movieidz = response.getElementsByTagName("movieidz")[0].firstChild.data;
            if(result=='ok' || result=='user_specific_block')
            {
                if(result=='user_specific_block')
                {
                    alert('sorry, you are not currently allowed to modify the hold status of links from this user (and the reverse is also true) because of an ongoing situation. Please if you think that this link should go on hold, inform me (envis) about it and i will take care of it and be very grateful for your help. thank you!');
                }
                if(mtpon == "yes")
                {
                    isonhold();
                }
                if(action == 'hold')
                {
                    reloadpannel(positive_renkid[broken_linkID]);
                    var functioncallexpression = 'update_episodes(' + movieidz + ')';
                    var t=setTimeout(functioncallexpression,1000);
                    var functioncallexpression = 'reloadpannel("linksonhold")';
                    var t=setTimeout(functioncallexpression,3000);
                }
                else if(action == 'dehold')
                {
                    reloadpannel("linksonhold");
                    var functioncallexpression = 'update_episodes(' + movieidz + ')';
                    var t=setTimeout(functioncallexpression,1000);
                    var functioncallexpression = 'reloadpannel("' + positive_renkid[broken_linkID] + '")';
                    var t=setTimeout(functioncallexpression,3000);
                }
            }
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req09098n04.statusText);
        }
    }
}

function update_episodes(mouvius)
{
    var urlz = "xmlgetepisodes?movie=" + mouvius;
    loadXMLDoc213v423b(urlz);
}
var req213v423b;
function loadXMLDoc213v423b(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req213v423b = new XMLHttpRequest();
        req213v423b.onreadystatechange = processReqChange213v423b;
        req213v423b.open("GET", url, true);
        req213v423b.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req213v423b = new ActiveXObject("Microsoft.XMLHTTP");
        if (req213v423b)
        {
            req213v423b.onreadystatechange = processReqChange213v423b;
            req213v423b.open("GET", url, true);
            req213v423b.send();
        }
    }
}

var availableseasonsarray=new Array();
var availableepisodesarray=new Array();
var totallinksarray=new Array();

var divswanted=new Array();

function processReqChange213v423b() 
{
    if (req213v423b.readyState == 4)
    {
        if (req213v423b.status == 200)
        {
            response = req213v423b.responseXML.documentElement;
            totalepisodes = response.getElementsByTagName("totalepisodes")[0].firstChild.data;
            themovieidz = response.getElementsByTagName("thismovieid")[0].firstChild.data;
            coutnsit = 0;
            availableseasonsarray.length = 0;
            availableepisodesarray.length = 0;
            totallinksarray.length = 0;
            divswanted.length = 0;
            while(coutnsit<totalepisodes)
            {
                coutnsit++;
                var thisseasonnamer = 'season_' + coutnsit;
                var thisepisodenamer = 'episode_' + coutnsit;
                var thistotallinksnamer = 'totallinks_' + coutnsit;
                availableseasonsarray[coutnsit] = response.getElementsByTagName(thisseasonnamer)[0].firstChild.data;
                availableepisodesarray[coutnsit] = response.getElementsByTagName(thisepisodenamer)[0].firstChild.data;
                totallinksarray[coutnsit] = response.getElementsByTagName(thistotallinksnamer)[0].firstChild.data;
                var containerdivname = 'container_' + availableseasonsarray[coutnsit] + '_' + availableepisodesarray[coutnsit];
                divswanted[containerdivname] = 'yes';
            }
            doepisodescomparison(themovieidz);
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req213v423b.statusText);
        }
    }
}

function doepisodescomparison(themovieidz)
{
    //check for divs that need to be added
    for (key in totallinksarray)
    {
        var thisseason = availableseasonsarray[key];
        var thisepisode = availableepisodesarray[key];
        var thistotallinks = totallinksarray[key];
        var containerdivname = 'container_' + thisseason + '_' + thisepisode;
        if(document.getElementById(containerdivname))
        {
            //div exists update total links
            var totallinksspanname = 'totallinks_' + thisseason + '_' + thisepisode;
            if(thistotallinks==1)
            {
                var linksS = '';
            }
            else
            {
                var linksS = 's';
            }
            document.getElementById(totallinksspanname).innerHTML = thistotallinks + ' link' + linksS;
        }
        else
        {
            //div does not exist, create it
            var previous_array_key = key - 1;
            if(totallinksarray[previous_array_key])
            {
                var expanddivname = 'expand_' + availableseasonsarray[previous_array_key] + '_' + availableepisodesarray[previous_array_key];
            }
            else
            {
                var expanddivname = 'expand_0_0';
            }
            document.getElementById(expanddivname).innerHTML = makeepisodebox(themovieidz, thisseason, thisepisode, thistotallinks, global_viewers_u, global_ismod);
        }
    }
    //check for divs that need to be removed
    for (key in divsontable)
    {
        if(divsontable[key]=='yes' && divswanted[key]!='yes')
        {
            //div is not wanted, clear and drop from divsontable
            document.getElementById(key).innerHTML = '';
            divsontable[key] = 'no';
        }
    }
}

var divsontable=new Array();
var global_viewers_u = 0;
var global_ismod = 0;
function makeepisodebox(movie, season, episode, howmany, viewers_u, ismod)
{
    global_viewers_u = viewers_u;
    global_ismod = ismod;
    var divname = 'links_' + season + '_' + episode;
    var containerdivname = 'container_' + season + '_' + episode;
    divsontable[containerdivname]='yes';
    var totallinksspanname = 'totallinks_' + season + '_' + episode;
    var expanddivname = 'expand_' + season + '_' + episode;
    if(howmany==1)
    {
        var linksS = '';
    }
    else
    {
        var linksS = 's';
    }
    var showlinks = '<a style="cursor:pointer;" onclick="sholinkuss(' + movie + ', ' + "'" + divname + "'" + ', ' + "'no'" + ', ' + season + ', ' + episode + ', 1, ' + global_viewers_u + ', ' + global_ismod + ')">show links</a>';
    var hidelinks = '<a style="cursor:pointer;" onclick="close_panel(' + "'" + divname + "'" + ')">hide links</a>';
    var myresult = '<div id="' + containerdivname + '"><div style="text-align:center;" class="effect">episode <b>' + season + ' x ' + episode + '</b> (<span id="' + totallinksspanname + '">' + howmany + ' link' + linksS + '</span>): ' + showlinks + ' | ' + hidelinks + "</div>";
    myresult = myresult + '<div id="' + divname + '"></div></div>';
    myresult = myresult + '<div id="' + expanddivname + '"></div>';
    return myresult;
}


function new_postthatlink_func(guestoruser, movieidz)
{
    var error = 0;
    link = document.getElementById("postedlink").value;
    bannerURL = document.getElementById("postedbanner").value;
    linkname = document.getElementById("postedlinkname").value;
    season = document.getElementById("postedseason").value;
    episode = document.getElementById("postedepisode").value;
    if (guestoruser == "guest")
    {
        error = 1;
        logintopostmessage = "please login to post links.";
        alert(logintopostmessage);
    }
    else if (link == "" || link == "http://")
    {
        error = 1;
        alert("you must write your link in the link box before you post it");
    }
    else if (linkname == "")
    {
        error = 1;
        alert("you must give a name to your link");
    }
    if (error == 0)
    {
        if(bannerURL=='' || bannerURL=='http://')
        {
            bannerURL='none';
        }
        maxlength=50;
        if ( linkname.length > maxlength )
        {
            linknamefordisplay = "<acronym title='" + linkname + "'>" + linkname.substr(0,maxlength) + "</acronym>";
        }
        else
        {
            linknamefordisplay = linkname;
        }
        if ( link.length > maxlength )
        {
            linkfordisplay = "<acronym title='" + link + "'>" + link.substr(0,maxlength) + "</acronym>";
        }
        else
        {
            linkfordisplay = link;
        }
        thispostforlog = "<span class='effect'>posting " + linknamefordisplay + ": <a href='" + link + "' target='_blank'>" + linkfordisplay + "</a></span><br />";
        document.getElementById("postlog").innerHTML = document.getElementById("postlog").innerHTML + thispostforlog;
        var urlz = "xmlpost?movie=" + movieidz + "&link=" + (encodeURIComponent(link)) + "&linkname=" + (encodeURIComponent(linkname)) + "&season=" + (encodeURIComponent(season)) + "&episode=" + (encodeURIComponent(episode)) + "&banner=" + (encodeURIComponent(bannerURL));
        loadXMLDoc22341234(urlz);
    }
}
var req22341234;
function loadXMLDoc22341234(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req22341234 = new XMLHttpRequest();
        req22341234.onreadystatechange = processReqChange22341234;
        req22341234.open("GET", url, true);
        req22341234.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req22341234 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req22341234)
        {
            req22341234.onreadystatechange = processReqChange22341234;
            req22341234.open("GET", url, true);
            req22341234.send();
        }
    }
}
function processReqChange22341234() 
{
    if (req22341234.readyState == 4)
    {
        if (req22341234.status == 200)
        {
            response = req22341234.responseXML.documentElement;
            thepostingresult = response.getElementsByTagName("result")[0].firstChild.data;
            thismovieid = response.getElementsByTagName("thismovie")[0].firstChild.data;
            season = response.getElementsByTagName("season")[0].firstChild.data;
            episode = response.getElementsByTagName("episode")[0].firstChild.data;
            if (thepostingresult == "ok")
            {
                var text = "<span style='color:green;'>======>link posted</span>";
                var text_nocolor = "<span>======>link posted</span>";


                if(bgpics=='off')
                {
                    var thispostforlog='<div style="position:relative;">' +
                    '<div style="position:relative;">' + text + '</div>' +
                    '</div>';
                }
                else
                {
                    var thispostforlog='<div style="position:relative;">' +
                    '<div style="position:absolute;top:1px;left:1px;" class="black">' + text + '</div>' +
                    '<div style="position:absolute;top:1px;left:-1px;" class="black">' + text_nocolor + '</div>' +
                    '<div style="position:absolute;top:-1px;left:1px;" class="black">' + text + '</div>' +
                    '<div style="position:absolute;top:-1px;left:-1px;" class="black">' + text_nocolor + '</div>' +
                    '<div style="position:absolute;top:0px;left:-1px;" class="black">' + text_nocolor + '</div>' +
                    '<div style="position:absolute;top:0px;left:1px;" class="black">' + text + '</div>' +
                    '<div style="position:absolute;top:1px;left:0px;" class="black">' + text_nocolor + '</div>' +
                    '<div style="position:absolute;top:-1px;left:0px;" class="black">' + text + '</div>' +
                    '<div style="position:relative;" class="white">' + text_nocolor + '</div>' +
                    '</div>';
                }





                document.getElementById("postlog").innerHTML = document.getElementById("postlog").innerHTML + thispostforlog;
                if(season == 0 && episode == 0)
                {
                    var divtoreload = 'links';
                }
                else
                {
                    var divtoreload = 'links_' + season + '_' + episode;
                    update_episodes(thismovieid);
                }
                if(document.getElementById(divtoreload).innerHTML != '')
                {
                    sholinkuss(thismovieid, divtoreload, 'no', season, episode, 'last', global_viewers_u, global_ismod);
                }
            }
            else if  (thepostingresult == "notallowed")
            {
                var notallowedtopostheremessage = 'you are not allowed to post on this page.';
                alert(notallowedtopostheremessage);
            }
            else if  (thepostingresult == "proxy")
            {
                var notallowedtopostheremessage = 'The ip address that you are using is known to be a proxy. You are not allowed to post links when connecting through a proxy. Please disable your proxy or access this page directly.';
                alert(notallowedtopostheremessage);
            }
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req22341234.statusText);
        }
    }
}



function new_inc_clicks_func(user_linkIDdodle)
{
    var spanID = 'clicks' + user_linkIDdodle;
    clicksuisarray[user_linkIDdodle]++;
    if(clicksuisarray[user_linkIDdodle]==1)
    {
        var elclicksS = '';
    }
    else
    {
        var elclicksS = 's';
    }
    document.getElementById(spanID).innerHTML = "clicked " + clicksuisarray[user_linkIDdodle] + " time" + elclicksS;
    var hasclickedlinkid = "hasclicked_" + user_linkIDdodle;
    document.getElementById(hasclickedlinkid).style.display = "inline";
}

function wordwrap( str, int_width, str_break, cut ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   improved by: Nick Callen
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Sakimori
    // *     example 1: wordwrap('Kevin van Zonneveld', 6, '|', true);
    // *     returns 1: 'Kevin |van |Zonnev|eld'
    // *     example 2: wordwrap('The quick brown fox jumped over the lazy dog.', 20, '<br />\n');
    // *     returns 2: 'The quick brown fox <br />\njumped over the lazy<br />\n dog.'
    // *     example 3: wordwrap('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.');
    // *     returns 3: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod \ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim \nveniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea \ncommodo consequat.'
 
    // PHP Defaults
    var m = ((arguments.length >= 2) ? arguments[1] : 75   );
    var b = ((arguments.length >= 3) ? arguments[2] : "\n" );
    var c = ((arguments.length >= 4) ? arguments[3] : false);
 
    var i, j, l, s, r;
 
    str += '';
 
    if (m < 1) {
        return str;
    }
 
    for (i = -1, l = (r = str.split("\n")).length; ++i < l; r[i] += s) {
        for(s = r[i], r[i] = ""; s.length > m; r[i] += s.slice(0, j) + ((s = s.slice(j)).length ? b : "")){
            j = c == 2 || (j = s.slice(0, m + 1).match(/\S*(\s)?$/))[1] ? m : j.input.length - j[0].length || c == 1 && m || j.input.length + (j = s.slice(m).match(/^\S*/)).input.length;
        }
    }
 
    return r.join("\n");
}
