
// function used to determine the window's body dimmensions...
function getPageBodyDimmensions() 
{
	var myWidth = 0, myHeight = 0;
	if(typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} 
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight) ) 
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} 
	else if(document.body && (document.body.clientWidth || document.body.clientHeight)) 
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [myWidth, myHeight]; // returns an array of 2 values...
}

function animateFlash()
{
	/*
	arrWindowSize = getPageBodyDimmensions();
	intWidth = 600;
	intHeight = intWidth;
	
	document.getElementById('idNPLogo').style.display = 'block';
	document.getElementById('idNPLogo').style.left = (arrWindowSize[0] - intWidth)/2 + "px";
	arrScrollPosition = getScrollXY();
	document.getElementById('idNPLogo').style.top = ((arrWindowSize[1] - intHeight)/2 + arrScrollPosition[1]) + "px";
	
	var fo = new FlashObject("/resources/swf/npAnimatedLogo.swf","npAnimatedLogo",intWidth,intHeight,"7","#FFFFFF");
	fo.addParam("allowScriptAccess","always");
	fo.addParam("quality","high");
	fo.addParam("wmode","transparent");
	fo.addParam("scale", "exact");
	fo.addParam("loop","true");
	fo.write("idNPLogo");
	
	setTimeout("hideNPAnimation()",1000);
	*/
}

function hideNPAnimation()
{
	document.getElementById('idNPLogo').style.display="none";
}

// Animate as soon as soon as the page loads...
if(window.location == 'http://www.nuclearpants.com/')
animateFlash();

function postAnimationProcessing() 
{
	//alert('hello');
}

//document.onmousedown = handleClick;
//document.onkeydown = handleClick;

function handleClick()
{
	animateFlash();
}

function getScrollXY() 
{
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) 
  {
	//Netscape compliant
	scrOfY = window.pageYOffset;
	scrOfX = window.pageXOffset;
  } 
  else if( document.body && (document.body.scrollLeft || document.body.scrollTop)) 
  {
	//DOM compliant
	scrOfY = document.body.scrollTop;
	scrOfX = document.body.scrollLeft;
  } 
  else if( document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) 
  {
	//IE6 standards compliant mode
	scrOfY = document.documentElement.scrollTop;
	scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ]; // returns an array of 2 values...
}


function nextGallery(objSel)
{
	if(objSel.options.selectedIndex <= objSel.options.length);
	{
		if(objSel.options.selectedIndex != (objSel.options.length -1))
		{
			objSel.options.selectedIndex++;
		}
		else
		{
			objSel.options.selectedIndex = 0;
		}
		window.location = '/photo-galleries?PHG_ID=' + objSel.value + '&galleryTitle=' + objSel.options[objSel.selectedIndex].text + '&musicWindowIsOpen=' + objSel.form.musicWindowIsOpen.value;
	}
}
function delayedNextGallery()
{
	nextGallery(document.getElementById('selGalleries'));
}
function previousGallery(objSel)
{
	blnResult = true;
	if(objSel.options.selectedIndex > 0)
	{
		objSel.options.selectedIndex--;
		window.location = '/photo-galleries?PHG_ID=' + objSel.value;
		blnResult =  false;
	}
	return blnResult;
}

function scrollToTop()
{
	Effect.ScrollTo('mainContainer', {duration:1});
}
function scrollToBottom()
{
	Effect.ScrollTo('copyright', {duration:1});
}

function expandCollapse(id)
{
	if($("contentID_" + id).style.display != "block")
	{
		$("contentID_" + id).style.display = "block";
		$("titleID_" + id).style.marginBottom = "15px";
		$("titleID_" + id).style.backgroundImage = "url('/resources/images/expand_icon_up.png')";
	}
	else
	{
		$("contentID_" + id).style.display = "none";
		$("titleID_" + id).style.marginBottom = "0px";
		$("titleID_" + id).style.backgroundImage = "url('/resources/images/expand_icon_down.png')";
	}
	
}
