var strapIndex = getCookie('strapIndex');
var index = parseInt(Math.floor(Math.random() * 3));
var color = '';

	$(function () {
		if (strapIndex != "" && strapIndex != null && strapIndex != false) {
			index = parseInt(strapIndex);
		}
		else {
			setCookie('strapIndex', index, null);
		}
		switch (index) {
			case 0: $('body').attr('id', 'blue'); color = 'blue'; break;
			case 1: $('body').attr('id', 'green'); color = 'green'; break;
			case 2: $('body').attr('id', 'red'); color = 'red'; break;
			default: $('body').attr('id', ''); color = 'default';
		}
	
	});

	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=/";
	}
