// JavaScript Document
function pickNums(nums, numArr)
{
	if(nums>numArr.length)
	{
		alert('You are trying to pick more elements from the array than it has!');
		return false;
	}
	var pickArr=new Array();
	var tempArr=numArr;
	for(var i=0; i<nums; i++)
	{
		pickArr[pickArr.length]=tempArr[Math.round((tempArr.length-1)*Math.random())];
		var temp=pickArr[pickArr.length-1];
		for(var j=0; j<tempArr.length; j++)
		{
			if(tempArr[j]==temp)
			{
				tempArr[j]=null;
				var tempArr2=new Array();
				for(var k=0; k<tempArr.length; k++)
					if(tempArr[k]!=null)
						tempArr2[tempArr2.length]=tempArr[k];
				tempArr=tempArr2;
				break;
			}
		}
	}
	return pickArr;
}		


//Add elements to this array
var myArr = new Array("1","2","3","4","5","6","7","8");
var outArr=pickNums(4, myArr); // Store the output 

// Print Output 
// Modify this part to suit your output needs 
for(var i=0; i<outArr.length; i++)
{
				document.write ('<img src="images/thumb_' + outArr[i] + '.jpg" width="65" height="65" />');								
				//document.write (outArr[i]);								
}



