var head = document.childNodes[1].childNodes[0];
var type = 'text/javascript';

if (BrowserDetect.supportsJQuery()) {
	var jQueryTag = document.createElement('script');
	var validatePluginTag = document.createElement('script');
	var pageScriptTag = document.createElement('script');

	if (Boolean(Element.prototype.setAttribute)) {						
		jQueryTag.setAttribute('type',type);
		jQueryTag.setAttribute('src','scripts/jQuery/jquery-1.3.2.js');
		
		validatePluginTag.setAttribute('type',type);
		validatePluginTag.setAttribute('src','scripts/jQuery/plugins/validation/jquery.validate.js');
		
		pageScriptTag.setAttribute('type',type);
		pageScriptTag.setAttribute('src','scripts/index.js');
	} else {
		jQueryTag.type = type;
		jQueryTag.src = 'scripts/jQuery/jquery-1.3.2.js';
		
		validatePluginTag.type = type;
		validatePluginTag.src = 'scripts/jQuery/plugins/validation/jquery.validate.js';
		
		pageScriptTag.type = type;
		pageScriptTag.src = 'scripts/index.js';
	}
	
	head.appendChild(jQueryTag);
	head.appendChild(validatePluginTag);
	head.appendChild(pageScriptTag);
} else {
	var scriptTag = document.createElement('script');
	
	if (Boolean(Element.prototype.setAttribute)) {
		scriptTag.setAttribute('type',type);
		scriptTag.setAttribute('src','scripts/legacy_index.js');
	} else {
		scriptTag.type = type;
		scriptTag.src = 'scripts/legacy_index.js';
	}
	
	head.appendChild(scriptTag);
}
