//Copyright HYDE COMMERCIAL SERVICES 2000-2007
//www.hydeservices.com
//PROPRIATARY SOFTWARE
//NO REPRODUCTION OR USE WITHOUT SIGNED WRITTEN CONSENT
//Date: 1/04/2006
//File: images.js
//Function: segment load of image groups & misc

var day="";
var month="";
var myweekday="";
var year="";
mydate = new Date();
mymonth = mydate.getMonth();
myweekday= mydate.getDate();
weekday= myweekday;
myyear= mydate.getYear();
year = myyear
if(mymonth == 0) {
month = "January "}
else if(mymonth ==1)
month = "February "
else if(mymonth ==2)
month = "March "
else if(mymonth ==3)
month = "April "
else if(mymonth ==4)
month = "May "
else if(mymonth ==5)
month = "June "
else if(mymonth ==6)
month = "July "
else if(mymonth ==7)
month = "August "
else if(mymonth ==8)
month = "September "
else if(mymonth ==9)
month = "October "
else if(mymonth ==10)
month = "November "
else if(mymonth ==11)
month = "December ";

var loaded=0;
	function loadButtonImages() {
		btn01on = new Image(143,17);
		btn01on.src = "images/btn01_on.jpg";
		btn02on = new Image(118,17);
		btn02on.src = "images/btn02_on.jpg";
		btn03on = new Image(90,17);
		btn03on.src = "images/btn03_on.jpg";
		btn04on = new Image(105,17);
		btn04on.src = "images/btn04_on.jpg";	
		btn01off = new Image(143,17);
		btn01off.src = "images/btn01.jpg";
		btn02off = new Image(118,17);
		btn02off.src = "images/btn02.jpg";
		btn03off = new Image(90,17);
		btn03off.src = "images/btn03.jpg";
		btn04off = new Image(105,17);
		btn04off.src = "images/btn04.jpg";					
loaded=1;
}

//load commom images - for speed
var loaded2=0;
	function loadAllImages(){
		pic1 = new Image(202,261);	
		pic1.src = "images/1_flip.jpg";
		pic2 = new Image(202,261);
		pic2.src = "images/2_flip.jpg";
		pic3 = new Image(202,261);
		pic3.src = "images/3_flip.jpg";
		pic4 = new Image(202,261);
		pic4.src = "images/4_flip.jpg";
		pic5 = new Image(202,261);
		pic5.src = "images/5_flip.jpg";
		pic6 = new Image(202,261);
		pic6.src = "images/6_flip.jpg";
		pic7 = new Image(202,261);
		pic7.src = "images/7_flip.jpg";
		pic8 = new Image(202,261);
		pic8.src = "images/8_flip.jpg";
		pic9 = new Image(202,261);
		pic9.src = "images/9_flip.jpg";
		pic10 = new Image(7,10);	
		pic10.src = "images/point_3_green.gif";
		pic11 = new Image(10,20);
		pic11.src = "images/point.jpg";				
loaded2=1;		
}

function imgOn(btn,img) {
	if (loaded==1){
	document[btn].src = eval(btn + "on.src");
	}
}
	
function imgOff(btn) {
	if (loaded==1){
	document[btn].src = eval(btn + "off.src");
	}
}

//Change pics - rotator display
var interval = 11; // delay between rotating images (in seconds)
var random_display = 0; // 0 = no, 1 = yes
interval *= 1000;

var image_index = 0;
image_list = new Array();

image_list[image_index++] = new imageItem("images/1_flip.jpg");
image_list[image_index++] = new imageItem("images/2_flip.jpg");
image_list[image_index++] = new imageItem("images/3_flip.jpg");
image_list[image_index++] = new imageItem("images/4_flip.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);
}
