/********************* 
   Position Footer
**********************/

function positionFooter()
{
      var cont = document.getElementById('container');
      var foot = document.getElementById('footer');
      var contH = cont.offsetHeight;
      var footH = foot.offsetHeight;
      var winH = getInnerHeight();
      if (winH > contH + footH) cont.style.height = winH - footH + 'px';
     
      
}

function positionFooter2()
{
      var cont = document.getElementById('container');
      var foot = document.getElementById('footer');
      var contH = cont.offsetHeight;
      var footH = foot.offsetHeight;
      var winH = getInnerHeight();
      if (winH > contH + footH) cont.style.height = winH - footH + 'px';
      document.getElementById('main-nav').style.height = contH + 85;
      
}

function getAbsPos(obj)
{
	var x = 0;
	var y = 0;
	while(obj.offsetParent)
	{
		y += obj.offsetTop;
		x += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	var rtn = {X:x,Y:y}
	return rtn;
}

function getInnerHeight()
{
	if (self.innerHeight) // all except Explorer
	{
		//x = self.innerWidth;
		innerY = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		//x = document.documentElement.clientWidth;
		innerY = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		//x = document.body.clientWidth;
		innerY = document.body.clientHeight;
	}
	return innerY
}

function getPageHeight()
{
	return document.body.scrollHeight;
}

function getAlignPos(width)
{
	var browX = screen.width
	var newBrowX = (browX - width)/2
	return newBrowX;
}

function getValignPos(height)
{
	var browY = screen.height
	var newBrowY = (browY - height)/2
	return newBrowY;
}

newWin = null;
function openNewWindow(strURL, strType, strWidth, strHeight)
{
	if (newWin != null && !newWin.closed) newWin.close();

	var strOptions = '';
	var maxWidth = screen.width - 30;
	var maxHeight = screen.height - 70;
	
	// resize window if too large
	if(strWidth > maxWidth) strWidth = maxWidth;
	if(strHeight > maxHeight) strHeight = maxHeight;
	
	if (strType=="console") strOptions = "resizable";
	if (strType=="resize") strOptions = "resizable=yes";
	if (strType=="console-scroll") strOptions = "resizable,scrollbars";
	if (strType=="team-profile") 
	{
		strWidth = 294;
		strHeight = 374;
		strOptions = "resizable";
	}
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,"+"resizable,location";
	
	if(strOptions) strOptions+=',';
	
	strOptions += "height="+strHeight+",width="+strWidth;

	var left = (screen.width/2) - strWidth/2;
 	var top = (screen.height/2) - strHeight/2;
	if(strWidth > maxWidth) left = 0;
	if(strHeight > maxHeight) top = 0;

	strOptions+=',left='+left+',top='+top+',screenX='+left+',screenY='+top;
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
	return newWin;	
}

function popImg(url,caption)//large 550px
{
	window.open('pop_img.aspx?url=' + url + '&caption=' + caption,'pop',"toolbar=no,menubar=no,titlebar=no,width=572,height=555,left=" + getAlignPos('572') + ",top=" + getValignPos('602'))
}
