/*
	fillme.js
	FillMe class
	Copyright 2005 Alex Schlegel.  All Rights Reserved.
	
	***
	*Requires url.js
	*the strPL perl script file must have the proper fillme sub:
		(in the action sub)
			if ($act eq 'fillme'){fillme($vars{'strEval'}); last SWITCH}
		(fill me sub)
			sub fillme($)
			{
				my $strEval	= $_[0];
				my $strFill	= eval($strEval);
				
				my $strJavaScript	= 
					'<script language="Javascript">
						function pleaseFillMe()
						{
							var eMe			= document.getElementById("theFiller");
							var eYou		= window.parent.document.getElementById("fillme-div");
							
							eYou.innerHTML	= eMe.innerHTML;
						}
					</script>';
				my $strBody	= '<div id="theFiller">'.$strFill.'</div>';
				
				print htmlHeader().
				htmlPre('',$strJavaScript).
				htmlBody($strBody,'onload=pleaseFillMe()').
				htmlPost();
			}
	***
*/

function FillMe(strPL)
{
	this.pl	= '/cgi-bin/'+strPL;
	
	this.fill		= fmFill;
	this.fillById	= fmFillById;
	
	document.write('<div class="fillme" id="fillme-div">Please wait...<iframe class="fillme" id="fillme-if"></iframe></div>');
	
	this.ifr	= document.getElementById('fillme-if');
}
	function fmFill(strEval,strExtra)
	{
		if(strExtra==undefined){
			strExtra	= '';
		}
		
		this.ifr.src	= this.pl+'?action=fillme&strEval='+strEval+strExtra;
	}
	function fmFillById(strEvalIf, strEvalIfNot)
	{
		var u	= new URL();
		var id	= u.Value('id');
		
		if(id.length){
			this.fill(strEvalIf,'&id='+id);
		}else{
			this.fill(strEvalIfNot);
		}
	}
