﻿// AutoScroll.action v3.0.3dv - January, 2009
// Copyright © 2000 by Walter Blady
// All rights reserved
var ASisNav4 = navigator.appName.indexOf("Netscape") >= 0 && parseInt(navigator.appVersion.charAt(0)) == 4;
var ASisNN6 = navigator.userAgent.indexOf("Netscape6") >= 0;
var ASisIE4 = navigator.appVersion.indexOf("MSIE 4") >= 0;
var ASW3C = document.getElementById ? true : false;
var ASisOpera = navigator.userAgent.indexOf("Opera") >= 0;
var ASsuff = ASisOpera ? "" : "px";
var ASObject0 = new Object(), ASObject1 = new Object();
var W3CinitFlag = false, ASparamsDiv;
function WBAutoScroll(action) {
	if (ASVersion()) {
		if (!W3CinitFlag) ASBoxPrep();
		var obj = eval("ASObject" + action[1]);
		if (obj.idx == null) {
			obj.idx = action[1];
			obj.doinit = ASDoInit;
			obj.action = action;
			obj.doinit();
		}
		if (action[2] == 6) {
			if (obj.ASrep > 0) clearTimeout(obj.ASrep);
			if (obj.ASrepeat > 0) clearInterval(obj.ASrepeat);
			obj.ASstopFlag = true;
			return;
		}
		if (action[2] == 4 || action[2] == 5) {
			if (obj.ASrep > 0) clearTimeout(obj.ASrep);
			if (obj.ASrepeat > 0) clearInterval(obj.ASrepeat);
			obj.ASpauseFlag = false;
			if (action[2] == 5) {
				if (obj.idx == 0 && !obj.ASstopFlag) obj.ASrepeat = setInterval("ASObject0.doscroll()", obj.ASdelay);
				if (obj.idx == 1 && !obj.ASstopFlag) obj.ASrepeat = setInterval("ASObject1.doscroll()", obj.ASdelay);
			}
			return;
		}
		obj.ASstartDelay = parseInt(action[7])*1000;
		obj.ASendDelay = parseInt(action[8])*1000;
		obj.ASpixelLines = parseInt(action[9]);
		obj.ASlineDelay = parseInt(action[10])*1000;
		obj.ASlines = parseInt(action[13]);
		obj.ASdelay = parseInt(action[14]);
		obj.ASpauseFlag = false;
		if (obj.ASrep > 0) clearTimeout(obj.ASrep);
		if (obj.ASrepeat > 0) clearInterval(obj.ASrepeat);
		if (action[2] == 0) {
			obj.ASupDown = true;
			obj.ASminus = false;
			if (obj.idx == 0) obj.ASrepeat = setInterval("ASObject0.doscroll()", obj.ASdelay);
			if (obj.idx == 1) obj.ASrepeat = setInterval("ASObject1.doscroll()", obj.ASdelay);
		}
		if (action[2] == 1) {
			obj.ASupDown = true;
			obj.ASminus = true;
			if (obj.idx == 0) obj.ASrepeat = setInterval("ASObject0.doscroll()", obj.ASdelay);
			if (obj.idx == 1) obj.ASrepeat = setInterval("ASObject1.doscroll()", obj.ASdelay);
		}
		if (action[2] == 2) {
			obj.ASupDown = false;
			obj.ASminus = false;
			if (obj.idx == 0) obj.ASrepeat = setInterval("ASObject0.doscroll()", obj.ASdelay);
			if (obj.idx == 1) obj.ASrepeat = setInterval("ASObject1.doscroll()", obj.ASdelay);
		}
		if (action[2] == 3) {
			obj.ASupDown = false;
			obj.ASminus = true;
			if (obj.idx == 0) obj.ASrepeat = setInterval("ASObject0.doscroll()", obj.ASdelay);
			if (obj.idx == 1) obj.ASrepeat = setInterval("ASObject1.doscroll()", obj.ASdelay);
		}
	}
	return;
}
function ASDoScroll() {
	var panx = 0, pany = 0;
	if (!this.ASpauseFlag && this.ASautoFlag) {
		this.scrollto(this.contentBox, this.ASxloc, this.ASyloc, panx, pany);
		this.ASpauseFlag = true;
		this.ASautoFlag = false;
		if (this.idx == 0) this.ASrep = setTimeout("ASObject0.pause()", this.ASstartDelay);
		if (this.idx == 1) this.ASrep = setTimeout("ASObject1.pause()", this.ASstartDelay);
	}
	if (!this.ASpauseFlag && this.ASpixelLines > 0 && this.ASpixCount >= this.ASpixelLines) {
		this.ASpixCount = 0;
		this.ASpauseFlag = true;
		if (this.idx == 0) this.ASrep = setTimeout("ASObject0.pause()", this.ASlineDelay);
		if (this.idx == 1) this.ASrep = setTimeout("ASObject1.pause()", this.ASlineDelay);
	}
	if (!this.ASpauseFlag) {
		var origin, posOrig;
		if (this.ASupDown) {
			if (this.ASminus) {
				this.end = (this.ASyloc <= this.ASyDest);
				if (!this.end) {
					origin = this.contentBox.wrapBox ? this.ASyDest : this.ASyOrig;
					posOrig = origin >= 0 ? this.ASyloc - this.ASlines <= origin : this.ASyloc - this.ASlines >= origin;
					this.ASyloc = posOrig ? this.ASyloc - this.ASlines : origin;
					//this.end = (this.ASyloc <= this.ASyDest);
					pany = this.ASyloc <= 0 ? this.contBoxHeight : -this.contBoxHeight;
				}
			}
			else {
				this.end = (this.ASyloc >= Math.abs(this.ASyDest));
				if (!this.end) {
					origin = this.contentBox.wrapBox ? this.ASyDest : this.ASyOrig;
					posOrig = origin >= 0 ? this.ASyloc + this.ASlines <= origin : this.ASyloc + this.ASlines >= origin;
					this.ASyloc = posOrig ? this.ASyloc + this.ASlines : origin;
					pany = this.ASyloc <= 0 ? this.contBoxHeight : -this.contBoxHeight;
				}
			}
		}
		else {
			if (this.ASminus) {
				this.end = (this.ASxloc <= this.ASxDest);
				if (!this.end) {
					origin = this.contentBox.wrapBox ? this.ASxDest : this.ASxOrig;
					posOrig = origin >= 0 ? this.ASxloc - this.ASlines <= origin : this.ASxloc - this.ASlines >= origin;
					this.ASxloc = posOrig ? this.ASxloc - this.ASlines : origin;
					panx = this.ASxloc <= 0 ? this.contBoxWidth : -this.contBoxWidth;
				}
			}
			else {
				this.end = (this.ASxloc >= Math.abs(this.ASxDest));
				if (!this.end) {
					origin = this.contentBox.wrapBox ? this.ASxDest : this.ASxOrig;
					posOrig = origin >= 0 ? this.ASxloc + this.ASlines <= origin : this.ASxloc + this.ASlines >= origin;
					this.ASxloc = posOrig ? this.ASxloc + this.ASlines : origin;
					panx = this.ASxloc <= 0 ? this.contBoxWidth : -this.contBoxWidth;
				}
			}
		}
		this.scrollto(this.contentBox, this.ASxloc, this.ASyloc, panx, pany);
		this.ASpixCount += this.ASlines;
	}
	if (this.end) {
		this.end = false;
		if (this.ASloop) {
			this.ASpauseFlag = true;
			this.ASautoFlag = true;
			if (this.action[2] == 1 || this.action[2] == 3) {
				this.ASyloc = this.ASyOrig;
				this.ASxloc = this.ASxOrig;
			}
			else if (this.action[2] == 0 || this.action[2] == 2){
				this.ASyloc = this.ASyOrig;
				this.ASxloc = this.ASxOrig;
			}
			this.ASpixCount = 0;
			if (this.idx == 0) this.ASrep = setTimeout("ASObject0.pause()", this.ASendDelay);
			if (this.idx == 1) this.ASrep = setTimeout("ASObject1.pause()", this.ASendDelay);
		}
		else {
			if (this.ASrepeat > 0) clearInterval(this.ASrepeat);
			if (this.ASrep > 0) clearTimeout(this.ASrep);
		}
	}
	return;
}
function ASScrollTo(obj, x, y, panx, pany) {
	if (ASW3C) {
		obj.left = x + ASsuff;
		obj.top = y + ASsuff;
		if (obj.wrapBox) {
			obj.wrapBox.left = (x + panx) + ASsuff;
			obj.wrapBox.top = (y + pany) + ASsuff;
		}
	}
	else if (ASisIE4) {
		obj.pixelLeft = x;
		obj.pixelTop = y;
		if (obj.wrapBox) {
			obj.wrapBox.pixelLeft = (x + panx);
			obj.wrapBox.pixelTop = (y + pany);
		}
	}
	else {
		obj.moveTo(x, y);
		if (obj.wrapBox) obj.wrapBox.moveTo(x + panx, y + pany);
	}
	return;
}
function ASPause() {
	this.ASpauseFlag = false;
	clearTimeout(this.ASrep);
	return;
}
function ASGetObject(objName) {
	var params;
	if (ASW3C) {
		params = eval('document.getElementById("' + objName + '").style');
	}
	else if (ASisIE4) {
		params = eval("document.all." + objName + ".style");
		ASparamsDiv = eval("document.all." + objName);
	}
	else {
		params = ASFindLayerObject(objName, 0);
	}
	return params;
}
function ASFindLayerObject(layer, thisLayer) {
	if (thisLayer) {
		var thisDocument = thisLayer.document;
	}
	else {
		var thisDocument = document;
	}
	var layerObj = thisDocument[layer];
	if (layerObj) {
		return layerObj;
	}
	else {
		for (var i = 0; i < thisDocument.layers.length; i++) {
			layerObj = ASFindLayerObject(layer, thisDocument.layers[i]); 
			if (layerObj) {
				break;
			}
		}
	}
	return layerObj;
}
function ASDoInit() {
	this.getobject = ASGetObject;
	this.scrollto = ASScrollTo;
	this.pause = ASPause;
	this.doscroll = ASDoScroll;
	this.clipingBox = this.getobject(this.action[4]);
	this.clipingBoxDiv = ASparamsDiv;
	this.contentBox = this.getobject(this.action[5]);
	this.contentBoxDiv = ASparamsDiv;
	if (this.action[6] != "") {
		this.contentBox.wrapBox = this.getobject(this.action[6]);
	}
	this.ASloop = this.contentBox.wrapBox ? true : this.action[11];
	this.ASscrollOut = this.contentBox.wrapBox ? true : this.action[12];
	this.ASstopFlag = false;
 	this.ASrepeat = 0;
 	this.ASrep = 0;
	this.ASstartDelay = 0;
	this.ASlineDelay = 0;
	this.ASendDelay = 0;
	this.ASyDest = 0;
	this.ASyOrig = 0;
	this.ASyloc = 0;
	this.ASxDest = 0;
	this.ASxOrig = 0;
	this.ASxloc = 0;
	this.ASpixCount = 0;
	this.ASpauseFlag = false;
	this.ASautoFlag = this.action[3] == 0 ? true : false;
	this.ASstopFlag = false;
	this.end = false;
	if (ASW3C) {
		if (ASisOpera) {
			var clipingBox = document.getElementById(this.action[4]);
			var contentBox = document.getElementById(this.action[5]);
			this.contBoxWidth = contentBox.clientWidth;
			this.contBoxHeight = contentBox.clientHeight;
			this.contBoxTop = contentBox.offsetTop;
			this.contBoxLeft = contentBox.offsetLeft;
			this.clipBoxWidth = clipingBox.clientWidth;
			this.clipBoxHeight = clipingBox.clientHeight;
			this.clipingBox.clip = "rect(" + 0 + " " + clipingBox.clientWidth + " " + clipingBox.clientHeight + " " + 0 + ")";
			this.clipingBox.overflow = "hidden";
		}
		else {
			this.contBoxWidth = parseInt(this.contentBox.width);
			this.contBoxHeight = parseInt(this.contentBox.height);
			this.contBoxTop = parseInt(this.contentBox.top);
			this.contBoxLeft = parseInt(this.contentBox.left);
			this.clipBoxWidth = parseInt(this.clipingBox.width);
			this.clipBoxHeight = parseInt(this.clipingBox.height);
			this.clipingBox.clip = "rect(" + 0 + " " + this.clipingBox.width + " " + this.clipingBox.height + " " + 0 + ")";
			this.clipingBox.overflow = "hidden";
		}
	}
	else if (document.all) {
		this.contBoxWidth = this.contentBoxDiv.clientWidth;
		this.contBoxHeight = this.contentBoxDiv.clientHeight;
		this.contBoxTop = this.contentBoxDiv.offsetTop;
		this.contBoxLeft = this.contentBoxDiv.offsetLeft;
		this.clipBoxWidth = this.clipingBoxDiv.clientWidth;
		this.clipBoxHeight = this.clipingBoxDiv.clientHeight;
		this.clipingBox.clip = "rect(" + 0 + " " + this.clipBoxWidth + " " + this.clipBoxHeight + " " + 0 + ")";
		this.clipingBox.overflow = "hidden";
	}
	else if (document.layers){
		this.contBoxWidth = this.contentBox.clip.width;
		this.contBoxHeight = this.contentBox.clip.height;
		this.contBoxTop = this.contentBox.top;
		this.contBoxLeft = this.contentBox.left;
		this.clipBoxWidth = this.clipingBox.clip.width;
		this.clipBoxHeight = this.clipingBox.clip.height;
		this.clipingBox.clip = "rect(" + 0 + " " + this.clipingBox.clip.width + " " + this.clipingBox.clip.height + " " + 0 + ")";
		this.clipingBox.overflow = "hidden";
	}
	if (this.contentBox.wrapBox) {
		if (ASW3C) {
			if (this.ASupDown) {
				this.contentBox.wrapBox.top = this.ASminus ? this.contBoxTop + this.contBoxHeight + ASsuff : this.contBoxTop - this.contBoxHeight + ASsuff;
				this.contentBox.wrapBox.left = this.contBoxLeft;
			}
			else {
				this.contentBox.wrapBox.top = this.contBoxTop;
				this.contentBox.wrapBox.left = this.ASminus ? this.contBoxLeft + this.contBoxWidth + ASsuff : this.contBoxLeft - this.contBoxWidth + ASsuff;
			}
		}
		else if (ASisIE4) {
			if (this.ASupDown) {
				this.contentBox.wrapBox.pixelTop = this.ASminus ? this.contBoxTop + this.contBoxHeight + ASsuff : this.contBoxTop - this.contBoxHeight + ASsuff;
				this.contentBox.wrapBox.pixelLeft = this.contBoxLeft;
			}
			else {
				this.contentBox.wrapBox.pixelTop = this.contBoxTop;
				this.contentBox.wrapBox.pixelLeft = this.ASminus ? this.contBoxLeft + this.contBoxWidth + ASsuff : this.contBoxLeft - this.contBoxWidth + ASsuff;
			}
		}
		else {
			if (this.contentBox.wrapBox) this.contentBox.wrapBox.moveTo(this.contBoxTop, this.contBoxLeft);
		}
	}
	this.scrollto(this.contentBox, this.contBoxLeft, this.contBoxTop, 0 ,0);
	this.ASyOrig = this.contBoxTop;
	this.ASxOrig = this.contBoxLeft;
	this.ASyloc = this.contBoxTop;
	this.ASxloc = this.contBoxLeft;
	if (this.ASscrollOut) {
		this.ASyDest = this.contBoxTop < 0 ? this.clipBoxHeight : -1*(this.contBoxHeight+this.contBoxTop);
		this.ASxDest = this.contBoxLeft < 0 ? this.clipBoxWidth : -1*(this.contBoxWidth+this.contBoxLeft);
	}
	else {
		this.ASyDest = this.contBoxTop < 0 ? 0 : -1*(this.contBoxHeight - this.clipBoxHeight);
		this.ASxDest = this.contBoxLeft < 0 ? 0 : -1*(this.contBoxWidth - this.clipBoxWidth);
	}
	return;
}
function ASBoxPrep() {
	if (!W3CinitFlag && ASW3C && document.getElementsByTagName("style")[0].innerHTML != "") {
		var d = document.getElementsByTagName("div");
		var s = document.getElementsByTagName("style");
		for (var i = 0; i < s.length; i++) {
			var html = (s[i].innerHTML);
			var start = html.indexOf("!--") + 3;
			var end = html.lastIndexOf("}") + 1 - start;
			html = html.indexOf("!--") > -1 ? html.substr(start, end) : html;
			html = html.replace(/^\s*/, "");
			html = html.replace(/:\s*#/g, ": ~");
			html = html.replace(/[\n\r]/g, "");
			var styleArray = html.split(/\s*\}\s*/);
			for (var j = 0; j < styleArray.length; j++) {
				var name = styleArray[j].substr(styleArray[j].search(/\w/), styleArray[j].search(/{/));
				name = name.replace(/[ \{].+/g, "")
				for (var k = 0; k < d.length; k++) {
					var match = (name == d[k].id && name != "");
					if (match) break;
				}
				if (styleArray[j] != "" && match) {
					styleArray[j] = styleArray[j].replace(/\**#/, "");
					styleArray[j] = styleArray[j].replace(/~/g, "#");
					var styleName = styleArray[j].substr(0, styleArray[j].indexOf("{"));
					styleName = styleName.replace(/\s*/g, "");
					styleArray[j] = styleArray[j].toLowerCase();
					var t = eval("d." + styleName + ".style");
					var divName = eval("d." + styleName + ".id");
					var styleString = styleArray[j].replace(/^.*\{\s*/, "");
					styleString = styleString.replace(/\s*\}.*$|\s*\}.*\n.*$|\s*\}.*\r.*$/, "");
					styleString = styleString.replace(/\;$/, "");
					var divArray = styleString.split(/\;\s*/g);
					for (var k = 0; k < divArray.length; k++) {
						var propertyName = divArray[k].substr(0, divArray[k].indexOf(":"));
						var dash = propertyName.indexOf("-");
						if (dash > -1) {
							var propertyName = propertyName.substr(0, dash) + propertyName.substr(dash + 1, 1).toUpperCase() + propertyName.substr(dash + 2, propertyName.length);
						}
						var propertyValue = divArray[k].substr(divArray[k].indexOf(":"), divArray[k].length);
						propertyValue = propertyValue.replace(/:*(-->)*}*\n*/g, "");
						propertyValue = propertyValue.replace(/^\s*|\s*$/, "");
						if (ASisNN6 && propertyValue.indexOf("(") > -1) {
							propertyValue = propertyValue.replace(/auto|pt|pi|px|em|ex|mm|cm|in|%/g, "$& ");
							propertyValue = propertyValue.replace(/ \)/g, ")");
						}
						t.name = divName;
						t[propertyName] = propertyValue;
					}
				}
			}
		}
		W3CinitFlag = true;
	}
	return;
}
function ASVersion() {
	return true;
}
//

