var strXML = "";

var globals = null;

if (window.opener != null)
{
    globals = window.opener.globals;
}

var complete = false;

function document.onreadystatechange()
{
    if (document.readyState == "complete" && !complete)
    {
        complete = true;

        setButtonPosition();

        if (window.opener)
        {
            // strHtmlToPrint comes from repair.js or tsbframe.js
            articleSectionToPrint.innerHTML = window.opener.strHtmlToPrint;

            document.title = globals.getVar("ARTICLE_TITLE");
            ReplaceATags();
            globals.SetVehicleConfInTitle(document);
        }
        else
        {
            document.body.innerHTML = strLoaderError;
        }

        document.body.ondrag = KillDrag;
    }
}

function ReplaceATags()
{
    var elementsA = document.body.getElementsByTagName("A");

    for (i = 0; i < elementsA.length; i ++)
    {
        var aObj = elementsA[i];
    	
        if (aObj.className != "menu")
        {
            aObj.removeAttribute("href");
            aObj.runtimeStyle.cursor = "default";
            aObj.runtimeStyle.color = "black";
            aObj.runtimeStyle.textDecoration = "none";
        }
    }
}

function Close()
{
    if (window.opener != null)
    {
        window.close();
        window.opener.focus();
    }
    else
    {
        window.close();
    }
}

function KillDrag()
{
    return false;
}

function document.oncontextmenu()
{
    event.returnValue = false;
}

function document.onselectstart()
{
    event.cancelBubble = false;
    event.returnValue = false;
}

function window.onscroll()
{
    setButtonPosition();
}

function window.onresize()
{
    setButtonPosition();
}

function setButtonPosition()
{
    document.all.idScrollMenu.style.posTop = document.documentElement.scrollTop + 10;
    document.all.idScrollMenu.style.posLeft = 
        document.documentElement.clientWidth - document.all.idScrollMenu.clientWidth - 10;
}