var index = 0;
var image1index;
var curImageSet;
var curIndex = 0;

// -------------------------------------------------------if (document.all) {
	layerRef = "document.all";
	ifStyle = ".style";
	n = 0;
	ie = 1;
	ie4 = true;
	ns4 = false;
	isIE = true;
	isNav = false;
} else if (document.layers) {
	layerRef = "document.layers";
	ifStyle = "";
	n = 1;
	ie = 0;
	ie4 = false;
	ns4 = true;
	isIE = false;
	isNav = true;
}function popup(path,name) {	var strWidth = (arguments.length==3)? '621' : '637';
	var strScroll = (arguments.length==3)? '0' : '1';
	window.open(path + name + '.html',name,'width=' + strWidth +',height=600,left=50,top=50,toolbar=0,menubar=0,location=0,resize=0,scrollbars=' + strScroll + ',status=0,directories=0');
}

function creaventana1(path,name) {
  window.open(path,name, 'width=620, height=700, scrollbars=1, resizable=1, left=150, top=0');
}

function creaventana(path,name) {
  //alert("prueba");
  window.open(path,name, 'width=580, height=600, scrollbars=1, resizable=1, left=150, top=0');
}

function creaventanaFancy(path,name,width,height) {
  //alert("prueba");
  window.open(path,name, 'width=' + width +', height=' + height + ', scrollbars=1, resizable=1, left=150, top=0');
}

function extpopup(path,name) {
  window.open(path,name, left=50, top=50, toolbar=0, menubar=0, status=0, directories=0,width=300, height=230, scrollbars=1,resize=1 );
}

function addImage(path) { // adds image to array
	this[index++] = path;
}

function pickRandom(range) {
	return (Math.round((Math.random() * (range - 1))));
}

var bgimageno = 7; // Number of alternative images
var bgimages = new Array(bgimageno);
	bgimages[0] = 'http://www.bcts.com/images/bg.gif';
	bgimages[1] = 'http://www.bcts.com/images/bgdarkaqua.gif';
	bgimages[2] = 'http://www.bcts.com/images/bgpurple.gif';
	bgimages[3] = 'http://www.bcts.com/images/bggreen.gif';
	bgimages[4] = 'http://www.bcts.com/images/bglightblue.gif';
	bgimages[5] = 'http://www.bcts.com/images/bglightorange.gif';
	bgimages[6] = 'http://www.bcts.com/images/bgmediumblue.gif';

var bgchoice = pickRandom(bgimageno);

function randomindex() {
	return (Math.round((Math.random() * (images.length - 1))));
}

Array.prototype.addImage = addImage;
images = new Array();

function imageGrab(number) { // number is which image you want to grab
	if (number == 1) {
		image1index = randomindex();
		return images[image1index];
	} 
}

// -------------------------------------------------------

function addImageSet(image1,image2,image3) { // adds imageset to array
  var entry = new Array(3);
  entry[0] = image1;
  entry[1] = image2;
  entry[2] = image3;
  this[index++] = entry;
}


function imageSetGrab() {
	curIndex = randomindex();
	curImageSet = images[curIndex];
}

Array.prototype.addImageSet = addImageSet;
Array.prototype.imageSetGrab = imageSetGrab;
Array.prototype.imageGrabSet = imageGrabSet;

function imageGrabSet(number) { //number is which image you want to grab
	return curImageSet[number - 1];
}	