	// randomization stuff

rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
	rnd.seed = (rnd.seed*9301+49297) % 233280;
	return rnd.seed/(233280.0);
};

function rand(number) {
	return Math.ceil(rnd()*number);
};

/*showFeaturedProducts(5, featuredProducts,'','','','${oid.pageTypeId}-${oid.nodeId}-${oid.assetId}','${oid.nodeId}','${oid.siteId}','${oid.editionId}'); */
function showFeaturedProducts(num, inArray, header, lineBreaks, tag, oid, nodeId, siteId, editionId, arrayNum) {

	var i;
    var show;
    var theURL;
    var removed;
		if(typeof inArray[arrayNum] !== "undefined") {
			var showBrs = false;

			if (num != null) {
				num = parseInt(num);
			} else {
				num = 1;
			}

			if (typeof inArray[arrayNum] !== "undefined" && inArray[arrayNum].length > 0) {
				for (i = 0; i < num; i++) {
					show = rand(inArray[arrayNum].length)-1;
					var obj = inArray[arrayNum][show];
					var writeThis = false;

                    if (typeof obj != "undefined") {
						writeThis = true;
					}

					if(writeThis) {

                        redirURL = escape(obj[2]);

                        theURL = "http://dw.com.com/redir?oid=" + oid + "&ontid=" + nodeId + "&siteid=" + siteId + "&edid=" + editionId ;

                        if (obj[3]) {
                            theURL = theURL + "&lop=feat&destcat=" + obj[3];
                        }

                        theURL = theURL +"&destUrl=" + redirURL.replace(/\//g, "%2F")

                        document.write('<div class="featuredProd">');
						document.write('<a style="cursor: pointer;" onclick="backBB(\'' + theURL + '\')" href="#">');
						document.write('<img src="' + obj[1] + '" align="left">');
						document.write(obj[0] + '</a>');
						document.write('<br class="clear" /></div>');

					}
					removed=inArray[arrayNum].splice(show,1);
				}
			}

		}

	}