/* suppression du cookie pour page promo */
var ID = '';
var echeance = new Date();
var delaiDepasse = echeance.getTime() - (24 * 60 * 60 * 1000);
echeance.setTime(delaiDepasse);
document.cookie = 'promo=' + ID + '; expires=' + echeance.toGMTString();

/**
 * use by _showSearchBarSU view
 */
function _openMagasin(_op)
{
    _obj = document.getElementById('formDns');
    _dnsSelect = document.getElementById('dns');
    _dns = _dnsSelect.options[_dnsSelect.selectedIndex].text;
    _rpdv = _dnsSelect.options[_dnsSelect.selectedIndex].value;

    if (_rpdv != "")
    {
        _width  = document.getElementById('wTract').value;
        _height = document.getElementById('hTract').value;
        _page   = document.getElementById('targetUrl').value +'/' + _rpdv;

        _openTract(_page, _width, _height);

        document.location = 'http://' + _dns + '/portailu/local/pg_d_sysu_bonnes_affaires_promos_acc#' + _op;
    }
    else
    {
        alert('Vous devez sélectionner votre magasin.');
    }
    return false;
}
/**
 * use by _showSearchBarSU view
 */
function _openTract(Page, width, height )
{
    var x = (640 - width)/2;
    var y = (480 - height)/2;
    if ( screen )
    {
        y = (screen.availHeight - height)/2;
        x = (screen.availWidth - width)/2;
    }
    if (screen.availWidth > 1800)
    {
        x = ((screen.availWidth/2) - width)/2;
    }
    window.open(Page,'tract', 'width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x+', resizable=yes');
    return false;
}
