// picks 3 LDS package images at random to show at the LDS right border section, passes OrderType to the order.cfm page, the values have been hard-coded to match the designservice table IDs so that the QTY value of the ordered package at the order.cfm will be set to 1 when the page is loaded

var count = 1;
var limit = 14;
var imageName = "images/";

randomNum =  new Array();
randomize = new Array();

randomLink = new Array();
randomLink[0] = "button_logoorder.gif";
randomLink[1] = "button_namecard.gif";
randomLink[2] = "button_letterhead.gif";
randomLink[3] = "button_envelope.gif";
randomLink[4] = "button_stat.gif";
randomLink[5] = "button_3plus1.gif";
randomLink[6] = "button_10pages.gif";
randomLink[7] = "button_20pages.gif";
randomLink[8] = "button_flashanimation.gif";
randomLink[9] = "button_3gifs.gif";
randomLink[10] = "button_6gifs.gif";
randomLink[11] = "button_flashbanner.gif";
randomLink[12] = "button_staticpage.gif";
randomLink[13] = "button_5pages.gif";

for(i=0;i<=limit;i++)
{
	randomize[i] = i;
}

function Random()
{
	num = Math.random(limit+1);
	num = Math.round(Math.abs(Math.sin(num) * 1000000)) % limit;
	return num;
}

for(i=1;i<=limit;i++)
{
	Random();
	if(randomize[num]==num)
	{
		randomNum[count] = randomize[num];
		randomize[num] = limit;
		count++;
	}
	else
	{
		i--;
	}
}

// loop 3 times
for(i=1;i<=3;i++)
{
	if(randomNum[i] == document.cookie)
	{
		i = 1;
	}
	else
	{
		// this is the hard-coding to match the designservice table IDs, which are 1-12, and 19 and 20
		if (randomNum[i] == 12)
		{
			OrderTypeVal = 19;
		}
		else if (randomNum[i] == 13)
		{
			OrderTypeVal = 20;
		}
		else
		{
			// for 0-11, just add 1 to get the ID
			OrderTypeVal = randomNum[i] + 1;
		}
	
		document.write('<tr><td>');
		document.write('<a href="order.cfm?OrderType='+OrderTypeVal+'"><img src='+imageName+randomLink[randomNum[i]]+' width="238" height="94" border="0"></a>');
		document.writeln('</td></tr>');
		document.cookie = randomNum[i];
	}
}
