//this should be absolute paths inside when we put it to live
var includes= new Hash ({
	library : {
		"addDrop" : ["AddDrop.js"],
		"autoComplete" : ["String.js", "MooDataStructure.js","AutoComplete.js"],
		"autoExpandTextArea" : ["AutoExpandTextArea.js"],
		"commentBlocks" : ["CommentBlocks.js"],
		"common" : ["String.js", "LoadingEffect.js","SearchValidation.js","common.js"],
		"dataManager" : ["DataManager.js"],
		"dataStructure" : ["MooDataStructure.js"],
		"historyManager" : ["HistoryManager.js"],
		"loadingEffect" : ["LoadingEffect.js"],
		"overlayContent" : ["OverlayContent.js"],
		"overlayAlert" : ["OverlayAlert.js"],
		"overflowScroller" : ["OverflowScroller.js"],
		"personInfoBox" : ["ToggleElement.js", "component_person_infobox.js"],
		"ratingStars" : ["RatingStars.js"],
		"searchValidation" : ["SearchValidation.js"],
		"scrollAnimator" : ["ScrollAnimator.js"],
		"scrollManager" : ["ScrollManager.js"],
		"string" : ["String.js"],
		"toggleElement" : ["ToggleElement.js"],
		"visitLog" : ["VisitLog.js"]
	},
	script : {
		"be_data_source_mapping" : "be_data_source_mapping.js"
	},
	
	paths : {
		"live" : "http://static.anobii.com/anobi/live/js/",
		"dev" : "http://208.101.11.19:81/InternalAPI/html/js/"
	}
});

jsVersion = jsVersion ? "?"+jsVersion : "";

//relative_path is the relative path that the html document relative to this include.js
//when put to live, we don't need this parameter
function include (key, relative_path) {
	relative_path = SITE ? includes.paths[SITE] : relative_path;	
	relative_path=relative_path.replace("\\", "/");
	if (relative_path && relative_path[relative_path.length-1]!="/")
		relative_path+="/";

	if (includes.library[key]){
		if ($type(includes.library[key])=="string")
			includes.library[key]=[includes.library[key]];
		includes.library[key].each(function (add) {
			new Asset.javascript(relative_path+add+jsVersion);
		});
	}
	else if (includes.script[key]) {
		if ($type(includes.script[key])=="string")
			includes.script[key]=[includes.script[key]];
		includes.script[key].each(function (add) {
			new Asset.javascript(relative_path+add+jsVersion);
		});
	}
	else
		new Asset.javascript(relative_path+key+".js"+jsVersion);
}

include ('common');
