JQ = jQuery.noConflict();
JQ(document).ready(function(){
    // detect the screen resolution
   
    if ((screen.width<1280) && (screen.height<1024)){
        JQ("div#notice").html("Looks like you're using a low resolution.<br/>\n\
                                This website has been designed for resolutions of 1280x1024px.  Please adjust your resolution\n\
                                in order to get the full experience of this site.");
    }
    
    _handleMusic();
});

function _handleMusic(){
    var files = JQ(".scrollItem");

    if(files.length > 0){
        JQ(".scrollItem").each(function(){
            var file = JQ(this);
            if(!JQ(file).hasClass("active")){
                file.animate({
                    opacity: 0.25
                }, 0);
            }
        });
    }

    JQ(".scrollItem").hoverIntent(function(){
       
        if(!JQ(this).hasClass("active")){
            JQ(this).animate({
                opacity: 1
            }, 300);
        }
    }, function(){
        if(!JQ(this).hasClass("active")){
            JQ(this).animate({
                opacity: 0.25
            }, 300);
        }

    });

    JQ(".scrollItem").click(function(){
        // what page are we on
        var page = getURIVar("p");
        if(page == ""){
            page = "index";
        }
        var file_id = JQ(this).attr("id").split("file_");
        var id = file_id[1];
        window.location.href = "?p=" + page + "&file=" + id;
    });

}

function getURIVar(name){

   name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if( results == null )
    return "";
    else
    return results[1];

}
