/*************************************************************************************/
/*************************************************************************************/

function getBrowserWidth()
{
var winW = 630;
if (navigator.appName=="Netscape") 
{
winW = window.innerWidth;
}
 
if (navigator.appName.indexOf("Microsoft") != -1) 
{
winW = document.body.offsetWidth;
}
return winW;
}

/*************************************************************************************/
/*************************************************************************************/

function getBrowserHeight()
{
var winH = 460;
if (navigator.appName=="Netscape") 
{
 winH = window.innerHeight;
}
 
if (navigator.appName.indexOf("Microsoft") != -1) 
{
winH = document.body.offsetHeight;
}
return winH;
}

/*************************************************************************************/
/*************************************************************************************/

function getWidthCenterPosition(ObjectWidth)
{
return (getBrowserWidth() - ObjectWidth) / 2;
}

/*************************************************************************************/
/*************************************************************************************/

function getHeightCenterPosition(ObjectHeight)
{
return (getBrowserHeight() - ObjectHeight) / 2;
}

/*************************************************************************************/
/*************************************************************************************/

function setControlPosition(ObjectWidth, divCtr)
{
var divTemp = document.getElementById(divCtr);
divTemp.style.left = getWidthCenterPosition(ObjectWidth) + 'px';
}

/*************************************************************************************/
/*************************************************************************************/

function ForceLinksToOpenInNewWindo()
{
    var getDiv = document.getElementById("left")
    var getDivA = getDiv.getElementsByTagName("a")
    for(i=0; i<getDivA.length; i++) 
    {
        getDivA[i].target="_blank"
    }
}

/*************************************************************************************/
/*************************************************************************************/

function RemoveAmp(data) 
{
    var newString = new String(data);
    newString = newString.replace(/amp;/g, "");
    return newString;
}

/*************************************************************************************/
/*************************************************************************************/

function GenerateRightOutput(data) 
{
    var newData = new String("");
    var i;
    for(i=0; i<data.length; i++)
    {
        if(data.charAt(i) != '\\')
        {
            newData += data.charAt(i);
        }
    }   
    return RemoveAmp(newData);
}

/*************************************************************************************/
/*************************************************************************************/

function LoadContent(FileToOpen) 
{
    var req = new XMLHttpRequest();
    req.open("GET", FileToOpen, false);
    req.send(null);
    var page = req.responseText;
    document.getElementById('left').innerHTML = GenerateRightOutput(page);
    ForceLinksToOpenInNewWindo();
}   

/*************************************************************************************/
/*************************************************************************************/

function LoadRightContent(FileToOpen) 
{
    var req = new XMLHttpRequest();
    req.open("GET", FileToOpen, false);
    req.send(null);
    var page = req.responseText;
    document.getElementById('tekst').innerHTML = GenerateRightOutput(page);
    ForceLinksToOpenInNewWindo();
}   

/*************************************************************************************/
/*************************************************************************************/

function GetRawPageData(FileToOpen) 
{
    var req = new XMLHttpRequest();
    req.open("GET", FileToOpen, false);
    req.send(null);
    var page = req.responseText;
    return page;
} 

/*************************************************************************************/
/*************************************************************************************/

