//this code is for a popup image swatch
var winPhoto2;
function makeNewWindow2(path,title)
{
	winPhoto2 = window.open("","AltView","height=300,width=300,status=0,scrollbars=0,location=0");
	winPhoto2.document.open();
	winPhoto2.document.write('<html>');
	winPhoto2.document.write('    <head>');
	winPhoto2.document.write('        <title>');
	//winPhoto2.document.write(title);
	winPhoto2.document.write('        </title>');
	winPhoto2.document.write('<script lang=javascript>');
	winPhoto2.document.write('var largeimage = new Image();');
	winPhoto2.document.write('largeimage.src ="assets/images/swatches/' + pf_id + '_' + path + '_lg.jpg"');
	winPhoto2.document.write('</script>');
	winPhoto2.document.write('    </head>');
	winPhoto2.document.write('    <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">');
	//winPhoto2.document.write('    <center><font size=4><b>'+title+'</b></font></center><br>');
	winPhoto2.document.write('        <center><br><img align=center src="assets/images/swatches/' + pf_id + '_' + path + '_lg.jpg" onLoad="window.resizeTo(largeimage.width+60,largeimage.height+170);" id=large_swatch></center>');
	winPhoto2.document.write('        <br><div align=center><a href=\'#\' onclick=\'document.getElementById("large_swatch").src="assets/images/swatches/' + pf_id + '_' + path + '_lg_back.jpg";return false;\' class=swatch>View Back</a></div>');
	winPhoto2.document.write('    </body>');
	winPhoto2.document.write('</html>');
	winPhoto2.document.close();
	winPhoto2.focus();
	return false;
}

function draw_image_2(){
	 if (product_image[1].scr=="PRODUCT" && product_image[1].image!="" ) { 
		if (product_image[1].image_show=="TARGET REG" || product_image[1].image_show=="TARGET" ){
			if (product_image[1].image_show=="TARGET REG"){
				if (user_guid==""){
					document.write("<A HREF=\"shopper_lookup.asp?target=" + product_image[1].target + "&\" onClick=return(visitargs('shopper_lookup.asp',\"target=" + product_image[1].target + "&\")); target=\"_top\" >");
				}else {
					document.write("<A HREF=\"" + product_image[1].target + "\" onClick=return(visitargs('" + product_image[1].target + "')); target=\"_top\" >");
				}
			}else {
				document.write("<a HREF=\"" + product_image[1].target + "\" target=\"_top\">");
			}
			document.write("<img name=\"mainimg\" id=\"mainimg\" ALIGN =" + product_image[1].align + " "); 
			if (product_image[1].width!=""){document.write("WIDTH =" + product_image[1].width + " ");}
			document.write(" BORDER=0  VSPACE=5  HSPACE=5 ALT=\"" + product_image[1].alt_text + "\" ");         
			document.write(" SRC=\"assets/product_images/" + product_image[1].image +"\"></a>");
		}else{
			document.write("<img name=\"mainimg\" id=\"mainimg\" ALIGN =\"" + product_image[1].align + "\" "); 
			if (product_image[1].width!=""){document.write("WIDTH =" + product_image[1].width + " ");}
			document.write(" BORDER=0  VSPACE=5  HSPACE=5 ALT=\"" + product_image[1].alt_text + "\" ");         
			document.write(" SRC=\"assets/product_images/" + product_image[1].image +"\">");
		}  		
	}
	else{
		document.write("<img src=\"assets/product_images/product.gif\">");
	}
}

function imgOn(imgName) {
        document.getElementById("mainimg").src="assets/images/swatches/" + pf_id + "_" + imgName + "_lg.jpg";
}

function display_thumbnails()
{
	var array_largeimage;
	if (typeof info_attributes!="undefined" && info_attributes != "" && info_attributes != "default")
	{
		var thumbnails_array = info_attributes.split(",");
		info_attributes="";
		var image_array;
		if (thumbnails_array.length >= 1)
		{
			//the number below changes the number of columns for the swatches
			var columns=3;
			var atn;
			atn=0;
			var myImage;
			var counter=1;
			document.write("<br>Other Colors/Views:&nbsp;");
			document.write("");
			
			for (atn=0; atn<thumbnails_array.length; atn++)
			{
				if (thumbnails_array[atn]!="")
				{
					image_array = thumbnails_array[atn].split(":");
					document.write("<A HREF=\"#\" onClick=\"return(makeNewWindow2('"+image_array[1]+"','"+image_array[0]+"'));\" class=swatch>"+image_array[0]+"</A>");
					//document.write("<br>"+image_array[0]+"</td></tr></table></td>");
					document.write("&nbsp;&nbsp;");
					if (counter==columns){document.write("");counter=0}
				}
			counter = counter+1;
			}
			document.write("");
		}
	}
} //end display_thumbnails

//old alt view code
//~ function display_thumbnails()
//~ {
	//~ var array_largeimage;
	//~ if (typeof info_attributes!="undefined" && info_attributes != "" && info_attributes != "default")
	//~ {
		//~ var thumbnails_array = info_attributes.split(",");
		//~ info_attributes="";
		//~ var image_array;
		//~ if (thumbnails_array.length >= 1)
		//~ {
			//~ //the number below changes the number of columns for the swatches
			//~ var columns=3;
			//~ var atn;
			//~ atn=0;
			//~ var myImage;
			//~ var counter=1;
			//~ document.write("<br>Alternate View:");
			//~ document.write("<br><table border=0><tr><td><div align=center width=100%><table border=0><tr>");
			
			//~ for (atn=0; atn<thumbnails_array.length; atn++)
			//~ {
				//~ if (thumbnails_array[atn]!="")
				//~ {
					//~ //image_array = thumbnails_array[atn].split(":");
					//~ document.write("<td align=center><table border=0><tr><td align=center><A HREF=\"#\" onClick=\"return(makeNewWindow2('"+thumbnails_array[atn]+"'));\" ><img src=\"assets/images/swatches/" + pf_id + "_" + thumbnails_array[atn] + "_sm.jpg\" border=0></A>");
					//~ document.write("</td></tr></table></td>");
					//~ if (counter==columns){document.write("</tr><tr>");counter=0}
				//~ }
			//~ counter = counter+1;
			//~ }
			//~ document.write("</tr></table></div></td></tr></table>");
		//~ }
	//~ }
//~ } //end display_thumbnails
