/* --- Show Subnav button on click */

function showSubnav(cat) {
	var theCats = new Array('press','features','shorts','series','writings','blog');
	var i = 0;
	for (i = 0; i < theCats.length; i++) {
		if(theCats[i] == cat) { //if clicked, turn on
			var theNav = document.getElementById('nav-' + theCats[i]);
			var theNavButton = theNav.getElementsByTagName("A");
			theNavButton[0].id = 'current';
			var theSubnavDiv = document.getElementById('subnav-' + theCats[i]);
			theSubnavDiv.style.display = '';		
		} else { //otherwise, turn off
			var theNav = document.getElementById('nav-' + theCats[i]);
			var theNavButton = theNav.getElementsByTagName("A");
			theNavButton[0].id = '';
			var theSubnavDiv = document.getElementById('subnav-' + theCats[i]);
			theSubnavDiv.style.display = 'none';
		}
	}
}

function setLogoPos() { 
  var myWidth = 0;
  var myHeight = 0;
  var obj = document.getElementById("pkpCircle");
  obj.style.top = '50px';
  obj.style.left = '50px';
  //alert (typeof(window.innerWidth));
  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;
  }
  
  myWidth = parseInt(myWidth) - 120;
  myHeight = parseInt(myHeight) - 270;
  //alert ('w: '+myWidth+', h: '+myHeight);
  var rand1a = Math.floor(Math.random()*myWidth);
  var rand1b = Math.floor(Math.random()*myHeight)+150;
  //alert ('1: '+rand1a+', 2: '+rand1b);
  obj.style.left = rand1a+'px';
  obj.style.top = rand1b+'px';
  obj.style.display = "block";
  //alert ('Left is: '+obj.style.left+', Top is: '+obj.style.top);
 
 obj.onmouseover = function() {
 	obj.style.backgroundPosition = '0px -115px';
 }
 obj.onmouseout = function() {
 	obj.style.backgroundPosition = '0px 0px';
 }
}