
function Flex() {
	try {
		if ((window == top) && (!opener)) {
			return;
		}
	}
	catch(e) {}
	if (location.href.indexOf("flexdone=1") != -1) {
		return;
	}
	if (location.href.indexOf("magicpage.pl") != -1) {
		return;
	}
	try {		// same domain
		
  		var bodyElement = document.body;
  		var myHeight = parseInt(bodyElement.scrollHeight);
  		if ((myHeight == 0) && document.documentElement && document.documentElement.scrollHeight) {
  			bodyElement = document.documentElement;
  			myHeight = parseInt(bodyElement.scrollHeight);
  		}
  		
		if (frameElement) {	// iframe
			var ifrHeight = parseInt(frameElement.clientHeight);
	 		if (frameElement.getAttribute("originalSize")) {
	 			var orig = frameElement.getAttribute("originalSize");
	 			frameElement.style.height = orig+"px";
	 			ifrHeight = orig;
	 		}
	 		
	 		
	  		if (ifrHeight < myHeight) {
	    		frameElement.style.height = myHeight+"px";
	    		frameElement.setAttribute("scrolling","no");
	    		frameElement.setAttribute("originalSize",ifrHeight);
	  		}
	  	}
	  	else if (self == top) {	// top window
	  		if (myHeight > bodyElement.clientHeight) {
	  			self.resizeBy(0, myHeight - bodyElement.clientHeight);
	  		}
		}
	}
	catch(e) {			// not same domain
	}
}
	
window.setTimeout("Flex()",250);
