build_div_head ();

function build_div_head () {
	var idx = head_max;
	wr_head ( head[idx].yr, head[idx].mo, head[idx].dy, head[idx].wkdy
			, head[idx].head, head[idx].note, head[idx].img, head[idx].photoby);
}

function wr_head (yr, mo, dy, wkdy, head, note, img, photoby) {
	document.write("<div id=\"tsbody\"><img src=\"images/stories/" + img + "\" align=\"top\" width=\"400\" height=\"200\" alt=\"\" />\n");
	document.write("    <div id=\"ts\">\n");
	document.write("		<div id=\"tstext\">\n");
	document.write("			<div id=\"tshead\" onclick=\"resize(\'ts\');\"><img src=\"images/1.gif\" align=\"top\" width=\"28\" height=\"5\" alt=\"\" /></div>\n");
	document.write("			<div id=\"tsheadline\">" + head + "</div>\n");
	document.write("			<small style=\"float:right;\">Photo: " + photoby + "</small>\n");
	document.write("			<small>" + wkdy + ", " + dy + " " + mo + " " + yr + "</small>\n");
	document.write("			<p>\n");
	document.write("				" + note + "<p>\n");
	document.write("			</p>\n");
	document.write("		</div>\n");
	document.write("	</div>\n");
	document.write("</div>\n");
}

function resize(targetid){
	theheight=document.getElementById(targetid).offsetHeight;
	if(theheight<100){
		document.getElementById(targetid).style.height=290+'px';
		document.getElementById("tshead").style.backgroundImage='url(images/w_hide.gif)';
	}
	else if(theheight>100){
		document.getElementById(targetid).style.height=60+'px';
		document.getElementById("tshead").style.backgroundImage='url(images/w_show.gif)';
	}
	return false;
}
