<!-- Begin hiding

function getCookieVal (offset) {

    // This function returns the portion of the "nymrDiesel=userName'" string
    // between the = and the ;
    var endstr = document.cookie.indexOf (";", offset);

    if (endstr == -1) {
        endstr = document.cookie.length;
    }
    return unescape(document.cookie.substring(offset, endstr));
}

function getCookie (cookieName)  {

    // We have to pick apart the cookie text.  First, we need to
    // find out how many characters are in the string "nymrDiesel="
    // and how long the entire cookie string is.

    var arg = cookieName + "=";  
    var argLength = arg.length;
    var cookieLength = document.cookie.length;

    var i = 0;

    // While the "i" counter is less than the number of characters in 
    // the cookie...
    while (i < cookieLength)  {

        // Offset the "j" counter by the number of characters in
        // "nymrDiesel=".
        var j = i + argLength;

        // If "nymrDiesel=" is found in the cookie contents
        // return the value associated with "nymrDiesel="
        if (document.cookie.substring(i, j) == arg) {
            return getCookieVal(j);
        }
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) {
            break
        }
     } 
     return null;
}

function setCookie(name, value) {
    
    // Capture all the arguments passed to the setCookie() function.

    var argv = setCookie.arguments;

    // Determine the number of arguments passed into this function
    var argc = setCookie.arguments.length;

    // We expect the 3rd argument passed in to be the expiration date.
    // If there isn't a third argument, set the expires variable to null.
    // (An expiration date of null marks a cookie as transient.  Transient
    // cookies are not saved to disk.)
    var expires = (argc > 2) ? argv[2] : null;

    // We expect the 4th argument passed in to be the path.
    // If there isn't a fourth argument, set the path variable to null. 
    var path = (argc > 3) ? argv[3] : null;

    // We expect the 5th argument passed in to be the domain.
    // If there isn't a fifth argument, set the domain variable to null. 
    var domain = (argc > 4) ? argv[4] : null;

    // We expect the 6th argument passed in to be true or false, 
    // depending on whether this cookie is secure (can be transmitted
    // only to a secure server via https) or not.
    // If there isn't a sixth argument, set the secure variable to false. 
    var secure = (argc > 5) ? argv[5] : false;

    // Set the cookie.

    document.cookie = name + "=" + escape(value) + 
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
        ((path == null) ? "" : ("; path=" + path)) + 
        ((domain == null) ? "" : ("; domain=" + domain)) + 
        ((secure == true) ? "; secure" : "");
}

function setJumpTo(urlName, value) {

    // If the name is missing, set next url as "welcome.htm"

    if (urlName == "" || urlName == null) {
        urlName = "welcome.htm"
    }

    // If no cookie called 'nymrDiesel' exists...
    if(getCookie('nymrDiesel') == null) {
 
        // Set the expiration date to today.
        var expdate = new Date();
      
        // Set the expiration date (which JavaScript stores as milliseconds
        // to a time exactly one minute in the future.

//        expdate.setTime(expdate.getTime() + (1000 * 60)); 
//        setCookie('nymrDiesel', urlName, expdate);  
        setCookie('nymrDiesel', urlName);  

        // Whisk the user to the requested page.
        top.location.href = "http://www.nymrdiesel.co.uk/index.htm"
     }
}

//Function to remove cookie
function removeCookie(cookieName) {
  var expired = new Date();
  expired.setTime(expired.getTime() - 1000000000);
  if (getCookie(cookieName) != null) {
    document.cookie = "nymrDiesel=" + null + "; expires=" + expired.toGMTString();
  }
}

// End hiding -->
