﻿var cm = null;
var cmel = null;
var active = false;
var cmbc = '';
//document.onclick = new Function("show(null)")
function ys_CalGetPos(el, sProp) {
    var iPos = 0;
    while ((el != null) && (el.id.indexOf('tabs') < 0)) { //
        iPos += el["offset" + sProp];
        el = el.offsetParent;
//        if (el.id.indexOf('cal') >= 0) {
//            el = null;
//        } else {
//            el = el.offsetParent;
//        }
    }
    return iPos;
}
function ys_CalShow(el, m) {
    if (active != el) {
        active = el;
        var myFx = new Fx.Tween(el);
        myFx.start('background-color', '#DDDDDD', '#F5F5F5');
        //setTimeout('active=null;',150);
    }

    el.style.backgroundColor = '#FFFFFF';

    if (m) {
        m.style.display = '';
        m.style.pixelLeft = ys_CalGetPos(el, "Left");
        m.style.pixelTop = ys_CalGetPos(el, "Top") + el.offsetHeight + 45;
    }
    if ((m = cm) && (cm)) cm.style.display = 'none';
    if ((m != cm)) cm.style.display = 'none';
    cm = m;
}
function ys_CalShow2(el, m) {
    if (m) {
        if ((el.style.backgroundColor) && (el.style.backgroundColor != '#ffffff')) {
            cmbc = el.style.backgroundColor;
        }
        el.style.backgroundColor = '#FFFFFF';
        m.style.display = 'block';
        m.style.pixelLeft = ys_CalGetPos(el, "Left");
        m.style.pixelTop = ys_CalGetPos(el, "Top") + el.offsetHeight + 45;
    }
    if ((m != cm) && (cm)) {
        cm.style.display = 'none';
        cmel.style.backgroundColor = cmbc;
        cm = m;
        cmel = el;
    } else if (cm) {
        m.style.display = 'none';
        el.style.backgroundColor = cmbc;
        cm = null;
        cmel = null;
    } else {
        cm = m;
        cmel = el;
    }
}
