var checkatwhatspeed = 10000;
var req;
var req2;
var req3;
var req4;
var req5;
var req6;
var yourvote = 0;
var movieorseriezzz=0;
var loggedin=0;
function stemovieorserie(num)
{
    movieorseriezzz=num;
}
function stelogin(num)
{
    loggedin=num;
}
var lastmovieid = 0;
var lastguestoruser = "unset";

var isflashing = 0;


function shovotes(alreadyvoted, votegiven, movierating, movievotes, dailymovierating, dailymovievotes, weeklymovierating, weeklymovievotes, monthlymovierating, monthlymovievotes, yearlymovierating, yearlymovievotes, thismovieid, guestoruser)
{
    if(thismovieid != 0)
    {
        lastmovieid = thismovieid;
    }
    else
    {
        if(lastmovieid != 0)
        {
            thismovieid = lastmovieid;
        }
        else
        {
            errormessage = "error in the shovotes string, movieid sent is 0 and lastmovieid is 0 too...";
            alert(errormessage);
        }
    }
    if(guestoruser != "unset")
    {
        lastguestoruser = guestoruser;
    }
    else
    {
        if(lastguestoruser != "unset")
        {
            guestoruser = lastguestoruser;
        }
        else
        {
            errormessage = "error in the shovotes string, guestoruser sent is unset and lastguestoruser is unset too...";
            alert(errormessage);
        }
    }
    var castvotestring = "vote: ";
    var countz = 0;
    while (countz <= 10)
    {
        var thisnote = "<a onclick='castvote(" + countz + "," + thismovieid + "," + '"' + guestoruser + '"' + ")' style='cursor:pointer;text-decoration:underline;font-weight:bold;'>" + countz + "</a>";
        castvotestring = castvotestring + thisnote;
        if (countz < 10)
        {
            castvotestring = castvotestring + ",";
        }
        countz++;
    }
    if (alreadyvoted == 1)
    {
        var alreadyvotedstring = "<div id='youvotedbox'>you voted " + votegiven + "</div>";
    }
    else
    {
        var alreadyvotedstring = "<div id='youvotedbox'></div>";
    }



    var precol_votesstring = "<table style='position:relative;right:0px;"
    var gab_votesstring = "<tr><td style='text-align:right;'>" +
    "today: " + shorate(dailymovierating, dailymovievotes) + "<br />" +
    "this week: " + shorate(weeklymovierating, weeklymovievotes) + "<br />" +
    "this month: " + shorate(monthlymovierating, monthlymovievotes) + "<br />" +
    "this year: " + shorate(yearlymovierating, yearlymovievotes) + "<br />" +
    "all-time: " + shorate(movierating, movievotes) + "<br />" +
    "</td></tr><tr><td style='text-align:center;'>" +
    "(<a onclick=" + '"' + "popuphelp('vote_details?movie=" + thismovieid + "')" + '"' + " style=" + '"' + "cursor:pointer;font-size:11px;" + '"' + ">details</a>)" +
    "</td></tr></table>";

    var floaterzz = '';
    if(floatit!=1)
    {
        floaterzz = '<div style="position:absolute;top:0px;right:0px;visibility:hidden;">' + gab_votesstring + '</div>';
    }

    var innerthing = '<div style="position:relative;top:0px;right:0px;">' +
    '<div style="position:absolute;top:1px;right:1px;text-align:right;vertical-align:top;">' + '<table style="position:relative;right:0px;color:#000000;">' + gab_votesstring + '</div>' +
    '<div style="position:absolute;top:1px;right:-1px;text-align:right;vertical-align:top;">' + '<table style="position:relative;right:0px;" class="black">' + gab_votesstring + '</div>' +
    '<div style="position:absolute;top:-1px;right:1px;text-align:right;vertical-align:top;">' + '<table style="position:relative;right:0px;color:#000000;">' + gab_votesstring + '</div>' +
    '<div style="position:absolute;top:-1px;right:-1px;text-align:right;vertical-align:top;">' + '<table style="position:relative;right:0px;" class="black">' + gab_votesstring + '</div>' +
    '<div style="position:absolute;top:0px;right:-1px;text-align:right;vertical-align:top;">' + '<table style="position:relative;right:0px;" class="black">' + gab_votesstring + '</div>' +
    '<div style="position:absolute;top:0px;right:1px;text-align:right;vertical-align:top;">' + '<table style="position:relative;right:0px;color:#000000;">' + gab_votesstring + '</div>' +
    '<div style="position:absolute;top:1px;right:0px;text-align:right;vertical-align:top;">' + '<table style="position:relative;right:0px;" class="black">' + gab_votesstring + '</div>' +
    '<div style="position:absolute;top:-1px;right:0px;text-align:right;vertical-align:top;">' + '<table style="position:relative;right:0px;color:#000000;">' + gab_votesstring + '</div>' +
    '<div style="position:absolute;top:0px;right:0px;text-align:right;vertical-align:top;">' + '<table style="position:relative;right:0px;" class="white">' + gab_votesstring + '</div>' +
    floaterzz +
    '</div>';



    var votesstringz = '<div style="padding:4px;" class="effect2">' +
    '<div style="font-size:80%;">retype this number before clicking your vote:</div>' +
    '<div><img src="image_verification?name=vote' + thismovieid + '&randor=' + Math.random() + '" alt="image verification" style="vertical-align:text-bottom;" /> => <input type="text" id="vote_imver" style="width:60px;" /></div>' +
    castvotestring + alreadyvotedstring;
    if(alreadyvoted!=1)
    {
        votesstringz = votesstringz + '<div style="width:100%;text-align:center;" id="voteshowup">please vote!</div>';
    }
    votesstringz = votesstringz + '</div>' + innerthing;

    document.getElementById("votesbox").innerHTML = votesstringz;
    if(isflashing==0 && alreadyvoted!=1)
    {
        flash_div("voteshowup");
        isflashing = 1;
    }
}


function shorate(movierating, movievotes)
{

    var light = 30;

    var movieratingstringinanarray = movierating.split("");
    var valuez;
    var reformatted_string = '';
    var countzz = 0;
    for(valuez in movieratingstringinanarray)
    {
        var font_size = 100 - (countzz * 7);
        if(font_size < 1)
        {
            font_size = 1;
        }
        reformatted_string = reformatted_string + '<span style="font-size:' + font_size + '%;">' + movieratingstringinanarray[valuez] + '</span>';
        countzz++;
    }
    if(movievotes == 0)
    {
        //        moveratingcolor = '#FFFFFF';
        //        reformatted_string = '?';
        var movierating_incolor = '?';
    }
    else
    {
        var percent_good = movierating * 10;
        var quantity_of_green = (200 * (percent_good / 100)) - 1;
        var quantity_of_green = Math.floor(quantity_of_green);
        var percent_bad = (10 - movierating) * 10;
        var quantity_of_red = (200 * (percent_bad / 100)) - 1;
        var quantity_of_red = Math.floor(quantity_of_red);

        quantity_of_red = quantity_of_red +light;
        if(quantity_of_red>255)
        {
            quantity_of_red=255;
        }
        quantity_of_green = quantity_of_green +light;
        if(quantity_of_green>255)
        {
            quantity_of_green=255;
        }


        var moveratingcolor = ' rgb(' + quantity_of_red + ', ' + quantity_of_green + ', ' + light + ')';
        var movierating_incolor = '<span style="color:' + moveratingcolor + ';"><span>' + reformatted_string + '</span></span>';
    }
    var ppls_good = movievotes;
    if(ppls_good > 10)
    {
        ppls_good = 10;
    }
    var percent_ppls_good = ppls_good * 10;
    var quantity_of_green = (256 * (percent_ppls_good / 100)) - 1;
    var quantity_of_green = Math.floor(quantity_of_green);
    var percent_ppls_bad = (10 - ppls_good) * 10;
    var quantity_of_red = (256 * (percent_ppls_bad / 100)) - 1;
    var quantity_of_red = Math.floor(quantity_of_red);

    quantity_of_red = quantity_of_red + light;
    if(quantity_of_red>255)
    {
        quantity_of_red=255;
    }
    quantity_of_green = quantity_of_green + light;
    if(quantity_of_green>255)
    {
        quantity_of_green=255;
    }


    var movievotescolor = ' rgb(' + quantity_of_red + ', ' + quantity_of_green + ', ' + light + ')';
    var movievotes_incolor = '<span style="color:' + movievotescolor + ';"><span>' + movievotes + '</span></span>';

    return "<span style='font-size:90%;color:inherit;'>rating: <span style='font-size:120%;color:inherit;'>" + movierating_incolor + "</span>, votes: <span style='font-size:140%;color:inherit;'>" + movievotes_incolor + "</span></span>";

}



function flash_div(div_id)
{
    var this_div=document.getElementById(div_id);
    if(this_div!=null)
    {
        if(this_div.style.visibility=='visible')
        {
            this_div.style.visibility='hidden';
        }
        else
        {
            this_div.style.visibility='visible';
        }
    }
    re_exec_string="flash_div('" + div_id + "');";
    var tiom=setTimeout(re_exec_string,500);
}

function castvote(thevote, thismovieid, guestoruser)
{
    document.getElementById("youvotedbox").innerHTML = ".";
    yourvote = thevote;
    votedotrot();
    var numbaz = document.getElementById("vote_imver").value;
    var url = "xmlvote?movie=" + thismovieid + "&vote=" + thevote + "&numbaz=" + numbaz;
    var executab = "loadXMLDoc6('" + url + "');";
    t=setTimeout(executab,1500);
}
function votedotrot()
{
    var t=setTimeout("fuckingrot()",50);
}
function fuckingrot()
{
    if(document.getElementById("youvotedbox").innerHTML == '.')
    {
        document.getElementById("youvotedbox").innerHTML = '..';
        votedotrot();
    }
    else if(document.getElementById("youvotedbox").innerHTML == '..')
    {
        document.getElementById("youvotedbox").innerHTML = '...';
        votedotrot();
    }
    else if(document.getElementById("youvotedbox").innerHTML == '...')
    {
        document.getElementById("youvotedbox").innerHTML = '....';
        votedotrot();
    }
    else if(document.getElementById("youvotedbox").innerHTML == '....')
    {
        document.getElementById("youvotedbox").innerHTML = '.....';
        votedotrot();
    }
    else if(document.getElementById("youvotedbox").innerHTML == '.....')
    {
        document.getElementById("youvotedbox").innerHTML = '......';
        votedotrot();
    }
    else if(document.getElementById("youvotedbox").innerHTML == '......')
    {
        document.getElementById("youvotedbox").innerHTML = '.......';
        votedotrot();
    }
    else if(document.getElementById("youvotedbox").innerHTML == '.......')
    {
        document.getElementById("youvotedbox").innerHTML = '........';
        votedotrot();
    }
    else if(document.getElementById("youvotedbox").innerHTML == '........')
    {
        document.getElementById("youvotedbox").innerHTML = '.........';
        votedotrot();
    }
    else if(document.getElementById("youvotedbox").innerHTML == '.........')
    {
        document.getElementById("youvotedbox").innerHTML = '..........';
        votedotrot();
    }
    else if(document.getElementById("youvotedbox").innerHTML == '..........')
    {
        document.getElementById("youvotedbox").innerHTML = '...........';
        votedotrot();
    }
    else if(document.getElementById("youvotedbox").innerHTML == '...........')
    {
        document.getElementById("youvotedbox").innerHTML = '.';
        votedotrot();
    }
}
function loadXMLDoc6(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req6 = new XMLHttpRequest();
        req6.onreadystatechange = processReqChange6;
        req6.open("GET", url, true);
        req6.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req6 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req6)
        {
            req6.onreadystatechange = processReqChange6;
            req6.open("GET", url, true);
            req6.send();
        }
    }
}
function processReqChange6() 
{
    if (req6.readyState == 4)
    {
        if (req6.status == 200)
        {
            response = req6.responseXML.documentElement;
            var result = response.getElementsByTagName("result")[0].firstChild.data;


            var movierating = response.getElementsByTagName("rating")[0].firstChild.data;
            var movievotes = response.getElementsByTagName("votes")[0].firstChild.data;
            
            var dailymovierating = response.getElementsByTagName("dailyrating")[0].firstChild.data;
            var dailymovievotes = response.getElementsByTagName("dailyvotes")[0].firstChild.data;
            var weeklymovierating = response.getElementsByTagName("weeklyrating")[0].firstChild.data;
            var weeklymovievotes = response.getElementsByTagName("weeklyvotes")[0].firstChild.data;
            var monthlymovierating = response.getElementsByTagName("monthlyrating")[0].firstChild.data;
            var monthlymovievotes = response.getElementsByTagName("monthlyvotes")[0].firstChild.data;
            var yearlymovierating = response.getElementsByTagName("yearlyrating")[0].firstChild.data;
            var yearlymovievotes = response.getElementsByTagName("yearlyvotes")[0].firstChild.data;



            var yourprivilege = response.getElementsByTagName("privilege")[0].firstChild.data;
            if (result == "ok")
            {
                if(yourprivilege != '1')
                {
                    var noprivmessage = "your vote has been recorded but will not be counted in the ratings until a mod enables your voting privileges.";
                    alert(noprivmessage);
                }
                shovotes(1,yourvote,movierating,movievotes,dailymovierating,dailymovievotes,weeklymovierating,weeklymovievotes,monthlymovierating,monthlymovievotes,yearlymovierating,yearlymovievotes,0,"unset");
            }
            else if (result == "badcode")
            {
                alert("the number in the box does not match the number in the picture");
            }
            else if (result == "proxy")
            {
                alert("The ip address that you are using is known to be a proxy. You are not allowed to vote when connecting through a proxy. Please disable your proxy or access this page directly.");
            }
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req6.statusText);
        }
    }
}
function loadXMLDoc4(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req4 = new XMLHttpRequest();
        req4.onreadystatechange = processReqChange4;
        req4.open("GET", url, true);
        req4.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req4 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req4)
        {
            req4.onreadystatechange = processReqChange4;
            req4.open("GET", url, true);
            req4.send();
        }
    }
}
function processReqChange4() 
{
    if (req4.readyState == 4)
    {
        if (req4.status == 200)
        {
            response = req4.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;
            eval(method + "('" + result + "','" + action + "','" + broken_linkID + "','" + mtpon + "')");
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req4.statusText);
        }
    }
}
function isonhold()
{
    var text = "<div style='width:100%;text-align:center;'><span style='font-size:120%;color:red;font-weight:bold;'>This page is on hold!</span><br /><span style='font-size:70%;font-weight:normal;'>if you have some links up on the page but do not have admin rights on the page, please reload the page to get admin rights.</span></div>";
    var text_nocolor = "<div style='width:100%;text-align:center;'><span style='font-size:120%;font-weight:bold;'>This page is on hold!</span><br /><span style='font-size:70%;font-weight:normal;'>if you have some links up on the page but do not have admin rights on the page, please reload the page to get admin rights.</span></div>";
    if(bgpics=='off')
    {
        var message='<div style="position:relative;width:100%;">' +
        '<div style="position:relative;">' + text + '</div>' +
        '</div>';
    }
    else
    {
        var message='<div style="position:relative;width:100%;">' +
        '<div style="position:absolute;top:1px;left:1px;width:100%;" class="black">' + text + '</div>' +
        '<div style="position:absolute;top:1px;left:-1px;width:100%;" class="black">' + text_nocolor + '</div>' +
        '<div style="position:absolute;top:-1px;left:1px;width:100%;" class="black">' + text + '</div>' +
        '<div style="position:absolute;top:-1px;left:-1px;width:100%;" class="black">' + text_nocolor + '</div>' +
        '<div style="position:absolute;top:0px;left:-1px;width:100%;" class="black">' + text_nocolor + '</div>' +
        '<div style="position:absolute;top:0px;left:1px;width:100%;" class="black">' + text + '</div>' +
        '<div style="position:absolute;top:1px;left:0px;width:100%;" class="black">' + text_nocolor + '</div>' +
        '<div style="position:absolute;top:-1px;left:0px;width:100%;" class="black">' + text + '</div>' +
        '<div style="position:relative;" class="white">' + text_nocolor + '</div>' +
        '</div>';
    }
    document.getElementById("holdmessage").innerHTML = message;
}
function youreadmin()
{
    var text = "<div style='width:100%;text-align:center;'><span style='font-size:120%;color:green;font-weight:bold;'>You have admin rights on this page.</span><br /><span style='font-size:70%;font-weight:normal;'>look below for the page admin menu.</span></div>";
    var text_nocolor = "<div style='width:100%;text-align:center;'><span style='font-size:120%;font-weight:bold;'>You have admin rights on this page.</span><br /><span style='font-size:70%;font-weight:normal;'>look below for the page admin menu.</span></div>";
    if(bgpics=='off')
    {
        var message='<div style="position:relative;width:100%;">' +
        '<div style="position:relative;">' + text + '</div>' +
        '</div>';
    }
    else
    {
        var message='<div style="position:relative;width:100%;">' +
        '<div style="position:absolute;top:1px;left:1px;width:100%;" class="black">' + text + '</div>' +
        '<div style="position:absolute;top:1px;left:-1px;width:100%;" class="black">' + text_nocolor + '</div>' +
        '<div style="position:absolute;top:-1px;left:1px;width:100%;" class="black">' + text + '</div>' +
        '<div style="position:absolute;top:-1px;left:-1px;width:100%;" class="black">' + text_nocolor + '</div>' +
        '<div style="position:absolute;top:0px;left:-1px;width:100%;" class="black">' + text_nocolor + '</div>' +
        '<div style="position:absolute;top:0px;left:1px;width:100%;" class="black">' + text + '</div>' +
        '<div style="position:absolute;top:1px;left:0px;width:100%;" class="black">' + text_nocolor + '</div>' +
        '<div style="position:absolute;top:-1px;left:0px;width:100%;" class="black">' + text + '</div>' +
        '<div style="position:relative;" class="white">' + text_nocolor + '</div>' +
        '</div>';
    }
    document.getElementById("adminmessage").innerHTML = message;
}
function shohits(hits, hitssince)
{
    var hitsS = "";
    if(hits != 1)
    {
        hitsS = "s";
    }
    var hitsstring = hits + " view" + hitsS;
    if (hitssince != 0)
    {
        var sincewhen = maketimus(hitssince);
        hitsstring = hitsstring + " since " + sincewhen;
    }

    if(bgpics=='off')
    {
        hitsstringz='<div style="position:relative;width:100%;">' +
        '<div style="position:relative;">' + hitsstring + '</div>' +
        '</div>';
    }
    else
    {
        hitsstringz='<div style="position:relative;width:100%;">' +
        '<div style="position:absolute;top:1px;left:1px;width:100%;" class="black">' + hitsstring + '</div>' +
        '<div style="position:absolute;top:1px;left:-1px;width:100%;" class="black">' + hitsstring + '</div>' +
        '<div style="position:absolute;top:-1px;left:1px;width:100%;" class="black">' + hitsstring + '</div>' +
        '<div style="position:absolute;top:-1px;left:-1px;width:100%;" class="black">' + hitsstring + '</div>' +
        '<div style="position:absolute;top:0px;left:-1px;width:100%;" class="black">' + hitsstring + '</div>' +
        '<div style="position:absolute;top:0px;left:1px;width:100%;" class="black">' + hitsstring + '</div>' +
        '<div style="position:absolute;top:1px;left:0px;width:100%;" class="black">' + hitsstring + '</div>' +
        '<div style="position:absolute;top:-1px;left:0px;width:100%;" class="black">' + hitsstring + '</div>' +
        '<div style="position:relative;" class="white">' + hitsstring + '</div>' +
        '</div>';
    }



    document.getElementById("hitssince").innerHTML = hitsstringz;
}


function thumb(li, action, theviewersUzzz)
{
    tupid = "tup" + li;
    tdoid = "tdo" + li;
    document.getElementById(tupid).innerHTML = '...';
    document.getElementById(tdoid).innerHTML = '...';
    start_crazydot_rot(li);
    url = "xmlthumbs?li=" + li + "&action=" + action;
    loadXMLDoc5(url);
}
function start_crazydot_rot(li)
{
    var execstring = 'rotlikecrazy(' + li + ')';
    var t=setTimeout(execstring,100);
}
function rotlikecrazy(li)
{
    tupid = "tup" + li;
    tdoid = "tdo" + li;
    if(document.getElementById(tupid).innerHTML == '...')
    {
        document.getElementById(tupid).innerHTML = '.';
        document.getElementById(tdoid).innerHTML = '.';
        start_crazydot_rot(li);
    }
    else if(document.getElementById(tupid).innerHTML == '.')
    {
        document.getElementById(tupid).innerHTML = '..';
        document.getElementById(tdoid).innerHTML = '..';
        start_crazydot_rot(li);
    }
    else if(document.getElementById(tupid).innerHTML == '..')
    {
        document.getElementById(tupid).innerHTML = '...';
        document.getElementById(tdoid).innerHTML = '...';
        start_crazydot_rot(li);
    }
}
function loadXMLDoc5(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req5 = new XMLHttpRequest();
        req5.onreadystatechange = processReqChange5;
        req5.open("GET", url, true);
        req5.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req5 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req5)
        {
            req5.onreadystatechange = processReqChange5;
            req5.open("GET", url, true);
            req5.send();
        }
    }
}
function processReqChange5() 
{
    if (req5.readyState == 4)
    {
        if (req5.status == 200)
        {
            response = req5.responseXML.documentElement;
            result = response.getElementsByTagName("result")[0].firstChild.data;
            tup = response.getElementsByTagName("tup")[0].firstChild.data;
            tdo = response.getElementsByTagName("tdo")[0].firstChild.data;
            thumbed = response.getElementsByTagName("thumbed")[0].firstChild.data;
            userIDz = response.getElementsByTagName("userID")[0].firstChild.data;
            if (result == "ok")
            {
                tupid = "tup" + thumbed;
                tdoid = "tdo" + thumbed;
                var explanation = "give a positive note to this link";
                document.getElementById(tupid).innerHTML = "<acronym title='" + explanation + "'><img style='cursor:pointer;' src='common_files/pics/thumbsup2.gif' alt='" + explanation + "' onmouseover='onbutton(" + '"tup' + thumbed + '", "common_files/pics/thumbsup1.gif"' + ");explain(" + '"' + explanation + '"' + ")' onmouseout='onbutton(" + '"tup' + thumbed + '", "common_files/pics/thumbsup2.gif"' + ");clearlegendmessage()' id='tup" + thumbed + "' onclick='thumb(" + thumbed + ',"up",' + userIDz + ")' /></acronym>" + tup;
                explanation = "give a negative note to this link";
                document.getElementById(tdoid).innerHTML = "<acronym title='" + explanation + "'><img style='cursor:pointer;' src='common_files/pics/thumbsdown2.gif' alt='" + explanation + "' onmouseover='onbutton(" + '"tdo' + thumbed + '", "common_files/pics/thumbsdown1.gif"' + ");explain(" + '"' + explanation + '"' + ")' onmouseout='onbutton(" + '"tdo' + thumbed + '", "common_files/pics/thumbsdown2.gif"' + ");clearlegendmessage()' id='tdo" + thumbed + "' onclick='thumb(" + thumbed + ',"down",' + userIDz + ")' /></acronym>" + tdo;
                loaderdivid = "loader" + thumbed;
                linksarray[thumbed] = document.getElementById(loaderdivid).innerHTML;
            }
            else if (result == "own")
            {
                cantthumbyourownmessage = "you cannot give thumbs up or thumbs down on your own links, let others judge.";
                alert(cantthumbyourownmessage);
            }
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req5.statusText);
        }
    }
}
function show_dump_mobile(moviez)
{
    document.getElementById("my_happy_dump_div").innerHTML='<iframe id="dump_frame" src="dump?movie=' + moviez + '" style="width:100%;height:700px;" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0></iframe>';
}
var req7;
var thepageimlookingat = 1;
var thelatestpost = 0;
function loadchat(moviegogel, thepage)
{
    thepageimlookingat = thepage;
    url = "xmltalk?movie=" + moviegogel + "&page=" + thepage;
    loadXMLDoc7(url);
}
function loadXMLDoc7(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req7 = new XMLHttpRequest();
        req7.onreadystatechange = processReqChange7;
        req7.open("GET", url, true);
        req7.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req7 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req7)
        {
            req7.onreadystatechange = processReqChange7;
            req7.open("GET", url, true);
            req7.send();
        }
    }
}
function processReqChange7() 
{
    if (req7.readyState == 4)
    {
        if (req7.status == 200)
        {
            thelatestpost=1;
            response = req7.responseXML.documentElement;
            ppage = response.getElementsByTagName("page")[0].firstChild.data;
            mystery = response.getElementsByTagName("mystery")[0].firstChild.data;
            viewersU = response.getElementsByTagName("viewersU")[0].firstChild.data;
            ismod = response.getElementsByTagName("ismod")[0].firstChild.data;
            moviegolez = response.getElementsByTagName("moviegol")[0].firstChild.data;

            var previouspagez = (Math.abs(ppage)) - 1;
            var nextpagez = (Math.abs(ppage)) + 1;
            var paginationstringz = '<div class="effect"><a onclick="loadchat(' + moviegolez + ', ' + previouspagez + ')" style="cursor:pointer;">previous</a> | comment page ' + ppage + ' | <a onclick="loadchat(' + moviegolez + ', ' + nextpagez + ')" style="cursor:pointer;">next</a><div>';
            document.getElementById('chatpagination1').innerHTML = paginationstringz;
            document.getElementById('chatpagination2').innerHTML = paginationstringz;

            var x;
            for (x=1;x<=10;x++)
            {
                postname = "message" + x;
                post = response.getElementsByTagName(postname)[0].firstChild.data;
                if (post == "-")
                {
                    mutechatbox(x,ppage);
                }
                else
                {
                    postIDname = "messageID" + x;
                    timename = "newtime" + x;
                    poster_statusname = "poster_status" + x;
                    publicnamename = "publicname" + x;
                    userIDname = "userID" + x;
                    picturename = "picture" + x;
                    mypagecolorname = "mypagecolor" + x;
                    mypagecolor2name = "mypagecolor2" + x;
                    framecolorname = "framecolor" + x;
                    textcolor1name = "textcolor1" + x;
                    textcolor2name = "textcolor2" + x;
                    textcolor3name = "textcolor3" + x;
                    postID = response.getElementsByTagName(postIDname)[0].firstChild.data;
                    if (thepageimlookingat == 1 && x == 1)
                    {
                        thelatestpost = postID;
                    }
                    time = response.getElementsByTagName(timename)[0].firstChild.data;
                    poster_status = response.getElementsByTagName(poster_statusname)[0].firstChild.data;
                    publicname = response.getElementsByTagName(publicnamename)[0].firstChild.data;
                    userID = response.getElementsByTagName(userIDname)[0].firstChild.data;
                    picture = response.getElementsByTagName(picturename)[0].firstChild.data;
                    mypagecolor = response.getElementsByTagName(mypagecolorname)[0].firstChild.data;
                    mypagecolor2 = response.getElementsByTagName(mypagecolor2name)[0].firstChild.data;
                    framecolor = response.getElementsByTagName(framecolorname)[0].firstChild.data;
                    textcolor1 = response.getElementsByTagName(textcolor1name)[0].firstChild.data;
                    textcolor2 = response.getElementsByTagName(textcolor2name)[0].firstChild.data;
                    textcolor3 = response.getElementsByTagName(textcolor3name)[0].firstChild.data;
                    shochat(ppage, mystery, post, postID, time, poster_status, publicname, userID, picture, mypagecolor, mypagecolor2, framecolor, textcolor1, textcolor2, textcolor3, x, viewersU, ismod, moviegolez);
                }
            }
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req7.statusText);
        }
    }
}
var req8;
function mutechatbox(x,ppage)
{
    var chatboxname = "commentbox" + x;
    if(ppage==1 && x==1)
    {
        var textforbox = '';
        document.getElementById('chatpagination1').innerHTML = '';
        document.getElementById('chatpagination2').innerHTML = '';
    }
    else if(x==1)
    {
        var textforbox = 'there are no comments on this page yet';
    }
    else
    {
        var textforbox = '';
    }
    document.getElementById(chatboxname).innerHTML = textforbox;
}
function shochat(ppage, mystery, post, postID, time, poster_status, publicname, userID, picture, mypagecolor, mypagecolor2, framecolor, textcolor1, textcolor2, textcolor3, x, viewersU, ismod, moviez)
{
    var chatboxname = "commentbox" + x;
    var desired_word_length = 50;
    var thecommentarray = post.split(" ");
    var xu;
    for (xu in thecommentarray)
    {
        startofcommentarrayxu = thecommentarray[xu].substr(0,5);
        if(startofcommentarrayxu == "href=")
        {
            thislinkid = "link" + postID + xu;
            thecommentarray[xu] = "id='" + thislinkid + "' style='color:" + textcolor2 + ";' onmouseover='hovercolor(" + '"' + textcolor3 + '", "' + thislinkid + '"' + ")' onmouseout='hovercolor(" + '"' + textcolor2 + '", "' + thislinkid + '"' + ")'" + thecommentarray[xu];
        }
        else if(thecommentarray[xu].length > desired_word_length)
        {
            thecommentarray[xu] = "<acronym title='" + thecommentarray[xu] + "'>" + thecommentarray[xu].substr(0,desired_word_length) + "...</acronym>";
        }
    }
    thecomment = thecommentarray.join(" ");
    if (picture == "no")
    {
        personspic = "common_files/pics/flobb.jpg";
    }
    else
    {
        personspic = "http://backstage." + myhappydomain + "/protected_content/" + mystery + "/userspics/" + picture;
    }
    mystyle="width:30px;height:30px;"
    if(poster_status == "guest")
    {
        posterslink = "a guest";
    }
    else
    {
        thelinkid = "userlink" + postID;
        posterslink = "<a href='http://backstage." + myhappydomain + "/userpage?u=" + userID + "' style='color:" + textcolor2 + ";' onmouseover='hovercolor(" + '"' + textcolor3 + '"' + "," + '"' + thelinkid + '"' + ")' onmouseout='hovercolor(" + '"' + textcolor2 + '"' + "," + '"' + thelinkid + '"' + ")' id='" + thelinkid + "'>" + publicname + "</a>";
    }
    if (time == "0")
    {
        nicetime = "";
    }
    else
    {
        nicetime = "<span style='font-size:80%;'>" + (maketimus(time)) + "</span> ";
    }
    var picid = "userpic" + postID;
    shownpic = "<img src='" + personspic + "' style='" + mystyle + "' id='" + picid + "' onload='resize_pic(30,30," + '"' + picid + '"' + ")' />";
    if ((poster_status != "guest" && viewersU == userID) || ismod == "yes")
    {
        erasebutton = " <img style='cursor:pointer;' src='common_files/pics/remove1.gif' alt='erase post' onmouseover='onbutton(" + '"droppost' + postID + '", "common_files/pics/remove2.gif"' + ")' onmouseout='onbutton(" + '"droppost' + postID + '", "common_files/pics/remove1.gif"' + ")' id='droppost" + postID + "' onclick='droppost(" + postID + "," + moviez + ")' />";
    }
    else
    {
        erasebutton = "";
    }
    thepost = "<div style='width:100%;'><table style='width:100%;color:" + textcolor1 + ";background-color:" + framecolor + ";'><tr><td style='text-align:center;vertical-align:middle;background-color:" + mypagecolor2 + ";width:32px;'>" + shownpic + "</td><td style='text-align:left;vertical-align:top;color:" + textcolor1 + ";background-color:" + mypagecolor + ";'>" + nicetime + posterslink + " said:<br />" + thecomment + erasebutton + "</td></tr></table></div>";
    document.getElementById(chatboxname).innerHTML = thepost;
}
var req10;
function droppost(postID, moviegel)
{
    var makesure=confirm("this will erase the post, are you sure?");
    if (makesure==true)
    {
        var urlz = "xmldroppost?movie=" + moviegel + "&messageID=" + postID;
        loadXMLDoc10(urlz);
    }
}
function loadXMLDoc10(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req10 = new XMLHttpRequest();
        req10.onreadystatechange = processReqChange10;
        req10.open("GET", url, true);
        req10.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req10 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req10)
        {
            req10.onreadystatechange = processReqChange10;
            req10.open("GET", url, true);
            req10.send();
        }
    }
}
function processReqChange10() 
{
    if (req10.readyState == 4)
    {
        if (req10.status == 200)
        {
            response = req10.responseXML.documentElement;
            result = response.getElementsByTagName("result")[0].firstChild.data;
            elmovi = response.getElementsByTagName("moviegol")[0].firstChild.data;
            if(result == "ok")
            {
                loadchat(elmovi,thepageimlookingat);
            }
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req10.statusText);
        }
    }
}
function iLoad(isrc)
{
    var oImg = new Image();
    var thebiggestis;
    oImg.src = isrc;
    if (oImg.complete)
    {
        if (oImg.width > oImg.height)
        {
            thebiggestis = "width";
        }
        else if (oImg.width < oImg.height)
        {
            thebiggestis = "height";
        }
        else if (oImg.width == oImg.height)
        {
            thebiggestis = "equal";
        }
    }
    else
    {
        thebiggestis = "error";
    }
    return thebiggestis;
}
function postthatcomment(guestoruser, thismoviez)
{
    thecomment = document.getElementById("mycomment").value;
    if(guestoruser == "guest")
    {
        theverificationimage = document.getElementById("imver").value;
    }
    else
    {
        theverificationimage = 0;
    }
    var urlz = "xmlmongraindesel?movie=" + thismoviez + "&imver=" + theverificationimage + "&comment=" + (encodeURIComponent(thecomment));
    loadXMLDoc8(urlz);
}
function loadXMLDoc8(url) 
{
    if (window.XMLHttpRequest)
    {
        // branch for native XMLHttpRequest object
        req8 = new XMLHttpRequest();
        req8.onreadystatechange = processReqChange8;
        req8.open("GET", url, true);
        req8.send(null);
    }
    else if (window.ActiveXObject)
    {
        // branch for IE/Windows ActiveX version
        req8 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req8)
        {
            req8.onreadystatechange = processReqChange8;
            req8.open("GET", url, true);
            req8.send();
        }
    }
}
function processReqChange8() 
{
    if (req8.readyState == 4)
    {
        if (req8.status == 200)
        {
            response = req8.responseXML.documentElement;
            result = response.getElementsByTagName("result")[0].firstChild.data;
            timeleft = response.getElementsByTagName("timeleft")[0].firstChild.data;
            elmovi = response.getElementsByTagName("moviegol")[0].firstChild.data;
            if (result == "ok")
            {
                loadchat(elmovi,1);
            }
            else if (result == "badcode")
            {
                errorcodemessage = "the code you entered in the box does not match the code on the page.";
                alert(errorcodemessage);
            }
            else if (result == "tooyoung")
            {
                erroryoungmessage = "you can leave a maximum of 1 comment per minute. please wait another " + timeleft + " seconds.";
                alert(erroryoungmessage);
            }
            else if (result == "writesomething")
            {
                writesomethingmessage = "you cannot post an empty message";
                alert(writesomethingmessage);
            }
            else
            {
                errormessage = "it didnt work...";
                alert(errormessage);
            }
        }
        else
        {
            alert("There was a problem retrieving the XML data:\n" + req8.statusText);
        }
    }
}
function explain(explanation)
{
    if(bgpics=='off')
    {
        var explanationz='<div style="position:relative;width:100%;">' +
        '<div style="position:relative;">' + explanation + '</div>' +
        '</div>';
    }
    else
    {
        var explanationz='<div style="position:relative;width:100%;">' +
        '<div style="position:absolute;top:1px;left:1px;width:100%;" class="black">' + explanation + '</div>' +
        '<div style="position:absolute;top:1px;left:-1px;width:100%;" class="black">' + explanation + '</div>' +
        '<div style="position:absolute;top:-1px;left:1px;width:100%;" class="black">' + explanation + '</div>' +
        '<div style="position:absolute;top:-1px;left:-1px;width:100%;" class="black">' + explanation + '</div>' +
        '<div style="position:absolute;top:0px;left:-1px;width:100%;" class="black">' + explanation + '</div>' +
        '<div style="position:absolute;top:0px;left:1px;width:100%;" class="black">' + explanation + '</div>' +
        '<div style="position:absolute;top:1px;left:0px;width:100%;" class="black">' + explanation + '</div>' +
        '<div style="position:absolute;top:-1px;left:0px;width:100%;" class="black">' + explanation + '</div>' +
        '<div style="position:relative;" class="white">' + explanation + '</div>' +
        '</div>';
    }
    document.getElementById("legendbox").innerHTML = explanationz;
}
function clearlegendmessage()
{
    document.getElementById("legendbox").innerHTML = "&#160;";
}


function resize_movi_pic(maxwidth, maxheigth)
{
    var javascrexpr = "exec_resize_movi_pic(" + maxwidth + ", " + maxheigth + ")";
    var random = (Math.random())*600;
    random = Math.abs(random);
    var t=setTimeout(javascrexpr,random);
}
function exec_resize_movi_pic(maxwidth, maxheigth)
{
    var thepiconmypage = document.getElementById("movi_pic");
    var image_source = thepiconmypage.src;
    var oImg = new Image();
    oImg.src = image_source;
    if (oImg.complete)
    {
        var width_of_this_pic_is_what_pr1_of_max = oImg.width / maxwidth;
        var height_of_this_pic_is_what_pr1_of_max = oImg.height / maxheigth;
        if(width_of_this_pic_is_what_pr1_of_max > 1 && width_of_this_pic_is_what_pr1_of_max >= height_of_this_pic_is_what_pr1_of_max)
        {
            var newwidth = Math.floor(oImg.width / width_of_this_pic_is_what_pr1_of_max);
            var newheigth = Math.floor(oImg.height / width_of_this_pic_is_what_pr1_of_max);
            thepiconmypage.style.width = newwidth + 'px';
            thepiconmypage.style.height = newheigth + 'px';
        }
        else if(height_of_this_pic_is_what_pr1_of_max > 1)
        {
            var newwidth = Math.floor(oImg.width / height_of_this_pic_is_what_pr1_of_max);
            var newheigth = Math.floor(oImg.height / height_of_this_pic_is_what_pr1_of_max);
            thepiconmypage.style.width = newwidth + 'px';
            thepiconmypage.style.height = newheigth + 'px';
        }
    }
}

