/*
Filename: wn_output.js
Version: 1.02
Date: 07/27/2001
Notes: This document will generate the graphics
needed to create the "What's New" box for the GEMS Home Page.
*/
//Append a trackable query string to the URLs
function WhatsNewLinkTracker(imgURL) {
	if (imgURL != "") {
		if ((imgURL.toLowerCase().indexOf("http") != 0) && (imgURL.toLowerCase().substr(imgURL.length-5) == ".html")) {
			imgURL+="?ad=wn";										
		}								
	}	
	return imgURL;
}


//Set wnbox_maxrecs = 0 to disable this area from printing
if (wnbox_maxrecs > 0) {
	/*
	Assign general variables here		
	*/
	var wn_maxwidth = 171;  //Maximum width of table
	var wn_itemwidth = 163; //Maximum width of text item area
	var wn_boxbgcolor = "#d4d0c1";  //Background color of box
	var wn_textbgcolor = "#b1a992";  //Background color of item text area
	
	//Check wnbox_top_link to determine if top image is a clickable link
	if (wnbox_top_link != "") {
		var wn_tlinkf = "<a href=\"" + WhatsNewLinkTracker(wnbox_top_link) + "\">";
		var wn_tlinkb = "</a>";
	} else {
		var wn_tlinkf = "";
		var wn_tlinkb = "";
	}
	//Check wnbox_bot_link to determine if bottom image is a clickable link 
	if (wnbox_bot_link != "") {
		var wn_blinkf = "<a href=\"" + WhatsNewLinkTracker(wnbox_bot_link) + "\">";
		var wn_blinkb = "</a>";
	} else {
		var wn_blinkf = "";
		var wn_blinkb = "";
	}
	//Begin writing HTML
	var a = ""; 	
	a+="<table cellspacing=\"0\" cellpadding=\"0\" width=\"" + wn_maxwidth + "\" border=\"0\">\n";
	a+="<tbody>\n";
	a+="	<tr>\n";
	a+="		<td colspan=\"6\">" + wn_tlinkf + "<img src=\"" + wnbox_top_img + "\" width=\"" + wnbox_top_imgwidth + "\" height=\"" + wnbox_top_imgheight + "\" alt=\"" + wnbox_top_alt + "\" border=\"0\">" + wn_tlinkb + "</td>\n";
	a+="	</tr>\n";
	a+="	<tr>\n";
	a+="		<td width=\"4\" bgcolor=\"" + wn_boxbgcolor + "\"><img src=\""+ir+"/images/spacer.gif\" width=\"4\" alt=\"\"></td>\n";
	a+="		<td valign=\"bottom\" align=\"left\" width=\"" + wn_itemwidth + "\" bgcolor=\"" + wn_textbgcolor + "\">\n";
	a+="			<table cellspacing=\"0\" cellpadding=\"0\" width=\"" + wn_itemwidth + "\" border=\"0\" bgcolor=\"" + wn_textbgcolor + "\">\n";
	a+="			<tbody>\n";
	a+="				<tr>\n";
	a+="					<td><img src=\""+ir+"/images/spacer.gif\" width=\"1\" height=\"8\" alt=\"\" border=\"0\"></td>\n";
	a+="				</tr>\n";
	//Begin loop of items
	wnbox_floor = Math.min(wnbox_maxrecs, wnbox_itemarray_text.length);
	for (wn_counter = 0; (wn_counter < wnbox_floor); wn_counter++) {
		//Verify that all arrays have items
		if ((wn_counter <= wnbox_itemarray_text.length) && (wn_counter <= wnbox_itemarray_link.length) && (wn_counter <= wnbox_itemarray_frimg.length) && (wn_counter <= wnbox_itemarray_bkimg.length)) {
			//Confirm that text is not blank
			if ((wnbox_itemarray_text[wn_counter] != "") && (wnbox_itemarray_link[wn_counter] != "")) {
				//Check if front image exists
				if (wnbox_itemarray_frimg[wn_counter] != "") {
					var wn_frimg = "<img src=\"" + wnbox_itemarray_frimg[wn_counter] + "\" border=\"0\" alt=\"\">"
				} else {
					var wn_frimg = ""
				}
				//Check if back image exists
				if (wnbox_itemarray_bkimg[wn_counter] != "") {
					var wn_bkimg = "<img src=\"" + wnbox_itemarray_frimg[wn_counter] + "\" border=\"0\" alt=\"\">"
				} else {
					var wn_bkimg = ""
				}
				//Write out text item row					
				a+="				<tr>\n";
				a+="					<td align=\"left\" valign=\"top\">" + wn_frimg + "<a href=\"" + WhatsNewLinkTracker(wnbox_itemarray_link[wn_counter]) + "\"><font class=\"newatgems\">" + wnbox_itemarray_text[wn_counter] + "</font></a>" + wn_bkimg + "</td>\n";
				a+="				</tr>\n";
				a+="				<tr>\n";
				a+="					<td><img src=\""+ir+"/images/spacer.gif\" width=\"1\" height=\"4\" alt=\"\"   border=\"0\"></td>\n";
				a+="				</tr>\n";
			}
		}
	}
	//End loop of items
	a+="				<tr>\n";
	a+="					<td><img src=\""+ir+"/images/spacer.gif\" width=\"1\" height=\"4\" alt=\"\" border=\"0\"></td>\n";
	a+="				</tr>\n";
	//Print bottom image if it exists
	if (wnbox_bot_img != "") {	
		a+="				<tr>\n";
		a+="					<td>" + wn_blinkf + "<img src=\"" + wnbox_bot_img + "\" width=\"" + wnbox_bot_imgwidth + "\" height=\"" + wnbox_bot_imgheight + "\" alt=\"" + wnbox_bot_alt + "\" border=\"0\">" + wn_blinkb + "</td>\n";
		a+="				</tr>\n";
	}
	//Print bottom of table
	a+="				<tr>\n";
	a+="					<td><img src=\""+ir+"/images/spacer.gif\" width=\"" + wn_itemwidth + "\" height=\"6\" alt=\"\" border=\"0\"></td>\n";
	a+="				</tr>\n";
	a+="			</tbody>\n";
	a+="			</table>\n";
	a+="		</td>\n";
	a+="		<td width=\"1\" bgcolor=\"#bab7aa\"><img src=\""+ir+"/images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\"></td>\n";
	a+="		<td width=\"1\" bgcolor=\"#aeab9e\"><img src=\""+ir+"/images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\"></td>\n";
	a+="		<td width=\"1\" bgcolor=\"#a09e93\"><img src=\""+ir+"/images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\"></td>\n";
	a+="		<td width=\"1\" bgcolor=\"#939188\"><img src=\""+ir+"/images/spacer.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\"></td>\n";
	a+="	</tr>\n";
	a+="	<tr>\n";
	a+="		<td colspan=\"6\"><img src=\""+ir+"/images/whatsnew/wn_box_bottom.gif\" width=\"" + wn_maxwidth + "\" height=\"10\" alt=\"\" border=\"0\"></td>\n";
	a+="	</tr>\n";
	a+="</tbody>\n";
	a+="</table>\n";
	//Stop writing HTML
	document.write(a);
	document.close();
	var a = null;
}
