//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
{
var version;
var axo;
var e;
// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
try {
// version will be set for 7.X or greater players
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
version = axo.GetVariable("$version");
} catch (e) {
}
if (!version)
{
try {
// version will be set for 6.X players only
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
// installed player is some revision of 6.0
// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
// so we have to be careful.
// default to the first public version
version = "WIN 6,0,21,0";
// throws if AllowScripAccess does not exist (introduced in 6.0r47)
axo.AllowScriptAccess = "always";
// safe to call for 6.0r47 or greater
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 4.X or 5.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = axo.GetVariable("$version");
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 3.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
version = "WIN 3,0,18,0";
} catch (e) {
}
}
if (!version)
{
try {
// version will be set for 2.X player
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
version = "WIN 2,0,0,11";
} catch (e) {
version = -1;
}
}
return version;
}
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
// NS/Opera version >= 3 check for Flash plugin in plugin array
var flashVer = -1;
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
var descArray = flashDescription.split(" ");
var tempArrayMajor = descArray[2].split(".");
var versionMajor = tempArrayMajor[0];
var versionMinor = tempArrayMajor[1];
var versionRevision = descArray[3];
if (versionRevision == "") {
versionRevision = descArray[4];
}
if (versionRevision[0] == "d") {
versionRevision = versionRevision.substring(1);
} else if (versionRevision[0] == "r") {
versionRevision = versionRevision.substring(1);
if (versionRevision.indexOf("d") > 0) {
versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
}
}
var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
}
}
// MSN/WebTV 2.6 supports Flash 4
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
// WebTV 2.5 supports Flash 3
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
// older WebTV supports Flash 2
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
else if ( isIE && isWin && !isOpera ) {
flashVer = ControlVersion();
}
return flashVer;
}
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
versionStr = GetSwfVer();
if (versionStr == -1 ) {
return false;
} else if (versionStr != 0) {
if(isIE && isWin && !isOpera) {
// Given "WIN 2,0,0,11"
tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
tempString = tempArray[1]; // "2,0,0,11"
versionArray = tempString.split(","); // ['2', '0', '0', '11']
} else {
versionArray = versionStr.split(".");
}
var versionMajor = versionArray[0];
var versionMinor = versionArray[1];
var versionRevision = versionArray[2];
// is the major.revision >= requested major.revision AND the minor version >= requested minor
if (versionMajor > parseFloat(reqMajorVer)) {
return true;
} else if (versionMajor == parseFloat(reqMajorVer)) {
if (versionMinor > parseFloat(reqMinorVer))
return true;
else if (versionMinor == parseFloat(reqMinorVer)) {
if (versionRevision >= parseFloat(reqRevision))
return true;
}
}
return false;
}
}
function AC_AddExtension(src, ext)
{
if (src.indexOf('?') != -1)
return src.replace(/\?/, ext+'?');
else
return src + ext;
}
function AC_Generateobj(objAttrs, params, embedAttrs)
{
var str = '';
if (isIE && isWin && !isOpera)
{
str += '';
}
else
{
str += '';
}
document.write(str);
}
function AC_FL_RunContent(){
var ret =
AC_GetArgs
( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
, "application/x-shockwave-flash"
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_SW_RunContent(){
var ret =
AC_GetArgs
( arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
, null
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
var ret = new Object();
ret.embedAttrs = new Object();
ret.params = new Object();
ret.objAttrs = new Object();
for (var i=0; i < args.length; i=i+2){
var currArg = args[i].toLowerCase();
switch (currArg){
case "classid":
break;
case "pluginspage":
ret.embedAttrs[args[i]] = args[i+1];
break;
case "src":
case "movie":
//args[i+1] = AC_AddExtension(args[i+1], ext);
ret.embedAttrs["src"] = args[i+1];
ret.params[srcParamName] = args[i+1];
break;
case "onafterupdate":
case "onbeforeupdate":
case "onblur":
case "oncellchange":
case "onclick":
case "ondblClick":
case "ondrag":
case "ondragend":
case "ondragenter":
case "ondragleave":
case "ondragover":
case "ondrop":
case "onfinish":
case "onfocus":
case "onhelp":
case "onmousedown":
case "onmouseup":
case "onmouseover":
case "onmousemove":
case "onmouseout":
case "onkeypress":
case "onkeydown":
case "onkeyup":
case "onload":
case "onlosecapture":
case "onpropertychange":
case "onreadystatechange":
case "onrowsdelete":
case "onrowenter":
case "onrowexit":
case "onrowsinserted":
case "onstart":
case "onscroll":
case "onbeforeeditfocus":
case "onactivate":
case "onbeforedeactivate":
case "ondeactivate":
case "type":
case "codebase":
case "id":
ret.objAttrs[args[i]] = args[i+1];
break;
case "width":
case "height":
case "align":
case "vspace":
case "hspace":
case "class":
case "title":
case "accesskey":
case "name":
case "tabindex":
ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
break;
default:
ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
}
}
ret.objAttrs["classid"] = classid;
if (mimeType) ret.embedAttrs["type"] = mimeType;
return ret;
}
function addGlobalSearchEvent()
{
globalSearchInput = document.getElementById('keyword');
addListener(globalSearchInput,'focus',function(e)
{
var evt = window.event || e;
focusChangeClass(evt);
});
addListener(globalSearchInput,'blur',function(e)
{
var evt = window.event || e;
blurChangeClass(evt)
});
}
function focusChangeClass(evt)
{
evtElement = evt.srcElement || evt.target;
id = evtElement.getAttribute('id');
document.getElementById(id).className = 'global_search_withkeyword';
}
function blurChangeClass(evt)
{
evtElement = evt.srcElement || evt.target;
id = evtElement.getAttribute('id');
value = globalSearchForm.keyword.value;
if(!value)
document.getElementById(id).className = 'global_search_nokeyword';
}var isFirefox=(window.navigator.userAgent.indexOf("Firefox")!=-1);
var isSafari=(window.navigator.userAgent.indexOf("Safari")!=-1);
function showSelectBoxes()
{
var selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++)
{
selects[i].style.visibility = "visible";
}
}
function hideSelectBoxes()
{
var selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++)
{
selects[i].style.visibility = "hidden";
}
}
function showFlash()
{
var flashObjects = document.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++)
{
flashObjects[i].style.visibility = "visible";
}
var flashEmbeds = document.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++)
{
flashEmbeds[i].style.visibility = "visible";
}
}
function hideFlash()
{
var flashObjects = document.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++)
{
flashObjects[i].style.visibility = "hidden";
}
var flashEmbeds = document.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++)
{
flashEmbeds[i].style.visibility = "hidden";
}
}
function StopFlashMovie()
{
var flashObjects = document.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++)
{
//flashObjects[i].StopPlay();
flashObjects[i].SetVariable("playAuto", "0");
}
var flashEmbeds = document.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++)
{
//flashEmbeds[i].StopPlay();
flashEmbeds[i].SetVariable("playAuto", "0");
}
}
function PlayFlashMovie()
{
var flashObjects = document.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++)
{
//flashObjects[i].Play();
flashObjects[i].SetVariable("playAuto", "1");
}
var flashEmbeds = document.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++)
{
//flashEmbeds[i].Play();
flashEmbeds[i].SetVariable("playAuto", "1");
}
}
function getPageSize()
{
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY)
{
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
}
else if (document.body.scrollHeight > document.body.offsetHeight)
{
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
}
else
{
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight)
{
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
{
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
}
else if (document.body)
{
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
if(yScroll < windowHeight)
{
pageHeight = windowHeight;
}
else
{
pageHeight = yScroll;
}
if(xScroll < windowWidth)
{
pageWidth = windowWidth;
}
else
{
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
function getPageScroll()
{
var yScroll;
if (self.pageYOffset)
{
yScroll = self.pageYOffset;
}
else if (document.documentElement && document.documentElement.scrollTop)
{
yScroll = document.documentElement.scrollTop;
}
else if (document.body)
{
yScroll = document.body.scrollTop;
}
arrayPageScroll = new Array('',yScroll)
return arrayPageScroll;
}
function startup()
{
//hideFlash();
StopFlashMovie();
hideSelectBoxes();
var overlayOpacity = 0.8;
var overlayDuration = 0.2;
var objBody = document.getElementsByTagName('body').item(0);
var objOverlay = document.createElement('div');
var arrayPageSize = getPageSize();
var arrayPageScroll = getPageScroll();
objOverlay.setAttribute('id','overlay');
objOverlay.style.display = 'block';
objOverlay.style.minHeight = arrayPageSize[1];
objBody.appendChild(objOverlay);
document.getElementById('overlay').style.height = arrayPageSize[1] +'px';
/*var objLightbox = document.createElement("div");
objLightbox.setAttribute('id','lightbox');
objLightbox.style.display = 'block';
objLightbox.style.top = (0 + 0 + 'px');
objBody.appendChild(objLightbox);*/
/*var objOuterImageContainer = document.createElement('div');
objOuterImageContainer.setAttribute('id','sys_msg');
objOuterImageContainer.setAttribute('align','center');
objLightbox.appendChild(objOuterImageContainer);*/
//document.getElementById('sys_msg').innerHTML = document.getElementById('show_msg').innerHTML;
start_opacity_effect_interval = setInterval("startup_opacity_effect('overlay')", 4);
document.getElementById('sys_msg').style.display = 'block';
document.getElementById('sys_msg').style.left = (document.body.clientWidth/2) - (document.getElementById('sys_msg').offsetWidth/2);
document.getElementById('sys_msg').style.top = arrayPageScroll[1] + (document.body.clientHeight/2) - (document.getElementById('sys_msg').offsetHeight/2);
document.getElementById('overlay').onclick = function(){end();};
}
function startup_opacity_effect(id)
{
element = getElement(id);
if (isFirefox)
{
if (element.style.MozOpacity == 0.5)
{
clearInterval(start_opacity_effect_interval);
}
alpha = (element.style.MozOpacity * 100 + 10) / 100;
element.style.MozOpacity = alpha;
}
else if (isSafari)
{
if (element.style.opacity == 0.5)
{
clearInterval(start_opacity_effect_interval);
}
alpha = (element.style.opacity * 100 + 10) / 100;
element.style.opacity = alpha;
}
else
{
if (element.filters.alpha.opacity == 50)
{
clearInterval(start_opacity_effect_interval);
}
element.filters.alpha.opacity += 10;
}
}
function end_opacity_effect(id)
{
element = getElement(id);
if (isFirefox)
{
if (element.style.MozOpacity == 0.0)
{
clearInterval(end_opacity_effect_interval);
var objBody = document.getElementsByTagName('body').item(0);
objBody.removeChild(getElement('overlay'));
}
else
{
alpha = (element.style.MozOpacity * 100 - 10) / 100;
element.style.MozOpacity = alpha;
}
}
else if(isSafari)
{
//alert('hf')
if (element.style.opacity == 0.0)
{
clearInterval(end_opacity_effect_interval);
var objBody = document.getElementsByTagName('body').item(0);
objBody.removeChild(getElement('overlay'));
}
else
{
alpha = (element.style.opacity * 100 - 10) / 100;
element.style.opacity = alpha;
}
}
else
{
if (element.filters.alpha.opacity == 0)
{
clearInterval(end_opacity_effect_interval);
var objBody = document.getElementsByTagName('body').item(0);
objBody.removeChild(getElement('overlay'));
}
else
{
element.filters.alpha.opacity -= 10;
}
}
}
function end()
{
showSelectBoxes();
//showFlash();
PlayFlashMovie();
var objBody = document.getElementsByTagName('body').item(0);
end_opacity_effect_interval = setInterval("end_opacity_effect('overlay')", 4);
document.getElementById('sys_msg').style.display = 'none';
}
function getElement(re) {
return document.getElementById(re);
}var menuBtnWidth = 180;
var menuAreaClass = 'navArea';
var menuLayerClass = 'subNavLayer';
var menuBtnClass = 'mainNav';
var hideLayerTimeout = '';
function getPos(id)
{
var object = document.getElementById(id);
var objTop = 0;
var objLeft = 0;
while(object !=document.body)
{
objTop += object.offsetTop;
objLeft += object.offsetLeft;
object = object.offsetParent;
}
return [objTop,objLeft];
}
function addListener(element,e,fn)
{
if(element.addEventListener)
{
element.addEventListener(e,fn,false);
}
else
{
element.attachEvent("on" + e,fn);
}
}
function removeListener(element,e,fn)
{
if(element.addEventListener)
{
element.removeEventListener(e,fn,false);
}
else
{
element.detachEvent("on" + e,fn);
}
}
function getElementByClassInId(id,theClass)
{
var classArray = new Array();
var allPageTags=document.getElementById(id).getElementsByTagName("*");
j=0;
for (i=0; i 0)
{
for(i=0; i < menuLayerArr.length; i++)
{
menuLayerArr[i].style.visibility = 'hidden';
}
}
mainNavOnArr = getElementByClassInId(menuAreaClass,'mainNav_on');
if(mainNavOnArr.length > 0)
{
for(i=0; i < mainNavOnArr.length; i++)
{
if(mainSection+'_btn' != mainNavOnArr[i].getAttribute('id'))
{
mainNavOnArr[i].className = 'mainNav';
}
}
}
}
function addMenuEvent()
{
var menuBtnArr = new Array();
var menuLayerArr = new Array();
menuBtnArr = getElementByClassInId(menuAreaClass,menuBtnClass);
for (i = 0 ; i < menuBtnArr.length ; i++)
{
addListener(menuBtnArr[i],'mouseover',function(e)
{
if(hideLayerTimeout)
{
clearTimeout(hideLayerTimeout);
}
var evt = window.event || e;
hideAllLayer();
showLayer(evt);
});
addListener(menuBtnArr[i],'mouseout',function(e)
{
var evt = window.event || e;
elementType = 'btn';
hideLayerEvent(evt,elementType);
});
}
menuLayerArr = getElementByClassInId(menuAreaClass,menuLayerClass);
for (i = 0 ; i < menuLayerArr.length ; i++)
{
addListener(menuLayerArr[i],'mouseover',function()
{
clearTimeout(hideLayerTimeout);
});
addListener(menuLayerArr[i],'mouseout',function(e)
{
var evt = window.event || e;
elementType = 'layer';
hideLayerEvent(evt,elementType);
});
}
}function jsScrollbar (o, s, a, ev) {
var self = this;
this.reset = function () {
//Arguments that were passed
this._parent = o;
this._src = s;
this.auto = a ? a : false;
this.eventHandler = ev ? ev : function () {};
//Component Objects
this._up = this._findComponent("Scrollbar-Up", this._parent);
this._down = this._findComponent("Scrollbar-Down", this._parent);
this._yTrack = this._findComponent("Scrollbar-Track", this._parent);
this._yHandle = this._findComponent("Scrollbar-Handle", this._yTrack);
//Height and position properties
this._trackTop = findOffsetTop(this._yTrack);
this._trackHeight = this._yTrack.offsetHeight;
this._handleHeight = this._yHandle.offsetHeight;
this._x = 0;
this._y = 0;
//Misc. variables
this._scrollDist = 5;
this._scrollTimer = null;
this._selectFunc = null;
this._grabPoint = null;
this._tempTarget = null;
this._tempDistX = 0;
this._tempDistY = 0;
this._disabled = false;
this._ratio = (this._src.totalHeight - this._src.viewableHeight)/(this._trackHeight - this._handleHeight);
this._yHandle.ondragstart = function () {return false;};
this._yHandle.onmousedown = function () {return false;};
this._addEvent(this._src.content, "mousewheel", this._scrollbarWheel);
this._removeEvent(this._parent, "mousedown", this._scrollbarClick);
this._addEvent(this._parent, "mousedown", this._scrollbarClick);
this._src.reset();
with (this._yHandle.style) {
top = "0px";
left = "0px";
}
this._moveContent();
if (this._src.totalHeight < this._src.viewableHeight) {
this._disabled = true;
this._yHandle.style.visibility = "hidden";
if (this.auto) this._parent.style.visibility = "hidden";
} else {
this._disabled = false;
this._yHandle.style.visibility = "visible";
this._parent.style.visibility = "visible";
}
};
this._addEvent = function (o, t, f) {
if (o.addEventListener) o.addEventListener(t, f, false);
else if (o.attachEvent) o.attachEvent('on'+ t, f);
else o['on'+ t] = f;
};
this._removeEvent = function (o, t, f) {
if (o.removeEventListener) o.removeEventListener(t, f, false);
else if (o.detachEvent) o.detachEvent('on'+ t, f);
else o['on'+ t] = null;
};
this._findComponent = function (c, o) {
var kids = o.childNodes;
for (var i = 0; i < kids.length; i++) {
if (kids[i].className && kids[i].className == c) {
return kids[i];
}
}
};
//Thank you, Quirksmode
function findOffsetTop (o) {
var t = 0;
if (o.offsetParent) {
while (o.offsetParent) {
t += o.offsetTop;
o = o.offsetParent;
}
}
return t;
};
this._scrollbarClick = function (e) {
if (self._disabled) return false;
e = e ? e : event;
if (!e.target) e.target = e.srcElement;
if (e.target.className.indexOf("Scrollbar-Up") > -1) self._scrollUp(e);
else if (e.target.className.indexOf("Scrollbar-Down") > -1) self._scrollDown(e);
else if (e.target.className.indexOf("Scrollbar-Track") > -1) self._scrollTrack(e);
else if (e.target.className.indexOf("Scrollbar-Handle") > -1) self._scrollHandle(e);
self._tempTarget = e.target;
self._selectFunc = document.onselectstart;
document.onselectstart = function () {return false;};
self.eventHandler(e.target, "mousedown");
self._addEvent(document, "mouseup", self._stopScroll, false);
return false;
};
this._scrollbarDrag = function (e) {
e = e ? e : event;
var t = parseInt(self._yHandle.style.top);
var v = e.clientY + document.body.scrollTop - self._trackTop;
with (self._yHandle.style) {
if (v >= self._trackHeight - self._handleHeight + self._grabPoint)
top = self._trackHeight - self._handleHeight +"px";
else if (v <= self._grabPoint) top = "0px";
else top = v - self._grabPoint +"px";
self._y = parseInt(top);
}
self._moveContent();
};
this._scrollbarWheel = function (e) {
e = e ? e : event;
var dir = 0;
if (e.wheelDelta >= 120) dir = -1;
if (e.wheelDelta <= -120) dir = 1;
self.scrollBy(0, dir * 20);
e.returnValue = false;
};
this._startScroll = function (x, y) {
this._tempDistX = x;
this._tempDistY = y;
this._scrollTimer = window.setInterval(function () {
self.scrollBy(self._tempDistX, self._tempDistY);
}, 40);
};
this._stopScroll = function () {
self._removeEvent(document, "mousemove", self._scrollbarDrag, false);
self._removeEvent(document, "mouseup", self._stopScroll, false);
if (self._selectFunc) document.onselectstart = self._selectFunc;
else document.onselectstart = function () { return true; };
if (self._scrollTimer) window.clearInterval(self._scrollTimer);
self.eventHandler (self._tempTarget, "mouseup");
};
this._scrollUp = function (e) {this._startScroll(0, -this._scrollDist);};
this._scrollDown = function (e) {this._startScroll(0, this._scrollDist);};
this._scrollTrack = function (e) {
var curY = e.clientY + document.body.scrollTop;
this._scroll(0, curY - this._trackTop - this._handleHeight/2);
};
this._scrollHandle = function (e) {
var curY = e.clientY + document.body.scrollTop;
this._grabPoint = curY - findOffsetTop(this._yHandle);
this._addEvent(document, "mousemove", this._scrollbarDrag, false);
};
this._scroll = function (x, y) {
if (y > this._trackHeight - this._handleHeight)
y = this._trackHeight - this._handleHeight;
if (y < 0) y = 0;
this._yHandle.style.top = y +"px";
this._y = y;
this._moveContent();
};
this._moveContent = function () {
this._src.scrollTo(0, Math.round(this._y * this._ratio));
};
this.scrollBy = function (x, y) {
this._scroll(0, (-this._src._y + y)/this._ratio);
};
this.scrollTo = function (x, y) {
this._scroll(0, y/this._ratio);
};
this.swapContent = function (o, w, h) {
this._removeEvent(this._src.content, "mousewheel", this._scrollbarWheel, false);
this._src.swapContent(o, w, h);
this.reset();
};
this.reset();
};function jsScroller (o, w, h) {
var self = this;
var list = o.getElementsByTagName("div");
for (var i = 0; i < list.length; i++) {
if (list[i].className.indexOf("Scroller-Container") > -1) {
o = list[i];
}
}
//Private methods
this._setPos = function (x, y) {
if (x < this.viewableWidth - this.totalWidth)
x = this.viewableWidth - this.totalWidth;
if (x > 0) x = 0;
if (y < this.viewableHeight - this.totalHeight)
y = this.viewableHeight - this.totalHeight;
if (y > 0) y = 0;
this._x = x;
this._y = y;
with (o.style) {
left = this._x +"px";
top = this._y +"px";
}
};
//Public Methods
this.reset = function () {
this.content = o;
this.totalHeight = o.offsetHeight;
this.totalWidth = o.offsetWidth;
this._x = 0;
this._y = 0;
with (o.style) {
left = "0px";
top = "0px";
}
};
this.scrollBy = function (x, y) {
this._setPos(this._x + x, this._y + y);
};
this.scrollTo = function (x, y) {
this._setPos(-x, -y);
};
this.stopScroll = function () {
if (this.scrollTimer) window.clearInterval(this.scrollTimer);
};
this.startScroll = function (x, y) {
this.stopScroll();
this.scrollTimer = window.setInterval(
function(){ self.scrollBy(x, y); }, 40
);
};
this.swapContent = function (c, w, h) {
o = c;
var list = o.getElementsByTagName("div");
for (var i = 0; i < list.length; i++) {
if (list[i].className.indexOf("Scroller-Container") > -1) {
o = list[i];
}
}
if (w) this.viewableWidth = w;
if (h) this.viewableHeight = h;
this.reset();
};
//variables
this.content = o;
this.viewableWidth = w;
this.viewableHeight = h;
this.totalWidth = o.offsetWidth;
this.totalHeight = o.offsetHeight;
this.scrollTimer = null;
this.reset();
};