function popup(url, id, width, height)
{
   newwindow = window.open(url,id,'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=yes,width=' + width + ',height=' + height);
   newwindow.focus();
}


$kuj(document).ready(function() {

	imagelinks = new Array();
	imagenum1 = 0;
	imagenum2 = 0;
	imagenum3 = 0;
	imagenum4 = 0;
	imagenum5 = 0;
	randomnumber = 0;
	imagelink = '/~hwc/images/banner.jpg';
	
	while (randomnumber == imagenum1)
	{
		var randomnumber=Math.floor(Math.random()*19);
	}
	
	imagelink = linkdecoder(randomnumber);
	imagelinks.push(imagelink);
	
	imagenum1 = randomnumber;
	randomnumber = imagenum2;
	
	while (randomnumber == imagenum2)
	{
		var randomnumber=Math.floor(Math.random()*19);
		if (randomnumber == imagenum1)
		{
			randomnumber = imagenum2;	
		}
	}
	
	imagelink = linkdecoder(randomnumber);
	imagelinks.push(imagelink);
	
	imagenum2 = randomnumber;
	randomnumber = imagenum3;
	
	while (randomnumber == imagenum3)
	{
		var randomnumber=Math.floor(Math.random()*19);
		if (randomnumber == imagenum1 || randomnumber == imagenum2)
		{
			randomnumber = imagenum3;	
		}
	}
	
	imagelink = linkdecoder(randomnumber);
	imagelinks.push(imagelink);
	
	imagenum3 = randomnumber;
	randomnumber = imagenum4;
	
	while (randomnumber == imagenum4)
	{
		var randomnumber=Math.floor(Math.random()*19);
		if (randomnumber == imagenum1 || randomnumber == imagenum2 || randomnumber == imagenum3)
		{
			randomnumber = imagenum4;	
		}
	}
	
	imagelink = linkdecoder(randomnumber);
	imagelinks.push(imagelink);
	
	imagenum4 = randomnumber;
	randomnumber = imagenum5;
	
	while (randomnumber == imagenum5)
	{
		var randomnumber=Math.floor(Math.random()*19);
		if (randomnumber == imagenum1 || randomnumber == imagenum2 || randomnumber == imagenum3 || randomnumber == imagenum4)
		{
			randomnumber = imagenum5;	
		}
	}
	
	imagelink = linkdecoder(randomnumber);
	imagelinks.push(imagelink);
	
	$kuj("img[id='banner']").replaceWith(imagelinks[0] + imagelinks[1] + imagelinks[2] + imagelinks[3] + imagelinks[4]);

});

function linkdecoder(imagenum)
{
	switch (imagenum) {
		case 1:
			return '<img src="/~hwc/images/random_images/aquinas.jpg" width="110" height="110"/>';
		break;
		case 2:
			return '<img src="/~hwc/images/random_images/aris-plato.jpg" width="110" height="110"/>';
		break;
		case 3:
			return '<img src="/~hwc/images/random_images/darwin.jpg" width="110" height="110"/>';
		break;
		case 4:
			return '<img src="/~hwc/images/random_images/descartes.jpg" width="110" height="110"/>';
		break;
		case 5:
			return '<img src="/~hwc/images/random_images/dostoevsky.jpg" width="110" height="110"/>';
		break;
		case 6:
			return '<img src="/~hwc/images/random_images/dubois.jpg" width="110" height="110"/>';
		break;
		case 7:
			return '<img src="/~hwc/images/random_images/freud.jpg" width="110" height="110"/>';
		break;
		case 8:
			return '<img src="/~hwc/images/random_images/galileo.jpg" width="110" height="110"/>';
		break;
		case 9:
			return '<img src="/~hwc/images/random_images/hamilton.jpg" width="110" height="110"/>';
		break;
		case 10:
			return '<img src="/~hwc/images/random_images/homer.jpg" width="110" height="110"/>';
		break;
		case 11:
			return '<img src="/~hwc/images/random_images/luther.jpg" width="110" height="110"/>';
		break;
		case 12:
			return '<img src="/~hwc/images/random_images/machiavelli.jpg" width="110" height="110"/>';
		break;
		case 13:
			return '<img src="/~hwc/images/random_images/madison.jpg" width="110" height="110"/>';
		break;
		case 14:
			return '<img src="/~hwc/images/random_images/marx.jpg" width="110" height="110"/>';
		break;
		case 15:
			return '<img src="/~hwc/images/random_images/nietzsche.jpg" width="110" height="110"/>';
		break;
		case 16:
			return '<img src="/~hwc/images/random_images/shelley.jpg" width="110" height="110"/>';
		break;
		case 17:
			return '<img src="/~hwc/images/random_images/voltaire.jpg" width="110" height="110"/>';
		break;
		case 18:
			return '<img src="/~hwc/images/random_images/woolf.jpg" width="110" height="110" />';
		break;
		default:
			return '<img src="/~hwc/images/banner.jpg" width="110" height="110"/>';		
	}
}