var AppDispatcher = require('../dispatcher/appDispatcher');
var EventEmitter = require('events').EventEmitter;
var CartConstants = require('../constants/cartConstants');
var CartActions = require('../actions/cartActions');
var NavigationActions = require('../actions/navigationActions');
var ItemInCart = require('../models/itemInCart');
var ItemInCartCollection = require('../models/itemInCartCollection');
var ItemCollection = require('../models/itemCollection');
var DeliveryDestination = require('../models/deliveryDestination');
var OrderConfirmation = require('../models/orderConfirmation');
var Place = require('../models/place');
var Validation = require('../utils/validation');

var _ = require('underscore');

var states = {}

var _itemsInCart = new ItemInCartCollection();
var _itemsForDisplay = new ItemCollection();
_itemsForDisplay.setFromCart(true);

var _deliveryDestination = new DeliveryDestination();
var _deliveryDestinationErrors = {};
var _deliveryCosts = new Place({
    postalCode: _deliveryDestination.get('place')
})

var _addressColapsed = false;


var supportedPlaces = [{
        "code": "-12",
        "placeLabel": "Izaberite mjesto"
    }, {
        "code": "-13",
        "placeLabel": "-------------------------------"
    }, {
        "code": " 71000",
        "placeLabel": "Sarajevo"
    }, 
    {
        "code": " 78000",
        "placeLabel": "Banja Luka"
    },
    {
        "code": " 75000",
        "placeLabel": "Tuzla"
    },

    {
        "code": " 88000",
        "placeLabel": "Mostar"
    }, 

    {
        "code": " 72000",
        "placeLabel": "Zenica"
    }
    , {
        "code": "-14",
        "placeLabel": "-------------------------------"
    }

    , {
        "code": "78255",
        "placeLabel": "Aleksandrovac"
    }

    , {
        "code": "89245",
        "placeLabel": "Avtovac"
    }

    , {
        "code": "76310",
        "placeLabel": "Balatun"
    }

    , {
        "code": "78000",
        "placeLabel": "Banja Luka"
    }

    , {
        "code": "75290",
        "placeLabel": "Banovici"
    }

    , {
        "code": "76312",
        "placeLabel": "Batkovic"
    }

    , {
        "code": "72233",
        "placeLabel": "Begov Han"
    }

    , {
        "code": "88363",
        "placeLabel": "Berkovici"
    }

    , {
        "code": "77000",
        "placeLabel": "Bihac"
    }

    , {
        "code": "76204",
        "placeLabel": "Bijela"
    }

    , {
        "code": "76300",
        "placeLabel": "Bijeljina"
    }

    , {
        "code": "73263",
        "placeLabel": "Bijelo Brdo"
    }

    , {
        "code": "89230",
        "placeLabel": "Bileca"
    }

    , {
        "code": "72248",
        "placeLabel": "Biljesevo"
    }

    , {
        "code": "88407",
        "placeLabel": "Bjelimici"
    }

    , {
        "code": "88201",
        "placeLabel": "Blagaj"
    }

    , {
        "code": "74275",
        "placeLabel": "Blatnica"
    }

    , {
        "code": "88263",
        "placeLabel": "Blatnica Kod Mostara"
    }

    , {
        "code": "71215",
        "placeLabel": "Blazuj"
    }

    , {
        "code": "76277",
        "placeLabel": "Bok"
    }

    , {
        "code": "74322",
        "placeLabel": "Boljanic"
    }

    , {
        "code": "77240",
        "placeLabel": "Bosanska Krupa"
    }

    , {
        "code": "77250",
        "placeLabel": "Bosanski Petrovac"
    }

    , {
        "code": "80270",
        "placeLabel": "Bosansko Grahovo"
    }

    , {
        "code": "88408",
        "placeLabel": "Bradina"
    }

    , {
        "code": "75420",
        "placeLabel": "Bratunac"
    }

    , {
        "code": "76000",
        "placeLabel": "Brcko"
    }

    , {
        "code": "76100",
        "placeLabel": "Brcko Distrikt"
    }

    , {
        "code": "77205",
        "placeLabel": "Brekovica"
    }

    , {
        "code": "74210",
        "placeLabel": "Brestovo"
    }

    , {
        "code": "71255",
        "placeLabel": "Brestovsko"
    }

    , {
        "code": "71370",
        "placeLabel": "Breza"
    }

    , {
        "code": "79208",
        "placeLabel": "Brezicani"
    }

    , {
        "code": "76109",
        "placeLabel": "Brezik"
    }

    , {
        "code": "76216",
        "placeLabel": "Brezovo Polje"
    }

    , {
        "code": "74206",
        "placeLabel": "Brijesnica"
    }

    , {
        "code": "74206",
        "placeLabel": "Brijesnica Kod Doboja"
    }

    , {
        "code": "74206",
        "placeLabel": "Brijesnica Mala"
    }

    , {
        "code": "74206",
        "placeLabel": "Brijesnica Velika"
    }

    , {
        "code": "76206",
        "placeLabel": "Brka"
    }

    , {
        "code": "72243",
        "placeLabel": "Brnjic"
    }

    , {
        "code": "88243",
        "placeLabel": "Brocanac"
    }

    , {
        "code": "88243",
        "placeLabel": "Brocanac"
    }

    , {
        "code": "73309",
        "placeLabel": "Brod Kod Foce"
    }

    , {
        "code": "76313",
        "placeLabel": "Brodac"
    }

    , {
        "code": "78204",
        "placeLabel": "Bronzani Majdan"
    }

    , {
        "code": "72290",
        "placeLabel": "Bucici"
    }

    , {
        "code": "70230",
        "placeLabel": "Bugojno"
    }

    , {
        "code": "75203",
        "placeLabel": "Bukinje"
    }

    , {
        "code": "74277",
        "placeLabel": "Buletic"
    }

    , {
        "code": "88202",
        "placeLabel": "Buna"
    }

    , {
        "code": "72260",
        "placeLabel": "Busovaca"
    }

    , {
        "code": "88409",
        "placeLabel": "Buturovicpolje"
    }

    , {
        "code": "77245",
        "placeLabel": "Buzim"
    }

    , {
        "code": "73280",
        "placeLabel": "Cajnice"
    }

    , {
        "code": "75405",
        "placeLabel": "Caparde"
    }

    , {
        "code": "88300",
        "placeLabel": "Capljina"
    }

    , {
        "code": "72224",
        "placeLabel": "Cardak"
    }

    , {
        "code": "71347",
        "placeLabel": "Careva Cuprija"
    }

    , {
        "code": "72246",
        "placeLabel": "Catici"
    }

    , {
        "code": "77220",
        "placeLabel": "Cazin"
    }

    , {
        "code": "74274",
        "placeLabel": "Cecava"
    }

    , {
        "code": "88404",
        "placeLabel": "Celebici"
    }

    , {
        "code": "80203",
        "placeLabel": "Celebici Lusnic"
    }

    , {
        "code": "73307",
        "placeLabel": "Celebici Kod Foce"
    }

    , {
        "code": "75246",
        "placeLabel": "Celic"
    }

    , {
        "code": "78240",
        "placeLabel": "Celinac"
    }

    , {
        "code": "89243",
        "placeLabel": "Cemerno"
    }

    , {
        "code": "88265",
        "placeLabel": "Cerin"
    }

    , {
        "code": "74211",
        "placeLabel": "Cerovica"
    }

    , {
        "code": "78403",
        "placeLabel": "Cerovljani"
    }

    , {
        "code": "88260",
        "placeLabel": "Citluk"
    }

    , {
        "code": "77226",
        "placeLabel": "Coralici"
    }

    , {
        "code": "76239",
        "placeLabel": "Crkvina"
    }

    , {
        "code": "88367",
        "placeLabel": "Crnici"
    }

    , {
        "code": "76328",
        "placeLabel": "Crnjelovo"
    }

    , {
        "code": "71221",
        "placeLabel": "Dejcici"
    }

    , {
        "code": "79243",
        "placeLabel": "Demirovac"
    }

    , {
        "code": "74400",
        "placeLabel": "Derventa"
    }

    , {
        "code": "75444",
        "placeLabel": "Derventa Kod Vlasenice"
    }

    , {
        "code": "89233",
        "placeLabel": "Divin"
    }

    , {
        "code": "74000",
        "placeLabel": "Doboj"
    }

    , {
        "code": "74206",
        "placeLabel": "Doboj Istok"
    }

    , {
        "code": "74203",
        "placeLabel": "Doboj Jug"
    }

    , {
        "code": "75328",
        "placeLabel": "Doborovci"
    }

    , {
        "code": "75308",
        "placeLabel": "Dobosnica"
    }

    , {
        "code": "77210",
        "placeLabel": "Dobretici"
    }

    , {
        "code": "71245",
        "placeLabel": "Dobrinja"
    }

    , {
        "code": "79223",
        "placeLabel": "Dobrljin"
    }

    , {
        "code": "77242",
        "placeLabel": "Dobro Selo"
    }

    , {
        "code": "73247",
        "placeLabel": "Dobrun"
    }

    , {
        "code": "75206",
        "placeLabel": "Dokanj"
    }

    , {
        "code": "72278",
        "placeLabel": "Dolac Na Lasvi"
    }

    , {
        "code": "76233",
        "placeLabel": "Domaljevac"
    }
    , {
        "code": "76274",
        "placeLabel": "Donja Mahala"
    }

    , {
        "code": "76257",
        "placeLabel": "Donja Medjidja"
    }

    , {
        "code": "76327",
        "placeLabel": "Donja Slatina"
    }

    , {
        "code": "71305",
        "placeLabel": "Donje Mostre"
    }

    , {
        "code": "79228",
        "placeLabel": "Donji Agici"
    }

    , {
        "code": "88343",
        "placeLabel": "Donji Memici"
    }

    , {
        "code": "70220",
        "placeLabel": "Donji Vakuf"
    }

    , {
        "code": "78432",
        "placeLabel": "Donji Vijacani"
    }

    , {
        "code": "79289",
        "placeLabel": "Donji Vrbljani"
    }

    , {
        "code": "76273",
        "placeLabel": "Donji Zabar"
    }

    , {
        "code": "76323",
        "placeLabel": "Dragaljevac"
    }

    , {
        "code": "74209",
        "placeLabel": "Dragalovci"
    }

    , {
        "code": "78215",
        "placeLabel": "Dragocaj"
    }

    , {
        "code": "88215",
        "placeLabel": "Dreznica"
    }

    , {
        "code": "75410",
        "placeLabel": "Drinjaca"
    }

    , {
        "code": "88344",
        "placeLabel": "Drinovci"
    }

    , {
        "code": "80260",
        "placeLabel": "Drvar"
    }

    , {
        "code": "75358",
        "placeLabel": "Duboki Potok"
    }

    , {
        "code": "75308",
        "placeLabel": "Dubostica"
    }

    , {
        "code": "78411",
        "placeLabel": "Dubrave"
    }

    , {
        "code": "75274",
        "placeLabel": "Dubrave Donje"
    }

    , {
        "code": "75273",
        "placeLabel": "Dubrave Gornje"
    }

    , {
        "code": "79227",
        "placeLabel": "Dubrovik"
    }

    , {
        "code": "74483",
        "placeLabel": "Dugo Polje"
    }

    , {
        "code": "75272",
        "placeLabel": "Djurdjevik"
    }

    , {
        "code": "75445",
        "placeLabel": "Dusanovo"
    }

    , {
        "code": "88342",
        "placeLabel": "Duzice"
    }

    , {
        "code": "76311",
        "placeLabel": "Dvorovi"
    }

    , {
        "code": "79264",
        "placeLabel": "Fajtovci"
    }

    , {
        "code": "73300",
        "placeLabel": "Foca"
    }

    , {
        "code": "71270",
        "placeLabel": "Fojnica"
    }

    , {
        "code": "89247",
        "placeLabel": "Fojnica Kod Gacka"
    }

    , {
        "code": "88306",
        "placeLabel": "Gabela Polje"
    }

    , {
        "code": "89240",
        "placeLabel": "Gacko"
    }

    , {
        "code": "80230",
        "placeLabel": "Glamoc"
    }

    , {
        "code": "76318",
        "placeLabel": "Glavicice"
    }

    , {
        "code": "71275",
        "placeLabel": "Gojevici"
    }

    , {
        "code": "73000",
        "placeLabel": "Gorazde"
    }

    , {
        "code": "88340",
        "placeLabel": "Gorica"
    }

    , {
        "code": "77222",
        "placeLabel": "Gornja Koprivna"
    }

    , {
        "code": "76238",
        "placeLabel": "Gornja Slatina"
    }

    , {
        "code": "75208",
        "placeLabel": "Gornja Tuzla"
    }

    , {
        "code": "79266",
        "placeLabel": "Gornji Kamengrad"
    }

    , {
        "code": "78405",
        "placeLabel": "Gornji Podgradci"
    }

    , {
        "code": "76207",
        "placeLabel": "Gornji Rahic"
    }

    , {
        "code": "78439",
        "placeLabel": "Gornji Strpci"
    }

    , {
        "code": "74272",
        "placeLabel": "Gornji Teslic"
    }

    , {
        "code": "70240",
        "placeLabel": "Gornji Vakuf Uskoplje"
    }

    , {
        "code": "76207",
        "placeLabel": "Gornji Zovik"
    }

    , {
        "code": "89201",
        "placeLabel": "Grab"
    }

    , {
        "code": "78227",
        "placeLabel": "Grabovica"
    }

    , {
        "code": "75320",
        "placeLabel": "Gracanica"
    }

    , {
        "code": "70233",
        "placeLabel": "Gracanica Kod Bugojna"
    }

    , {
        "code": "75276",
        "placeLabel": "Gracanica Selo"
    }

    , {
        "code": "88392",
        "placeLabel": "Gradac"
    }

    , {
        "code": "76250",
        "placeLabel": "Gradacac"
    }

    , {
        "code": "78400",
        "placeLabel": "Gradiska"
    }

    , {
        "code": "88340",
        "placeLabel": "Grude"
    }

    , {
        "code": "80205",
        "placeLabel": "Guber"
    }

    , {
        "code": "80204",
        "placeLabel": "Listani"
    }

    , {
        "code": "72277",
        "placeLabel": "Guca Gora"
    }

    , {
        "code": "71240",
        "placeLabel": "Hadzici"
    }

    , {
        "code": "72225",
        "placeLabel": "Hajdarevici"
    }

    , {
        "code": "72245",
        "placeLabel": "Haljinici"
    }

    , {
        "code": "72281",
        "placeLabel": "Han Bila"
    }

    , {
        "code": "71360",
        "placeLabel": "Han Pijesak"
    }

    , {
        "code": "71212",
        "placeLabel": "Hrasnica"
    }

    , {
        "code": "88395",
        "placeLabel": "Hrasno"
    }

    , {
        "code": "71144",
        "placeLabel": "Hresa"
    }

    , {
        "code": "78436",
        "placeLabel": "Hrvacani"
    }

    , {
        "code": "75216",
        "placeLabel": "Husino"
    }

    , {
        "code": "88394",
        "placeLabel": "Hutovo"
    }

    , {
        "code": "71210",
        "placeLabel": "Ilidza"
    }

    , {
        "code": "71380",
        "placeLabel": "Ilijas"
    }

    , {
        "code": "73208",
        "placeLabel": "Ilovaca"
    }

    , {
        "code": "78234",
        "placeLabel": "Imljani"
    }

    , {
        "code": "77208",
        "placeLabel": "Izacic"
    }

    , {
        "code": "88420",
        "placeLabel": "Jablanica"
    }

    , {
        "code": "71423",
        "placeLabel": "Jahorina"
    }

    , {
        "code": "70101",
        "placeLabel": "Jajce"
    }

    , {
        "code": "76316",
        "placeLabel": "Janja"
    }

    , {
        "code": "72215",
        "placeLabel": "Janjici"
    }

    , {
        "code": "88224",
        "placeLabel": "Jare"
    }

    , {
        "code": "78233",
        "placeLabel": "Javorani"
    }

    , {
        "code": "74264",
        "placeLabel": "Jelah"
    }

    , {
        "code": "77241",
        "placeLabel": "Jezerski"
    }

    , {
        "code": "79244",
        "placeLabel": "Johova"
    }

    , {
        "code": "73319",
        "placeLabel": "Josanica"
    }

    , {
        "code": "78244",
        "placeLabel": "Josavka"
    }

    , {
        "code": "72264",
        "placeLabel": "Kacuni"
    }

    , {
        "code": "72240",
        "placeLabel": "Kakanj"
    }

    , {
        "code": "74413",
        "placeLabel": "Kalenderovci"
    }

    , {
        "code": "75260",
        "placeLabel": "Kalesija"
    }

    , {
        "code": "71230",
        "placeLabel": "Kalinovik"
    }

    , {
        "code": "77204",
        "placeLabel": "Kamenica"
    }

    , {
        "code": "72265",
        "placeLabel": "Kaonik"
    }

    , {
        "code": "71213",
        "placeLabel": "Kasindo"
    }

    , {
        "code": "80246",
        "placeLabel": "Kazaginac"
    }

    , {
        "code": "88283",
        "placeLabel": "Kifino Selo"
    }

    , {
        "code": "71250",
        "placeLabel": "Kiseljak"
    }

    , {
        "code": "75211",
        "placeLabel": "Kiseljak, Kod Tuzle"
    }

    , {
        "code": "75280",
        "placeLabel": "Kladanj"
    }

    , {
        "code": "74452",
        "placeLabel": "Klakar Donji"
    }

    , {
        "code": "79280",
        "placeLabel": "Kljuc"
    }

    , {
        "code": "88324",
        "placeLabel": "Klobuk"
    }

    , {
        "code": "74207",
        "placeLabel": "Klokotnica"
    }

    , {
        "code": "78230",
        "placeLabel": "Knezevo"
    }

    , {
        "code": "78230",
        "placeLabel": "Skender Vakuf"
    }

    , {
        "code": "79246",
        "placeLabel": "Knezica"
    }

    , {
        "code": "71356",
        "placeLabel": "Knezina"
    }

    , {
        "code": "78423",
        "placeLabel": "Kobas"
    }

    , {
        "code": "88226",
        "placeLabel": "Kocerin"
    }

    , {
        "code": "78409",
        "placeLabel": "Kocicevo"
    }

    , {
        "code": "78207",
        "placeLabel": "Kola"
    }

    , {
        "code": "80244",
        "placeLabel": "Kongora"
    }

    , {
        "code": "88400",
        "placeLabel": "Konjic"
    }

    , {
        "code": "77249",
        "placeLabel": "Konjoder"
    }

    , {
        "code": "74489",
        "placeLabel": "Koprivna"
    }

    , {
        "code": "75247",
        "placeLabel": "Koraj"
    }

    , {
        "code": "76236",
        "placeLabel": "Kornica"
    }

    , {
        "code": "74253",
        "placeLabel": "Kosova"
    }

    , {
        "code": "76276",
        "placeLabel": "Kostric"
    }

    , {
        "code": "78220",
        "placeLabel": "Kotor Varos"
    }

    , {
        "code": "74215",
        "placeLabel": "Kotorsko"
    }

    , {
        "code": "72226",
        "placeLabel": "Kovaci"
    }

    , {
        "code": "79002",
        "placeLabel": "Kozarac"
    }

    , {
        "code": "79240",
        "placeLabel": "Bosanska Dubica"
    }

    , {
        "code": "75413",
        "placeLabel": "Kozluk"
    }

    , {
        "code": "72244",
        "placeLabel": "Kraljeva Sutjeska"
    }

    , {
        "code": "71260",
        "placeLabel": "Kresevo"
    }

    , {
        "code": "78256",
        "placeLabel": "Kriskovci"
    }

    , {
        "code": "78206",
        "placeLabel": "Krupa Na Vrbasu"
    }

    , {
        "code": "88203",
        "placeLabel": "Krusevo"
    }

    , {
        "code": "78424",
        "placeLabel": "Kukulje"
    }

    , {
        "code": "71216",
        "placeLabel": "Kula"
    }

    , {
        "code": "78443",
        "placeLabel": "Kulasi"
    }

    , {
        "code": "77206",
        "placeLabel": "Kulen Vakuf"
    }

    , {
        "code": "80320",
        "placeLabel": "Kupres"
    }

    , {
        "code": "78250",
        "placeLabel": "Laktasi"
    }

    , {
        "code": "78407",
        "placeLabel": "Laminci Sredjani"
    }

    , {
        "code": "79204",
        "placeLabel": "Lamovita"
    }

    , {
        "code": "89208",
        "placeLabel": "Lastva"
    }

    , {
        "code": "72216",
        "placeLabel": "Lasva"
    }

    , {
        "code": "78222",
        "placeLabel": "Liplje"
    }

    , {
        "code": "75213",
        "placeLabel": "Lipnica"
    }

    , {
        "code": "78434",
        "placeLabel": "Lisnja"
    }

    , {
        "code": "80101",
        "placeLabel": "Livno"
    }

    , {
        "code": "75214",
        "placeLabel": "Ljubace"
    }

    , {
        "code": "79206",
        "placeLabel": "Ljubija"
    }

    , {
        "code": "88380",
        "placeLabel": "Ljubinje"
    }

    , {
        "code": "89209",
        "placeLabel": "Ljubomir"
    }

    , {
        "code": "88320",
        "placeLabel": "Ljubuski"
    }

    , {
        "code": "88223",
        "placeLabel": "Ljuti Dolac"
    }

    , {
        "code": "76278",
        "placeLabel": "Loncari"
    }

    , {
        "code": "75240",
        "placeLabel": "Lopare"
    }

    , {
        "code": "75300",
        "placeLabel": "Lukavac"
    }

    , {
        "code": "75301",
        "placeLabel": "Lukavac Mjesto"
    }

    , {
        "code": "75327",
        "placeLabel": "Lukavica"
    }

    , {
        "code": "79267",
        "placeLabel": "Lusci Palanka"
    }

    , {
        "code": "74250",
        "placeLabel": "Maglaj"
    }

    , {
        "code": "74216",
        "placeLabel": "Majevac"
    }

    , {
        "code": "77235",
        "placeLabel": "Mala Kladusa"
    }

    , {
        "code": "74418",
        "placeLabel": "Mala Socanica"
    }

    , {
        "code": "76208",
        "placeLabel": "Maoca"
    }

    , {
        "code": "78410",
        "placeLabel": "Masici"
    }

    , {
        "code": "78223",
        "placeLabel": "Maslovare"
    }

    , {
        "code": "76271",
        "placeLabel": "Matici"
    }

    , {
        "code": "74203",
        "placeLabel": "Matuzici"
    }

    , {
        "code": "88266",
        "placeLabel": "Medjugorje"
    }

    , {
        "code": "79247",
        "placeLabel": "Medjuvodje"
    }

    , {
        "code": "72282",
        "placeLabel": "Mehurici"
    }

    , {
        "code": "80243",
        "placeLabel": "Mesihovina"
    }

    , {
        "code": "75446",
        "placeLabel": "Milici"
    }

    , {
        "code": "73283",
        "placeLabel": "Miljeno"
    }

    , {
        "code": "73313",
        "placeLabel": "Miljevina"
    }

    , {
        "code": "74485",
        "placeLabel": "Milosevac"
    }

    , {
        "code": "75329",
        "placeLabel": "Miricina"
    }

    , {
        "code": "74480",
        "placeLabel": "Modrica"
    }

    , {
        "code": "71428",
        "placeLabel": "Mokro"
    }

    , {
        "code": "89204",
        "placeLabel": "Mosko"
    }

    , {
        "code": "88000",
        "placeLabel": "Mostar"
    }

    , {
        "code": "75212",
        "placeLabel": "Mramor"
    }

    , {
        "code": "73206",
        "placeLabel": "Mravinjac"
    }

    , {
        "code": "79544",
        "placeLabel": "Mrkodol"
    }

    , {
        "code": "70260",
        "placeLabel": "Mrkonjic Grad"
    }

    , {
        "code": "72212",
        "placeLabel": "Nemila"
    }

    , {
        "code": "88390",
        "placeLabel": "Neum"
    }

    , {
        "code": "88280",
        "placeLabel": "Nevesinje"
    }

    , {
        "code": "72276",
        "placeLabel": "Nova Bila"
    }

    , {
        "code": "78418",
        "placeLabel": "Nova Topola"
    }

    , {
        "code": "79220",
        "placeLabel": "Bosanski Novi"
    }

    , {
        "code": "74254",
        "placeLabel": "Novi Seher"
    }

    , {
        "code": "72290",
        "placeLabel": "Novi Travnik"
    }

    , {
        "code": "78428",
        "placeLabel": "Nozicko"
    }

    , {
        "code": "70225",
        "placeLabel": "Oborci"
    }

    , {
        "code": "76235",
        "placeLabel": "Obudovac"
    }

    , {
        "code": "76290",
        "placeLabel": "Odzak"
    }

    , {
        "code": "74470",
        "placeLabel": "Vukosavlje"
    }

    , {
        "code": "88285",
        "placeLabel": "Odzak Kod Nevesinja"
    }

    , {
        "code": "71340",
        "placeLabel": "Olovo"
    }

    , {
        "code": "79203",
        "placeLabel": "Omarska"
    }

    , {
        "code": "78406",
        "placeLabel": "Orahova"
    }

    , {
        "code": "75323",
        "placeLabel": "Orahovica Donja"
    }

    , {
        "code": "76270",
        "placeLabel": "Orasje"
    }

    , {
        "code": "74412",
        "placeLabel": "Osinja"
    }

    , {
        "code": "74225",
        "placeLabel": "Osjecani"
    }

    , {
        "code": "75406",
        "placeLabel": "Osmaci"
    }

    , {
        "code": "79263",
        "placeLabel": "Ostra Luka"
    }

    , {
        "code": "88423",
        "placeLabel": "Ostrozac"
    }

    , {
        "code": "77228",
        "placeLabel": "Ostrozac Kod Cazina"
    }

    , {
        "code": "77244",
        "placeLabel": "Otoka"
    }

    , {
        "code": "72238",
        "placeLabel": "Ozimica"
    }

    , {
        "code": "78437",
        "placeLabel": "Palackovci"
    }

    , {
        "code": "71420",
        "placeLabel": "Pale"
    }

    , {
        "code": "75435",
        "placeLabel": "Papraca"
    }

    , {
        "code": "71243",
        "placeLabel": "Pazaric"
    }

    , {
        "code": "77227",
        "placeLabel": "Pecigrad"
    }

    , {
        "code": "76256",
        "placeLabel": "Pelagicevo"
    }

    , {
        "code": "72112",
        "placeLabel": "Perin Han"
    }

    , {
        "code": "74317",
        "placeLabel": "Petrovo"
    }

    , {
        "code": "75412",
        "placeLabel": "Pilica"
    }

    , {
        "code": "78217",
        "placeLabel": "Piskavica"
    }

    , {
        "code": "88305",
        "placeLabel": "Pocitelj"
    }

    , {
        "code": "72252",
        "placeLabel": "Poculica"
    }

    , {
        "code": "71425",
        "placeLabel": "Podgrab"
    }

    , {
        "code": "80209",
        "placeLabel": "Podhum"
    }

    , {
        "code": "71387",
        "placeLabel": "Podlugovi"
    }

    , {
        "code": "74217",
        "placeLabel": "Podnovlje"
    }

    , {
        "code": "75355",
        "placeLabel": "Podorasje Kod Srebrenika"
    }

    , {
        "code": "77232",
        "placeLabel": "Podzvizd"
    }

    , {
        "code": "75303",
        "placeLabel": "Poljice"
    }
    , {
        "code": "88240",
        "placeLabel": "Posusje"
    }

    , {
        "code": "78216",
        "placeLabel": "Potkozarje"
    }

    , {
        "code": "78435",
        "placeLabel": "Potocani"
    }

    , {
        "code": "73290",
        "placeLabel": "Praca"
    }

    , {
        "code": "73245",
        "placeLabel": "Prelovo"
    }

    , {
        "code": "79287",
        "placeLabel": "Previja"
    }

    , {
        "code": "74276",
        "placeLabel": "Pribinic"
    }

    , {
        "code": "75249",
        "placeLabel": "Priboj Kod Lopara"
    }

    , {
        "code": "79101",
        "placeLabel": "Prijedor"
    }

    , {
        "code": "80202",
        "placeLabel": "Priluka"
    }

    , {
        "code": "80245",
        "placeLabel": "Prisoje"
    }

    , {
        "code": "78430",
        "placeLabel": "Prnjavor"
    }

    , {
        "code": "80206",
        "placeLabel": "Prolog"
    }

    , {
        "code": "88440",
        "placeLabel": "Prozor"
    }

    , {
        "code": "70223",
        "placeLabel": "Prusac"
    }

    , {
        "code": "71335",
        "placeLabel": "Przici"
    }

    , {
        "code": "72207",
        "placeLabel": "Puhovac"
    }

    , {
        "code": "75305",
        "placeLabel": "Puracic"
    }

    , {
        "code": "88325",
        "placeLabel": "Radisici"
    }

    , {
        "code": "75268",
        "placeLabel": "Rainci Gornji"
    }

    , {
        "code": "88245",
        "placeLabel": "Rakitno"
    }

    , {
        "code": "71217",
        "placeLabel": "Rakovica"
    }

    , {
        "code": "80247",
        "placeLabel": "Rasko Polje"
    }

    , {
        "code": "78429",
        "placeLabel": "Razboj Lijevce"
    }

    , {
        "code": "76218",
        "placeLabel": "Razljevo"
    }

    , {
        "code": "79288",
        "placeLabel": "Ribnik"
    }

    , {
        "code": "77215",
        "placeLabel": "Ripac"
    }

    , {
        "code": "73220",
        "placeLabel": "Rogatica"
    }

    , {
        "code": "79226",
        "placeLabel": "Rudice"
    }

    , {
        "code": "73260",
        "placeLabel": "Rudo"
    }

    , {
        "code": "88347",
        "placeLabel": "Ruzici"
    }

    , {
        "code": "76230",
        "placeLabel": "Bosanski Samac"
    }

    , {
        "code": "79285",
        "placeLabel": "Sanica Gornja"
    }

    , {
        "code": "79260",
        "placeLabel": "Sanski Most"
    }

    , {
        "code": "75411",
        "placeLabel": "Sapna"
    }

    , {
        "code": "78202",
        "placeLabel": "Saracica"
    }

    , {
        "code": "71000",
        "placeLabel": "Sarajevo"
    }

    , {
        "code": "71103",
        "placeLabel": "Sarajevo, Centar"
    }

    , {
        "code": "71160",
        "placeLabel": "Sarajevo, Novi Grad"
    }

    , {
        "code": "71120",
        "placeLabel": "Sarajevo, Novo Sarajevo"
    }

    , {
        "code": "71140",
        "placeLabel": "Sarajevo, Stari Grad"
    }

    , {
        "code": "76209",
        "placeLabel": "Satorovici"
    }

    , {
        "code": "73305",
        "placeLabel": "Sekovici"
    }

    , {
        "code": "75450",
        "placeLabel": "Sekovici"
    }

    , {
        "code": "71321",
        "placeLabel": "Semizovac"
    }

    , {
        "code": "76205",
        "placeLabel": "Seonjaci"
    }

    , {
        "code": "75275",
        "placeLabel": "Serici"
    }

    , {
        "code": "75245",
        "placeLabel": "Sibosnica"
    }

    , {
        "code": "78433",
        "placeLabel": "Sibovska"
    }

    , {
        "code": "75207",
        "placeLabel": "Simin Han"
    }

    , {
        "code": "78364",
        "placeLabel": "Sipovo"
    }

    , {
        "code": "78224",
        "placeLabel": "Siprage"
    }

    , {
        "code": "88220",
        "placeLabel": "Siroki Brijeg"
    }

    , {
        "code": "78422",
        "placeLabel": "Sitnesi"
    }

    , {
        "code": "79283",
        "placeLabel": "Sitnica"
    }

    , {
        "code": "75436",
        "placeLabel": "Skelani"
    }

    , {
        "code": "74261",
        "placeLabel": "Skugric"
    }

    , {
        "code": "75353",
        "placeLabel": "Sladna"
    }

    , {
        "code": "78253",
        "placeLabel": "Slatina Ilidza"
    }

    , {
        "code": "78438",
        "placeLabel": "Smrtici"
    }

    , {
        "code": "74279",
        "placeLabel": "Snjegotina Gornja"
    }

    , {
        "code": "74323",
        "placeLabel": "Sockovac"
    }

    , {
        "code": "71350",
        "placeLabel": "Sokolac"
    }

    , {
        "code": "71210",
        "placeLabel": "Sokolovici"
    }

    , {
        "code": "88345",
        "placeLabel": "Sovici"
    }

    , {
        "code": "75356",
        "placeLabel": "Spionica"
    }

    , {
        "code": "78420",
        "placeLabel": "Srbac"
    }

    , {
        "code": "75430",
        "placeLabel": "Srebrenica"
    }

    , {
        "code": "75350",
        "placeLabel": "Srebrenik"
    }

    , {
        "code": "71385",
        "placeLabel": "Srednje"
    }

    , {
        "code": "79249",
        "placeLabel": "Sreflije"
    }

    , {
        "code": "76258",
        "placeLabel": "Srnice"
    }

    , {
        "code": "79224",
        "placeLabel": "Bosanska Kostajnica"
    }

    , {
        "code": "74450",
        "placeLabel": "Bosanski Brod"
    }

    , {
        "code": "73110",
        "placeLabel": "Srpsko Gorazde"
    }

    , {
        "code": "76278",
        "placeLabel": "Srpsko Orasje"
    }

    , {
        "code": "71123",
        "placeLabel": "Srpsko Sarajevo"
    }

    , {
        "code": "74208",
        "placeLabel": "Stanari"
    }

    , {
        "code": "78243",
        "placeLabel": "Stara Dubrava"
    }

    , {
        "code": "79268",
        "placeLabel": "Stari Majdan"
    }

    , {
        "code": "77224",
        "placeLabel": "Stijena"
    }

    , {
        "code": "73223",
        "placeLabel": "Stjenice"
    }

    , {
        "code": "75324",
        "placeLabel": "Stjepan Polje"
    }

    , {
        "code": "88360",
        "placeLabel": "Stolac"
    }

    , {
        "code": "72209",
        "placeLabel": "Stranjani"
    }

    , {
        "code": "78208",
        "placeLabel": "Stricici"
    }

    , {
        "code": "75305",
        "placeLabel": "Strpci"
    }

    , {
        "code": "88323",
        "placeLabel": "Studenci"
    }

    , {
        "code": "75283",
        "placeLabel": "Stupari"
    }

    , {
        "code": "77223",
        "placeLabel": "Sturlic"
    }

    , {
        "code": "75344",
        "placeLabel": "Suho Polje"
    }

    , {
        "code": "80249",
        "placeLabel": "Sujica"
    }

    , {
        "code": "79229",
        "placeLabel": "Svodna"
    }

    , {
        "code": "71244",
        "placeLabel": "Tarcin"
    }

    , {
        "code": "75414",
        "placeLabel": "Teocak"
    }

    , {
        "code": "74260",
        "placeLabel": "Tesanj"
    }

    , {
        "code": "74266",
        "placeLabel": "Tesanjka"
    }

    , {
        "code": "74270",
        "placeLabel": "Teslic"
    }

    , {
        "code": "88348",
        "placeLabel": "Tihaljina"
    }

    , {
        "code": "75357",
        "placeLabel": "Tinja"
    }

    , {
        "code": "75455",
        "placeLabel": "Tisca"
    }

    , {
        "code": "77233",
        "placeLabel": "Todorovo"
    }

    , {
        "code": "75265",
        "placeLabel": "Tojsici"
    }

    , {
        "code": "76272",
        "placeLabel": "Tolisa"
    }

    , {
        "code": "79265",
        "placeLabel": "Tomina"
    }

    , {
        "code": "80240",
        "placeLabel": "Tomislavgrad"
    }

    , {
        "code": "72213",
        "placeLabel": "Topcic Polje"
    }

    , {
        "code": "72270",
        "placeLabel": "Travnik"
    }

    , {
        "code": "88375",
        "placeLabel": "Trebinja"
    }

    , {
        "code": "89000",
        "placeLabel": "Trebinje"
    }

    , {
        "code": "78252",
        "placeLabel": "Trn"
    }

    , {
        "code": "76335",
        "placeLabel": "Trnava Donja"
    }

    , {
        "code": "76310",
        "placeLabel": "Trnjaci"
    }

    , {
        "code": "71220",
        "placeLabel": "Trnovo"
    }

    , {
        "code": "77225",
        "placeLabel": "Trzacka Rastela"
    }

    , {
        "code": "72283",
        "placeLabel": "Turbe"
    }

    , {
        "code": "75306",
        "placeLabel": "Turija"
    }

    , {
        "code": "78404",
        "placeLabel": "Turjak Kod Bosanske Gradiske"
    }

    , {
        "code": "75000",
        "placeLabel": "Tuzla"
    }

    , {
        "code": "76330",
        "placeLabel": "Ugljevik"
    }

    , {
        "code": "74278",
        "placeLabel": "Ugodnovici"
    }

    , {
        "code": "71233",
        "placeLabel": "Ulog"
    }

    , {
        "code": "74230",
        "placeLabel": "Usora"
    }

    , {
        "code": "73250",
        "placeLabel": "Ustikolina"
    }

    , {
        "code": "73265",
        "placeLabel": "Uvac"
    }

    , {
        "code": "73249",
        "placeLabel": "Vardiste"
    }

    , {
        "code": "71330",
        "placeLabel": "Vares"
    }

    , {
        "code": "77245",
        "placeLabel": "Varoska Rijeka"
    }

    , {
        "code": "74213",
        "placeLabel": "Velika Bukovica"
    }

    , {
        "code": "77207",
        "placeLabel": "Velika Gata"
    }

    , {
        "code": "77230",
        "placeLabel": "Velika Kladusa"
    }

    , {
        "code": "76329",
        "placeLabel": "Velika Obarska"
    }

    , {
        "code": "88208",
        "placeLabel": "Vidosi"
    }

    , {
        "code": "76275",
        "placeLabel": "Vidovice"
    }

    , {
        "code": "70202",
        "placeLabel": "Vinac"
    }

    , {
        "code": "88247",
        "placeLabel": "Vir Kod Posusja"
    }

    , {
        "code": "73240",
        "placeLabel": "Visegrad"
    }

    , {
        "code": "88307",
        "placeLabel": "Visici"
    }

    , {
        "code": "71300",
        "placeLabel": "Visoko"
    }

    , {
        "code": "72250",
        "placeLabel": "Vitez"
    }

    , {
        "code": "88326",
        "placeLabel": "Vitina"
    }

    , {
        "code": "74265",
        "placeLabel": "Vitkovci Donji"
    }

    , {
        "code": "73205",
        "placeLabel": "Vitkovici"
    }

    , {
        "code": "75440",
        "placeLabel": "Vlasenica"
    }

    , {
        "code": "71320",
        "placeLabel": "Vogosca"
    }

    , {
        "code": "71123",
        "placeLabel": "Vojkovici"
    }

    , {
        "code": "70246",
        "placeLabel": "Voljevac"
    }

    , {
        "code": "72227",
        "placeLabel": "Vozuca"
    }

    , {
        "code": "74488",
        "placeLabel": "Vranjak"
    }

    , {
        "code": "88113",
        "placeLabel": "Vrapcici"
    }

    , {
        "code": "75248",
        "placeLabel": "Vrazici"
    }

    , {
        "code": "78211",
        "placeLabel": "Vrbanja Kod Banja Luke"
    }

    , {
        "code": "78225",
        "placeLabel": "Vrbanjci"
    }

    , {
        "code": "78408",
        "placeLabel": "Vrbaska"
    }

    , {
        "code": "77231",
        "placeLabel": "Vrnograc"
    }

    , {
        "code": "76325",
        "placeLabel": "Vrsani"
    }

    , {
        "code": "77203",
        "placeLabel": "Vrsta"
    }

    , {
        "code": "76254",
        "placeLabel": "Vuckovci"
    }

    , {
        "code": "74470",
        "placeLabel": "Vukosavlje"
    }

    , {
        "code": "76273",
        "placeLabel": "Zabar Donji"
    }

    , {
        "code": "73287",
        "placeLabel": "Zaborak"
    }

    , {
        "code": "76333",
        "placeLabel": "Zabrdje"
    }

    , {
        "code": "78221",
        "placeLabel": "Zabrdje Kod Kotor Varosi"
    }

    , {
        "code": "78214",
        "placeLabel": "Zaluzani"
    }

    , {
        "code": "72220",
        "placeLabel": "Zavidovici"
    }

    , {
        "code": "74451",
        "placeLabel": "Zboriste"
    }

    , {
        "code": "76259",
        "placeLabel": "Zelinja"
    }

    , {
        "code": "72236",
        "placeLabel": "Zeljezno Polje"
    }

    , {
        "code": "72000",
        "placeLabel": "Zenica"
    }

    , {
        "code": "72230",
        "placeLabel": "Zepce"
    }

    , {
        "code": "88268",
        "placeLabel": "Zitomislici"
    }

    , {
        "code": "75270",
        "placeLabel": "Zivinice"
    }

    , {
        "code": "71370",
        "placeLabel": "Zupca"
    }

    , {
        "code": "75400",
        "placeLabel": "Zvornik"
    }

];

var _cartDataLoadCalled = false;

var nameOfThePlace = function(code) {
    for (var i = 0; i < supportedPlaces.length; i++) {
        var place = supportedPlaces[i];
        if (place.code === code) {
            return place.placeLabel;
        }
    }
    return "";
}

var loadCart = function() {

    _itemsInCart.fetch({
        success: function() {
            states = {}
            for (var i = 0; i < _itemsInCart.models.length; i++) {
                var itemInCart = _itemsInCart.models[i];
                states[itemInCart.get('item_id')] = itemInCart;
            }
            _itemsForDisplay.fetch({
                success: function() {
                    CartActions.dataLoaded();

                    _deliveryDestination.fetch({
                        success: function() {
                            validateDeliveryDestinationForm();
                            collapseAddressIfNeeded();
                            fetchPlace();
                            CartActions.dataLoaded();
                        }
                    });
                }
            });
        }
    });

    _cartDataLoadCalled = true;
};

var collapseAddressIfNeeded = function() {
    if (isDeliveryDestinationValid()) {
        _addressColapsed = true;
    } else {
        _addressColapsed = false;
    }
}

var fetchPlace = function() {
    _deliveryCosts = new Place({
        postalCode: _deliveryDestination.get('place')
    })
    _deliveryCosts.fetch({
        success: function() {
            CartActions.dataLoaded();
        }
    })

}


var saveCartStateForItem = function(itemId) {
    var item = CartStore.getStateFor(itemId);
    item.save({
        success: function() {
            loadCart();
        }
    });
};

/* need it for delete - will delete it later
 */
var takeItemOut = function(itemId) {

    var state = states[itemId] || new ItemInCart({
        item_id: itemId,
        count: 0
    })
    if (state.get('count') > 0) {
        // state.set('count', state.get('count') - 1);
        state.set('count', 0);
    }

    states[itemId] = state;
    saveCartStateForItem(itemId);
};

var setItemCount = function(itemId, count) {
    var state = states[itemId] || new ItemInCart({
        item_id: itemId,
        count: 0
    });

    if (count === "") {
        state.set('count', "");
        CartStore.emitChange();
        return;
    }

    var cnt = parseInt(count);

    if (isNaN(cnt) || cnt <= 0) {
        cnt = 1;
    }

    state.set('count', cnt);

    states[itemId] = state;
    saveCartStateForItem(itemId);
    // CartStore.emitChange();
};

var addNItems = function(item, count) {

    var itemId = item.get('id');
    var state = states[itemId] || new ItemInCart({
        item_id: itemId,
        count: 0
    })

    _itemsForDisplay.add(item);

    var realCount = state.get('count') + count;

    // remove if we choose to support more than
    // 10 items of single type in cart
    if (realCount > 10) {
        realCount = 10;

    }
    state.set('count', realCount);

    states[itemId] = state;
    saveCartStateForItem(itemId);
}

var changeDeliveryDestinationProperty = function(property, value) {
    _deliveryDestination.set(property, value);

    if (property === 'place') {
        fetchPlace();
    }
    validateDeliveryDestinationForm();
};


var confirmOrder = function() {

    var oc = new OrderConfirmation({
        hamo: 'meho'
    });
    oc.save({
        b: 'b'
    }, {
        success: function() {

            NavigationActions.goToThankYou();
            loadCart();
        }
    });
};


var saveDeliveryDestination = function() {
    _deliveryDestination.save(null, {
        success: function() {

            confirmOrder();
        }
    })
};

var validateDeliveryDestinationForm = function() {
    _deliveryDestinationErrors = {};

    var nameRegex = /.+\s+.+/i;
    if (Validation.safeString(_deliveryDestination.get('name')).search(nameRegex) < 0) {
        _deliveryDestinationErrors['name'] = "I prezime i ime su obavezni";
    }

    var addressRegex = /.+\s+.+/i;
    if (Validation.safeString(_deliveryDestination.get('address')).search(addressRegex) < 0) {
        _deliveryDestinationErrors['address'] = "Adresa mora biti ispravna";
    }

    var emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/i;
    if (Validation.safeString(_deliveryDestination.get('email')).search(emailRegex) < 0) {
        _deliveryDestinationErrors['email'] = "Email mora biti ispravno upisan";
    }

    var phoneRegex = /^[\d\s-]{8,12}$/i;
    if (Validation.safeString(_deliveryDestination.get('phone')).search(phoneRegex) < 0) {
        _deliveryDestinationErrors['phone'] = "Telefon mora biti ispravan";
    }

    var placeRegex = /^\s{0,1}\d{5}$/i;
    if (Validation.safeString(_deliveryDestination.get('place')).search(placeRegex) < 0) {
        _deliveryDestinationErrors['place'] = "Mjesto mora biti izabrano";
    }

    var requiredFields = ["name", "email", "place", 'address', 'phone'];
    for (var i in requiredFields) {
        var value = _deliveryDestination.get(requiredFields[i]);
        if (value === undefined || value === null || value === "") {
            // if it's required there will be a star there
            _deliveryDestinationErrors[requiredFields[i]] = "*";
        }
    }

}


var isDeliveryDestinationValid = function() {
        return Object.getOwnPropertyNames(_deliveryDestinationErrors).length === 0;
    }
    // Extend CartStore with EventEmitter to add eventing capabilities
var CartStore = _.extend({}, EventEmitter.prototype, {

    dataStartedLoading: function() {
        return _cartDataLoadCalled;
    },

    getStateFor: function(itemId) {

        var state = states[itemId] || new ItemInCart({
            item_id: itemId,
            count: 0
        })
        return state
    },

    getSupportedPlaces: function() {
        return supportedPlaces;
    },

    getWholeCartState: function() {

        var numberOfItems = 0;

        for (key in states) {
            if (states.hasOwnProperty(key)) {
                var value = states[key];
                if (value.get('count') > 0) {
                    numberOfItems += value.get('count');
                }
            }
        };

        var state = {
            count: numberOfItems,
            items: _itemsForDisplay,
            itemCounts: states,
            deliveryDestination: _deliveryDestination,
            deliveryDestinationErrors: _deliveryDestinationErrors,
            isDeliveryDestinationValid: isDeliveryDestinationValid(),
            deliveryCosts: _deliveryCosts,
            destinationValid: isDeliveryDestinationValid()
        };
        return state;
    },

    // Emit Change event
    emitChange: function() {
        this.emit('change');
    },

    // Add change listener
    addChangeListener: function(callback) {
        this.on('change', callback);
    },

    // Remove change listener
    removeChangeListener: function(callback) {
        this.removeListener('change', callback);
    },

    isDeliveryDestinationValid: isDeliveryDestinationValid,

    isAddressColapsed: function() {
        return _addressColapsed;

    },

    getHumanReadableAddress: function() {
        var address = [];
        address.push(_deliveryDestination.get('name'));
        address.push(_deliveryDestination.get('address'));
        address.push(_deliveryDestination.get('place') + " " + nameOfThePlace(_deliveryDestination.get('place')));
        address.push("Bosna i Hercegovina");
        address.push("+387" + _deliveryDestination.get('phone'))
        address.push(_deliveryDestination.get('email'))

        return address;
    }

});


// Register callback with AppDispatcher
AppDispatcher.register(function(payload) {
    var action = payload.action;
    var text;

    switch (action.actionType) {
        case CartConstants.LOAD_CART_CONTENTS:
            loadCart();
            break;
        case CartConstants.TAKE_ITEM_OUT:
            takeItemOut(action.itemId);
            break;
        case CartConstants.CART_DATA_LOADED:
            // do nothing - just emmit change
            break;
        case CartConstants.SAVE_CART_STATE_FOR_ITEM:
            if (isDeliveryDestinationValid()) {
                saveCartStateForItem(action.itemId);
            }
            break;
        case CartConstants.CHANGE_DELIVERY_DESTINATION_PROPERTY:
            changeDeliveryDestinationProperty(action.propertyName, action.value)
            break;
        case CartConstants.CONFIRM_DELIVERY:
            saveDeliveryDestination();
            break;
        case CartConstants.ADD_N_ITEMS:
            addNItems(action.item, action.count);
            break;
        case CartConstants.SET_ITEM_COUNT:
            setItemCount(action.itemId, action.count);
            break;
        case CartConstants.SET_ADDRESS_COLAPSED:
            _addressColapsed = action.isColapsed
            break;
        default:
            return true;
    }

    // If action was responded to, emit change event
    CartStore.emitChange();
    return true;

});

module.exports = CartStore;
