﻿


function showToolTip(ctl, title, desc)
{
    var elemPos = elementPosition(ctl);
    //alert('Left: ' + elemPos.x + '\nTop: ' + elemPos.y);



    var tt = document.getElementById('divTT1')
    var ttTitle = document.getElementById('divTTTitle')
    var ttDesc= document.getElementById('divTTDesc')

    ttTitle.innerHTML = title;
    ttDesc.innerHTML = desc;
        
    ctl.style.cursor='hand';
    ctl.style.cursor='pointer';
    tt.style.display = 'block';

    var top = elemPos.y + ctl.offsetHeight + 5;
    var left = elemPos.x;
    top = top + "px";
    left = left + "px";
    
    tt.style.top = top;
    tt.style.left = left;

}
        
        


function elementPosition(ctl) 
{
    var curleft = 0;
    var curtop = 0;
    
    if(ctl.offsetParent)
    {
        curleft = ctl.offsetLeft;
        curtop = ctl.offsetTop;
        
        while(ctl = ctl.offsetParent)
        {
            curleft += ctl.offsetLeft;
            curtop += ctl.offsetTop;
        }

    }
   
        
        return {x: curleft, y: curtop};
    
    }





function hideToolTip(ctl) {
    var tt = document.getElementById('divTT1')            
    tt.style.display = 'none';
    ctl.style.cursor = 'default'; 
    
}

    
    
    
    
      function newWin(mypage, myname, w, h, scroll) 
    {

        //var winl = (screen.width - 1) / 2;
        //var wint = (screen.height - h) / 2;
        var winl = 100;
        var wint = 100;

        winprops = 'height=' + h + ', width=' + w + ', top=' + wint + ',left=' + winl + ',scrollbars=' + scroll + ',resizable=yes'
        win = window.open(mypage, myname, winprops)
        if (parseInt(navigator.appVersion) >= 4) 
        {
            win.window.focus();
        }
    }


    function newWinDefault(mypage, myname, w, h, scroll) {

        //var winl = (screen.width - 1) / 2;
        //var wint = (screen.height - h) / 2;
        var winl = 100;
        var wint = 100;

        winprops = 'height=600, width=1000, top=' + wint + ',left=' + winl + ',scrollbars=yes,resizable=yes'
        win = window.open(mypage, myname, winprops)
        if (parseInt(navigator.appVersion) >= 4) {
            win.window.focus();
        }
    }

    function showAd(imageControl, adType) {

        var page = 'Ad.aspx?adType=' + adType + '&image=' + document.getElementById('img' + imageControl).src + '?imageNumber=' + document.getElementById('hdnId' + imageControl).value
        newWin(page, '', 1100, 600, 'yes')
        //   window.open('Ad.aspx?adType=' + adType + '&image=' + document.getElementById('img' + imageControl).src + '?imageNumber=' + document.getElementById('hdnId' + imageControl).value);

    }

    function showSite(imageControl, adType) {
        var link = 'hdnURL' + imageControl;
        newWinDefault(document.getElementById(link).value, '');

    }  

