
if(typeof(app)=='undefined'){
	if(!app){
		var app = new browser();
	
		if (app.compat_d_layers)	{
			document.getElementById = ns4_getLayerById;
		}
	}
}

document.getImageById = app.compat_d_all ? ie_get_fromAll : (app.compat_d_layers ? ns_getImgById : dom_getImgById);

function inspect(inObj)	{
	var s = "";
	for (var p in inObj)	{
		s = s + p + ": " + inObj[p] + ";<br> ";
	}
	w = window.open("", "_blank");
	w.document.open();
	w.document.write(s);
	w.document.close();
}


function browser()	{
	this.compat_dom = (document.getElementById) ? 1 : 0;
	this.compat_d_all = (document.all) ? 1 : 0;
	this.compat_d_layers = (document.layers) ? 1 : 0;
	this.version_name = navigator.appVersion;
	this.ie5 = ((this.version_name.indexOf('MSIE') != -1) && this.compat_dom);
	this.ie4 = (this.compat_d_all && !this.compat_dom);
	this.ns4 = (this.compat_d_layers && !this.compat_dom);
	this.op5 = (this.compat_dom && (parseInt(this.version_name, 10) >= 5) && (navigator.appName.indexOf('Opera') != -1));
	this.ns6 = (this.compat_dom && (parseInt(this.version_name, 10) >= 5) && (navigator.userAgent.indexOf('Gecko') != -1));
	this.platform = (this.version_name.indexOf('Macintosh') != -1) ? 'mac' : ((this.version_name.indexOf('Win') != -1) ? 'win' : 'unix');
	this.scrollfactor = (this.platform == 'win') ? 10 : 1;
	this.scrollspeed = new Function ('inSpeed', 'return this.scrollfactor * inSpeed;');
	this.supported_browser = (this.ie5 || (this.ie4 && (this.platform == "win")) || this.ns4 || this.op5 || this.ns6);

	return this;
}

function ns4_getLayerById(inName)	{
	return ns4_searchTree(document, 'layers', inName);
}

function ns4_searchTree(inStart, inType, inName)	{

	var tree = inStart[inType];
	if (tree)	{
		for (var i = 0; i < tree.length; ++i)	{
			if (tree[i].name == inName)	{
				return tree[i];
			} else {
				var foundlayer = ns4_searchTree(tree[i], inType, inName);
				if (foundlayer) return foundlayer;
			}
		}
	}
	return null;
}
function ie_get_fromAll(inID, inDiv)	{
	return document.all[inID] || null;
}

function dom_getImgById(inID, inDiv)	{
	var elem = (document.getElementById(inID) || document.images[inID]);
	return elem;
}

function ns_getImgById(inID, inDiv)	{

	//alert("inDiv "+inDiv);alert("inID "+inID);
	if (inDiv != "") {
		var lay = document.getElementById(inDiv);
		return lay.document.images[inID];
	} else {
		return document.images[inID];
	}	
}

var firstTime=true;
var pageNum=0;
var pageLayer;

var page=new MakeArray(100);

function MakeArray(n)	
{
	this.length = n;
	for (var i = 0; i<=n; i++)	
	{
		this[i] = false;
	}
	return this;
}

function ppzPicOver(n,layer)	
{	
	if(page[n]==false)	
	{
		var img = document.getImageById('pic'+n, layer);
		img.src = eval('on'+n).src;
	}
}

function ppzPicOut(n,layer)
{
	if(page[n]==false)
	{
		var img = document.getImageById('pic'+n, layer);
		
		img.src = eval('off'+n).src;
	}
}

function ppzPicClick(n,layer)	
{
	if (!firstTime)
	{
		page[pageNum]=false;
		ppzPicOut(pageNum,pageLayer);
	}
	pageNum=n;
	pageLayer=layer;
	ppzPicOver(n,layer)	
	page[n]=true;
	firstTime=false;
}
