/*

To write the interactive grid properly with one function, we need to manipulate/access the following:

images - thumbnails and full size
caption description
unique id for the image and text description
where  and how to break the thumbmail row

Variable to be fed to the function:

theArray		array of image names for image source and text description. This, essentially, is the pattern or Color
staticImg		for image source path and name
staticDesc		for text description and image? Will be Throw or Picnic, etc...
elemID			to get at innerHtml and image to be changed



*/

////// ARRAYS //////////

throwBlankets = new Array("Black",
"Burgundy",
"Cocoa",
"Gold",
"Hunter",
"Ivory",
"Navy",
"Orange",
"Pink",
"Purple",
"Red",
"Royal",
"Silver_Heather",
"Charcoal");


picnicBlankets = new Array("Black",
"Burgundy",
"Charcoal",
"Hunter",
"Navy",
"Red",
"Royal",
"Buffalo_Check",
"Blackwatch");

economyThrow = new Array ("Black",
"Royal",
"Red",
"Navy",
"Hunter",
"Cinder");

babyBlankets = new Array ("White",
"Pastel_Pink",
"Pastel_Yellow",
"Pastel_Mint",
"Pastel_Blue",
"Red",
"Navy",
"Royal",
"Ivory");

scarf = new Array ("Black",
"Charcoal",
"Hunter",
"Navy",
"Red",
"Royal"
);

coral = new Array ("Black",
"Brown",
"Burgundy",
"Cinder",
"Cream",
"Hunter_Green",
"Navy",
"Pink",
"Purple",
"Red",
"Royal"
);


/*function writeGrid1(theArray,staticImg,staticDesc,elemID,breakRow) {
	rowBreak = 0;
	for (i=0;i<theArray.length;i++) {
	rowBreak++;
		//alert(theArray[i] + staticDesc);
		document.write("<td><a onMouseOver=\"javascript:changeInfo('" + staticImg + "','"  + theArray[i] + "','" + staticDesc + "','" + elemID +"')\"><img src=\"Graphics/Thumbs/" + theArray[i] + staticImg + ".jpg\"/></a></td>");
			if(rowBreak == breakRow) {
				document.write("</tr><tr>");
				rowBreak = 0;
				}
	}
}*/



function writeGrid(theArray,staticImg,staticDesc,elemID,breakRow) {
	rowBreak = 0;
	for (i=0;i<theArray.length;i++) {
	rowBreak++;
		//alert(theArray[i] + staticDesc);
		document.write("<a onMouseOver=\"javascript:changeInfo('" + staticImg + "','"  + theArray[i] + "','" + staticDesc + "','" + elemID +"')\"><img src=\"Graphics/Thumbs/" + theArray[i] + staticImg + ".jpg\"/></a>");
			if(rowBreak == breakRow) {
				document.write("<br/>");
				rowBreak = 0;
				}
	}
}

//elemID is the uniqueID for the test, prodInfo is the pattern/color string
function changeInfo(staticImg,blanketDesc,staticDesc,elemID) {
	//alert((staticImg + "," + blanketDesc + "," + elemID));
	
var searchStr = "_"; 
var replaceStr = " "; 
var re = new RegExp(searchStr , "g"); 
var noScore = staticImg.replace(re, replaceStr); 
var noScoreColor = blanketDesc.replace(re, replaceStr); 
	
	document.getElementById(elemID).innerHTML=noScoreColor + " " + noScore + " " + staticDesc;
	//alert("Graphics/Large/" + blanketDesc + staticImg + ".jpg");
	document.images[staticImg].src = "Graphics/Large/" + blanketDesc + staticImg + ".jpg";
	
	
	
}