// Here is a working example of the script. First define some variables.
// The variable "base" is not "images" but "pix/mo_".


// Some variables

var base= "/mall/Tate/images/swatches_img2/"



var nrm = new Array();
var omo = new Array();
var ocl = new Array();
var stuff = new Array('color1','color2','color3','color4','color5','color6','color7','color8','color9','color10','color11','color12','color13','color14','color15','color16','color17','color18');
var select = -1;
var name2 = "";
var temp = 0;


//redirection script - sends to relevant subdepartment page

function sending(){

var wheretogo=document.FormX.color.value;

if(!wheretogo){

	alert("Please select a color!");

} else {

document.location.href="/mall/departmentpage.cfm?store=Tate&did="+wheretogo+""
}
	
}




// Pre-load part.



if (document.images)
{
	

	for (i=0;i<stuff.length;i++)
	{
		nrm[i] = new Image;
		nrm[i].src = base + stuff[i] + ".gif"
		omo[i] = new Image;
		omo[i].src = base + stuff[i] + "_clic.gif";
		ocl[i] = new Image;
		ocl[i].src = base + stuff[i] + "_clic.gif";
	}
}

// The functions: first mouseover, then mouseout

function over(no)
{	
	if (document.images && select != no)
	{
		document.images[stuff[no]].src = omo[no].src
	}
	window.status='Click to select colour';return true;
}

function out(no)
{
	if (document.images && select != no)
	{
		document.images[stuff[no]].src = nrm[no].src
	}
}


//sets value of hidden text field

function hasArg(x){
	document.FormX.color.value = x;
	sending();
}




function clic(no)
{
	if (document.images)
	{
		document.images[stuff[no]].src = ocl[no].src
		temp = select;
		select = no;
		if (temp != -1) {out(temp)}
	}
}

// JavaScript Document