function browsercheck() {
  this.ua = navigator.userAgent.toLowerCase();
  this.dom = document.getElementById ? 1 : 0;
  this.macie = (this.dom && this.ua.indexOf('mac') > -1) ? 1 : 0;
  this.op6 = (this.dom && this.ua.indexOf('opera 6') > -1 || this.ua.indexOf('opera/6') > -1) ? 1 : 0;
  this.op7 = (this.dom && this.ua.indexOf('opera 7') > -1 || this.ua.indexOf('opera/7') > -1) ? 1 : 0;
  this.ie5 = (this.dom && this.ua.indexOf('msie 5') > -1) ? 1 : 0;
  this.ie6 = (this.dom && this.ua.indexOf('msie 6') > -1) ? 1 : 0;
  this.moz = (this.dom && this.ua.indexOf('mozilla') > -1 && this.ua.indexOf('gecko') > -1) ? 1 : 0;
}
bw = new browsercheck();
//glitch fix
if (bw.moz) {document.write('<style>#center{overflow:hidden}</style>');}

function vheight(){
	x=0
	q=0
	if (bw.moz || bw.macie){
		if (bw.moz) {x = document.body.scrollHeight; q = window.innerHeight}
		//if (bw.op7) {x = document.body.offsetHeight; q = window.innerHeight}
		else if (bw.macie) {x = document.documentElement.offsetHeight; q = window.innerHeight}
	
		if (x<q) {x=q} 
		else {x = x}
		
		document.getElementById('center').style.height = x+'px'
		document.getElementById('container').style.height = x+'px'
	}
}

function fixColHeight()
{
	var args = arguments;
	var arrHeight = Array(args.length);
	var maxHeight = null
	// find max
	for(i=0; i<args.length; i++)
	{
		//alert(args[i].offsetHeight)
		if(maxHeight==null) { // is null
			maxHeight = args[i].offsetHeight;
			continue;
		}
		if(maxHeight > args[i].offsetHeight) { // is greater
			continue;
		}
		maxHeight = args[i].offsetHeight; // is less than
	}
	// set all height to Max
	for(i=0; i<args.length; i++)
	{
		args[i].style.height = (maxHeight)+'px';
	}
}

// onload
//window.onload=vheight;
// onresize
//window.onresize=function(){window.location.reload();}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function change(id,type,hex){
if (typeof id!=='object'){id=MM_findObj(id);}

if(type=='bg'){id.style.background=hex}
else if(type=='brd'){id.style.borderColor=hex}
else if(type=='txt'){id.style.color=hex}

id.style.cursor=(bw.ie5)?'hand':'pointer';
}

// open / close list menu
lastMenu=null;
function showList(v) {
  if ( (obj = MM_findObj(v) ) != null) {
    if(lastMenu)
      lastMenu.style.display = 'none';
    obj.style.display = 'block';
    lastMenu=obj;
  }
}

function getMe(uri) {
location.href=uri;
}

// pop-up for opening news and project images
var popwin = null;
function popImage(imagesrc,winwidth,winheight,alt){
	var left = (screen.width/2) - winwidth/2;
 	var top = (screen.height/2) - winheight/2;
 	var look='width='+winwidth+',height='+winheight+',left='+left+',top='+top+',screenX='+left+',screenY='+top;
	if (popwin != null && !popwin.closed) popwin.close();
	popwin=window.open("","imgWin",look);
	popwin.document.open();
	popwin.document.write('<html>\n<head>\n');
	popwin.document.write('<title>'+alt+'</title>\n');
	popwin.document.write('<style type="text/css">\n');
	popwin.document.write('body { margin:0px; background-color:#cccc99; background-image:url(../images/loading.gif);	background-repeat:no-repeat; background-position:center center; }\n');
	popwin.document.write('</style>\n');
	popwin.document.write('</head>\n<body marginwidth="0" marginheight="0">\n');
	popwin.document.write('<a href="javascript:;" onClick="window.close()"><img src="'+imagesrc+'" alt="'+alt+'" border="0"></a>\n');
	popwin.document.write('</body>\n</html>');
	popwin.document.close();
}
// POP-UP WINDOWS
// generic multi use pop-up with pre-programmed 'type'
var newWin = null;
function popUp(strURL, strType, strWidth, strHeight) {
	if (newWin != null && !newWin.closed) newWin.close();
	var left = (screen.width/2) - strWidth/2;
	var top = (screen.height/2) - strHeight/2;
	var strOptions="";
	if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,"+"resizable,location,height="+strHeight+",width="+strWidth;	
	strOptions+=',left='+left+',top='+top+',screenX='+left+',screenY='+top;
	
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
}