﻿// JScript File


function revealEffect_show(objid, transition)
{

var obj = document.getElementById(objid);

if (obj!=null)
    {
    if (obj.style.visibility=='visible') {revealEffect_hide(obj, transition)};

    var origfilter = obj.style.filter;

    obj.style.filter='revealTrans(duration=1, transition=' + transition + ')';
    obj.filters.revealTrans.apply();
    obj.style.visibility='visible';
    obj.filters.revealTrans.play();
    obj.style.filter = origfilter;
    };
}

function revealEffect_hide(objid, transition)
{

var obj = document.getElementById(objid);

if (obj!=null)
    {
    var origfilter = obj.style.filter;
    obj.style.filter="revealTrans(duration=1, transition="  + transition + ")";
    obj.filters.revealTrans.apply();
    obj.style.visibility="hidden";
    obj.filters.revealTrans.play();
    obj.style.filter = origfilter;
    }
}

function findAboluteLeft(obj) 
{
    if (obj!=null){    
        if (obj.TagName!='BODY')
            {
            return obj.offsetLeft + findAboluteLeft(obj.offsetParent);
            }
        else 
        {return 0;}
        
    } else {return 0;}
}

function findAboluteTop(obj) 
{
    if (obj!=null){    
        if (obj.TagName!='BODY')
            {
            return obj.offsetTop + findAboluteTop(obj.offsetParent);
            }
        else 
        {return 0;}
        
    } else {return 0;}
}



function ShowHint(taskid, hintid, frameid, titleid, link, width)
{
    var pnl_hint = document.getElementById(hintid);
    var pnl_task = document.getElementById(taskid);
    var fme_hint = document.getElementById(frameid);
    var span_title = document.getElementById(titleid);
        
    
    if ((pnl_hint!=null)&&(pnl_task!=null))
        {
        fme_hint.src = '';
                
        var x = 0;
        var y = 0;
        
        
        x = findAboluteLeft(pnl_task);
        y = findAboluteTop(pnl_task);
                                
        pnl_hint.style.zIndex = 1;            
        
        fme_hint.src = link;
                 
         var windowwidth = 0, windowheight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            windowwidth = window.innerWidth;
            windowheight = window.innerHeight;
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            windowwidth = document.documentElement.clientWidth;
            windowheight = document.documentElement.clientHeight;
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            windowwidth = document.body.clientWidth;
            windowheight = document.body.clientHeight;
          }
     
//        
//        if (x + width > windowwidth - 16){
//            pnl_hint.style.posLeft = x - width;
//            }
//        else {
//            pnl_hint.style.posLeft = x + 100;
//        }
//        
//        
//          
//        if (y + 200 > windowheight){
//            pnl_hint.style.posTop = y - 200;
//            }
//        else {
//            pnl_hint.style.posTop = y;
//        }

        pnl_hint.style.posLeft = (windowwidth - width) / 2;
        pnl_hint.style.posTop = y - 200 ;// window.document.body.scrollTop;
        
               
                        
        revealEffect_show(pnl_hint.id, 4);
        
        
        };                
}


function displayblock(blockid, width) {


    var windowwidth = 0, windowheight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        windowwidth = window.innerWidth;
        windowheight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        windowwidth = document.documentElement.clientWidth;
        windowheight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        windowwidth = document.body.clientWidth;
        windowheight = document.body.clientHeight;
    }


    var b = document.getElementById(blockid);

    if (b != null) {


        b.style.posLeft = (windowwidth - width) / 2;
        b.style.posTop = getScrollPos() + (windowheight - 100) / 2;

        revealEffect_show(blockid, 1);
    }

}

function getScrollPos() {
    var scrollPos = document.documentElement.scrollTop;
    if (typeof window.pageYOffset != 'undefined') {
        scrollPos = window.pageYOffset;
    } else
        if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
        scrollPos = document.documentElement.scrollTop;
    } else
        if (typeof document.body != 'undefined') {
        scrollPos = document.body.scrollTop;
    }

    return scrollPos;

}