// JavaScript Document
		 	function PopupWindow(text, width, height) {
				features = "toolbar=no, status=no, width=" + width + ", height=" + height;
			 	popup = window.open("", "_blank", features);
			 	popup.document.write("<html><head></head><body><p style='font-family: arial, \'lucida console\', sans-serif'>");
			 	popup.document.write(text);
			 	popup.document.write("</p></body></html>");
			}
			
			var text, width, height, xmlhttp;
			function PopupWindow2(pURL, wid, ht) {
				width = wid;
				height = ht;
   				if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc
      				xmlhttp=new XMLHttpRequest();
      				xmlhttp.onreadystatechange=postFileReady;
      				xmlhttp.open("GET", pURL, true);
      				xmlhttp.send(null);
   				} else if (window.ActiveXObject) { //IE
      				xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
					if (xmlhttp) {
         				xmlhttp.onreadystatechange=postFileReady;
						xmlhttp.open('GET', pURL, true);
         				xmlhttp.send();
      				}
   				}
			}
			
			function countLines(text) {
				pattern = /<br\/>/;
				arr = text.split(pattern);
//				alert(arr.length);
				return arr.length;
			}
			
			function maxLength(text) {
				pattern = /<br\/>/;
				arr = text.split(pattern);
				max = 0;
				for (i = 0; i < arr.length; i++) {
//					alert(arr[i]);
					len = arr[i].length;
					if (len > max)
						max = len;
				}
//				alert(max);
				return max;
			}

			// function to handle asynchronous call
			function postFileReady() {
   				if (xmlhttp.readyState==4) {
      				if (xmlhttp.status==200) {
						text = xmlhttp.responseText;
		 				features = "toolbar=no, scrollbars=yes, status=no, width=" +
							 maxLength(text) * 8 + ", height=" + countLines(text) * 19;;
			 			popup = window.open("", "_blank", features);
			 			popup.document.write("<html><head></head><body><div style='font-size:16px;font-family: arial, \'lucida console\', sans-serif'>");
			 			popup.document.write(text);
			 			popup.document.write("</div></body></html>");
      				}
				}
			}
