function switchImage(IDref,nImage)
{
	document.getElementById(IDref).src = nImage;
}


function nTokens(inString,inToken)
{
	a = inString;
	j = 0;
	i = a.search(inToken);

	if (i!=-1)
	{
		do
		{
			j = j + 1;			/* increment count */
			a = a.substring(i+1,a.length);  /* remove found token */
			i = a.search(inToken);		/* perform search */
			
		}	
		while (i!=-1)
	}	
	return(j);
}

/* ----------------------------------------------------------------------------------- */

function strParse(inString,inToken,inRef)
{
	n = nTokens(inString,inToken);
	a = inString;
	errm = "notfound";
	i = -1;

	if (n <= 0)
	{
		return(errm);			/* error checking */
	}
	else if (inRef <= 0)
	{
		return(errm);
	}			
	else if (inRef > n)
	{
		return(errm);
	}
	else if (inRef == 1)			/* if first ref, return */
	{
		i = a.search(inToken);
		return(a.substring(0,i));	
	}
	else
	{
		for (j = 1; j <= inRef-1; j++)	/* if not first, rebuild string, return result */
		{
			i = a.search(inToken);
			a = a.substring(i+1,a.length);
		}
		i = a.search(inToken);
		return(a.substring(0,i));		
	}
}

/* ----------------------------------------------------------------------------------- */


function switchImages(dString)
{
	lcv = 1;
	ntkns = nTokens(dString,";");
	while (lcv <= ntkns)
	{
		itm = strParse(dString,";",lcv);
		lcv = lcv + 1;
		pth = strParse(dString,";",lcv);
		lcv = lcv + 1;
		document.getElementById(itm).src = pth;
	}
	
}


/* ----------------------------------------------------------------------------------- */


function imagetoWindow400x400(imagep,wname)
{
	window.open(imagep,wname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=400,height=400")
}
