title: Can i use javascript to prevent Loading the same script over and over?
body: <p>Writing an application for a custom gallery, and all the script files are put in a resource folder inside each gallery folder-</p>
  
  <p>is it possible to have a variable enabled that would prevent the page from loading its local JavaScript files but instead load from the main page's resource folder? trying to avoid having to hard-code it as well.</p>
  
  <p>esentially all i really want is for my script files to be able to have a variable starting path- IE</p>
  
  <pre><code>(script src="(path)load.js" type="text/javascript")(/script)
  </code></pre>
  
  <p>where path is either blank "" or main main site- "http://www.site.com/resources/"</p>
  
  <p>some of the files are CSS files so im not sure the class method would work well-
  also- is there a way to refer to the root of a site? similar to using ../ but just to get the root html path.</p>
  
  <p>More Info-----</p>
  
  <p>The layout i have is that each gallery made is a separate folder- (for example, photography, painting, drawings, etc- would all be separate folders). They each would contain their own resources withing their folder. this is so i can just upload 1 gallery to a site and everything would be packaged nicely. But- if im running multiple gallery on one site- as with a portfolio site, each page is loading its own set of resources, which is probably not a great idea.</p>
  
  <p>The resources are - thumbnails, images, xml( which are all specific to individual gallery) but then they also each have a couple javascript files for functions, a css file, and a few images that make the gallery maneuverable(arrows and the like).</p>
  
  <p>I just want to be able to have the scripts which are loaded in the header- load from the root site resource folder if there are multiple gallerys</p>