LeftMenuAwards = {};

LeftMenuAwards.ChangeContent = function() {
    var request = new CHttpRequest();
    sender = document.getElementById('AwardContentBlock');
    request.QueryString = "AjaxType=HTML&RequestFile=Blocks.LeftMenuAwards&MethodName=XGetContent";
    request.AsyncCall = true;
    request.State = sender;
    
     Element = document.getElementById('AwardContentBlockRecord');
    nCurrentRecordID = Element.getAttribute('record');
   // alert(nCurrentRecordID);
    request.AddProperty("Arguments[CurrentRecordID]", nCurrentRecordID);
    request.OnResponse = LeftMenuAwards.ChangeContentent_Callback;
    request.Send();
}

LeftMenuAwards.ChangeContentent_Callback = function(request, state) {

    LeftMenuAwards.OpacityEffect('LayerAwards', 1, 100, 1000, request.responseText);
    state.disabled = false;
}

window.setTimeout("LeftMenuAwards.ChangeContent()", 2000);




LeftMenuAwards.ChangeText = function(id, value) {
    ShadowContentLayerContainer = document.getElementById(id);
    ShadowContentLayerContainer.innerHTML = value;
}

LeftMenuAwards.StyleDisplay = function(id, value) {
    document.getElementById(id).style.display = value;
}

/*  Opacity Effect   */
LeftMenuAwards.OpacityEffect = function(id, opacStart, opacEnd, millisec, sText) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    if (opacStart > opacEnd) { // появяване
        for (i = opacStart; i >= opacEnd; i--) {
            setTimeout("LeftMenuAwards.ChangeOpacity(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
        setTimeout(" LeftMenuAwards.StyleDisplay('LayerAwards', 'none')", (timer * speed));
        setTimeout("LeftMenuAwards.ChangeContent()", 5000);

    } else if (opacStart < opacEnd) { // скриване
        for (i = opacStart; i <= opacEnd; i++) {
            if (i == opacStart) {
                LeftMenuAwards.StyleDisplay('LayerAwards', 'block');
            }
            setTimeout("LeftMenuAwards.ChangeOpacity(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
        setTimeout("LeftMenuAwards.ChangeText('AwardContentBlock', '" + sText + "')", (timer * speed));
        setTimeout("LeftMenuAwards.OpacityEffect('LayerAwards', 100, 1, 1000, '')", (timer * speed));
    }
}

LeftMenuAwards.ChangeOpacity = function(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
