var SizesCookie = function(el, options, strCookieName){
	var $el = $(el);
	var COOKIE_NAME = typeof strCookieName == "undefined" ? "SizeSelections" : strCookieName;
	var arrValue = new Array();
	
	var init = function(){
		if(options){
			if(options.jqElement && options.eventName){
				options.jqElement.bind(options.eventName,addCookieValue);
			}
		}
		
		$el.bind("addCookieValue", addCookieValue);
	}
	
	var addCookieValue = function(){
		var strValue = $.cookie(COOKIE_NAME);
		var intCount = 0;
		var txtValue = $.trim($el.val()).toLowerCase();
		
		if(txtValue.length > 0){
			if(strValue == null|| strValue.length == 0){
				arrValue[0] = $.trim(txtValue);
			}else{
				arrValue = strValue.split(",");
				if($.inArray(txtValue,arrValue) == -1){
					if(arrValue.length >= 6){
						for(intIndex = 1;intIndex <= 6; intIndex++){arrValue[intIndex-1] = arrValue[intIndex];}		
						arrValue[5] = $.trim(txtValue);
					}else{
						arrValue[arrValue.length] = $.trim(txtValue);
					}
				}
			}
		
			$.cookie(COOKIE_NAME,arrValue.join(","),{expires:30});
			$el.data("values", arrValue.join(","));
		}
	}
	
	
	init();
	return $el;
}

