function repaint()
{
	for (i = 0; i<document.applets.length; i++)
		document.applets[i].repaint();
}

function printHTML()
{
		document.applets[0].printHTML();
}

function changeLayoutContext(context)
{
	//alert("Number of applets: "+document.applets.length);
	// change the context in applets located in the same document
	for (j = 0; j<document.applets.length; j++) {
		document.applets[j].changeContext(context);
		//alert("Change context in applet: "+document.applets[j].name);
	}
	//alert("Number of frames: "+top.frames.length);
	// change the context in applets located in the frames of the same document
	for (i = 0; i<top.frames.length; i++) {
		//alert("Number of applets: "+top.frames[i].document.applets.length+" in frame "+top.frames[i].name);
		for (j = 0; j<top.frames[i].document.applets.length; j++) {
			top.frames[i].document.applets[j].changeContext(context);
			//alert("Change context in applet: "+top.frames[i].document.applets[j].name);
		}
	}
}

function changeContext(appletName, context)
{
	for (i = 0; i<document.applets.length; i++) {
		if (document.applets[i].name == appletName)
			document.applets[i].changeContext(context);
			return true;
	}
	return false;
}

/*
 * 
 */
function loadPicture(appletName, imageName, context)
{
	//alert("load image "+imageName+" in applet "+appletName+" with context "+context);
	for (i = 0; i<document.applets.length; i++) {
		if (document.applets[i].name == appletName) {
			document.applets[i].selectPicture(imageName);
			document.applets[i].changeContext(context);
			return true;
		}
	}
	for (i = 0; i<top.frames.length; i++) {
		//alert("Number of applets: "+top.frames[i].document.applets.length+" in frame "+top.frames[i].name);
		for (j = 0; j<top.frames[i].document.applets.length; j++) {
			if (top.frames[i].document.applets[j].name == appletName) {
				top.frames[i].document.applets[j].selectPicture(imageName);
				top.frames[i].document.applets[j].changeContext(context);
				return true;
			}
		}
	}
	//alert("Error loading image "+imageName+": applet "+appletName+" was not found");
	return false;
}

