function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

function toggleTshirtDetails(whichImg){
	if (whichImg == 'tsBack')
		document.getElementById('tshirt').innerHTML = '<img src="img/tshirt/backDetail.gif" alt="Back-Detail"/>'; 
	else if (whichImg == 'tsFront')
		document.getElementById('tshirt').innerHTML = '<img src="img/tshirt/frontDetail.gif" alt="Front-Detail"/>'; 
	else if (whichImg == 'overview')
		document.getElementById('tshirt').innerHTML = '<img src="img/tshirt/overview.gif" alt="Overview"/>';
	else if (whichImg == 'apathy_front')
		document.getElementById('apathy_cover').innerHTML = '<img src="img/covers/apathyFrontXL.jpg" alt="Apathy Esplanade Cover - Front"/>';
	else if (whichImg == 'apathy_back')
		document.getElementById('apathy_cover').innerHTML = '<img src="img/covers/apathyBackXL.jpg" alt="Apathy Esplanade Cover - Back"/>';
	else toggleTshirtDetails = null;
}

window.onload = function()
{
		var links = document.getElementsByTagName( 'a' );
    for ( i = 0; i < links.length; i++ ) {
		
		if ( links[i].className == 'external' ) {
			
			links[i].onclick=function() {
                newwindow = window.open( this.href );
				
				if ( window.focus ) {
                    newwindow.focus();
                }
				return false;
            }
        }
		
		if( links[i].className.indexOf( 'popup' ) != -1 ) {
            links[i].onclick=function() {
				
				var url    = this.href;
                var left   = 0;
                var top    = 0;
                var width  = 242;
                var height = 290;
                left = (screen.width-width)/2;
                if ( left <= 0 ) {
                    left = 0;
                }
                top = (screen.height-height)/2;
                if ( top <= 0 ) {
                    top = 0;
                }
                newwindow = window.open( url, 'popup','width='+width+',height='+height+',left='+left+',top='+top );
                if ( window.focus ) {
                    newwindow.focus();
                }
                return false;
            }
        }

    }
}