var imageSourcePath = "file:///G:/web/FeuerZeugKeramik/work/img/";
//var imageSourcePath = "http://www.feuer-zeug-keramik.de/test/img/";
//var imageSourcePath = "http://www.feuer-zeug-keramik.de/img/";

var debug = true;

function mouseOver(imageName)
{
	document.images[imageName].src = imageSourcePath + imageName + "_mo.jpg";
}

//----------------------------------------------------------------------------
// Called whenever mouse has left the given image name.
// Sets the source of the documents image to the "mouse out" image.
//----------------------------------------------------------------------------
function mouseOut(imageName)
{
	document.images[imageName].src = imageSourcePath + imageName + ".jpg";
}

function debugAlert(message)
{
	if (debug) alert(message);
}

//------------------------------------------------------------------
// Preloads the given image.
//------------------------------------------------------------------
function preloadImage(imageSource)
{
	if (!document.preloadedImages) document.preloadedImages = new Array();
	var count = document.preloadedImages.length;

	document.preloadedImages[count] = new Image();
	document.preloadedImages[count].src = imageSource;
}

//------------------------------------------------------------------
// Sets mouse over and optionally mouse down source for the image 
// and preloads them.
//------------------------------------------------------------------
function imageMouseInit(imageName, stateName, source)
{
	if (!document.imgStates) document.imgStates = new Array();
	if (!document.imgStates[imageName]) document.imgStates[imageName] = new Array();
	
	if (document.imgStates[imageName][stateName]) { debugAlert("image state '" + imageName + "'/'" + stateName + "' already exists!"); return; }

	document.imgStates[imageName][stateName] = new Object();
	
	document.imgStates[imageName][stateName].source = source;
	
	preloadImage(source);
}

//------------------------------------------------------------------
// Sets the given state of the given image.
//------------------------------------------------------------------
function setImageState(imageName, stateName)
{
	var state = document.imgStates[imageName][stateName];
	if (state)
	{
		var img = document.images[imageName];
		if (img)
		{
			img.src = state.source;
		}
	}
}

/*function findObject(objectId, doc) 
{ //v4.01
	var p, i, x;
	
	// initialize document if null
	if (!doc) doc = document; 
	
	// question mark used to address frames inside a document
	var pos = objectId.indexOf("?");
	if (pos > 0 && parent.frames.length)
	{
		doc = parent.frames[objectId.substring(pos + 1)].document; 
		objectId = objectId.substring(0, pos);
	}
	
	// search for object in document
	x = doc[objectId];
	if (x) return x;
	
	// search for object in document "all" array
	if (doc.all) x = doc.all[objectId];
	if (x) return x;
	
	// search for object in document forms
	for (i = 0; i < doc.forms.length; i++) 
	{
		x = doc.forms[i][objectId];
		if (x) return x;
	}
	
	// search for object in document layers
	for (i = 0; doc.layers && i < doc.layers.length; i++)
	{
		x = findObject(objectId, doc.layers[i].document);
		if (x) return x;
	}
	
	// if still not found, search recursively by "getElementById"
	// WARNING! Can lead to bugs if doc = document
	if (doc.getElementById)
	{
		x = doc.getElementById(objectId);
	}
	
	return x;
}

function onEvent(eventId, groupId) 
{
	//v6.0
	var i, img, group, args = onEvent.arguments;
	if (eventId == "init" && args.length > 2) 
	{
		// find image "arg2"
		img = findObject(args[2]);
		if (!img || img.initialized) return;

		// set "up" to "arg3" and "down" of image
		img.initialized = true; 
		img.up   = args[3]; 
		img.down = img.src;
		
		// add image to group "groupId"
		if (!document[groupId]) document[grpName] = new Array();
		group = document[groupId];
		group[group.length] = img;

		// go through any further arguments
		for (i = 4; i < args.length - 1; i += 2) 
		{
			// find image "arg4", "arg6", ...
			img = findObject(args[i]);
			if (!img) continue;

			// set "up" and "down" of image
			if (!img.up) img.up = img.src;
			img.src = img.down = args[i+1];
			
			// add image to group
			group[group.length] = img;
		}
	} 
	else if (event == "over") 
	{
		document.over = group = new Array();
		for (i = 1; i < args.length - 1; i += 3) 
		{
			img = findObject(args[i]);
			if (!img) continue;
			
			if (!img.up) img.up = img.src;

			if (img.down && args[i+2])
			{
				img.src = args[i+2];
			}
			else if (args[i+1])
			{
				img.src = args[i+1];
			}
			else
			{
				img.src = img.up;
			}
			
			group[group.length] = img;
		}
	} 
	else if (event == "out" ) 
	{
		for (i = 0; i < document.over.length; i++) 
		{
			img = document.over[i]; 
			img.src = (img.down? img.down : img.up); 
		}
	} 
	else if (event == "down") 
	{
		// if group "groupId" is found, set all its images to "up" and reset their "down"
		group = document[groupId];
		if (group)
		{
			for (i = 0; i < group.length; i++) 
			{ 
				img = group[i]; 
				img.src  = img.up; 
				img.down = 0; 
			}
		}

		// re-create empty group
		document[groupId] = group = new Array();
		
		// go through remaining arguments
		for (i = 2; i < args.length - 1; i += 2) 
		{
			// find image "arg2", "arg4", ...
			img = findObject(args[i]);
			if (img == null) continue;

			// set their "up" to source (if not set already)
			if (!img.up) img.up = img.src;
			
			// set "down" and "src" to following arg
			img.src = img.down = (args[i+1]? args[i+1] : img.up);
			
			// add image to group
			group[group.length] = img;
		}
	}
}
*/

/*
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

function OpenWindow(filename){

var breite = 800;
var hoehe = 600;
var l = (screen.availWidth - breite) / 2;
var t = (screen.availHeight - hoehe) / 2;
  wind = window.open(filename,'fzk',"toolbar=no,width=400,height=400,status=yes,scrollbars=no,resize=yes,location=yes,toolbar=yes,left="+l+",top="+t+",scrollbars=0,resizable=0;");
  wind.focus();
}
*/