
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 > 0) {
	  			self.resizeBy(0, myHeight);
	  		}
		}
	}
	catch(e) {			// not same domain
		/*
  		var myHeight = 0
		scrollBy(0,9000);
		if (document.body.scrollTop > 0) {	// needs enlargement
			myHeight = document.body.scrollTop;
		}
		scrollTo(0,0);
		
		if (myHeight == 0) {
			return;
		}
		var me = encodeURIComponent(location.href);
		var flex_page = "/htm-webaxy/javascript/flex.htm";
		flex_page += "?height="+(myHeight + 5)+"&me="+me;
		// now jump to flex page
		//location.replace(flex_page);	
		*/
	}
}
	
window.setTimeout("Flex()",250);
