function showFeatures(what) {
	
	w = document.body.clientWidth || window.innerWidth;
	h = document.body.clientHeight || window.innerHeight;
	
	size = alertSize();
	
	// ie use scrollheight
	
	// ff use innerHeight + scrollMaxY
	
	if(window.innerHeight) {
		if(window.scrollMaxY) {
			nh = window.innerHeight + window.scrollMaxY;
		} else {
			nh = window.innerHeight; 
		}
		
		if(document.body.scrollHeight && document.body.scrollHeight > nh) {
			nh = document.body.scrollHeight;
		}
		
	} else {
		if(size[1] > document.body.scrollHeight) {
			nh = size[1];
		} else {
			nh = document.body.scrollHeight;
		}
	}
	
	document.getElementById('bg').style.width = w + "px";
	document.getElementById('bg').style.height = nh + "px";
	document.getElementById('bg').style.display = 'block';
	
	pos = findPos(document.getElementById('wrapper'));
	
	document.getElementById('popup').style.top = (pos[1] + 190) + "px";
	
	document.getElementById('popup').style.left = (pos[0] + 330) + "px";
	
	document.getElementById('popup').style.display = '';
	
	
	document.getElementById('popup_content').style.top = (pos[1] + 190) + "px";
	
	document.getElementById('popup_content').style.left = (pos[0] + 330) + "px";
	
	document.getElementById('popup_content').style.display = '';
}

function closeFeatures() {
	document.getElementById('popup').style.display = 'none';
	document.getElementById('popup_content').style.display = 'none';
	document.getElementById('bg').style.display = 'none';
}

function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	//return arrayPageSizeWithScroll;
}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  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;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
  return [ myWidth, myHeight ];
}

function findPos(obj) {
	var curleft = curtop = 0;
	
	if (obj.offsetParent) {
	
		do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
				
		} while (obj = obj.offsetParent);
	}
	
	return [curleft,curtop];
}

function getScrollXY() {

  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
	//Netscape compliant
	scrOfY = window.pageYOffset;
	scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	//DOM compliant
	scrOfY = document.body.scrollTop;
	scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	//IE6 standards compliant mode
	scrOfY = document.documentElement.scrollTop;
	scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}