// JavaScript Document

window.onload = function resizeWindow() {
	var size = getViewportSize();
	var width = 360;
	if(size[0] > 360) {
		width = size[0];	
	}
	top.resizeTo(width,findPosY(document.getElementById('bottom'))+90);
	if(document.getElementById('firstname')) {
		document.getElementById('firstname').focus();
	}
}

function getViewportSize()
{
  var size = [0,0];

  if (typeof window.innerWidth != 'undefined')
  {
    size = [
        window.innerWidth,
        window.innerHeight
    ];
  }
  else if (typeof document.documentElement != 'undefined'
      && typeof document.documentElement.clientWidth != 'undefined'
      && document.documentElement.clientWidth != 0)
  {
    size = [
        document.documentElement.clientWidth,
        document.documentElement.clientHeight
    ];
  }
  else
  {
    size = [
        document.getElementsByTagName('body')[0].clientWidth,
        document.getElementsByTagName('body')[0].clientHeight
    ];
  }

  return size;
}

function findPosY(obj) {
 var curTop = 0;
 if (obj.offsetParent) {
   do {
     curTop += obj.offsetTop;
   } while (obj = obj.offsetParent);
 }
 else if (obj.y) {
   curTop += obj.y;
 }
 return curTop;
}
