var menutime=500;
var lastn=0;
var fadeInStep=20;
var fadeOutStep=10;
var fadeTime=50;

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-25156119-3']);
  _gaq.push(['_setDomainName', 'none']);
  _gaq.push(['_setAllowLinker', true]);
  _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);
  })();

function showSubnav(menu) {
	 var m=1;
	 var obj=false;
	 do {
		if (obj=document.getElementById('subnav'+m)) {
			if (menu!=m)
				fadeOut(obj);
			else
				fadeIn(obj);
		}
		else
			break;
	 } while (m++);
	 lastn++;
}
function hideSubnav() {
	lastn++;
	setTimeout("closeSubnav("+lastn+")", menutime); 
}
function closeSubnav(tick) {
	if (tick==lastn)
		showSubnav(0);
}
function fadeIn(obj) {
	if (navigator.userAgent.search(/(MSIE|Firefox)/)==-1)
		obj.style.display = 'block';
	else {
		if (obj) {
			if (typeof obj.fade == 'undefined')
				obj.fade = 0;
			obj.step = fadeInStep;
			if (obj.fade == 0)
					doFade(obj.id);
		}
	}
}
function fadeOut(obj) {
	if (navigator.userAgent.search(/(MSIE|Firefox)/)==-1)
		obj.style.display = 'none';
	else {
		if (obj) {
			if (typeof obj.fade == 'undefined')
				obj.fade = 0;
			obj.step = -fadeOutStep;
			if (obj.fade == 100)
					doFade(obj.id);
		}
	}
}
function doFade(id) {
	var obj = document.getElementById(id);
	if (obj) {
		// add/subtract current step amount
		obj.fade = Math.min(100,Math.max(0,obj.fade + obj.step));
		// set opacity
		setFade(obj,obj.fade);
		// Still more to go - timeout for a bit and keep going
		if (obj.fade<100 && obj.fade>0)
			setTimeout("doFade('" + id + "')",fadeTime);
	}
}
function setFade(obj,value) {
	// if completely faded, don't display
	obj.style.display = (value == 0 ? 'none' : 'block');
	// Set fade amount
	if (document.all)
		obj.style.filter = "alpha(opacity=" + value + ")";
	else
		obj.style.MozOpacity = value/100;

}




/* Tab Controls */
function showTab(name) {
	var content=document.getElementById('content');
	if (content) {
		var divs=content.getElementsByTagName('div');
		for (var div=0; div<divs.length; div++)
			if (divs[div].className=='contentTab')
				divs[div].style.display=(divs[div].id==name ? 'block' : 'none');
	}
	var controls=document.getElementById('contentTabs');
	if (controls) {
		var links=controls.getElementsByTagName('a');
		for (var l=0; l<links.length; l++)
			links[l].className=(links[l].id==(name + 'link') ? 'current' : '');
	}
	return false;
}



/* View Trx Image */
function MM_openBrWindow(theURL,winName,features) {
  var win=window.open(theURL,winName,features);
  if (typeof win != 'undefined') win.focus();
  else win=false;
  return win;
}
function viewTRXImage(url) {
	MM_openBrWindow(url,'Trx','width=700,resizable,scrollbars');
}
