var isIE = 0/*@cc_on + 1 @*/;
var HEAD = document.getElementsByTagName('head')[0];
function $import(href){
	var type;
	if (href.match(/\bie\b/) && !isIE) return;
	if (href.match(/\.js$/)) type = 'js';
	if (href.match(/\.css$/)) type = 'css';
	
	if (type === 'js') {
		document.write('<scr'+'ipt src="' + href + '" type="text/javascript" charset="utf-8"><\/script>');
	}
	else
	if (type === 'css') {
		var media = 'screen';
		if (href.match(/\bprint\b/)) media = 'print';
		var link = document.createElement('link');
		link.setAttribute('href', href);
		link.setAttribute('rel',"stylesheet");
		link.setAttribute('type',"text/css");
		link.setAttribute('media',media);
		link.setAttribute('charset',"utf-8");
		HEAD.appendChild(link);
	}
	
};

try{
	if (!document.getElementById) throw 'Old browser :P';
	
	$import('/static/css/screen.css');
	$import('/static/css/subtlegradient.css');
	// $import('/static/css/print.css');
	// $import('/static/css/ie.css');
	
	document.documentElement.className = 'loading';
	setTimeout(function(){
		document.documentElement.className = 'loaded';
	},5*1000);
	
	var isIE5 = isIE && !document.compatMode;
	if (isIE5) document.documentElement.className = 'loaded';
	else {
		$import('http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js');
		$import('/static/js/subtlegradient.js');
	}
	if (!isIE5) $import('/static/js/fixes.js');
	
	
	// $import('http://www.google-analytics.com/ga.js');
	$import('http://s3.amazonaws.com/new.cetrk.com/pages/scripts/0000/0269.js');
	
	this.KM_KEY = "7676e94a6ee7904a65738ecb9c163492f92f72b5";
	$import("http://scripts.kissmetrics.com/t.js");
	setTimeout(function(){
		if ("/" == document.location.pathname.toLowerCase())
			KM.record("Viewed Home");
		if ("/articles/" == document.location.pathname.toLowerCase())
			KM.record("Viewed Articles");
		if (/^\/articles\/.+/i.test(document.location.pathname))
			KM.record("Viewed an Article");
	}, 1000);
	
	
}catch(e){
	document.documentElement.className = 'loaded';
}

