﻿
            var cartLoaded = false;
            var blockBag = false;
            var cartLoading = '<div style="text-align: center"><br /><h3><img src="/content/images/loading.gif" style="vertical-align:middle;" /> Loading Info</h3></div>';

            var validationErrors = '';
            var showValidationErrors_old = function(json) {
                validationErrors = '';
                $.each(json, function(item) { $('#' + this.Field).addClass('errorField'); });
                //$.each(json, function(item) { $('#' + this.Field).addClass('errorField'); validationErrors += '<li>' + this.Message + '</li>'; });
                //$('#validationErrors').html(validationErrors);
                //$('#validationErrors').show();
            }
            var showValidationErrors = function(json) {
                validationErrors = '';
                $.each(json, function(item) { if (this.Field != '') { $('#' + this.Field).addClass('errorField'); if ($('#' + this.Field + '_error_message') != null) { $('#' + this.Field + '_error_message').html(this.Message); } if ($('#' + this.Field + '_error_image') != null) { $('#' + this.Field + '_error_image').show(); } } });
            }
            
//            function toggleBag() {

//                if (!blockBag){
//                    if ($('#shoppingBag').is(':visible'))
//                        hideBag();
//                    else {

//                        if (!cartLoaded)
//                            getCart();
//                        else
//                            showBag();

//                    }
//                }
//                    
//            }
//            function showBag() {

//                //document.getElementById('shoppingBag').style.display = 'block';
//                //$('#shoppingBag').hide();
//                $('#cartTitle').html('Shopping Cart');
//                
//                if(!$('#shoppingBag').is(':visible'))
//                    $('#shoppingBag').toggle("slide");
//                
//            }
//            function hideBag() {
//                //document.getElementById('shoppingBag').style.display = 'none';
//                //$('#shoppingBag').hide();

//                if ($('#shoppingBag').is(':visible'))          
//                    $('#shoppingBag').toggle("slide");

//            }
//            function addItem(shirtID) {
//                $('#shoppingBagContentRow').html(cartLoading);
//                showBag();
//                               
//                $.scrollTo($('shoppingBag'), 800);
//                $.ajax({
//                    cache: false,
//                    url: "/Cart/Add?ShirtDesignID=" + shirtID.toString() + "&ShirtStyleID=" + $('#shirtStyle').val() + "&ShirtColorID=" + $('#shirtColor').val() + "&PrintColorID=" + $('#printColor').val() + "&SizeID=" + $('#shirtSize').val() + "&t=" + new Date().getTime(),
//                    type: "GET",
//                    dataType: 'json',
//                    success: function(result) {
//                        //showBag();
//                        $('#cartTitle').html('Added to Cart');
//                        $('#shoppingBagContentRow').html(result.Message);
//                        cartLoaded = true;
//                    } //, beforeSend: function() { $('#shoppingBagContentRow').html(''); }
//                });
//            }
//            function getCart() {
//                $('#shoppingBagContentRow').html(cartLoading);
//                showBag();
//                
//                $.ajax({
//                    cache: false,
//                    url: "/Cart/Get", //?t=" + new Date().getTime(),
//                    type: "GET",
//                    dataType: 'json',
//                    success: function(result) {
//                        //showBag();
//                        $('#cartTitle').html('Shopping Cart');
//                        $('#shoppingBagContentRow').html(result.Message);
//                        cartLoaded = true;
//                    } //, beforeSend: function() { $('#shoppingBagContentRow').html(''); }
//                });
//            }

