document.referrer for a splash effect

document.referrer for a splash effect

    Hi, I'm trying to create a splash page effect on my index page by adding some full screen images with jquery. I got that to work, but I only want to call the script if a person is arriving at the homepage after coming from an external site.  I think I can use document.referrer in something like this:
    1. <script type="text/javascript">
    2. $(document).ready(function() {
    3.                 var url = document.referrer;
    4.                 var match = url.indexOf("sitename");
    5.                 if (match != -1) {
    6.                    $('#wrapper').hide();
    7. $('#imgContainer').npFullBgImg("images/leisurestuff.jpg", {fadeInSpeed: 2000, center: true});
    8. $('#logoContainer').fullLogoImg("images/splash_logo.png", {fadeInSpeed: 2000, center: true});
    9. $('#logoContainer').click(function(){
    10. $('#wrapper').show('fast');
    11. $('#splash_kill').remove();
    12. $(this).remove();
    13. });
    14.    }
    15. });
    16. </script>   

    But it's not working I'm very new to javascript so any help would be much appreciated.  Thanks!