// Launch DW Scroll

function init_dw_Scroll() {
    var wndo = new dw_scrollObj('wn', 'lyr1', 't1');
    wndo.setUpScrollControls('scrollLinks');


    wndo.on_scroll = wndo.on_glidescroll = function () {
        if (wndo.x == -wndo.maxX) {
            // put your conditions here for end of scroll area
           if(document.URL.match("identity")) {
  location.href = "collateral.html";
}
if(document.URL.match("collateral")) {
  location.href = "advertising.html";
}
if(document.URL.match("advertising")) {
  location.href = "branding.html";
}

           
           
        }
        if (wndo.x == 0) {
            // put your conditions here for start of scroll area
           
           
        }
    }
   
    //Added extra to link to a specific portion of the slide:
    var val = dw_getValueFromQueryString('elID');
    if ( val ) {
        // wndoId, id, lyrId, duration
        dw_scrollObj.scrollToId('wn', val, 'lyr1', 0); 
    }
   
}

// if code supported, link in the style sheet and call the init function onload
if ( dw_scrollObj.isSupported() ) {
    //dw_Util.writeStyleSheet('css/scroll.css');
    dw_Event.add( window, 'load', init_dw_Scroll);
}



// obj: link or window.location
function dw_getValueFromQueryString(name, obj) {
    obj = obj? obj: window.location;
    if (obj.search && obj.search.indexOf(name != -1) ) {
        var pairs = obj.search.slice(1).split("&"); // name/value pairs
        var set;
        for (var i=0; pairs[i]; i++) {
            set = pairs[i].split("="); // Check each pair for match on name
            if ( set[0] == name && set[1] ) {
                return set[1];
            }
        }
    }
    return '';
}
