/* -------------------------------------------------------------------------- */
/** 
 *    @fileoverview
 *       external js files loader.
 *
 *    @version rev004.2008-10-15
 */
/* -------------------------------------------------------------------------- */

function CWJImportJS(D,F){
	if(!D||typeof D!="string"){
		throw"CWJImportJS: first argument must be a file name or file path or full URL."
	}else{
		var G=arguments.callee;
		var B=(D.match("/"))?"":G.jsDir;
		var E=B+D;
		for(var A=0,C=false;(A<G.imported.length&&!C);A++){
			C=(C||G.imported[A]==E)
		}
		if(!C){
			var E=' src="'+E+'"';F=(F=="defer"||F===true)?' defer="defer"':"";
			document.write('<script type="text/javascript"'+E+F+"><\/script>");
			G.imported.push(E)
		}
	}
}

CWJImportJS.imported=[];
CWJImportJS.jsDir="./";
CWJImportJS.from=function(D){
	if(!D||typeof D!="string"){
		throw"CWJImportJS.from: first argument must be a directory path or a file name."
	}else{
		if(D.match("/")){
			if(D.substr(D.length-1)!="/"){
				throw"CWJImportJS.from: first argument must end with '/' in the case of specifying directory path."
			}else{
				this.jsDir=D
			}
		}else{
			var B=document.getElementsByTagName("head")[0].getElementsByTagName("script");
			for(var C=0,E=B.length;C<E;C++){
				var A=B[C].src.split("/");
				if(A.pop()==D){
					this.jsDir=A.join("/")+"/";
					break
				}
			}
		}
	}
};


/* --------------- import external scripts --------------- */

CWJImportJS.from('import.js');   // URL/path to js-directory, or filename of this file.

CWJImportJS('common.js');
CWJImportJS('rollover.js');
CWJImportJS('smoothScroll.js');
CWJImportJS('alphaImageLoader.js');