window.onload = setOnLink;

function setOnLink(){
	var a = document.getElementById('headerDiv').getElementsByTagName("A");
    for (var i = 0; i < a.length; i++) {
        if (a[i].href == window.location.href.split("#")[0]) {
			a[i].className = 'on';
		}
	}
}

/*************************************************************************/

function popUpObj(obj, img, imgW, imgH, type) {
	var popUpLoc = document.getElementById(obj);
	//alert(obj + ', ' + popUpLoc);
	//clear the popup window
	popUpLoc.innerHTML = '';
	//screen width/height
	var screenW;
	var screenH;
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	if (typeof window.innerWidth != 'undefined')
	{
		screenW = window.innerWidth,
		screenH = window.innerHeight
	}
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	else if (typeof document.documentElement != 'undefined'
	 && typeof document.documentElement.clientWidth !=
	 'undefined' && document.documentElement.clientWidth != 0)
	{
	    screenW = document.documentElement.clientWidth,
		screenH = document.documentElement.clientHeight
	}
	// older versions of IE
	else
	{
	    screenW = document.getElementsByTagName('body')[0].clientWidth,
		screenH = document.getElementsByTagName('body')[0].clientHeight
	}
	//alert('screen width = ' + screenW + ', screen height = ' + screenH);
	//user scroll positions
	var scrollX = typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement.scrollLeft;
  	var scrollY = typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement.scrollTop;
	//alert('scrollX='+scrollX+', scrollY='+scrollY);
	//position the popup window
	var midX = Math.floor(screenW/2) + scrollX;
	var midY = Math.floor(screenH/2) + scrollY;
	var imgMidX = Math.floor(imgW/2);
	var imgMidY = Math.floor(imgH/2);
	var posLeft = midX - imgMidX;
	var posTop = midY - imgMidY;
	//alert('midX='+midX+', midY='+midY+', imgMidX='+imgMidX+', imgMidY='+imgMidY+', posLeft='+posLeft+', posTop='+posTop);
	//set popup window properties
	popUpLoc.style.top = posTop + 'px';
	popUpLoc.style.left = posLeft + 'px';
	popUpLoc.style.width = imgW + 'px';
	//popUpLoc.style.height = (imgH + 10) + 'px';
	if (type == 'ss') {
		popUpLoc.innerHTML = '<div align="right"><a href="#" onclick="hide(\''+obj+'\'); return false;">[close]</a></div><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '+
					'width="640" height="428" id="slideshow1" align="middle">'+
					'<param name="allowScriptAccess" value="sameDomain" />'+
					'<param name="movie" value="slideshow.swf?imgXML='+img+'" />'+
					'<param name="quality" value="high" />'+
					'<param name="bgcolor" value="#000000" />'+
					'<embed src="slideshow.swf?imgXML='+img+'" quality="high" bgcolor="#000000" '+
					'	width="640" height="428" name="slideshow1" '+
					'	align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
				'</object>';
	} else {
		popUpLoc.innerHTML = '<div align="right"><a href="#" onclick="hide(\''+obj+'\'); return false;">[close]</a></div><a href="#" onclick="hide(\''+obj+'\'); return false;"><img src="'+img+'" width="'+imgW+'" height="'+imgH+'" border="0" alt="click to close" title="click to close" /></a>';
	}
	//display the popup window
	popUpLoc.style.display = 'block';
}
function hide(obj) {
	document.getElementById(obj).style.display = 'none';
}