function TimerSet()
{
    document.getElementById('ctl00_MainContentPlaceHolder_btnNext').click()
}

function changeCss(elt, cssClass) 
{
    elt.className = cssClass;
}

function GetEnterKey(e, buttonid) 
{
    var evt = e ? e : window.event;
    var bt = document.getElementById(buttonid);
    if (bt)
    {
        if (evt.keyCode == 13)
        {
            bt.click();
            return false;
        }
    }
}

function CheckSelection() 
{
    form = document.getElementById("aspnetForm");
    inputs = form.getElementsByTagName("input");
    count = 0;
    for(i=0 ; i<inputs.length ; i++)
    {
        if(inputs[i].type=="checkbox" && inputs[i].checked==true)
        {
            count++;
        }
    }
    if (count == 0)
    {
        alert('Veuillez s\351lectionner au moins un produit');
    }
}

function onClientActiveTabChanged(sender, args)
{
    var lnk = document.getElementById('ctl00_MainContentPlaceHolder_lnkChangeDate');
    var hiddenInput = document.getElementById('ctl00_MainContentPlaceHolder_tabDisplayedIndex');
    hiddenInput.value = sender.get_activeTabIndex();
    var lastIndex = sender.get_tabs().length - 1;
    if(sender.get_activeTabIndex() == 2)
    {
        lnk.style.display = 'none'
    }
    else
    {
         lnk.style.display = 'block'
    }
}

function checkBoxes()
{
    form = document.getElementById("aspnetForm");
    inputs = form.getElementsByTagName("input");
    count = 0;
    for(i=0 ; i<inputs.length ; i++)
    {
        if(inputs[i].type=="checkbox" && inputs[i].checked==true)
        {
            count++;
        }
    }

    for(i=0 ; i<inputs.length ; i++)
    {
        if(inputs[i].type=="submit" && inputs[i].name.indexOf("ViewNavHistory") != -1)
        {
          inputs[i].disabled=(count == 0);
        }
    }
    return false;
}


function findLeftPositionOfTheControl(control)
{
    var curleft = 0;
    if(control.offsetParent)
    {
        while(1) 
        {
            curleft += control.offsetLeft;
            if(!control.offsetParent)
            {
                break;
            }
            control = control.offsetParent;
        }
    }
    else if(control.x)
    {
        curleft += control.x;
    }
    return curleft;
}

function findTopPositionOfTheControl(control)
{
    var curtop = 0;
    if(control.offsetParent)
    {
        while(1)
        {
            curtop += control.offsetTop;
            if(!control.offsetParent)
            {
                break;
            }
            control = control.offsetParent;
        }
    }
    else if(control.y)
    {
        curtop += control.y;
    }
    return curtop;
}