window.name='mainWin';
function openPopup (URL,TARGET,OPT) {
  window.onerror=null;
  window.open(URL,TARGET,OPT);
}


var USER_DATA = {
    Browser: {
                KHTML: /Konqueror|KHTML/.test(navigator.userAgent) &&
                !/Apple/.test(navigator.userAgent),
                Safari: /KHTML/.test(navigator.userAgent) &&
                /Apple/.test(navigator.userAgent),
                Opera: !!window.opera,
                Opera9: !!window.opera && /9/.test(window.opera.version()),
                FF: !!/Firefox/.test(navigator.userAgent),
                MSIE: !!(window.attachEvent && !window.opera),
                Gecko: /Gecko/.test(navigator.userAgent) &&
                !/Konqueror|KHTML/.test(navigator.userAgent)
    },
    OS: {
    Windows: navigator.platform.indexOf("Win") > -1,
    Mac: navigator.platform.indexOf("Mac") > -1,
    Linux: navigator.platform.indexOf("Linux") > -1
    }
}
Number.prototype.NaN0 = function(){return isNaN(this)?0:this;}

var IS_IE = USER_DATA['Browser'].MSIE;
var IS_OPERA9 = USER_DATA['Browser'].Opera9;
var IS_FF = USER_DATA['Browser'].FF;


function Coords ()
{


    function setXY(pElName, sElName)
    {
        try {
            var showEl  = document.getElementById(sElName);
            var positionEl = document.getElementById(pElName);

            var _coords  = getPosition(positionEl);
            var elHeight = getOffsetHeight(positionEl);

            var plusLeft = -1;
            var plusTop  = 0;

            if(IS_OPERA9) {
                //plusTop = -8;
                plusTop = 0;
                //plusLeft = -9;
                plusLeft = 4;
            }

            if(IS_FF) {
                plusTop = 5;
                plusLeft = 4;
            }

            var x=true;
            if(window.clipboardData&&document.compatMode){x=window.XMLHttpRequest?true:false;}
            else if(window.clipboardData) {x=false; if(!document.createDocumentFragment) x=false;}
            else if(document.doctype && !window.print ) x=false;
            if(x != true) {plusTop = -156;}

            showEl.style.top = _coords.y+elHeight+plusTop+"px";
            showEl.style.left = _coords.x+plusLeft+"px";
        } catch (e) {
        }

    }
    this.setXY = setXY




    function getPosition(e){
        var left = 0;
        var top  = 0;

        while (e.offsetParent) {
            left += e.offsetLeft + (e.currentStyle ?
            (parseInt(e.currentStyle.borderLeftWidth)).NaN0() : 0);
            top  += e.offsetTop  + (e.currentStyle ?
            (parseInt(e.currentStyle.borderTopWidth)).NaN0() : 0);
            e = e.offsetParent;
        }

        left += e.offsetLeft + (e.currentStyle ?
        (parseInt(e.currentStyle.borderLeftWidth)).NaN0() : 0);
        top  += e.offsetTop  + (e.currentStyle ?
        (parseInt(e.currentStyle.borderTopWidth)).NaN0(): 0);

        return {x:left, y:top};
    }

/*
function getAlignedPosition(e) {
    var left = 0;
    var top  = 0;

    while (e.offsetParent) {
        left += e.offsetLeft + (e.currentStyle ?
            (parseInt(e.currentStyle.borderLeftWidth)).NaN0() : 0);
        top  += e.offsetTop  + (e.currentStyle ?
            (parseInt(e.currentStyle.borderTopWidth)).NaN0() : 0);
        e  = e.offsetParent;

        if (e.scrollLeft) {left -= e.scrollLeft; }
        if (e.scrollTop)  {top  -= e.scrollTop; }
    }

    var docBody = document.documentElement ?
    document.documentElement : document.body;

    left += e.offsetLeft +
            (e.currentStyle ?
            (parseInt(e.currentStyle.borderLeftWidth)).NaN0()
            : 0) +
            (IS_IE ? (parseInt(docBody.scrollLeft)).NaN0() : 0) -
            (parseInt(docBody.clientLeft)).NaN0();
    top  += e.offsetTop  +
            (e.currentStyle ?
            (parseInt(e.currentStyle.borderTopWidth)).NaN0()
            :  0) +
            (IS_IE ? (parseInt(docBody.scrollTop)).NaN0() : 0) -
            (parseInt(docBody.clientTop)).NaN0();

    return {x:left, y:top};
}
*/

    function findOffsetHeight(e) {
        var res = 0;
        while ((res == 0) && e.parentNode) {
            e = e.parentNode;
            res = e.offsetHeight;
        }
        return res;
    }

    function getOffsetHeight(e) {
        return e.offsetHeight ||
               e.style.pixelHeight ||
               findOffsetHeight(e);
    }

    this.getOffsetHeight = getOffsetHeight;

}
var coords = new Coords;


function getObj(obj) //getElement
{
    try {
        return document.getElementById(obj);
    } catch (ff) {
        return 0;
    }
}


function jsTranslator()
{
    var context = '';
    var decoder = false;
    function html_entity_decode(string)
    {
        try {
            if (decoder == false) {
                decoder = document.createElement('textarea');
            }
            decoder.innerHTML = string;
            return decoder.value;
        } catch (ff) {
            return string; //not translated
        }
    }


    function t(key)
    {
        if (js_tr[context][key]) {
            return html_entity_decode(js_tr[context][key])
        }
    }
    this.t = t


    function setContext(cont)
    {
        context = cont;
    }
    this.setContext = setContext;
}//jsTranslator

function replaceStarsForIe6()
{
    var x=true;
    if(window.clipboardData&&document.compatMode){  x=window.XMLHttpRequest?true:false;}
    else if(window.clipboardData) {
        x=false;
        if(!document.createDocumentFragment) x=false;
    }
    else if(document.doctype && !window.print ) x=false;
    if(x != true) {
        for(var i in document.images) {
            var imagex = document.images[i].src;
            if(imagex != undefined) {
                var matchx = imagex.match(/star_full/g);
                if(matchx == "star_full") {
                    document.images[i].src = "/framework/fr-fr/icons/star_full.gif";
                }
                var matchx = imagex.match(/star_blank/g);
                if(matchx == "star_blank") {
                     document.images[i].src = "/framework/fr-fr/icons/star_blank.gif";
                }
            }
        }
    }
}
