// WBMultiCache.action v2.0 - November, 2008
// Copyright © 1999 by Walter Blady
// All rights reserved
var MCisNav4 = navigator.appName.indexOf("Netscape") >= 0 && parseInt(navigator.appVersion.charAt(0)) == 4;
var MCisIE4 = navigator.appVersion.indexOf("MSIE 4") >= 0;
var MCisIE = window.navigator.userAgent.indexOf("MSIE") > 0;
var MCW3C = document.getElementById ? true : false;
var MCaction, MCwait, MClastImage, MCcount = 0, MCnumber, MCbar, MCwaitBar, MCincrement;
var MCImageObj = new Array();
var MCsetDelay = 0, MCwindowObj, MCprotectImageObj, MCaction;
var MCscreenWidth, MCscreenHeight, MCparams, MCwindowNam, MCstatusWindow;
var MCstate, MCvis, MChid;
function WBMultiCache(action) {
	if (MCVersion()) {
		for (var i = 12; i < 60; i += 4 ) {
			if (action[i+3] != "" && action[i+3] != "#") {
				var imageObj = null;
				if (action[i].length > 0) {
					if (window.navigator.userAgent.indexOf("MSIE") > 0 || MCW3C) {
						imageObj = document.images[action[i]];
					}
					else {
						imageObj = document.images[action[i]];
					}
				}
				if (imageObj) {
					MCImageObj[MCImageObj.length] = new Image(imageObj.width, imageObj.height);
				}
				else if (action[i+1] > 0 && action[i+2] > 0) {
					MCImageObj[MCImageObj.length] = new Image(parseInt(action[i+1]), parseInt(action[i+2]));
				}
				else {
					MCImageObj[MCImageObj.length] = new Image();
				}
				MCImageObj[MCImageObj.length-1].cacheImage = action[i+3];
			}
		}
		if (action[1]) {
			MCaction = action;
			MCcount = MCImageObj.length;
			if (action[3] == 1 && !MCisNav4) {
				MCincrement = 360/MCcount;
				MCstatusWindow = MCOpenWindow();
				if (window.navigator.userAgent.indexOf("MSIE") > 0 || MCW3C) {
					MCbar = MCstatusWindow.document.images.bar;
				}
				else {
					MCbar = MCstatusWindow.document.MClayer.document.images[0];
				}
			}
			else if ((action[3] == 2 || action[3] == 3) && action[7] != "" && action[7] != "#") {
				MCincrement = parseInt(action[10])/MCcount;
				MCparams = MCGetObject(action[8]);
				if (MCparams) {
					if (action[3] == 3) {
						if (window.navigator.userAgent.indexOf("MSIE") > 0 || MCW3C) {
							MCbar = document.images[action[9]];
						}
						else {
							MCbar = MCFindImageObject(action[9], 0);
						}
					}
					MCvis = (MCW3C || MCisIE4) ? "visible" : "show";
					MChid = (MCW3C || MCisIE4) ? "hidden" : "hide";
					MCShowHide(MCparams, MCvis)
				}
			}
			if (MCaction[3] == 3) MCbar.width = 1;
			MCwait = setTimeout("MCCacheIt()", parseInt(action[2]) * 1000);
		}
	}
	return;
}
function MCCacheIt() {
	for (var i = 0; i < MCImageObj.length; i++) {
		MCImageObj[i].src = MCImageObj[i].cacheImage;
		MClastImage = MCImageObj[i];
	}
	if (MClastImage.complete) {
		if (MCaction[11] != "" && MCaction[11] != "#") {
			window.location.href = MCaction[11];
		}
		return;
	}
	MCnumber = 0;
	if (MCaction[3] == 1 || MCaction[3] == 2 || MCaction[3] == 3) {
		MCwaitBar = setInterval("MCProgressBar()", 30);
	}
	else if (MCaction[11] != "" && MCaction[11] != "#") {
		MCwait = setInterval("MCWaitLoad()", 500);
	}
	return;
}
function MCProgressBar() {
	var img = MCImageObj[MCnumber];
	if (img && MCaction[3] == 1) {
		if (MCstatusWindow && !MCstatusWindow.closed) {
			MCstatusWindow.focus();
			if (img.complete && img.src.indexOf(img.cacheImage) > -1) {
				MCbar.width += MCincrement;
				MCbar.src = MCaction[7];
				MCnumber += 1;
				if (MCnumber == MCImageObj.length) {
					clearInterval(MCwait);
					clearInterval(MCwaitBar);
					MCImageObj.length = 0;
					MCwaitOut = setTimeout("MCWaitHide()", 300);
					if (MCaction[11] != "" && MCaction[11] != "#") {
						MCwait = setInterval("MCWaitLoad()", 500);
					}
				}
			}
		}
	}
	else if (img && (MCaction[3] == 2 || MCaction[3] == 3)) {
		if (img.complete && img.src.indexOf(img.cacheImage) > -1) {
			if (MCaction[3] == 3) {
				MCbar.width += MCincrement;
				MCbar.src = MCaction[7];
			}
			MCnumber += 1;
			if (MCnumber == MCImageObj.length) {
				clearInterval(MCwait);
				clearInterval(MCwaitBar);
				MCImageObj.length = 0;
				MCwaitOut = setTimeout("MCWaitHide()", 300);
				if (MCaction[11] != "" && MCaction[11] != "#") {
					MCwait = setInterval("MCWaitLoad()", 500);
				}
			}
		}
	}
	else {
		clearInterval(MCwait);
		clearInterval(MCwaitBar);
		MCImageObj.length = 0;
		if (MCaction[11] != "" && MCaction[11] != "#") {
			MCwait = setInterval("MCWaitLoad()", 500);
		}
	}
	return;
}
function MCWaitHide() {
	if (MCaction[3] == 1) MCstatusWindow.close();
	if (MCaction[3] == 2 || MCaction[3] == 3) MCShowHide(MCparams, MChid);
	return;
}
function MCWaitLoad() {
	if (MClastImage.complete && MClastImage.src.indexOf(MClastImage.cacheImage) > -1) {
		clearInterval(MCwait);
		clearInterval(MCwaitBar);
		MCImageObj.length = 0;
		window.location.href = MCaction[11];
	}
	return;
}
function MCFindImageObject(baseImage, thisLayer) {
	if (thisLayer) {
		var thisDocument = thisLayer.document;
	}
	else {
		var thisDocument = document;
	}
	var imageObj = thisDocument[baseImage];
	if (imageObj) {
		return imageObj;
	}
	else {
		for (var i = 0; i < thisDocument.layers.length; i++) {
			imageObj = MCFindImageObject(baseImage, thisDocument.layers[i]); 
			if (imageObj) {
				break;
			}
		}
	}
	return imageObj;
}
function MCShowHide(object, state) {
	if (MCW3C) {
		object.style.visibility = state;
		var innerObjs = object.getElementsByTagName("div");
		for (var i = 0; i < innerObjs.length; i++) {
			innerObjs[i].style.visibility = state;
		}
	}
	else if (MCisIE4) {
		object.style.visibility = state;
		for (var i = 0; i < object.children.length; i++) {
			object.children[i].style.visibility = state;
			if (object.children[i].children.length > 0) {
				layerObj = MCShowHide(object.children[i], state);
			}
		}
	}
	else if (MCisNav4) {
		object.visibility = state;
		for (var i = 0; i < object.layers.length; i++) {
			object.layers[i].visibility = state;
			if (object.layers[i].layers.length > 0) {
				layerObj = MCShowHide(object.layers[i], state);
			}
		}
	}
	return;
}
function MCGetObject(objName, frameName) {
	if (MCW3C) {
		MCparams = eval('document.getElementById("' + objName + '")');
	}
	else if (MCisIE4) {
		MCparams = eval("document.all." + objName);
	}
	else {
		MCparams = MCFindLayerObject(objName, 0);
	}
	return MCparams;
}
function MCFindLayerObject(layer, thisLayer) {
	if (thisLayer) {
		var thisDocument = eval("thisLayer.document");
	}
	else {
		var thisDocument = eval("document");
	}
	var layerObj = thisDocument[layer];
	if (layerObj) {
		return layerObj;
	}
	else {
		for (var i = 0; i < thisDocument.layers.length; i++) {
			layerObj = MCFindLayerObject(layer, thisDocument.layers[i]);
			if (layerObj) {
				break;
			}
		}
	}
	return layerObj;
}
function MCOpenWindow() {
	MCwindowObj = "newWindowObject";
	MCwindowNam = "MCnewWindowName";
	MCparams = "";
	var winWidth = 375;
	var winHeight = 40;
	winTop = parseInt(MCaction[5]);
	winLeft = parseInt(MCaction[6]);
	MCparams += "width=" + winWidth;
	MCparams += ",height=" + winHeight;
	MCparams += ",toolbar=0,location=0,directories=0,status=0,menubar=0,favorites=0,scrollbars=0,resizable=0";
	MCparams += (MCisIE) ? ",top=" + winTop + ",left=" + winLeft : ",screenY=" + winTop + ",screenX=" + winLeft;
	MCimageObj = "imageObject";
	var htmlContent = '<html><head>';
	htmlContent += '<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">';
	htmlContent += '<title>' + MCaction[4] + '</title>';
	htmlContent += '<style type="text/css" media="screen"><!' + '--#MClayer  { border: solid 1px #000; position: absolute; top: 12px; left: 5px; width: 360px; height: 18px;'
	htmlContent += 'visibility: visible; display: block }--' + '></style>';
	htmlContent += '</head><body bgcolor="#ffffff">';
	htmlContent += '<div id="MClayer"><img src="' + MCaction[7] + '" alt="" name="bar" height="15" width="1" border="0"></div>';
	htmlContent += '</body></html>';
	MCstatusWindow = window.open("", MCwindowNam, MCparams);
	MCstatusWindow.moveTo(winLeft, winTop);
	MCstatusWindow.document.open();
	MCstatusWindow.document.write(htmlContent);
	MCstatusWindow.document.close();
	MCstatusWindow.focus();
	return MCstatusWindow;
}
function MCVersion() {
	return true;
}
//
