window.onload = initProductImageEvents

// Assign event handlers to product images
function initProductImageEvents()
{
	for(var i=0; i<document.images.length; i++)
	{		
		// Current image
		var image = document.images[i];

		// Only assign events to the product images
		if( (image.name == "store_product_image") || (image.name == "color_swatch") )
		{
			image.onclick = largeImageWindow;
		}
	}
}


function largeImageWindow()
{
    // The 'id' attribute of the img element specifies the large image file
  	var imgName = this.id;

	// Image is 450x372 -- add 20px horiz and vert.
	var imgWindow = window.open(imgName, "largeImageWindow", "width=470,height=392,scrollbars=0,resizeable=0,status=0,toolbar=0");
}
