// Begin Random Homepage Image
var interval = 2.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1000;

var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("support/images/index/case_01.jpg");
image_list[image_index++] = new imageItem("support/images/index/case_02.jpg");
image_list[image_index++] = new imageItem("support/images/index/case_03.jpg");
image_list[image_index++] = new imageItem("support/images/index/case_04.jpg");
image_list[image_index++] = new imageItem("support/images/index/case_05.jpg");
var number_of_image = image_list.length;
function imageItem(image_location) {
	this.image_item = new Image();
	this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
	return(imageObj.image_item.src)
}
function generate(x, y) {
	var range = y - x + 1;
	return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
	if (random_display) {
		image_index = generate(0, number_of_image-1);
	}
	else {
		image_index = (image_index+1) % number_of_image;
	}
	var new_image = get_ImageItemLocation(image_list[image_index]);
	return(new_image);
}
function rotateImage(place) {
	var new_image = getNextImage();
	document[place].src = new_image;
	//var recur_call = "rotateImage('"+place+"')";
	//setTimeout(recur_call, interval);
}
function gotoCase() {
	var idx = image_index + 1;
	window.location.href = 'case_studies/case_' + idx + '.aspx';
}
// End Random Homepage Image

function DoPopup(URL, Width, Height, Resizable, Scrollbars, Toolbar, Location, Status, Menubar)
{
    /*
    Width=Use this to define the width of the new window.
    Height=Use this to define the height of the new window.
    Resizable=yes or no; Use this to control whether or not you want the user to be able to resize the window.
    Scrollbars=yes or no; This lets you decide whether or not to have scrollbars on the window.
    Toolbar=yes or no; Whether or not the new window should have the browser navigation bar at the top (The back, foward, stop buttons..etc.).
    Location=yes or no; Whether or not you wish to show the location box with the current url (The place to type http://address).
    Status=yes or no; Whether or not to show the window status bar at the bottom of the window.
    Menubar=yes or no; Whether or not to show the menus at the top of the window (File, Edit, etc...).
    */

    var windowprops='width=' + Width + ',height=' + Height + ',resizable=' + Resizable + ',scrollbars=' + Scrollbars + ',toolbar=' + Toolbar + ',location=' + Location + ',status=' + Status + ',menubar=' + Menubar;
    var new_window = window.open(URL,'NewWindow',windowprops);

    var xPos = (screen.availWidth-parseInt(Width)) * 0.50;
    var yPos = (screen.availHeight-parseInt(Height)) * 0.25;
    new_window.moveTo(xPos,yPos);
    new_window.focus();
}

function closeWindow() {
	window.opener.focus();
	window.close();
}