
//alert("writer.js");

	// following code from: "aulit.js"
	
	function spaceSub( thecount	)
	{
		outstring="";
		for(i=0; i<thecount; i++)
			outstring=outstring+"&nbsp;";
		return(outstring);
	}
	
	function sp( thecount	)
	{
		var outstring=spaceSub( thecount	);
		document.write( outstring);
	}
	

function	getBrowserVersion()
{
	var nVer = navigator.appVersion;
	var nAgt = navigator.userAgent;
	
	var fullVersion = parseFloat(nVer);
	var majorVersion = parseInt(nVer);
	
	var browser;

	if ((verOffset=nAgt.indexOf("Safari"))!=-1) 
	{
		browser="Safari";
		fullVersion = parseFloat(nAgt.substring(verOffset+7,nAgt.length));
	}

	// In Internet Explorer, the true version is after "MSIE" 

	if ((verOffset=nAgt.indexOf("MSIE"))!=-1) 
	{
		browser="MSIE";
		fullVersion = parseFloat(nAgt.substring(verOffset+5,nAgt.length));
		majorVersion = parseInt(''+fullVersion);
	}

	if ((verOffset=nAgt.indexOf("Opera"))!=-1) 
	{
		browser="Opera";
		fullVersion = parseFloat(nAgt.substring(verOffset+6,nAgt.length));
		majorVersion = parseInt(''+fullVersion);
	}
	var returnval=browser+' '+fullVersion;
	return( returnval	);
}

function myload2()
{
//	alert("myload2");
	
	if(remote) myHeight-=26;
	
	
	if(getOs()=="Win")
		myHeight+=70;

	var Version =	getBrowserVersion()	;
	if ((verOffset=Version.indexOf("Safari"))!=-1) 
		 myHeight+=	36;
		 
	myLeft= (14.5*(screen.width-myWidth))/16;
	myTop= (10*(screen.height-myHeight))/16;
	
	resizeTo( myWidth, myHeight);
	moveTo( myLeft, myTop );
	resizeTo( myWidth, myHeight);
	moveTo( myLeft, myTop );
}

function	randAndMod(limit)
{
	var theNumber=Math.round((limit-1)*Math.random());
	return(theNumber);
}
		
function randomWikiItem()
{
	var theList=["Aesthetics", "Beauty", "Saussure", "climategate", "Ethics", "Altruism", "T. S. Eliot", "Robert Frost", "Wallace Stevens", "Fernando Sor", "Eugenio Montale", "Philip Larkin", "songwriting", "isochrony", "prosody"];
	
	var randno=new Number( Math.floor(theList.length*Math.random()));
	return(theList[randno]);
}

function randomWikiItem2()
{
	var theList=["innerlea", "os x",  "os x bash",  "os x perl",  "os x python"];
	
	var randno=new Number( Math.floor(theList.length*Math.random()));
	return(theList[randno]);
}


function	searchWikipe()
{
//	var searchlist=	{"Aesthetics", "Robert Frost", "Wallace Stevens", "T. S. Eliot"};
	
//	alert("searchWikipe");
	
	var searchItem=randomWikiItem();
//	alert(searchItem);
	
	var theString=	'<form id="search" method="get" action="http://en.wikipedia.org/w/index.php" style="display:inline; margin:0">';
	theString+=		'<input type="hidden" name="title" value="Special:Search" />';
	theString+=		'<div><div>';
	theString+=		'<input type="text" id="lsearchbox"  size=31  value="';
	theString+=		searchItem;
	theString+=		'" name="search" />';
	
	theString+=		'<span id="loadStatus"></span>';
	theString+=		'<input type="submit" name="fulltext" value="Wikipedia" />';
	theString+=		'<div id="results"></div></div></div>';
	theString+=		'</form>';

	document.write(theString);
}	
function	searchWikipe2()
{
//	var searchlist=	{"Aesthetics", "Robert Frost", "Wallace Stevens", "T. S. Eliot"};
	
//	alert("searchWikipe");
	
	var searchItem=randomWikiItem2();
//	alert(searchItem);
	
	var theString=	'<form id="search" method="get" action="http://en.wikipedia.org/w/index.php" style="display:inline; margin:0">';
	theString+=		'<input type="hidden" name="title" value="Special:Search" />';
	theString+=		'<div><div>';
	theString+=		'<input type="text" id="lsearchbox"  size=31  value="';
	theString+=		searchItem;
	theString+=		'" name="search" />';
	
	theString+=		'<span id="loadStatus"></span>';
	theString+=		'<input type="submit" name="fulltext" value="Wikipedia" />';
	theString+=		'<div id="results"></div></div></div>';
	theString+=		'</form>';

	document.write(theString);
}		
	

function randomGoogleItem()
{
	var theList=["innerlea", "songwriting", "homeschooling", "poetry", "brian boyd", "Philip Larkin", "Thom Gunn", "Mark Strand", "Andrew Hudgins", "Pale Fire", "Stephen Dunn", "Lawrence Raab", "Traci Brimhall", "Robert Morgan", "medieval studies", "A Lecture on Russian Poetry", "prosody", "Lawrance Thompson"];

	var urList=["teachers poetry", "poetry blog", "recorded poetry", "innerlea", "misused words", "grammer", "writer's resource", "isochrony", "Dana Gioia" ];

	var randno=new Number( Math.floor(theList.length*Math.random()));
// return("A Lecture on Russian Poetry");
	return(theList[randno]);
}

function randomGoogleItem2()
{
	var theList=["innerlea", "os x",  "os x bash",  "os x perl",  "os x python"];

	var randno=new Number( Math.floor(theList.length*Math.random()));
// return("A Lecture on Russian Poetry");
	return(theList[randno]);
}

function	searchGoogle()
{
	var searchItem=randomGoogleItem();
//	alert(searchItem);
	
	var theString=	'<form name="theForm" method=GET action="http://www.google.com/search" style="display:inline; margin:0" >';
	theString+=		'<INPUT TYPE=text name="q" size=31 maxlength=255 value="';
	theString+=		searchItem;
	theString+=		'">';
	theString+=		'<INPUT type=submit name="btnG" VALUE="Google Search">';
	theString+=		'</form>';
	document.write(theString);
}		

function	searchGoogle2()
{
	var searchItem=randomGoogleItem2();
//	alert(searchItem);
	
	var theString=	'<form name="theForm" method=GET action="http://www.google.com/custom" style="display:inline; margin:0" >';
	theString+=		'<INPUT TYPE=text name="q" size=31 maxlength=255 value="';
	theString+=		searchItem;
	theString+=		'">';
	theString+=		'<INPUT type=submit name="btnG" VALUE="Google Search">';
	theString+=		'</form>';
	document.write(theString);
}		




function randomDictItem()
{
	var theList=["abattoir", "aeolian", "aetiology", "anamnesis", "aplomb", "archly", "assignation", "autarkic", "avatar", "avaunt", 
	"balustrade", "bane", "blancmange", "bract", "bricolage", "brigand", "brocken", 
	"cachou", "cairn", "caracoles", "carrel", "catamites", "catchpolls", "caudle", "ceinture", "cetewale", "chignon", "chrysoprase", "chthonic", "churl", "chyron", "codicil", "comedic", "condign", "congeries", "consigliere", "crepitation", "cresset", "cygnet", "cynosure", 
	"derne", "diffident", "dimity", "dogsbody", "durbar", "durum",
	"egregious", "enceinte", "entomology", "entrepot", "epicene", "epistemic", "eponym", "ersatz","eschatology", "escutcheon", "excreable",
	"falding", "fanfaronade", "farrago", "fatidic", "felicitous", "fillip", "fisc", "flaccid", "flense", "fo'c'sle", "foxearth", "frieze", "friable", "fulmar", "fustian", "fusty", 
	"gewgaw", "glissade", "glossolalia", "gnof", "goetic", "grampus", "gravamen", "greaves", "grimoire","grimpen", "grise", 
	"hamper", "hende", "Hebe", "hebephrenia", "Hesperus", "hoi polloi", "hoyden", "hudibrastic",
	"ingle", "inguen", "intercalated", "inveterate", "involute", "irenic", "irisated", "irredentist", "ithyphallic", 
	"jape", "jeremiad", "keens", 
	"lacustrine", "lambent", "lanier", "lapidary", "larch", "legatees", "leonine", "lepidoptery", "leporine", "lithophane", "littoral", "ludicrous", 
	"manteau", "marge", "megrim", "meretricious", "metropoles", "miasma", "mica", "mickle", "mimesis", "miscreant", "mishegoss", "moiety", "moil", "murine", "mythos", "myxomatosis", 
	"nacelles", "nacre", "nacreous", "nates", "nebulated", "necrologist", "noctilucent", "nonplussed", "nubble", "nugatory", 
	"obscurantism", "omerta", "omoplate", "optatives", "orbicle", "ormolu", "otiose", 
	"palimpsest", "palpate", "palpebra", "paludal", "Pangloss", "parhelion", "Parmentier", "parsimonious", "patrimony", "patronymic", "penurious", "perdition", "pergola", "perlustration", "pernicious", "petrifaction", "phalanx", "pharisaic", "philter", "phocine", "plangent", "plaudit", "plonk", "poltroon", "poppet", "prefect", "preterist", "priapic", "prolix", "proprietary", "psephologist", "psychopompos", 
	"rapine", "recrudescence", "refectory", "reticulated", "revanche", "rood",
	"scholium", "scritch", "scullion", "scupper", "scurrilous", "seamy", "sempiternal", "senescent", "sidle", "skulk", "sloe", "solecism", "solipsism", "soutane", "spavin", "specious", "spoor", "stakhanovite", "stillicide", "stilted", "stipple", "stoush", "sub-rosa", "subsume", "supercilious", "suppurate", "surd", "swain", "sylph",
	"Tanagra", "thirty-twomo", "tittle", "tocsin", "torquated", "tosspot", "tousling", "tranche", "tranter", "trenchant", "trundle", "turbid", "tussocky", 
	"ululation", "urning",
	"vade mecum", "vagaries", "variorum", "vavasour", "versipellous", "vespiary", "vicu–a", "voluble", "Volupere", 
	"Walpurgis Night", "wattle", "weir", "witter", "wonted", "zwieback"];
	
	var randno=new Number( Math.floor(theList.length*Math.random()));
	return(theList[randno]);
}
	
function	searchFreeDict()
{
	var searchItem=randomDictItem();
//	alert(searchItem);
	
	var theString=	'<nobr><form action="http://www.thefreedictionary.com/_/partner.aspx" method=get target="_top" name=dictionary ';
	theString+=		'style="display:inline;margin:0">'
	theString+=		'<input name=Word value="';
	theString+=		searchItem;
	theString+=		'" size=31>';
	theString+=		'<input type=submit name=submit value="freedictionary.com">';
	theString+=		'</form></nobr><br>';
	document.write(theString);
	return;
}		

	//-----------------------------
	
	function getOs()
	{
		if (navigator.appVersion.indexOf("Mac") > 0) return( "Mac"	);
		if (navigator.appVersion.indexOf("Win") > 0) return( "Win"	);
		if (navigator.appVersion.indexOf("X11")!=-1) return( "UNIX"	);
		if (navigator.appVersion.indexOf("Linux")!=-1) return( "Linux"	);
		return( "Unknown OS"	);
	}

	function sp( thecount	)
	{
		var outstring=spaceSub( thecount	);
		document.write( outstring);
	}
	
	function	adjustFontsize(	fontsize	)
	{
		var osname=getOs();
		if(osname=="Win")
		{
			fontsize-=1;	//was: 2
		}
		return(	fontsize	);
	}
	
	function makeUSpan(fontsize, etc)
	{
		var	htmlcode;
		fontsize=adjustFontsize(	fontsize	);
		var	htmlcode='<span style="font-size:'+fontsize+'px; '+etc+'">';
		document.write(htmlcode);
	}
	
	function makeUDiv(	fontsize, etc, centered	)	//	also a possibilty: "makeUSpan()"
	{
	//	alert("makeUDiv");
		var	htmlcode;
		fontsize=adjustFontsize(	fontsize	);
		var	htmlcode='<div style="font-size:'+fontsize+'px; '+etc;
		
		if(centered) 
			htmlcode+=" text-align:center; ";
		
		htmlcode+='">';
		document.write(htmlcode);
	}
		
	
	function aulitHeader(	path,	title	)
	{
	//	a generic constructor of "simple, linked, table-based, headers"
	//	uses a std margin, color, width(as percentage), fontsize(19px).
	//	KEEP: MAY BE BASIS FOR A MORE GENERAL HEADER CONSTRUCTOR 10-19-05!!
		
	//	alert("aulitHeader()");
	
		var osname=getOs();
		var	htmlcode='<div style="margin-left:.3in">';
		htmlcode+='<table width="80%" bgcolor="#999999">';
		htmlcode+='<tr><a href="'+path+'">';
		htmlcode+='<td ><script>makeUSpan(19, "");sp(3);</script>'+title+'<br></span></td></a></tr></table></div><br>';
		document.write(htmlcode);
	}
	//-----------------------------------
	var remote=true;

	
	function makecopynotice()
	{
		var osname=getOs();
		var	htmlcode='<span style="font-size:11px; color:black;">';
	//	if(osname=="Mac")	htmlcode+='<br>';
		var	htmlcode=htmlcode+' &mdash; copyright &copy 2005, G. S. Lipon. <b>All Rights Reserved</b>. &mdash;</span>';
		document.write(htmlcode);
	}
