﻿$(function () {
    var strapIndex = getCookie('strapIndex');
    var index = parseInt(Math.random() * 4) + 1;

    if (strapIndex != "" && strapIndex != null && strapIndex != false) {
        index = parseInt(strapIndex);
    }
    else {
        setCookie('strapIndex', index, null);
    }

    /*
    switch (index) {
        case 1: $('body').attr('id', 'ng_us_fuschia'); color = 'fuschia'; break;
        case 2: $('body').attr('id', 'ng_us_navy'); color = 'navy'; break;
        case 3: $('body').attr('id', 'ng_us_aqua'); color = 'aqua'; break;
        //case 3: $('body').attr('id', 'ng_us_orange'); color = 'orange'; break;    
        default: $('body').attr('id', 'ng_us_orange'); color = 'orange';
    }
    */
    $('body').attr('id', 'ng_us_versant');
    color = 'versant';
});         /****End onload functions*******/

function getCookie(c_name) {
    if (document.cookie.length > 0) {
        var i, x, y, ARRcookies = document.cookie.split(";");
        for (i = 0; i < ARRcookies.length; i++) {
            x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
            y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
            x = x.replace(/^\s+|\s+$/g, "");
            if (x == c_name) {
                return unescape(y);
            }
        }
    }
    return false;
}

function setCookie(c_name, value, expiredays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) +
	((expiredays == null) ? ";path=/" : ";expires=" + exdate.toUTCString()); +"path=/";
}

