function SetAllowAddColor() {
// set cookie and return true
	if(CheckColorSet(document.color)) {
		createCookie("AllowAddColor", "allow", 1);
		document.color.submit();	
		//reset the color text box
	} else {
		alert("Please Pick Color");
	}
}

function GetAllowAddColor() {
// check for cookie, and return true, else false
	var cookieValue;
	
	if(CheckColorSet(document.color2)) {
		cookieValue = readCookie("AllowAddColor");
		if(cookieValue = "allow" && cookieValue != null) {
			//alert("Allowed");
			document.color2.submit();
		} else {
			alert("Item Only Available With Purchase Of Kandy Bag");
		}
	} else {
		alert("Please Pick Color");
	}
}

function BasicCheckColorSet() {
	if(CheckColorSet(document.color3)) {
		document.color3.submit();	
		//reset the color text box
	} else {
		alert("Please Pick Color");
	}
}

function CheckColorSet(form) {
// check text box and make sure it's not blank, then return true, else false
	if(form.os0.value != "") {
		return true;
	} else {
		return false;
	}	
}

//Cookie functions
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


