    
        //Google load callback function 
        //google.setOnLoadCallback(function() {
        $(document).ready(function () {
            //Set all of the items with a preview class that contain an a tag to have the functionality
            //of calling the aClickPlay method when the user clicks on the item
            $(".preview a").bind('click', aClickPlay);
        });
        
        swfobject.registerObject("shoppingCartPreview", "9.0.0", "expressInstall.swf");
        
        //Called by the preview object when user clicks on the item

        function aClickPlay()
        {	
            if(navigator.mimeTypes ["application/x-shockwave-flash"] == undefined) {
                
                if (window.ActiveXObject) {
                    var control = null;
                    try {
                        control = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
                    } catch (e) {
                        return;
                    }
                    
                    if (control) {
                        playFlashSong(this.rel, this.id);
                    } else {
                        $(".preview a").each(function(){
                            $(this).addClass('play').removeClass('stop');
                        });
                        playHTML5Song(this.rel, this.id);
                        
                    }
                    
                } else {
                    $(".preview a").each(function(){
                        $(this).addClass('play').removeClass('stop');
                    });
                    playHTML5Song(this.rel, this.id);
                    
                }
                
            } else {
                playFlashSong(this.rel, this.id);
            }
            
        }
            
        //Called by the preview object when user clicks on the item when the sound is playing
        function aClickStop()
        {
            if (navigator.mimeTypes ["application/x-shockwave-flash"] == undefined) {
                  if (window.ActiveXObject) {
                    var control = null;
                    try {
                        control = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
                    } catch (e) {
                        return;
                    }
                    
                    if (control) {
                        stopFlashSong();  
                    } else {
                        stopHTML5Song(this.id);
                    }
                    
                } else {
                    stopHTML5Song(this.id);
                }
            } else {
                stopFlashSong();  
            }
            
        }
            
        //Called by aClickPlay method. Calls the play function in the flash object
        function playFlashSong (url, name)
        {
            var obj = swfobject.getObjectById("shoppingCartPreview");
            if (url && name) {
                if (obj) {
                    obj.playTrack(url, name); // e.g. an external interface call
                }
            }
        }
            
        function playHTML5Song (url, name)
        {
            var obj = document.getElementById("html5Player");
            if (url && name) {
                if (obj && obj.play) {
                    obj.setAttribute('src', url);
                    obj.play();
                    songPlaying(name);
                } else {
                    alert ('Your browser must support Flash or HTML5 Audio to listen to this track');
                }
            }
        }
            
        //Called by aClickStop method. Calls the stop function in the flash object
        function stopFlashSong()
        {
            var obj = swfobject.getObjectById("shoppingCartPreview");
            if(obj && obj.stopTrack)
            {
                obj.stopTrack();
            }
        }
        
        function stopHTML5Song(name)
        {
            var obj = document.getElementById("html5Player");
            if(obj && obj.pause)
            {
                obj.pause();
                songStopped(name)
            }
        }
        
        
        //Flash Callback function. Called by Flash object when a track starts to play
        //Function changes the class of the playing track preview element. 
        //Sets the click event to aClickStop of the element
        function songPlaying(name)
        {
            $(function()
                {
                    $('#'+name).addClass('stop').removeClass('play');
                    $('#'+name).unbind('click', aClickPlay).bind('click', aClickStop);
                }
            )
        }
            
        //Flash Callback function. Called by Flash object when a track stops playing
        //Function changes the class of the playing track preview element. 
        //Sets the click event to aClickPlay of the element
        function songStopped(name)
        {
            $(function()
                {
                    $('#' + name).addClass('play').removeClass('stop');
                    $('#' + name).unbind('click', aClickStop).bind('click', aClickPlay);
                    $('#' + name).triggerHandler('afterSongStopped');
                }
            )
        }
            

        function hidediscPreview (id) {
            $("#discPreviewDiv").hide("fast");
            $("#discPreview").html('');
        }
    
        
        function showdiscPreview (id) {
            
            $("#discPreviewDiv").show("fast");
            
            $.ajax({async: true,
                    type: "GET",
                    url: "/music/discpreview.popup.php?lib="+id, // /music/discpreview.popup.php?lib="+id,
                    success: function (data) {
                        $("#discPreview").html(data);
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $("#discPreview").html('request failed');
                    }
                });
        
            $("#discPreviewDiv").center();
        }
        
        
        
        function toggleComposer (id) {
            if ($('#'+id).css('height') == '215px') {
                $('#'+id+'More').html('<img src="images/FeaturedComposer-btm-Less.jpg" border="0" width="249" height="30" />');
                $('#'+id).css( 'height', '100%');
            } else {
                $('#'+id+'More').html('<img src="images/FeaturedComposer-btm-More.jpg" border="0" width="249" height="30" />');
                $('#'+id).css( 'height', '215px');
            }
        }
        
        /*function toggleComposer (id) {
            if ($('#'+id+'More').html() == 'v') {
            $('#'+id+'More').html('^');
            $('#'+id).css( 'height', '100%');
            } else {
            $('#'+id+'More').html('v');
            $('#'+id).css( 'height', '215px');
            }
        }*/
        
        function toggleComposerP () {
            if ($('#ComposerPMore').html() == '- Show More -') {
                $('#composerP').css('max-height', '100%');
                $('#ComposerPMore').html('- Show Less -');
                $('#composerP').css('height', '100%');
            } else {
                $('#ComposerPMore').html('- Show More -');
                $('#composerP').css('height', '215px');
            }
            
        }
