
function move_box(an, box) {
    var cleft = -85;
    var ctop = -5;
    var obj = an;
    while (obj.offsetParent) {
        cleft += obj.offsetLeft;
        ctop += obj.offsetTop;
        obj = obj.offsetParent;
    }
    box.style.left = cleft + 'px';
    ctop += an.offsetHeight + 8;
    if (document.body.currentStyle && document.body.currentStyle['marginTop'])
        ctop += parseInt(document.body.currentStyle['marginTop']);
    box.style.top = ctop + 'px';
}

function show_hide_box(an, width, height, borderStyle) {
    var href = an.href;
    var boxdiv = document.getElementById(href);
    if (boxdiv != null) {
        if (boxdiv.style.display == 'none') {
            move_box(an, boxdiv);
            boxdiv.style.display = 'block';
        }
        else boxdiv.style.display = 'none';
        return false;
    }
    boxdiv = document.createElement('div');
    boxdiv.setAttribute('id', href);
    boxdiv.style.display = 'block';
    boxdiv.style.position = 'absolute';
    boxdiv.style.width = width + 'px';
    boxdiv.style.height = height + 'px';
    boxdiv.style.border = borderStyle;
    boxdiv.style.backgroundColor = '#fff';
    boxdiv.align = 'left';
    boxdiv.innerHTML = '<div id="google_translate_element" style="position:relative;left:5px"></div><a href="#" onClick="return show_hide_box(this,185,55,\'1px solid\')"><img style="position:absolute;top:3px;right:3px" src="http://biocitystudio.com/wp-content/themes/biocity/images/close-icon.gif" /></a>';
    var newScript = document.createElement('script');
    newScript.type = "text/javascript";
    newScript.src = 'http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit';
    document.body.appendChild(boxdiv);
    move_box(an, boxdiv);
    document.getElementById(href).appendChild(newScript);
    return false;
}

