updated javascript to jQuery Cookie