// Show or hide the feedback for reflection idevice
function showAnswer(id,isShow) {
    if (isShow==1) {
        document.getElementById("s"+id).style.display = "block";
        document.getElementById("hide"+id).style.display = "block";
        document.getElementById("view"+id).style.display = "none";
    } else {
        document.getElementById("s"+id).style.display = "none";
        document.getElementById("hide"+id).style.display = "none";
        document.getElementById("view"+id).style.display = "block";
    }
}


//START PopOver.js
function popOver(linkObj){
    var aObj = linkObj;
    popName = linkObj.id + 'Pop';
    var myPop = document.getElementById(popName);
    if(myPop){
        linkObj.timer = setTimeout("movePop('" + popName + "','"+ linkObj.id +"\
')", 1000);
        lockPop(myPop);
    }
}
function movePop (popName, linkObj ){
    var myPop = document.getElementById(popName);
    var aLink = document.getElementById(linkObj);
    var myPopURL = window.location.href;

    var checkmyCompanyURL = myPopURL.match("company-profiles");
    var checkmyExecURL = myPopURL.match("executive-profiles");
    if (checkmyCompanyURL != "company-profiles" && checkmyExecURL != "executive\
-profiles") {
        var offsetPx = 14;
        myPop.style.left = getTotalLeft(aLink) + 'px';
        myPop.style.top = getTotalTop(aLink) + offsetPx + 'px';
    } else {
        aLink.style.position = "relative";
        myPop.style.position = "absolute";
        var pos = Position.cumulativeOffset(aLink);
        var newTop = (pos[1] - 540) + 'px';
        myPop.style.top = newTop;
        var newLeft = (pos[0] - 100) + 'px';
        myPop.style.left = newLeft;
    }
}
function unPopOver(myObj){
    clearTimeout(myObj.timer);
    var myId = myObj.id;
    if(myId.indexOf('Pop') < 0){
        myId = myId + 'Pop';
    }
    var myPop = document.getElementById(myId);
    if(myPop){
        myPop.popLock = false;
        setTimeout("closePopOver('" + myId + "')", 1000);
    }
}
function closePopOver(myId, overRide){
    var myPop = document.getElementById(myId);
    if(!myPop.popLock || overRide){
        myPop.style.left = '-1000px';
        myPop.style.top = '-1000px';
        myPop.popLock = false;
    }
}
function lockPop(myPop){
    myPop.popLock = true;
}
function getTotalTop(obj) {
    return getTotalCommon(obj,true);
}
function getTotalLeft(obj) {
    return getTotalCommon(obj,false);
}
function getTotalCommon(obj, blnTop) {
    var i = 0;
    while (obj.tagName != 'BODY') {
        i += blnTop ? obj.offsetTop : obj.offsetLeft;
        obj = obj.offsetParent;
    }
    return i;
}
//END PopOver.js
