var boxObjects=new Array();
var iBox=-1;

//contact details
iBox++;
contactBoxId=iBox;
boxObjects[iBox]=new Array();
boxObjects[iBox]['totalWidth']='192';
boxObjects[iBox]['headerWidth']='190';
boxObjects[iBox]['contentWidth']='190';
boxObjects[iBox]['frameColour']='navy';
boxObjects[iBox]['headerColour']='steelblue';
boxObjects[iBox]['contentColour']='white';
boxObjects[iBox]['leftMargin']='3';
boxObjects[iBox]['rightMargin']='3';
boxObjects[iBox]['txtHeader']='CONTACT US';
boxObjects[iBox]['headerAlign']='center';
boxObjects[iBox]['hdrClass']='boxHeader';

//bible verse
iBox++;
contactBibleVerse=iBox;
boxObjects[iBox]=new Array();
boxObjects[iBox]['totalWidth']='192';
boxObjects[iBox]['headerWidth']='190';
boxObjects[iBox]['contentWidth']='190';
boxObjects[iBox]['frameColour']='navy';
boxObjects[iBox]['headerColour']='steelblue';
boxObjects[iBox]['contentColour']='white';
boxObjects[iBox]['leftMargin']='3';
boxObjects[iBox]['rightMargin']='3';
boxObjects[iBox]['txtHeader']='A BIBLE VERSE';
boxObjects[iBox]['headerAlign']='center';
boxObjects[iBox]['hdrClass']='boxHeader';

function drawBox(i)
{
	var outerFrameWidth=(parseInt(boxObjects[i]['totalWidth'])-parseInt(boxObjects[i]['headerWidth']))/2;
	var innerFrameWidth=(parseInt(boxObjects[i]['headerWidth'])-parseInt(boxObjects[i]['contentWidth']))/2;
	var hdrTextWidth=parseInt(boxObjects[i]['headerWidth'])-15;

	if (outerFrameWidth != 0)
	{
		document.write("<table border=\"0\" bgcolor=\"" + boxObjects[i]['frameColour'] + "\" width=\"" + boxObjects[i]['totalWidth'] + "\" cellpadding=\"0\" cellspacing=\"0\">");
		document.write("<tr height=\"" + outerFrameWidth + "\"><td></td></tr>");
		document.write("<tr>");
		document.write("<td align=\"center\">");
	}

	document.write("<table border=\"0\" bgcolor=\"" + boxObjects[i]['headerColour'] + "\" width=\"" + boxObjects[i]['headerWidth'] + "\" cellpadding=\"0\" cellspacing=\"0\">");
	document.write("<tr>");
	document.write("<td align=\"center\" valign=\"center\">");
	document.write("<table bgcolor=\"" + boxObjects[i]['headerColour'] + "\" width=\"" + boxObjects[i]['headerWidth'] + "\" cellpadding=\"0\" cellspacing=\"0\">");
	document.write("<tr height=\"19\">");
	document.write("<td bgcolor=\"" + boxObjects[i]['headerColour'] + "\" valign=\"center\" align=\"" + boxObjects[i]['headerAlign'] + "\" width=\"" + hdrTextWidth + "\"><span class=\"" + boxObjects[i]['hdrClass'] + "\">&nbsp;" + boxObjects[i]['txtHeader'] + "</span></td>");
	document.write("<td bgcolor=\"" + boxObjects[i]['headerColour'] + "\" valign=\"center\" align=\"right\" width=\"15\"><span class=\"" + boxObjects[i]['hdrClass'] + "\"><img src=\"images/web/minus.gif\" onmouseover=\"style.cursor='hand'\" onclick=\"toggle(this," + i + ")\" title=\"Minimise\">&nbsp;</span></td>");
	document.write("</tr>");
	document.write("</table>");
	document.write("<div id=\"box_" + i + "\">");
	document.write("<table border=\"0\" bgcolor=\"" + boxObjects[i]['headerColour'] + "\" width=\"" + boxObjects[i]['headerWidth'] + "\" cellpadding=\"0\" cellspacing=\"0\"><tr height=\"" + innerFrameWidth + "\"><td></td></tr></table>");
	document.write("<table bgcolor=\"" + boxObjects[i]['contentColour'] + "\" width=\"" + boxObjects[i]['contentWidth'] + "\" cellpadding=\"0\" cellspacing=\"0\" id=\"content_" + i + "\">");
	document.write("</table>");

	if (innerFrameWidth != 0)
	{
		document.write("<table border=\"0\" bgcolor=\"" + boxObjects[i]['headerColour'] + "\" width=\"" + boxObjects[i]['headerWidth'] + "\" cellpadding=\"0\" cellspacing=\"0\"><tr height=\"" + innerFrameWidth + "\"><td></td></tr></table>");
	}

	document.write("</div>");
	document.write("</td>");
	document.write("</tr>");
	document.write("</table>");

	if (outerFrameWidth != 0)
	{
		document.write("</td>");
		document.write("</tr>");
		document.write("<tr height=\"" + outerFrameWidth + "\"><td></td></tr>");
		document.write("</table>");
	}
}

function toggle(el,i)
{
	var box=document.getElementById('box_' + i);

	if (el.title=='Minimise')
	{
		el.title='Maximise';
		el.src='images/web/plus.gif';
		box.style.display='none';
	}
	else
	{
		el.title='Minimise';
		el.src='images/web/minus.gif';
		box.style.display='block';
	}	
}

function addRow(i, content, align, style, rowHeight)
{
	//can pass this function html for the content - eg an img file - but check 
	//that the box parameters in the array allow enough space for the content
	var box=document.getElementById('content_' + i);

	//add new row	
	var newRow=box.insertRow(-1);
	if (rowHeight>0)
		newRow.height=rowHeight;

	//cell for left margin
	var leftCol=newRow.insertCell(-1);
	leftCol.width=boxObjects[i]['leftMargin'];

	//cell for content
	var newCell=newRow.insertCell(-1);
	newCell.align=align;
	newCell.innerHTML="<span class=\"" + style + "\">" + content + "</span>";

	//cell for right margin
	var rightCol=newRow.insertCell(-1);
	rightCol.width=boxObjects[i]['rightMargin'];
}

function blankRow(i, rowHeight)
{
	addRow(i, '', 'center', '', rowHeight);
}
