 $(document).ready(function() {

            $('li.current_page_item').attr('class', '');

            var animating = false;
            var reset = true;
            var topPic = "#topPic1";
            var bottomPic = "#bottomPic1";

            $("#bottom-photo-container").append("<img  height=\"132px\" id=\"bottomPic2\" src=\"/Content/images/gallery/CropperCapture[15].jpg\" style=\"border:1px solid #AE2ECC\;opacity:0;\"  width=\"167px\" />");
            $("#top-photo-container").append("<img  height=\"132px\" id=\"topPic2\" src=\"/Content/images/bows/1256917230607_71c4d.jpg\" style=\"border:1px solid #AE2ECC\;opacity:0;\"  width=\"167px\" />");

//commented out slideshow stuff for now
            //for (x = 0; x <= 5; x = x + 1) {
//            var wait = setInterval(function() {

//                if (reset) {

//                    // item photo (topPic1)
//                    if (!$(bottomPic).is(":animated") && animating == false) {
//                        animating = true;
//                        $(topPic).animate(
//                   { opacity: 0
//                   },
//                   5000);
//                        
//                        
//                        $.getJSON("Photo/RandomItemPhoto?itemId=" + $("#topId").text(), function(item) {
//                            $("#photo-caption2").text(item.Name);

//                            if (topPic == "#topPic1") {
//                                topPic = "#topPic2";
//                            }
//                            else {
//                                topPic = "#topPic1";
//                            }


//                            $(topPic).attr("src", "../../Content/images/bows/" + item.Uri);
//                            //  $(topPic).attr("alt", item.Name);    
//                            // $(topPic).attr("title", item.Name);    

//                            $(topPic).animate({
//                                opacity: 1.0
//                            }, 5000, function() { animating = false; reset = !reset });

//                            
//                            $("#topId").text(item.ItemId);
//                            //itemId = item.ItemId;
//                        });


//                    }



//                }


//                else {


//                    // gallery photo (bottomPic1)
//                    if (!$(topPic).is(":animated") && animating == false) {
//                        animating = true;
//                        $(bottomPic).animate(
//                           { opacity: 0
//                           },
//                           5000);

//                        


//                        $.getJSON("Photo/RandomGalleryPhoto?photoString=" + $("#bottomId").text(), function(photo) {
//                            $("#photo-caption1").text(photo.Name);

//                            if (bottomPic == "#bottomPic1") {
//                                bottomPic = "#bottomPic2";
//                            }
//                            else {
//                                bottomPic = "#bottomPic1";
//                            }
//                            $(bottomPic).attr("src", "../../Content/images/gallery/" + photo.URL);
//                            // $(bottomPic).attr("alt", photo.Name);       
//                            //  $(bottomPic).attr("title", photo.Name);       
//                            $(bottomPic).animate({
//                                opacity: 1.0
//                            }, 5000, function() { animating = false; reset = !reset });

//                            
//                            $("#bottomId").text(photo.Random);
//                            //photoId = photo.PhotoId;
//                            
//                            //alert(photoId);
//                        });



//                        //                           
//                        //                           , function() {
//                        //                               $.getJSON("Photo/RandomGalleryPhoto?photoId=" + photoId, function(photo) {
//                        //                                   $("#photo-caption1").text(photo.Name);
//                        //                                   
//                        //                                   $("#pic1").attr("alt", photo.Name);
//                        //                                   $("#pic1").attr("src", photo.URL);

//                        //                                   $("#pic1").animate(
//                        //                                   { opacity: 1.0
//                        //                                   },
//                        //                                   5000, function() { animating = false; reset = !reset });
//                        //                                   photoId = photo.PhotoId;
//                        //                               });

//                        //                           });
//                    }
//                }

//            }, 1000); //200 ms


//$(".items-img").hover(
            $(".quick-view").hover(
                  function(e) {
                  
                      var quickView = $(this).parent().find(".img-description");
                      var textContainer = $(this).parent().find(".item-text-container");
                      var yThreshold = textContainer.offset().top;
                      

                      //accomodate for IE
                      var pageY = e.pageY - 5;
                      
                      if( pageY <= yThreshold ) {
                      
                          quickView.stop(true, true);

                          var top = 200;
                          var left = 150;
                          
                          if($.browser.msie && $.browser.version.substr(0,3)=="6.0") {
                             top = 150;
                             left = 100;
                          }
                          
                          quickView.css({ "top": parseInt($(this).parent().find(".items-img").css("top")) + top, "left": parseInt($(this).parent().find(".items-img").css("left")) + left });
                          quickView.slideDown(300);
                      }
                      // $(this).parent().children().stop(true, true);
                  },
                  function() {
                      $(this).parent().find(".img-description").slideUp(50);
                  }
              );

            $('#_quickView').dialog(
            {
                autoOpen: false,
                modal: true,
                overlay: { "opacity": ".8", "backgroundColor": "black" },
                width: 600,
                height: 700,
                position: 'top',
                resizable: false,
                draggable: false
            });
        })

 function fnShowQuickView(id) {

            //<span id="ui-dialog-title-_quickView" class="ui-dialog-title" unselectable="on" style="-moz-user-select: none;">18</span>
            //<a class="ui-dialog-titlebar-close ui-corner-all" href="#" role="button" unselectable="on" style="-moz-user-select: none;">
            //<span class="ui-icon ui-icon-closethick" unselectable="on" style="-moz-user-select: none;">close</span>


            //background: #CCCCCC url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) repeat-x scroll 50% 50%
           // $("#tabs").tabs();
            //$(".ui-dialog-titlebar").removeClass('ui-widget-header');
            //                 $(".ui-dialog-titlebar").each(function(idx, el) {
            //                     el.style.background = '';
            //                 }
            //);

            //    $("#ItemId").val(id);

            $.getJSON("/Order/OrderQuickView?itemId=" + id, function(orderViewData) {


                if (orderViewData.Item.New) {

                    $("#_quickView").data('title.dialog', orderViewData.Item.Name + " **New Item**");
                }
                else {

                    $("#_quickView").data('title.dialog', orderViewData.Item.Name);

                }

                $("#ListImage").attr("src", "/Content/images/bows/" + orderViewData.Item.ListPicture);



                $("#Description").text(orderViewData.Item.Description);
                
                
//                TODO: need to display sale price and out of stock on this quick view and index quick view
//                if(orderViewData.Item.OriginalPrice > 0) {
//                    var newHtml = "<p id='OriginalPrice' class='quickView-original-price line-through'>" + orderViewData.Item.OriginalPrice + "</p>";
//                    $(".colorFieldset:first").before(newHtml);
//                    
//                }

                $("#Price").text("$" + orderViewData.Item.Price.toFixed(2));


//                if(orderViewData.Item.OutOfStock) {
//                    
//                }




                //  for (i = 0; i <= colors.length - 1; i++) {
                //      $("select#Colors option[value='" + colors[i] + "']").attr("selected", "selected");
                //  }


                //  for (i = 0; i <= clips.length - 1; i++) {
                //      $("select#Clips option[value='" + clips[i] + "']").attr("selected", "selected");
                //  }



                $("#order-link").attr("href", "/Order/Order?itemId=" + orderViewData.Item.ItemId);

                $('#_quickView').dialog("open");

                // remove all previous colors so don't get duplicated
                $(".color").remove();

                // remove previous legend so doesn't duplicate
                $("#mylegend").remove();
                
                // remove previous fieldset so doesn't duplicate
                var placeholder = $("#placeholder");
                $("#myfieldset").replaceWith(placeholder);


                if (orderViewData.QuickViewColors != null && orderViewData.QuickViewColors.length > 0) {                
                    $("#placeholder").wrap("<fieldset id=\"myfieldset\"></fieldset>");
                    $("#placeholder").before("<legend id=\"mylegend\">" + orderViewData.QuickViewColorLabel + "s</legend>");
                }

                if (orderViewData.QuickViewColors != null) {
                    for (i = 0; i <= orderViewData.QuickViewColors.length - 1; i++) {
                        $("#placeholder").append("<img class=\"color\"  src=\"/Content/images/colors/" + orderViewData.QuickViewColors[i].Picture + "\" border=\"0\" alt=\"Missing\" height=\"40px\" width=\"45px\" alt=\"" + orderViewData.QuickViewColors[i].Name + "\" title=\"" + orderViewData.QuickViewColors[i].Name + "\" />");

                    }
                }
            });


            //$(".ui-dialog-titlebar").hide();




        }