function printDoc() {
if(window.print) window.print()
    else alert (tr.pressCltP);
}

function bookmark (url, description){
if(window.external) window.external.AddFavorite(url,description);
else alert (tr.pressCtlD);
}

function showFrameContainer (el, container, frame, url, width, height, xOffset, yOffset, busyUrl){
    if (document.getElementById){
        var e = document.getElementById(el);
        var c = document.getElementById(container);
        var f = document.getElementById(frame);
        if (c.style.display == "block"){
            c.style.display="none";
return false;
        }
        if (f.src != url) f.src=url;
        var l=0; var t=0;
        aTag = e;
            do {
                aTag = aTag.offsetParent;
                l += aTag.offsetLeft;
                t += aTag.offsetTop;
            } while (aTag.offsetParent && aTag.tagName != 'BODY');
        var left =  e.offsetLeft + l;
if (xOffset) left += xOffset;
        var top = e.offsetTop + t
if (yOffset) top += yOffset;
if (!width) width = parseInt(c.style.width);
if (width && ( (left + width) > getBrowserWidth() )) left = getBrowserWidth() - width - 40;
if (left < 0) left = 0;
        c.style.left = left+'px';
        c.style.top = top+'px';
        c.style.display="block";
        return false;
    } else {
        window.open(url);
    }
}

function hideFrameContainer (container, frame, busyUrl) {
    if (document.getElementById){
        var c=document.getElementById(container);
        var f=document.getElementById(frame);
        c.style.display="none";
    }
}

function showPhoto (imgSrc, imgCont){
    if (document.getElementById){
        var c = document.getElementById(imgCont);
        if (c.style.display != "block"){
            c.innerHTML = '<img src="' + imgSrc + '">';
        }
else {
            c.innerHTML = '<img src="' + tr.icons + '/transparent.gif">';
            c.style.display="none";
        }
    }
}

function hideEl(el){
if (document.getElementById){
        document.getElementById(el).style.display = 'none';
    }
}

function showEl(el){
    if (document.getElementById){
        document.getElementById(el).style.display = 'block';
    }
}


function tickCheckBox(el){
if (document.getElementById) {
if (document.getElementById(el)){
document.getElementById(el).checked=true;
}
}
return true;
}

function openCurrencyConverter(obj, amount, currency) {
    if (document.getElementById) {
        document.getElementById("amount").value = amount;
        document.getElementById("sourceCurrency").value = currency;
document.getElementById("currencyResults").style.display = 'none';
        positionObj(obj, 'currencyconv');
document.getElementById('currencyconv').style.display = 'block';
    }
}

function calculateCurrency () {
    if (document.getElementById) {
        var a = document.getElementById("amount").value;
        var sc = currencydb[document.getElementById("sourceCurrency").value];
        var sd = currencydb[document.getElementById("destinationCurrency").value];
        var da = Math.round(100 * a * (sd.val / sc.val)) / 100;
        document.getElementById("displayCurrencyResults").innerHTML = sc.symbol +" "+a+" = " + sd.symbol + " " + da;
document.getElementById('currencyResults').style.display = "block";
        return false;
    }
}

function closeCurrencyConverter() {
    if (document.getElementById) {
        document.getElementById('displayCurrencyResults').innerHTML = "";
document.getElementById('currencyResults').style.display = "none";
        document.getElementById('currencyconv').style.display = "none";
        // return false;
    }
}


function showDiv (el, div, alignX, alignY) {
if (document.getElementById){
    var i = document.getElementById(el);
var c = document.getElementById(div);
        if (c.style.display != "block"){
var l=0; var t=0;
            aTag = i;
            do {
                aTag = aTag.offsetParent;
                l += aTag.offsetLeft;

                t += aTag.offsetTop;
            } while (aTag.offsetParent && aTag.tagName != 'BODY');
        var left =  i.offsetLeft + l;
        var top = i.offsetTop + t + i.offsetHeight + 2;
if (alignX == 'left' && c.style.width){
left = left - parseInt(c.style.width);
}
if (alignY == 'top' && c.style.height){
top = top - parseInt(c.style.height) -25;
}
        c.style.left = left+'px';
        c.style.top = top+'px';
c.style.display = "block";
} else {
c.style.display="none";
}
}
}

function hideDiv (div) {
if (document.getElementById){
var c=document.getElementById(div);
c.style.display="none";
}
}

var hide  = true;

function positionObj (p, el){
if (document.getElementById){
var e = document.getElementById(el);
        var bw = getBrowserWidth();

var l=0; var t=0;
aTag = p;
do {
aTag = aTag.offsetParent;
l += aTag.offsetLeft;
t += aTag.offsetTop;
} while (aTag.offsetParent && aTag.tagName != 'BODY');
var left =  p.offsetLeft + l;

// this should be replaced by something generic.
// for some reason e.style.width is emptly, so
// i cannot read the width of this element

var width = 300;
if (left + width > bw){
left = bw-width-30;
}

var top = p.offsetTop + t + p.offsetHeight + 2;
e.style.left = left+'px';
e.style.top = top+'px';
}
}

function getBrowserWidth(){
  var w = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    w = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    w = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    w = document.body.clientWidth;
  }
  return w;
}

function getBrowserHeight(){
  var h = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    h = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    h = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    h = document.body.clientHeight;
  }
  return h;
}

function showBlock(el){
if (document.getElementById) {
document.getElementById(el).style.display = 'block';
}
}

function displayArrow(ulist, image) {
    var ulBlock = document.getElementById(ulist);
    var ulBlockDisplay = ulBlock.style.display;
    var arrowImg = document.getElementById(image);
    if (ulBlockDisplay == "none") {
        arrowImg.style.backgroundPosition = "0 -11px";
    }
    else {
        arrowImg.style.backgroundPosition = "left top";
    }
}
function toggleTxt(ulist, spanAll, spanTop) {
    var ulBlock = document.getElementById(ulist);
    var ulBlockDisplay = ulBlock.style.display;
    var txtAll = document.getElementById(spanAll);
    var txtTop = document.getElementById(spanTop);
    if (ulBlockDisplay == "none") {
        txtAll.style.display = "none";
        txtTop.style.display = "inline";
    }
    else {
        txtAll.style.display = "inline";
        txtTop.style.display = "none";
    }
}

function sSc(q, bar, score){
    if (document.getElementById){
        document.getElementById('rbar_'+q).style.backgroundPosition= bar + 'px 0';
        document.getElementById('rsc_' + q).innerHTML=score;
    }
}
function sSc2(nr, el){
    if (document.getElementById){
        document.getElementById('rnr').innerHTML=nr;
        for ( var i = -1; i < 10; i++ ) {
            var l = document.getElementById('rl' + i);
            if (l) {
                l.style.color='';
                l.style.textDecoration='underline';
            }
        }
        el.style.color='#003580';
        el.style.textDecoration='none';
        el.blur();
    }
}