function goShoppingPage() {

//--------------------------------------------------------------------------------
// goShoppingPage
//
// Determine which shopping page to go, either welcome or reward listing page. 
//--------------------------------------------------------------------------------

    sParam = getSearchResult(); // get from cookie
  
    if (sParam == "" || sParam == "none") {
        // no search result so direct to welcome page
        window.location.href = "../main/index.asp";
    } else {
        // has search result so direct to reward listing page
        window.location.href = "step1.asp?" + sParam;
    }
}


function getSearchResult() {

//--------------------------------------------------------------------------------
// getSearchResult
//
// Retrieve previous search result from cookie. 
//--------------------------------------------------------------------------------

    var sParam = document.cookie;

    if (sParam.indexOf("SearchString") == -1) {
        // not found
        return ("none");
    } else {    
        // cookie string fount
        var iStartPos = sParam.indexOf("SearchString") + 13;
        sParam = sParam.substring(iStartPos); // trim to start after SearchString=
    
        var iEndPos = sParam.indexOf(";");
        sParam = sParam.substring(0, iEndPos); // remove everything after the next ;
        
        return (sParam);
    }

}