
function printImages()
{
	/* add check to make sure all array lengths are the same */
	var length_check = new Array(
	width.length, 
	height.length, 
	image.length, 
	title.length
	);

	for (i = 0; i < length_check.length; i ++)
	{
		if (length_check[i] % length_check[0] != 0)
		{			
			alert ("Either one of the following is missing - \nimage width \nimage height \nimage name \nimage text");			
		}
	}
    
	
	
	for (i = 0; i < width.length; i ++)
	{
		// odd amount of images check
		if (width.length % 2 != 0 && (i + 1) == width.length)
		{
			
			document.write('<tr><td align="center" valign="top"><a href="javascript:winOpen(\''+path+image[i]+'\', '+width[i]+', '+height[i]+')">');
			document.write('<img src="'+path+image[i]+'" width="200" alt="'+title[i]+'" class="picborder"></a></td><td>&nbsp;</td></tr>');
			
			document.write('<tr><td align="center" valign="top">');
		    document.write('<b>' + title[i] + '</b>')
			
			if (typeof(text[i]) != 'undefined')
			{
				document.write('<br>'+text[i]);
			}
			
			document.write('</td><td>&nbsp;</td></tr>');
			
			continue;
	
		}
		
		if (i % 2 == 0)
		{
			document.write('<tr>');
		}
				
		document.write('<td align="center" valign="top"><a href="javascript:winOpen(\''+path+image[i]+'\', '+width[i]+', '+height[i]+')">');
		document.write('<img src="'+path+image[i]+'" width="200" alt="'+title[i]+'" class="picborder"></a></td>');
		
		
		
		if (i % 2 != 0)
		{
			document.write('</tr>');
			
			document.write('<tr><td align="center" valign="top">');
		    document.write('<b>' + title[i - 1] + '</b>');
			
			if (typeof(text[i - 1]) != 'undefined')
			{
				document.write('<br>'+text[i - 1]);
			}
			
		   	document.write('</td><td align="center" valign="top">');
			document.write('<b>' + title[i] + '</b>');
			
			if (typeof(text[i]) != 'undefined')
			{
				document.write('<br>'+text[i]);
			}
			
		   	document.write('</td></tr>');
						
		}	
	
	}
	
	
	document.write('</td></tr>');
	document.write('</table></td>');
	document.write('</tr></table>');
}


function randWord()
{
	var random_name = '';
	var num = 0;
	
	letters = new Array();
	letters[1]  = 'a';
	letters[2]  = 'b';
	letters[3]  = 'c';
	letters[4]  = 'd';
	letters[5]  = 'e';
	letters[6]  = 'f';
	letters[7]  = 'g';
	letters[8]  = 'h';
	letters[9]  = 'i';
	letters[10] = 'j';
	letters[11] = 'k';
	letters[12] = 'l';
	letters[13] = 'm';
	letters[14] = 'n';
	letters[15] = 'o';
	letters[16] = 'p';
	letters[17] = 'q';
	letters[18] = 'r';
	letters[19] = 's';
	letters[20] = 't';
	letters[21] = 'u';
	letters[22] = 'v';
	letters[23] = 'w';
	letters[24] = 'x';
	letters[25] = 'y';
	letters[26] = 'z';
	
	
	for (i = 0; i <= 6; i ++)
	{
		num = Math.floor(Math.random() * 26) + 1;
		random_name += letters[num];
	
	}
	
	return random_name;
	
}


function winOpen(image, width, height)
{

	var ow = window.open('', randWord(), "height="+height+", width="+width+", toolbar=no, status=no, scrollbars=no, location=no, menubar=no, directories=no, resizable=no");
	
	ow.document.write('<html>');
	ow.document.write('<title>'+document.title+'</title>');
	ow.document.write('<LINK REL="StyleSheet" HREF="css/gi.css" type="text/css">');
	
	ow.document.write('<body>');
	ow.document.write('<img src ="'+image+'">');
	ow.document.write('</body>');
	ow.document.write('</html>');
}

function cellColour(cn, c, flag)
{

	document.getElementById(cn).className = c;

	/* Hack so that graphic design text turns white */
	if (cn == 5)
	{
		
		if (flag)
		{
			document.getElementById('5a').style.color = '#000000';
			document.getElementById('5b').style.color = '#000000';
		}
		
		else
		{
			document.getElementById('5a').style.color = '#ffffff';
			document.getElementById('5b').style.color = '#ffffff';
		}
		
	}

}

//=======================================
// text generating functions
//=======================================
function menu(page_name)
{
	document.write('<table align="left" cellpadding="0" cellspacing="2"  width="770">');
	document.write('<tr><td valign="top">');
	document.write('<table align="left" cellpadding="0" cellspacing="2">');
	document.write('<tr><td class="nav">');
	
	document.write('<a href="index.htm" onmouseover="cellColour(1, \'tophome\')" onmouseout="cellColour(1, \'nav\')">');
	document.write('<img src="images/Home/navigation_icon.gif" border="0" width="100" height="100" alt="Home" border="0"></a>');
	document.write('</td><td class="nav" valign="top" width="100" id="1">');
	document.write('<table cellpadding="4" cellspacing="0">');
	document.write('<tr><td>');
	document.write('<a href="index.htm" style="text-decoration:none">');
	document.write('<b>Home</b></a><br><br>');
	document.write('<span class="textsmall">G I</span>');
	document.write('</td></tr></table>');
	
	document.write('</td></tr>');
	document.write('<tr><td class="nav">');
	
	document.write('<a href="monotypes.htm" onmouseover="cellColour(2, \'topMonotypes\')" onmouseout="cellColour(2, \'nav\')">');
	document.write('<img src="images/Monotypes/navigation_icon.jpg" border="0" width="100" height="100" alt="Monotypes" border="0"></a>');
	document.write('</td><td class="nav" valign="top" width="100" id="2">');
	document.write('<table cellpadding="4" cellspacing="0">');
	document.write('<tr><td>');
	document.write('<a href="monotypes.htm" style="text-decoration:none">');
	document.write('<b>Monotypes</b></a><br><br>');
	document.write('<span class="textsmall">view Hazel\'s monotypes</span>');
	document.write('</td></tr></table>');
	
	document.write('</td></tr>');
	document.write('<tr><td class="nav">');
	
	document.write('<a href="oilpainting.htm" onmouseover="cellColour(3, \'topOilPaintings\')" onmouseout="cellColour(3, \'nav\')">');
	document.write('<img src="images/OilPaintings/navigation_icon.jpg" border="0" width="100" height="100" alt="Oil Paintings" border="0"></a>');
	document.write('</td><td class="nav" valign="top" width="100" id="3">');
	document.write('<table cellpadding="4" cellspacing="0">');
	document.write('<tr><td>');
	document.write('<a href="oilpainting.htm" style="text-decoration:none">');
	document.write('<b>Oil Paintings</b></a><br><br>');
	document.write('<span class="textsmall">view Hazel\'s paintings</span>');
	document.write('</td></tr></table>');
	
	document.write('</td></tr>');
	document.write('<tr><td class="nav">');
	
	document.write('<a href="publicart.htm" onmouseover="cellColour(4, \'topPublicArt\')" onmouseout="cellColour(4, \'nav\')">');
	document.write('<img src="images/PublicArt/navigation_icon.jpg" border="0" width="100" height="100" alt="Public Art" border="0"></a>');
	document.write('</td><td class="nav" valign="top" width="100" id="4">');
	document.write('<table cellpadding="4" cellspacing="0">');
	document.write('<tr><td>');
	document.write('<a href="publicart.htm" style="text-decoration:none">');
	document.write('<b>Public Art</b></a><br><br>');
	document.write('<span class="textsmall">view Hazel\'s public art projects</span>');
	document.write('</td></tr></table>');
	
	document.write('</td></tr>');
	document.write('<tr><td class="nav">');
	
	document.write('<a href="illustration.htm" onmouseover="cellColour(6, \'topIllustration\')" onmouseout="cellColour(6, \'nav\')">');
	document.write('<img src="images/Illustration/navigation_icon.jpg" border="0" width="100" height="100" alt="Illustration" border="0"></a>');
	document.write('</td><td class="nav" valign="top" width="100" id="6">');
	document.write('<table cellpadding="4" cellspacing="0">');
	document.write('<tr><td>');
	document.write('<a href="illustration.htm" style="text-decoration:none">');
	document.write('<b>Illustration</b></a><br><br>');
	document.write('<span class="textsmall">view Hazel\'s illustrations</span>');
	document.write('</td></tr></table>');	
	
	document.write('</td></tr>');
	document.write('<tr><td class="nav">');
	
	document.write('<a href="graphicdesign.htm" onmouseover="cellColour(5, \'topGraphicDesign\')" onmouseout="cellColour(5, \'nav\', 1)">');
	document.write('<img src="images/GraphicDesign/navigation_icon.jpg" border="0" width="100" height="100" alt="Graphic Design" border="0"></a>');
	document.write('</td><td class="nav" valign="top" width="100" id="5">');
	document.write('<table cellpadding="4" cellspacing="0">');
	document.write('<tr><td>');
	document.write('<a href="graphicdesign.htm" style="text-decoration:none" id="5a">');
	document.write('<b>Graphic&nbsp;Design</b></a><br><br>');
	document.write('<span class="textsmall" id="5b">view Jeremy\'s graphic design work</span>');
	document.write('</td></tr></table>');
	
	document.write('</td></tr>');
	document.write('<tr><td class="nav">');
	
	document.write('<a href="contact.htm" onmouseover="cellColour(7, \'topContact\')" onmouseout="cellColour(7, \'nav\')">');
	document.write('<img src="images/Contact/navigation_icon.jpg" border="0" width="100" height="100" alt="Contact" border="0"></a>');
	document.write('</td><td class="nav" valign="top" width="100" id="7">');
	document.write('<table cellpadding="4" cellspacing="0">');
	document.write('<tr><td>');
	document.write('<a href="contact.htm" style="text-decoration:none">');
	document.write('<b>Contact</b></a><br><br>');
	document.write('<span class="textsmall">phone or email us</span>');
	document.write('</td></tr></table>');
	
	document.write('</td></tr>');
	document.write('<tr><td class="textsmall" colspan="2" valign="top">');
	
	document.write('website - <a href="http://www.cuttingimage.com" style="color:red;text-decoration:none" target="_blank">cuttingimage</a> &copy;'+new Date().getFullYear());
	
	document.write('</td></tr>');
	
	document.write('</table></td>');
	document.write('<td width="50">');
	document.write('<!-- gutter -->&nbsp;<!-- gutter --></td>');
	document.write('</td><td valign="top">');
	document.write('<table align="left" cellpadding="5" cellspacing="2">');
	
	document.write('<tr><td class="top'+page_name+'" align="left" valign="bottom" height="100">');
	document.write('<img src="images/'+page_name+'/header.gif"  alt="'+page_name+'" border="0" width="360" height="78">');
	document.write('</td></tr>');
	document.write('<tr><td class="nav" rowspan="7" valign="top" align="center" width="475">');
	
	document.write('<table  cellpadding="7" cellspacing="2" align="center" width="450">');
	document.write('<tr><td colspan="2" height="5"><img src="images/Generic/1pix.gif" height="5"></td></tr>'); 
   
}