var DURATION = .25;
function toggle_detail(el, noAnim) {
	var parent = $(el);
	var targets = getElementsByTagAndClassName(null, 'additional-detail', parent);
	if (hasElementClass(parent, 'hide-detail')) {
		forEach(targets, function (el) {
			if (! noAnim) {
				blindDown(el, {duration: DURATION});
				appear(el, {duration: DURATION});
			} else {
				setStyle(el, {display:'block'});
			}
		});
		removeElementClass(parent, 'hide-detail');
	} else {
	
	}
}

function check_anchor(clsName) {
//	var s = location.hash;
//	if (s && s.length == 2) {
//		s = s[1];
//		toggle_detail(clsName + s, true);
//	}
	var targets = getElementsByTagAndClassName(null, 'hide-detail');
	forEach(targets, function (el) {
		toggle_detail(el, true);
		//removeElementClass(el, 'hide-detail');
		//removeElementClass(el, 'hide-detail');
	});

}

var _gaq = null;

function check_target() {
	var links = getElementsByTagAndClassName('a');
	var check = new RegExp('^javascript');
	var check2 = new RegExp('^http://(www.)?new\-?angles');
	var check3 = new RegExp('^mnpp');
	forEach(links, function (e) {
	    if (e.href && (! e.href.match(check) && ! e.href.match(check2)  && ! e.href.match(check3))) {
	        e.target= '_blank';
	    }
	});
}


connect(window, 'onload', function () {
	check_target();
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-3094953-12']);
	_gaq.push(['_trackPageview']);
	
	(function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	})();
});
