﻿$(document).ready(function() {
      
     $('a.moreButton').click(function(){
     
            // Setup the ajax indicator
            $(this).append('<div id="ajaxBusy"><p><img src="'+siteRoot+'_storkart/images/global/updating.gif" /></p></div>');
        
            $('#ajaxBusy').css({
                display:"none",
                position:"absolute",
                right:"3px",
                top:"3px",
                width:"auto",
                zIndex:"10000"
            });
     
            // Ajax activity indicator bound
            // to ajax start/stop document events
            $(document).ajaxStart(function(){
                $('#ajaxBusy').show();
            }).ajaxStop(function(){
                $('#ajaxBusy').hide();
                
                // Remove the added div to prevent 'cloning'
                $('#ajaxBusy').remove();
            });
         
            var id=$(this).attr('id');
                    
            // parse out the id number
            var idpart = id.slice(11);
                   
            $.post(siteRoot+"AJAXProducts.aspx",{productid: idpart}, function(response) {
                         
                $("div#moreDetail_" + idpart).html(response);
                $("div#moreDetail_" + idpart).toggle("slow");
                         
            });
            
            // Toggle the more button between more/hide ...
            if ($("#moreImage_" + idpart).attr("src")== siteRoot+"_storkart/images/global/button_hide.gif"){
                    $("#moreImage_" + idpart).attr("src", siteRoot+"_storkart/images/global/button_more.gif");
            }
            else{
                     $("#moreImage_" + idpart).attr("src", siteRoot+"_storkart/images/global/button_hide.gif");
            }
                
            // Prevent the link from actually being followed
            return false;
        
       });   
            
});
    




