if the element not exists, gallery plugin will get error and broken all codes.

example code:

$("#thumb").overlay().gallery({ 
 
    speed: 300
    
});
there is no #thumb on the HTML docs.