// Display random image

"use strict";

var random_image	= [
	{
		alt	: 'Pennsylvania, USA',
		file	: 'pennsylvania_crop.jpg',
		url	: 'http://www.state.pa.us/',
		className : 'image-no-border'
	},
	{
		alt	: 'Star Trek',
		file	: '1701.jpg',
		url	: 'http://www.freewebs.com/startrek_sector1965/ship.htm',
		className : 'image-border'
	},
	{
		alt	: 'Mission Impossible',
		file	: 'mis2logo.gif',
		url	: 'http://web.onetel.net.uk/~gnudawn/mission/index.html',
		className : 'image-border'
	},
	{
		alt	: 'Hawaii Five-0',
		file	: '50wave.jpg',
		url	: 'http://www.mjq.net/fiveo/',
		className : 'image-border'
	},
	{
		alt	: 'Mystery Science Theater 3000',
		file	: 'mst3k.jpg',
		url	: 'http://www.mst3kinfo.com/',
		className : 'image-border'
	},
	{
		alt	: 'Bruce Momjian',
		file	: 'shadow.jpg',
		url	: '',
		className : 'image-no-border'
	},
	{
		alt	: 'PostgreSQL',
		file	: 'logo_w_elephant.jpg',
		url	: 'http://www.postgresql.org/',
		className : 'image-no-border'
	},
	{
		alt	: 'Armenia',
		file	: 'unicode-armenian.gif',
		url	: 'http://www.armeniainfo.am/',
		className : 'image-no-border'
	},
	{
		alt	: 'Bethany Presbyterian Church',
		file	: 'bethany.jpg',
		url	: 'http://bethanycollegiate.org',
		className : 'image-border'
	},
	{
		alt	: 'Tains',
		file	: 'pc917PJtele.jpg',
		url	: 'http://broadway.pennsyrr.com/Rail/Prr/',
		className : 'image-border'
	},
	{
		alt	: 'V8 Juice',
		file	: 'V8_Logo.jpg',
		url	: 'http://www.v8juice.com/',
		className : 'image-border'
	},
	{
		alt	: 'Pretzel',
		file	: 'Pretzel_salted_small.jpg',
		url	: 'http://www.ushistory.org/tour/tour_pretzel.htm',
		className : 'image-no-border'
	},
	{
		alt	: 'Bow tie',
		file	: 'IRVG7515.jpg',
		url	: 'http://www.bowtieclub.com/',
		className : 'image-no-border'
	},
	{
		alt	: 'Trips',
		file	: 'trips.jpg',
		url	: '/main/trips.html',
		className : 'image-border'
	},
	{
		alt	: 'Hedgerow Theatre',
		file	: '001031theater.jpg',
		url	: 'http://www.hedgerowtheatre.org',
		className : 'image-no-border'
	},
	{
		alt	: 'EnterpriseDB',
		file	: 'edb.gif',
		url	: 'http://www.enterprisedb.com/',
		className : 'image-no-border'
	},
	{
		alt	: 'MXC',
		file	: 'MXC.jpg',
		url	: 'http://www.centralwow.com/mxc/about/',
		className : 'image-no-border'
	},
	{
		alt	: "Hank's Root Beer",
		file	: 'hanks.jpg',
		url	: 'http://www.hanksbeverages.net/index.php',
		className : 'image-border'
	}
	/*
	{	
		alt	: 'My webcam',
		file	: '../webcam/horandom_urly/12.jpg',
		url	: '/main/webcam/webcam2.html',
		className : 'image-border'
	}
	*/
];

function show_random_image(){
	// range [0-p]
	var image_num = Math.floor(Math.random() * random_image.length);

	// make range [0-(p-1)]
	if (image_num == random_image.length)
		image_num--;

	document.getElementById('random-image-a').href = random_image[image_num]['url'];
	document.getElementById('random-image').src = '/main/img/random/' + random_image[image_num]['file'];
	document.getElementById('random-image').alt = random_image[image_num]['alt'];
	document.getElementById('random-image').className = random_image[image_num]['className'] + ' center';
}

show_random_image();
/* images change randomly for every page so there is no way to preload */
