var domLib_userAgent = navigator.userAgent.toLowerCase(); var domLib_isMac = navigator.appVersion.indexOf('Mac') != -1; var domLib_isOpera = domLib_userAgent.indexOf('opera') != -1; var domLib_isOpera7 = (domLib_userAgent.indexOf('opera/7') != -1 || domLib_userAgent.indexOf('opera 7') != -1); var domLib_isSafari = domLib_userAgent.indexOf('safari') != -1; var domLib_isKonq = domLib_userAgent.indexOf('konqueror') != -1; var domLib_isKHTML = (domLib_isKonq || domLib_isSafari); var domLib_isIE = (!domLib_isKHTML && !domLib_isOpera && (domLib_userAgent.indexOf('msie 5') != -1 || domLib_userAgent.indexOf('msie 6') != -1)); var domLib_isIE5up = domLib_isIE; var domLib_isIE50 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.0') != -1); var domLib_isIE55 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.5') != -1); var domLib_isIE5 = (domLib_isIE50 || domLib_isIE55); var domLib_isGecko = domLib_userAgent.indexOf('gecko/') != -1; var domLib_isMacIE = (domLib_isIE && domLib_isMac); var domLib_isIE55up = domLib_isIE5up && !domLib_isIE50 && !domLib_isMacIE; var domLib_isIE6up = domLib_isIE55up && !domLib_isIE55; var domLib_standardsMode = (document.compatMode && document.compatMode == 'CSS1Compat'); var domLib_useLibrary = (domLib_isOpera7 || domLib_isKonq || domLib_isIE5up || domLib_isGecko); var domLib_hasBrokenTimeout = (domLib_isMacIE || (domLib_isKonq && domLib_userAgent.match(/konqueror\/3.([2-9])/) == null)); var domLib_canFade = (domLib_isGecko || domLib_isIE || domLib_isSafari); var domLib_canDrawOverSelect = (domLib_isGecko || domLib_isOpera || domLib_isMac); var domLib_eventTarget = domLib_isIE ? 'srcElement' : 'currentTarget'; var domLib_eventButton = domLib_isIE ? 'button' : 'which'; var domLib_eventTo = domLib_isIE ? 'toElement' : 'relatedTarget'; var domLib_stylePointer = domLib_isIE ? 'hand' : 'pointer'; var domLib_styleNoMaxWidth = domLib_isOpera ? '1000000px' : 'none'; var domLib_hidePosition = '-1000px'; var domLib_scrollbarWidth = 14; var domLib_autoId = 1; var domLib_zIndex = 100; var domLib_selectElements; var domLib_timeoutStateId = 0; var domLib_timeoutStates = new Hash(); var WebDDM_style_out = ''; var WebDDM_style_rollover = '_rollover'; var WebDDM_style_rolloverPressed = '_rollover_pressed'; var WebDDM_style_menuopenOut = '_menuopen'; var WebDDM_style_menuopenRollover = '_menuopen_rollover'; var WebDDM_style_menuopenPressed = '_menuopen_pressed'; var WebDDM_globalInitDone = false; var WebDDM_mousePosition = {x:0, y:0}; var WebDDMObjects = new Hash(); var thisObjs = new Hash(); var domTT_dragMouseDown = false; function Hash()
{ this.length = 0; this.numericLength = 0; this.elementData = []; if (arguments[0] && arguments[0].elementData) { this.length = arguments[0].length; this.numericLength = arguments[0].numericLength; this.elementData = arguments[0].elementData; return;}
if (typeof(arguments[0]) == 'object') { this.elementData = arguments[0]; return;}
for (var i = 0; i < arguments.length; i += 2)
{ if (typeof(arguments[i + 1]) != 'undefined')
{ this.elementData[arguments[i]] = arguments[i + 1]; this.length++; if (arguments[i] == parseInt(arguments[i]))
{ this.numericLength++;}
}
}
}
Hash.prototype.get = function(in_key)
{ return this.elementData[in_key];}
Hash.prototype.set = function(in_key, in_value)
{ if (typeof(in_value) != 'undefined')
{ if (typeof(this.elementData[in_key]) == 'undefined')
{ this.length++; if (parseInt(in_key) == in_key)
{ this.numericLength++;}
}
return this.elementData[in_key] = in_value;}
return false;}
Hash.prototype.remove = function(in_key)
{ var tmp_value; if (typeof(this.elementData[in_key]) != 'undefined')
{ this.length--; if (in_key == parseInt(in_key))
{ this.numericLength--;}
tmp_value = this.elementData[in_key]; delete this.elementData[in_key];}
return tmp_value;}
Hash.prototype.size = function()
{ return this.length;}
Hash.prototype.has = function(in_key)
{ return typeof(this.elementData[in_key]) != 'undefined';}
Hash.prototype.find = function(in_obj)
{ for (var tmp_key in this.elementData)
{ if (this.elementData[tmp_key] == in_obj)
{ return tmp_key;}
}
return null;}
Hash.prototype.merge = function(in_hash)
{ for (var tmp_key in in_hash.elementData)
{ if (typeof(this.elementData[tmp_key]) == 'undefined')
{ this.length++; if (tmp_key == parseInt(tmp_key))
{ this.numericLength++;}
}
this.elementData[tmp_key] = in_hash.elementData[tmp_key];}
}
Hash.prototype.compare = function(in_hash)
{ if (this.length != in_hash.length)
{ return false;}
for (var tmp_key in this.elementData)
{ if (this.elementData[tmp_key] != in_hash.elementData[tmp_key])
{ return false;}
}
return true;}
function Hashify (in_array)
{ if (typeof(in_array) == 'object') { for (var i in in_array) { if (typeof(in_array[i]) == 'object') { in_array[i] = Hashify(in_array[i]);}
}
in_array = new Hash(in_array); return in_array;}
return in_array;}
function WebDDM_formatUnit (unit)
{ var formatted; if (parseInt(unit) == unit) { formatted = unit + 'px';} else { formatted = unit;}
return formatted;}
function evalEscapeString (s, quoteType)
{ var quoteType = quoteType ? quoteType : '"'; return 'unescape('+quoteType+escape(s)+quoteType+')';}
function WebDDM_buildFunction (function1, function2)
{ var function_body = ''; var function_params = ''; if (function1 && (data = WebDDM_parseFunction(function1 + ''))) { function_body += data[1]; function_params += data[0];}
if (function2 && (data = WebDDM_parseFunction(function2 + ''))) { function_body += data[1]; function_params += (function_params && data[0] ? ',' : '') + data[0];}
var retFunc; (function(){ eval('retFunc = function ('+function_params+') {'+function_body+'};');})(); return retFunc;}
function WebDDM_parseFunction (parseFunction)
{ var data = ['','']; if (parseFunction.match(/\s*function\s*\(([^\)]*)\)\s*\{([^$]*)\}\s*/)) { data[0] = RegExp.$1; data[1] = RegExp.$2;} else { data[1] = parseFunction;}
return data;}
function WebDDM_mergeArrays (baseArray, mergeArray, override, provideIncrementalKeys)
{ for (var i in mergeArray) { if (parseInt(i) == i) { i = parseInt(i);}
if (typeof(baseArray[i]) == 'undefined' || override) { baseArray[i] = mergeArray[i];} else if (provideIncrementalKeys && typeof(i) == 'number') { baseArray[baseArray.length] = mergeArray[i];}
}
return baseArray;}
function domLib_setTimeout(in_function, in_timeout, in_args)
{ if (typeof(in_args) == 'undefined')
{ in_args = [];}
if (typeof(in_function) == 'string') { eval('var in_function = function () { '+in_function+' }');}
if (in_timeout <= 0)
{ in_function(in_args); return 0;}
var args = WebDDM_mergeArrays({}, in_args); if (!domLib_hasBrokenTimeout)
{ return setTimeout(function() { in_function(args);}, in_timeout);}
else
{ var id = domLib_timeoutStateId++; var data = new Hash(); data.set('function', in_function); data.set('args', args); domLib_timeoutStates.set(id, data); data.set('timeoutId', setTimeout('domLib_timeoutStates.get(' + id + ').get(\'function\')(domLib_timeoutStates.get(' + id + ').get(\'args\')); domLib_timeoutStates.remove(' + id + ');', in_timeout)); return id;}
}
function domLib_clearTimeout(in_id)
{ if (!domLib_hasBrokenTimeout)
{ clearTimeout(in_id);}
else
{ if (domLib_timeoutStates.has(in_id))
{ clearTimeout(domLib_timeoutStates.get(in_id).get('timeoutId'))
domLib_timeoutStates.remove(in_id);}
}
}
function domLib_getOffsets (in_object)
{ var originalObject = in_object; var originalWidth = in_object.offsetWidth; var originalHeight = in_object.offsetHeight; var offsetLeft = 0; var offsetTop = 0; while (in_object)
{ offsetLeft += in_object.offsetLeft; offsetTop += in_object.offsetTop; in_object = in_object.offsetParent;}
if (domLib_isMacIE) { offsetLeft += 10; offsetTop += 10;}
return new Hash( 'left', offsetLeft, 'top', offsetTop, 'right', offsetLeft + originalWidth, 'bottom', offsetTop + originalHeight, 'leftCenter', offsetLeft + originalWidth/2, 'topCenter', offsetTop + originalHeight/2, 'radius', Math.max(originalWidth, originalHeight) );}
function domLib_isDescendantOf(in_object, in_ancestor)
{ if (in_object == in_ancestor)
{ return true;}
while (in_object != document.documentElement)
{ try
{ if ((tmp_object = in_object.offsetParent) && tmp_object == in_ancestor)
{ return true;}
else if ((tmp_object = in_object.parentNode) == in_ancestor)
{ return true;}
else
{ in_object = tmp_object;}
}
catch(e)
{ return true;}
}
return false;}
function domLib_getEventPosition(in_eventObj)
{ var eventPosition = new Hash('x', 0, 'y', 0); if (domLib_isKonq)
{ eventPosition.set('x', in_eventObj.x); eventPosition.set('y', in_eventObj.y);}
else if (domLib_isIE)
{ if (domLib_standardsMode)
{ eventPosition.set('x', in_eventObj.clientX + document.documentElement.scrollLeft); eventPosition.set('y', in_eventObj.clientY + document.documentElement.scrollTop);}
else if (document.body)
{ eventPosition.set('x', in_eventObj.clientX + document.body.scrollLeft); eventPosition.set('y', in_eventObj.clientY + document.body.scrollTop);}
}
else
{ eventPosition.set('x', in_eventObj.pageX); eventPosition.set('y', in_eventObj.pageY);}
return eventPosition;}
function domLib_detectCollisions(in_object, in_recover)
{ if (domLib_canDrawOverSelect)
{ return;}
if (typeof(domLib_selectElements) == 'undefined')
{ domLib_selectElements = document.getElementsByTagName('select'); domLib_selectElements = WebDDM_mergeArrays(domLib_selectElements, document.getElementsByTagName('applet'), false, true); domLib_selectElements = WebDDM_mergeArrays(domLib_selectElements, document.getElementsByTagName('object'), false, true);}
if (in_recover)
{ for (var cnt = 0; cnt < domLib_selectElements.length; cnt++)
{ var thisSelect = domLib_selectElements[cnt]; if (!thisSelect.hideList)
{ thisSelect.hideList = new Hash();}
thisSelect.hideList.remove(in_object.id); if (!thisSelect.hideList.length)
{ domLib_selectElements[cnt].style.visibility = 'visible'; if (domLib_isKonq) { domLib_selectElements[cnt].style.display = '';}
}
}
return;}
var objectOffsets = domLib_getOffsets(in_object); for (var cnt = 0; cnt < domLib_selectElements.length; cnt++)
{ var thisSelect = domLib_selectElements[cnt]; if (domLib_isDescendantOf(thisSelect, in_object))
{ continue;}
if (!thisSelect.hideList)
{ thisSelect.hideList = new Hash();}
var selectOffsets = domLib_getOffsets(thisSelect); var center2centerDistance = Math.sqrt(Math.pow(selectOffsets.get('leftCenter') - objectOffsets.get('leftCenter'), 2) + Math.pow(selectOffsets.get('topCenter') - objectOffsets.get('topCenter'), 2)); var radiusSum = selectOffsets.get('radius') + objectOffsets.get('radius'); if (center2centerDistance < radiusSum)
{ if ((objectOffsets.get('leftCenter') <= selectOffsets.get('leftCenter') && objectOffsets.get('right') < selectOffsets.get('left')) || (objectOffsets.get('leftCenter') > selectOffsets.get('leftCenter') && objectOffsets.get('left') > selectOffsets.get('right')) || (objectOffsets.get('topCenter') <= selectOffsets.get('topCenter') && objectOffsets.get('bottom') < selectOffsets.get('top')) || (objectOffsets.get('topCenter') > selectOffsets.get('topCenter') && objectOffsets.get('top') > selectOffsets.get('bottom')))
{ thisSelect.hideList.remove(in_object.id); if (!thisSelect.hideList.length)
{ thisSelect.style.visibility = 'visible'; if (domLib_isKonq) { thisSelect.style.display = '';}
}
}
else
{ thisSelect.hideList.set(in_object.id, true); thisSelect.style.visibility = 'hidden'; if (domLib_isKonq) { thisSelect.style.display = 'none';}
}
}
}
}
function WebDDM_getElement (elementId)
{ return document.all
? document.all[elementId]
: document.getElementById(elementId);}
function interCap (str)
{ while (str.match(/\-(.)/)) { var c = RegExp.$1; str = str.replace('-'+c, c.toUpperCase());}
return str;}
function parseCssString (cssString)
{ var css = {}; var chunks = cssString.split(/\s*\;\s*/); for (var k in chunks)
{ var v = chunks[k]; if (v.match(/^\s*([a-zA-Z0-9\-]*)\s*\:(.*?)$/)) { css[RegExp.$1] = RegExp.$2;}
}
return css;}
function domLib_cancelBubble(in_event)
{ var eventObj = in_event ? in_event : window.event; eventObj.cancelBubble = true;}
function WebDDM (containerId, menuData)
{ WebDDMObjects.set(containerId, this); var container = WebDDM_getElement(containerId); if (!container) { container = document.createElement('div'); container.id = containerId; document.body.appendChild(container);}
this.containerId = containerId; this.menuData = Hashify(menuData); this.openMenuData = new Hash(); this.hashEvalPathCache = new Hash(); this.zIndex = (this.menuData.has('zIndex') ? this.menuData.get('zIndex') : 200); this.lastMouseoverElement = ''; this.mouseoverStatuses = new Hash(); this.menuOpenStatuses = new Hash(); this.cleanMenusLoopTimeout = false; this.hideAllTimeout = false; this.cleanMenuTimeout = false; this.cleanMenuId = false; this.alphaAPIObjects = new Hash(); this.clipperObjects = new Hash(); container.innerHTML = '<div style="visibility: visible;" id="WebDDM_loading_' + container.id + '">A WebDDM menu is loading; please wait!</div>'; var styles = ['position', 'top', 'left', 'width', 'height']; for (var i = 0; styles[i]; i++) { var style = styles[i]; var value = this.menuData.get(style); if (i != 'position') { container.style[style] = WebDDM_formatUnit(value);} else { container.style[style] = value;}
}
container.style.backgroundColor = 'transparent'; container.style.visibility = container.style.overflow = 'visible'; container.style.zIndex = this.zIndex++; if (this.menuData.get('float')) { this.floatHandler = new FloatAPI(container.id, this.menuData.get('top'), this.menuData.get('left'), this.menuData.get('floatSpeed'), true);}
else if (this.menuData.get('expand_menu').match(/context\(([a-zA-Z\-]*)\,([a-zA-Z0-9\-\_]*)\)/)) { var expandType = RegExp.$1; var contextObjectId = RegExp.$2; var contextObject; if (contextObjectId == 'document') { contextObject = document;} else { contextObject = WebDDM_getElement(contextObjectId);}
var contextEvent; if (expandType == 'left-click') { contextEvent = 'onclick';} else if (expandType == 'right-click') { contextEvent = 'oncontextmenu';} else { contextEvent = 'onmouseover';}
var evalCode = 'var contextFunctionCode = function (in_event) {' + 'eval("var obj = getWebDDMObject(\\"' + this.containerId + '\\");");' + 'obj.showMenu(obj.menuData, "");' + 'obj.setMenuAtCursor();' + 'return false;' + '}'; eval(evalCode); contextObject[contextEvent] = WebDDM_buildFunction(contextFunctionCode, contextObject[contextEvent]); this.menuData.set('position', 'absolute'); container.style.position = 'absolute';}
if (!WebDDM_globalInitDone) { var mousemoveCode = function (in_event) { var in_event = in_event ? in_event : window.event; var eventPos = domLib_getEventPosition(in_event); WebDDM_mousePosition.x = eventPos.get('x'); WebDDM_mousePosition.y = eventPos.get('y'); if (domTT_dragMouseDown) { domTT_dragUpdate(in_event);}
}; var hideCode = function () { WebDDM_hideAllMenus();}; (function(){ document.onclick = WebDDM_buildFunction(document.onclick, hideCode); document.onblur = WebDDM_buildFunction(document.onblur, hideCode); document.onmousemove = WebDDM_buildFunction(document.onmousemove, mousemoveCode);})(); WebDDM_globalInitDone = true;}
if (this.menuData.get('expand_menu').match('auto')) { this.showMenu(this.menuData, "");}
WebDDM_getElement('WebDDM_loading_' + container.id).style.visiblity = 'hidden'; WebDDM_getElement('WebDDM_loading_' + container.id).innerHTML = ''; return this;}
WebDDM.prototype.setMenuAtCursor = function ()
{ var topPos = WebDDM_mousePosition.y + parseInt(this.menuData.get('top')); var leftPos = WebDDM_mousePosition.x + parseInt(this.menuData.get('left')); WebDDM_getElement(this.containerId).style.top = topPos + 'px'; WebDDM_getElement(this.containerId).style.left = leftPos + 'px';}
WebDDM.prototype.buildMenu = function (parentItemHash)
{ var itemId = parentItemHash.get('itemId') || this.containerId; var HTML = ''; var actionsArray = []; var zIndex = parentItemHash.zIndex || this.zIndex++; zIndex++; var originalZIndex = zIndex; for (var itemIndex = 1; parentItemHash.get('items').has(itemIndex); itemIndex++) { var thisItemId = itemId + '_' + itemIndex; var itemHash = parentItemHash.get('items').get(itemIndex); itemHash.set('itemId', thisItemId); if (!itemHash.has('zIndex')) { itemHash.set('zIndex', zIndex++);}
var getWebDDMObjectVarCode = 'var WebDDM_obj = getWebDDMObject("'+this.containerId+'");'; var actions = { 'mouseover': getWebDDMObjectVarCode, 'mouseout': getWebDDMObjectVarCode, 'click': getWebDDMObjectVarCode, 'mouseup': getWebDDMObjectVarCode, 'mousemove': getWebDDMObjectVarCode, 'mousedown': getWebDDMObjectVarCode, 'selectstart': (domLib_isIE ? 'return false;' : '')
}; itemHash.set('expand_menu', (itemHash.has('expand_menu') ? itemHash.get('expand_menu') : 'rollover')); itemHash.set('contract_menu', (itemHash.has('contract_menu') ? itemHash.get('contract_menu') : 'rollout')); actions.mouseover += 'WebDDM_obj.mouseAction(in_event, "mouseover", "'+thisItemId+'");'; actions.mouseout += 'WebDDM_obj.mouseAction(in_event, "mouseout", "'+thisItemId+'");'; actions.mousemove += 'WebDDM_obj.mouseAction(in_event, "mousemove", "'+thisItemId+'");'; actions.mouseup += 'WebDDM_obj.mouseAction(in_event, "mouseup", "'+thisItemId+'");'; actions.mousedown += 'WebDDM_obj.mouseAction(in_event, "mousedown", "'+thisItemId+'");'; actions.click += 'WebDDM_obj.mouseAction(in_event, "click", "'+thisItemId+'");'; var css = itemHash.has('css') ? itemHash.get('css') + ';' : ''; var filter = itemHash.has('filter') && domLib_isIE
? 'filter: ' + itemHash.get('filter') + ';'
: ''; var cursor = (itemHash.has('cursor')
? (itemHash.get('cursor').match(/hand|pointer/)
? domLib_stylePointer
: itemHash.get('cursor'))
: 'default'); css += 'cursor: ' + cursor + ';'; var itemClass = (itemHash.get('class')
? 'class="' + itemHash.get('class') + '"'
: ''); HTML += '<div id="' + thisItemId + '_item_container" ' + 'style="visibility:inherit;position:absolute;' + 'top: ' + WebDDM_formatUnit(itemHash.get('top')) + ';' + 'left: ' + WebDDM_formatUnit(itemHash.get('left')) + ';' + 'margin: 0px; z-index: ' + itemHash.get('zIndex') + ';' + 'width: ' + WebDDM_formatUnit(itemHash.get('width')) + ';' + 'height: ' + WebDDM_formatUnit(itemHash.get('height')) + ';' + filter + ';">' + '<table style="width:100%;height:100%;background-color:transparent;"' + ' cellpadding="0" cellspacing="0"><tbody><tr>' + '<td id="' + thisItemId + '_item" ' + itemClass + ' ' + 'style="' + css + '">' + itemHash.get('content') + '</td>' + '</tr></tbody></table>' + '</div>'; actionsArray[itemIndex] = actions;}
var itemsHash = parentItemHash.get('items'); var itemsContainer = WebDDM_getElement(this.containerId).
appendChild(document.createElement('div')); itemsContainer.id = itemId + '_subitems'; itemsContainer.innerHTML = HTML; itemsContainer.style.position = 'absolute'; itemsContainer.style.top = WebDDM_formatUnit(itemsHash.get('top') + (parentItemHash.get('parentId')
? this.getItemHash(parentItemHash.get('parentId')).get('items').get('top')
: 0)); itemsContainer.style.left = WebDDM_formatUnit(itemsHash.get('left') + (parentItemHash.get('parentId')
? this.getItemHash(parentItemHash.get('parentId')).get('items').get('left')
: 0)); itemsContainer.style.height = WebDDM_formatUnit(itemsHash.get('height')); itemsContainer.style.width = WebDDM_formatUnit(itemsHash.get('width')); itemsContainer.style.visibility = itemsContainer.style.overflow = 'hidden'; itemsContainer.style.zIndex = originalZIndex; itemsContainer.style.borderStyle = 'none'; eval('var onmousemoveCode = function () {' + 'getWebDDMObject("'+this.containerId+'").' + 'setMouseoverStatus("'+itemId+'subitems", true, true);' + '};'); eval('var onmouseoutCode = function () {' + 'getWebDDMObject("'+this.containerId+'").' + 'setMouseoverStatus("'+itemId+'subitems", false, true);' + '};'); (function(){ itemsContainer.onmousemove = onmousemoveCode; itemsContainer.onmouseout = onmouseoutCode;})(); if (domLib_isIE) { itemsContainer.style.backgroundImage = 'url(-)'; if (itemsHash.has('filter')) { itemsContainer.style.filter = itemsHash.get('filter');}
}
for (var i in actionsArray) { var itemObject = WebDDM_getElement(itemId + '_' + i + '_item_container'); for (actionName in actionsArray[i]) { eval('var eventAction = function(in_event)' + '{' + 'in_event = typeof(in_event) != "undefined" ? in_event : window.event; ' + actionsArray[i][actionName] + '};'); (function(){ itemObject['on' + actionName] = eventAction;})();}
}
}; WebDDM.prototype.setMouseoverStatus = function (elementId, status, doNotSetAsLast)
{ if (typeof(doNotSetAsLast) == 'undefined') { doNotSetAsLast = false;}
if (!doNotSetAsLast)
{ if (this.lastMouseoverElement && this.lastMouseoverElement != elementId)
{ this.mouseoverStatuses.set(this.lastMouseoverElement, false); this.mouseAction(0, 'mouseout', this.lastMouseoverElement);}
this.lastMouseoverElement = elementId;}
this.mouseoverStatuses.set(elementId, status);}; WebDDM.prototype.getMouseoverStatus = function (elementId)
{ return this.mouseoverStatuses.get(elementId)
? true
: false;}; WebDDM.prototype.canHideMenu = function (itemHash)
{ if (!itemHash || (itemHash && !itemHash.has('itemId'))) { return true;}
var itemId = itemHash.get('itemId'); var contractMenu = itemHash.has('contract_menu') ? itemHash.get('contract_menu') : false; if (!contractMenu) { if (itemId == this.containerId || !itemId) { return false;} else { return true;}
}
if (contractMenu && (!contractMenu.match(/rollout/) || contractMenu.match(/none/))) { return false;}
if (this.getMouseoverStatus(itemId)) { return false;}
if (this.getMouseoverStatus(itemId + 'subitems')) { return false;}
if (itemHash.has('items')) { for (var i in itemHash.get('items').elementData) { if (parseInt(i) != i) { continue;}
if (!this.canHideMenu(itemHash.get('items').get(i))) { return false;}
}
}
return true;}; WebDDM.prototype.initializeItemAttributes = function (itemHash, itemId)
{ var bareItemId = itemId.replace(this.containerId + '_', ''); itemHash.set('menuLevel', (bareItemId
? bareItemId.split('_').length
: 0)); itemHash.set('parentId', (itemId.match(/^(.*?)\_([0-9]+)$/)
? RegExp.$1
: '')); itemHash.set('itemId', itemId);}; WebDDM.prototype.getItemHash = function (itemId)
{ var itemId = (this.containerId == itemId ? '' : itemId); var bareItemId = itemId.replace(this.containerId + '_', ''); if (!this.hashEvalPathCache.has(bareItemId)) { var evalCode = 'var itemHash = this.menuData'; if (itemId != '') { var chunks = bareItemId.split('_'); for (var i = 0; i < chunks.length; i++) { evalCode += '.get("items").get('+chunks[i]+')';}
}
evalCode += ';'; this.hashEvalPathCache.set(bareItemId, evalCode);}
eval(this.hashEvalPathCache.get(bareItemId)); return itemHash;}; WebDDM.prototype.menuIsOpen = function (itemId)
{ return (this.menuOpenStatuses.get(itemId)
? true
: false);}; WebDDM.prototype.hideMenusOnLevel = function (itemHash)
{ var menuLevel = itemHash.get('menuLevel'); var itemId = itemHash.get('itemId'); if (itemHash.get('menuLevel') > 0) { for (var tmp_key = (this.openMenuData.size()-1); tmp_key >= 0; tmp_key--) { var tmp_itemHash = this.openMenuData.get(tmp_key); var tmp_menuLevel = tmp_itemHash.get('menuLevel'); var tmp_itemId = tmp_itemHash.get('itemId'); if (tmp_menuLevel >= menuLevel && !tmp_itemId.match(itemId)) { this.hideMenu(tmp_itemHash);}
}
}
}; WebDDM.prototype.showMenu = function (itemHash, itemId)
{ if (!itemHash.has('parentId')) { this.initializeItemAttributes(itemHash, itemId);}
this.hideMenusOnLevel(itemHash); if (!itemHash.has('items')) { return;}
this.menuOpenStatuses.set(itemId, true); var thisMenuOpen = false; var thisArrayId = this.openMenuData.find(itemHash) || -1; if (thisArrayId != -1) { thisMenuOpen = true;}
var itemOrContainerId = itemId || this.containerId; if (!WebDDM_getElement(itemOrContainerId + '_subitems')) { this.buildMenu(itemHash);}
if (thisMenuOpen == false) { thisArrayId = this.openMenuData.size(); if (itemId) { this.setItemStyle(itemHash, WebDDM_style_menuopenOut);} else if (itemHash.get('contract_menu') &&
itemHash.get('contract_menu').match('rollout'))
{ this.setMouseoverStatus(this.containerId + '_1', true);}
}
this.openMenuData.set(thisArrayId, itemHash); this.setVisibility(itemHash.get('items'), itemOrContainerId + '_subitems', true); for (var i = 1; itemHash.get('items').has(i); i++) { var expandMenu = itemHash.get('items').get(i).get('expand_menu'); if (expandMenu && expandMenu.match('auto')) { var subItemId = itemHash.get('items').get(i).get('itemId'); this.showMenu(itemHash.get('items').get(i), subItemId); var contractMenu = itemHash.get('items').get(i).get('contract_menu'); if (contractMenu && contractMenu.match('rollout')) { this.setMouseoverStatus(subItemId, true);}
}
}
this.cleanMenusLoop();}; WebDDM.prototype.checkClickMenu = function (itemId)
{ var itemHash = this.getItemHash(itemId); var bareItemId = itemId.replace(this.containerId + '_', ''); if (!itemHash.has('menuLevel')) { itemHash.set('menuLevel', (bareItemId
? bareItemId.split('_').length
: 0));}
if (itemHash.get('menuLevel') > 0) { for (var i = (this.openMenuData.size() - 1); i > 0; i--) { var data = this.openMenuData.get(i); if (data && data.get('menuLevel') == itemHash.get('menuLevel') &&
data.get('itemId') != itemId)
{ if (data.get('expand_menu').match('click')) { if (data.get('contract_menu').match('click')) { this.showMenu(itemHash, itemId); break;} else if (data.get('contract_menu').match('rollout')) { this.hideMenusOnLevel(itemHash);}
}
}
}
}
}; WebDDM.prototype.cleanMenusLoop = function ()
{ domLib_clearTimeout(this.cleanMenusLoopTimeout); var data = this.openMenuData.get(0); if (data && data.has('contract_menu') && data.get('contract_menu').match(/rollout/)) { var firstId = 0;} else { var firstId = 1;}
this.cleanMenusLoopTimeout = domLib_setTimeout('getWebDDMObject("' + this.containerId + '").cleanMenusLoop();', ((this.openMenuData.size()-1) >= firstId) ? 10 : 1000); this.cleanMenus(firstId);}; WebDDM.prototype.cleanMenus = function (firstId)
{ this.cleanMenuId = (this.openMenuData.size() - 1); var data = this.openMenuData.get(this.cleanMenuId); if (data && !this.cleanMenuTimeout && this.canHideMenu(data)) { this.cleanMenuTimeout = domLib_setTimeout('var obj = getWebDDMObject("' + this.containerId + '");' + 'obj.cleanMenuTimeout = false;' + 'var data = obj.openMenuData.get(obj.cleanMenuId);' + 'if (data && obj.canHideMenu(data)) {' + 'obj.hideMenu(data);' + '}', data.has('closeDelay') ? data.get('closeDelay') : 1);}
var firstEl = this.openMenuData.get(firstId); if (firstEl && this.canHideMenu(firstEl)) { if (this.hideAllTimeout == false) { this.hideAllTimeout = domLib_setTimeout('var obj = getWebDDMObject("' + this.containerId + '");' + 'obj.hideAllTimeout = false;' + 'var firstEl = obj.openMenuData.get(' + firstId + ');' + 'if (firstEl && obj.canHideMenu(firstEl)) {' + 'obj.hideAllSubmenus(' + firstId + ');' + '}', data.has('closeDelay') ? data.get('closeDelay') : 100);}
} else { domLib_clearTimeout(this.hideAllTimeout); this.hideAllTimeout = false;}
}; WebDDM.prototype.hideMenu = function (itemHash, setMouseoverStatus)
{ if (!itemHash) { return;}
if (typeof(setMouseoverStatus) == 'undefined') { setMouseoverStatus = true;}
if (itemHash != this.openMenuData.get(this.openMenuData.size() - 1)) { return;}
var itemId = itemHash.get('itemId'); if (setMouseoverStatus) { this.setMouseoverStatus(itemId, false);}
if (itemHash.get('itemId')) { this.setItemStyle(itemHash, (this.getMouseoverStatus(itemHash.get('itemId'))
? WebDDM_style_rollover
: WebDDM_style_out));}
this.setVisibility(itemHash.get('items'), (itemHash.get('itemId') || this.containerId) + '_subitems', false); this.openMenuData.remove(this.openMenuData.size() - 1); this.menuOpenStatuses.set(itemHash.get('itemId'), false);}; WebDDM.prototype.hideAllSubmenus = function (firstId)
{ if (typeof(firstId) == 'undefined') { var data = this.openMenuData.get(0); if (data && data.has('contract_menu') && data.get('contract_menu').match(/rollout/)) { var firstId = 0;} else { var firstId = 1;}
}
if (!this.openMenuData.has(firstId)) { return;}
for (var i = (this.openMenuData.size() - 1); i >= firstId; i--) { this.setMouseoverStatus(this.openMenuData.get(i).get('itemId'), false); this.hideMenu(this.openMenuData.get(i));}
}; WebDDM.prototype.setItemStyle = function (itemHash, new_style, forceStyle)
{ new_style.match(/^([\_a-zA-Z]*)\_([a-zA-Z]*)$/); var fallback_style = RegExp.$1; var element = WebDDM_getElement(itemHash.get('itemId') + '_item'); var style = itemHash.has('class' + new_style) ? new_style : fallback_style; if (itemHash.has('class' + style) && !(itemHash.get('currentStyleClass') == style && !forceStyle)) { element.className = itemHash.get('class' + style); itemHash.set('currentStyleClass', style);}
var style = itemHash.has('css' + new_style) ? new_style : fallback_style; if (itemHash.has('css' + style) && !(itemHash.get('currentStyleCSS') == style && !forceStyle)) { var css = parseCssString(itemHash.get('css' + style)); for (var k in css) { try { element.style[interCap(k)] = css[k];} catch (e) { }
}
itemHash.set('currentStyleCSS', style);}
var style = itemHash.has('content' + new_style) ? new_style : fallback_style; if (itemHash.has('content' + style) && !(itemHash.get('currentStyleContent') == style && !forceStyle)) { element.innerHTML = itemHash.get('content' + style); itemHash.set('currentStyleContent', style);}
}; WebDDM.prototype.setVisibility = function (itemsData, itemsId, visibility)
{ if (visibility) { domLib_detectCollisions(WebDDM_getElement(itemsId), false);}
var transitionsUsed = false; if (itemsData.has('alphaTrans') && domLib_canFade) { this.alphaTrans(itemsData.get('alphaTrans'), itemsId, visibility); transitionsUsed = true;}
if (itemsData.has('clipTrans')) { this.clipTrans(itemsData.get('clipTrans'), itemsId, visibility); transitionsUsed = true;}
var element = WebDDM_getElement(itemsId); if (!transitionsUsed) { element.style.visibility = visibility
? 'visible'
: 'hidden'; this.transitionCompleted(element, visibility);} else if (visibility) { element.style.visibility = 'visible';}
}; WebDDM.prototype.alphaTrans = function (transitionData, itemsId, visibility)
{ var fader; if (this.alphaAPIObjects.has(itemsId)) { fader = this.alphaAPIObjects.get(itemsId); fader.pause();} else { fader = new alphaAPI(WebDDM_getElement(itemsId), this); this.alphaAPIObjects.set(itemsId, fader); fader.setAlpha(0);}
if (!transitionData.has('maxOpacity')) { transitionData.set('maxOpacity', 100);}
if (!domLib_canFade || (transitionData.get('direction') == 'in' && !visibility) || (transitionData.get('direction') == 'out' && visibility))
{ fader.setAlpha(visibility ? transitionData.get('maxOpacity') : 0); WebDDM_getElement(itemsId).style.visibility = visibility
? 'visible'
: 'hidden';}
if (transitionData.has('delay')) { transitionData.set('inDelay', transitionData.get('delay')); transitionData.set('outDelay', transitionData.get('delay'));}
fader.fadeInDelay = transitionData.get('inDelay'); fader.fadeOutDelay = transitionData.get('outDelay'); fader.offsetTime = 0; fader.deltaAlpha = transitionData.get('delta'); var currentAlpha = fader.getAlpha(); if (visibility) { fader.startAlpha = transitionData.get('maxOpacity'); fader.fadeIn();} else { fader.stopAlpha = 0; fader.fadeOut();}
}; WebDDM.prototype.clipTrans = function (transitionData, itemsId, visibility)
{ var clipper; if (!this.clipperObjects.has(itemsId)) { clipper = new clipAPI(itemsId, this); this.clipperObjects.set(itemsId, clipper);} else { clipper = this.clipperObjects.get(itemsId);}
clipper.duration = transitionData.get('duration'); clipper.frames = transitionData.get('frames'); if (visibility) { var transition; if (transitionData.has('transitionIn')) { transition = transitionData.get('transitionIn');} else if (transitionData.has('transition')) { transition = transitionData.get('transition');} else { transition = 'none';}
clipper.transition = transition; clipper.setDirection('in');} else { var transition; if (transitionData.has('transitionOut')) { transition = transitionData.get('transitionOut');} else if (transitionData.has('transition')) { transition = transitionData.get('transition');} else { transition = 'none';}
clipper.transition = transition; clipper.setDirection('out');}
clipper.start();}; WebDDM.prototype.transitionCompleted = function (domObj, visibilityStatus)
{ if (!visibilityStatus) { domObj.style.visibility = 'hidden'; domLib_detectCollisions(WebDDM_getElement(domObj.id), true);} else { domLib_detectCollisions(WebDDM_getElement(domObj.id), false);}
}; WebDDM.prototype.reloadItem = function (itemHash)
{ if (!itemHash || !itemHash.has('itemId')) { return;}
this.setItemStyle(itemHash, itemHash.get('currentStyle') || '', true);}; WebDDM.prototype.modifyMenuData = function (hashPath, newValue)
{ var evalHashPath = 'this.menuData'; var itemHashPath = 'this.menuData'; var attributeName = ''; var chunks = hashPath.split('-'); for (var i = 0; i < chunks.length; i++) { var chunk = chunks[i]; if (typeof(chunks[i+1]) == 'undefined') { attributeName = chunk;} else { evalHashPath += '.get("'+chunk+'")'; if (chunk == 'items' || !isNaN(chunk)) { itemHashPath += '.get("'+chunk+'")';}
}
}
eval('var attributeHash = ' + evalHashPath); eval('var itemHash = ' + itemHashPath); attributeHash.set(attributeName, newValue); this.reloadItem(itemHash);}; WebDDM.prototype.getMenuData = function (hashPath)
{ var evalAttributePath = 'this.menuData'; var attributeName = ''; var chunks = hashPath.split('-'); for (var i in chunks) { evalAttributePath += '.get("'+chunks[i]+'")';}
eval('var attribute = ' + evalAttributePath); return attribute;}; WebDDM.prototype.mouseAction = function (in_event, action, itemId)
{ var in_event = (in_event
? in_event
: (in_event == 0
? false
: (window.event
? window.event
: false))); var itemHash = this.getItemHash(itemId); if (!itemHash) { return;}
if (in_event) { domLib_cancelBubble(in_event);}
switch (action) { default:
break; case 'mouseover':
if (this.mouseoutTimeout == itemId && !this.getMouseoverStatus(itemId)) { this.setMouseoverStatus(itemId, true); return;}
if (itemHash.has('items')) { if (itemHash.get('expand_menu').match('click')) { this.checkClickMenu(itemId);}
if (itemHash.get('expand_menu').match('rollover')) { var instance = this; domLib_setTimeout (function () { instance.showMenu(itemHash, itemId);}, itemHash.has('openDelay') ? itemHash.get('openDelay') : 0);}
} else if (!itemHash.has('isContainerItem')) { this.showMenu(itemHash, itemId);}
if (itemHash.has('tooltip')) { var ttcode = ''; for (var key in itemHash.get('tooltip').elementData) { var value = itemHash.get('tooltip').get(key); value = (typeof(value) == 'string'
? evalEscapeString(value)
: value); ttcode += ', "' + key + '", ' + value;}
eval('domTT_activate(WebDDM_getElement("'+itemId+'_item_container"), in_event' + ttcode + ');');}
if (this.menuIsOpen(itemId)) { this.setItemStyle(itemHash, WebDDM_style_menuopenRollover);} else { this.setItemStyle(itemHash, WebDDM_style_rollover);}
if (itemId != this.containerId && itemHash.get('parentId')) { this.showMenu(this.getItemHash(itemHash.get('parentId')), itemHash.get('parentId'));}
this.setMouseoverStatus(itemId, true); break; case 'click':
if (itemHash.has('items')) { if (itemHash.get('expand_menu').match('click')) { if (this.menuIsOpen(itemId) && itemHash.get('contract_menu').match('click')) { this.hideMenu(itemHash, false);} else { domLib_setTimeout (function (args) { args[0].showMenu(itemHash, itemId);}, itemHash.has('openDelay') ? itemHash.get('openDelay') : 0, [this]);}
} else if (itemHash.get('contract_menu').match('click')) { this.hideMenu(itemHash, false);}
}
case 'mouseup':
if (itemHash.has('url')) { eval('window.open(' + evalEscapeString( itemHash.get('url').replace(/^javascript\:/, 'javascript:void ')) + ', "' + (itemHash.has('target') ? itemHash.get('target') : '_self') + '"' + ')');}
if (this.menuIsOpen(itemId)) { this.setItemStyle(itemHash, WebDDM_style_menuopenRollover);} else { this.setItemStyle(itemHash, WebDDM_style_rollover);}
if (window.getSelection) { window.getSelection().removeAllRanges();}
break; case 'mousemove':
if (window.getSelection) { window.getSelection().removeAllRanges();}
if (itemHash.has('tooltip')) { domTT_mousemove(WebDDM_getElement(itemId + '_item_container'), in_event);}
break; case 'mouseout':
this.setMouseoverStatus(itemId, false); if (in_event) { var instance = this; this.mouseoutTimeout = itemId; domLib_setTimeout(function () { instance.mouseoutTimeout = false; if (!instance.getMouseoverStatus(itemId)) { if (instance.menuIsOpen(itemId)) { instance.setItemStyle(itemHash, WebDDM_style_menuopenOut);} else { instance.setItemStyle(itemHash, WebDDM_style_out);}
if (itemHash.has('tooltip')) { domTT_mouseout(WebDDM_getElement(itemId + '_item_container'), in_event);}
if (itemHash.has('actions')) { if (itemHash.get('actions').has(action)) { eval(itemHash.get('actions').get(action));} else if (itemHash.get('actions').has('on' + action)) { eval(itemHash.get('actions').get('on' + action));}
}
}
}, 10);} else { this.mouseoutTimeout = false; if (this.menuIsOpen(itemId)) { this.setItemStyle(itemHash, WebDDM_style_menuopenOut);} else { this.setItemStyle(itemHash, WebDDM_style_out);}
if (itemHash.has('tooltip')) { domTT_mouseout(WebDDM_getElement(itemId + '_item_container'), in_event);}
if (itemHash.has('actions')) { if (itemHash.get('actions').has(action)) { eval(itemHash.get('actions').get(action));} else if (itemHash.get('actions').has('on' + action)) { eval(itemHash.get('actions').get('on' + action));}
}
}
break; case 'mousedown':
if (action.match(/mousedown/)) { if (this.menuIsOpen(itemId)) { this.setItemStyle(itemHash, WebDDM_style_menuopenPressed);} else { this.setItemStyle(itemHash, WebDDM_style_rolloverPressed);}
}
break;}
if (itemHash.has('actions') && !action.match('mouseout')) { if (itemHash.get('actions').has(action)) { eval(itemHash.get('actions').get(action));} else if (itemHash.get('actions').has('on' + action)) { eval(itemHash.get('actions').get('on' + action));}
}
}; function getWebDDMObject (containerId)
{ return WebDDMObjects.has(containerId)
? WebDDMObjects.get(containerId)
: false;}
function WebDDM_hideAllMenus ()
{ for (var i in WebDDMObjects.elementData)
{ getWebDDMObject(i).hideAllSubmenus();}
}
function WebDDM_preloadImages ()
{ var imgs = []; for (var i = 0; i < arguments.length; i++) { imgs[i] = document.createElement('img'); imgs[i].src = arguments[i];}
}
function FloatAPI (domId, offsetX, offsetY, floatSpeed, checkScrolling)
{ this.domId = domId; this.offsetX = offsetX; this.offsetY = offsetY; this.speed = floatSpeed; this.timeoutId = 'FloatAPI' + Math.random() + this.domId; this.scrollCheckDelay = 100; this.lastPageXOffset = false; this.lastPageYOffset = false; thisObjs.set(this.timeoutId, this); if (checkScrolling) { domLib_setTimeout('thisObjs.get("'+this.timeoutId+'").checkScrolling();', this.scrollCheckDelay);}
return this;}
FloatAPI.prototype.checkScrolling = function ()
{ if (typeof(document.body.scrollTop) != 'undefined') { pageYOffsetNow = document.body.scrollTop; pageXOffsetNow = document.body.scrollLeft;} else { pageYOffsetNow = window.pageYOffset; pageXOffsetNow = window.pageXOffset;}
if ((this.lastPageXOffset != pageXOffsetNow) || (this.lastPageYOffset != pageYOffsetNow))
{ if (!this.floating) { this.floatElement();}
}
this.lastPageXOffset = pageXOffsetNow; this.lastPageYOffset = pageYOffsetNow; domLib_setTimeout('thisObjs.get("'+this.timeoutId+'").checkScrolling();', this.scrollCheckDelay);}; FloatAPI.prototype.floatElement = function ()
{ domEl = WebDDM_getElement(this.domId); if (typeof(document.body.scrollTop) != 'undefined') { pageYOffsetNow = document.body.scrollTop; pageXOffsetNow = document.body.scrollLeft;} else { pageYOffsetNow = window.pageYOffset; pageXOffsetNow = window.pageXOffset;}
shouldBePosX = pageXOffsetNow + this.offsetX; shouldBePosY = pageYOffsetNow + this.offsetY; currentPosX = parseInt(domEl.style.left); currentPosY = parseInt(domEl.style.top); if (currentPosX > shouldBePosX) { floatGapX = currentPosX - shouldBePosX; newPosX = currentPosX - (floatGapX / (85 - this.speed));} else { floatGapX = shouldBePosX - currentPosX; newPosX = currentPosX + (floatGapX / (85 - this.speed));}
if (currentPosY > shouldBePosY) { floatGapY = currentPosY - shouldBePosY; newPosY = currentPosY - (floatGapY / (85 - this.speed));} else { floatGapY = shouldBePosY - currentPosY; newPosY = currentPosY + (floatGapY / (85 - this.speed));}
if (floatGapX > 0 || floatGapY > 0) { this.floating = true; domEl.style.top = newPosY + 'px'; domEl.style.left = newPosX + 'px'; domLib_setTimeout('thisObjs.get("'+this.timeoutId+'").floatElement();', (100 - this.speed) / (floatGapY > 25 ? 1 : 3));} else { domEl.style.top = shouldBePosY + 'px'; domEl.style.left = shouldBePosX + 'px'; this.floating = false;}
}; function clipAPI (elId, parent)
{ this.element = WebDDM_getElement(elId); this.parent = parent; this.duration = 500; this.frames = 10; this.currentFrame = false; this.transition = 'none'; this.direction = ''; this.clipTimer = false; this.startClip = false; this.targetClip = false; this.currentClip = false; this.startPos = false; this.targetPos = false; this.currentPos = false; this.lastTransCompleted = ''; this.originalPos = { 'left': parseInt(this.element.offsetLeft), 'top': parseInt(this.element.offsetTop)
}; this.timeoutId = 'clipAPI' + Math.random() + elId; thisObjs.set(this.timeoutId, this); return this;}
clipAPI.prototype.start = function ()
{ domLib_clearTimeout(this.clipTimer); if (this.transition == 'none' || this.lastTransCompleted == this.direction + this.transition)
{ this.element.style.visibility = (this.direction == 'in'
? 'visible'
: 'hidden'); return;}
var elHeight = parseInt(this.element.offsetHeight); var elWidth = parseInt(this.element.offsetWidth); if (this.direction == 'in') { if (!this.startClip || (this.startClip == this.targetClip) || !this.clipTimer) { var sliding = this.transition.match('slide') ? true : false; var topClipPos, bottomClipPos, leftClipPos, rightClipPos; var topPos = this.originalPos.top, leftPos = this.originalPos.left; if (this.transition.match(/north(.*?)\-to\-south(.*?)/)) { topClipPos = 0; bottomClipPos = 0; if (sliding) { topPos = this.originalPos.top + elHeight;}
} else if (this.transition.match(/south(.*?)\-to\-north(.*?)/)) { topClipPos = elHeight; bottomClipPos = elHeight; if (sliding) { topPos = this.originalPos.top - elHeight;}
} else if (this.transition.match('center-to-edges')) { topClipPos = elHeight / 2; bottomClipPos = elHeight / 2;} else if (this.transition.match('center-to-horizontal-edges')) { topClipPos = elHeight / 2; bottomClipPos = elHeight / 2;} else { topClipPos = 0; bottomClipPos = elHeight;}
if (this.transition.match(/(.*?)west\-to\-(.*?)east/)) { leftClipPos = 0; rightClipPos = 0; if (sliding) { leftPos = this.originalPos.left + elWidth;}
} else if (this.transition.match(/(.*?)east\-to\-(.*?)west/)) { leftClipPos = elWidth; rightClipPos = elWidth; if (sliding) { leftPos = this.originalPos.left - elWidth;}
} else if (this.transition.match('center-to-edges')) { leftClipPos = elWidth / 2; rightClipPos = elWidth / 2;} else if (this.transition.match('center-to-vertical-edges')) { leftClipPos = elWidth / 2; rightClipPos = elWidth / 2;} else { leftClipPos = 0; rightClipPos = elWidth;}
this.startClip = { 'top': topClipPos, 'right': rightClipPos, 'bottom': bottomClipPos, 'left': leftClipPos
}; this.startPos = { 'top': topPos, 'left': leftPos
};}
this.targetClip = { 'top': 0, 'right': elWidth, 'bottom': elHeight, 'left': 0
}; this.targetPos = this.originalPos; this.element.style.visibility = 'visible';} else { var sliding = this.transition.match('slide') ? true : false; var topClipPos, bottomClipPos, leftClipPos, rightClipPos; var topPos = this.startPos.top; var leftPos = this.startPos.left; if (this.transition.match(/north(.*?)\-to\-south(.*?)/)) { topClipPos = this.startClip.bottom; bottomClipPos = this.startClip.bottom; if (sliding) { topPos = this.originalPos.top - elHeight;}
} else if (this.transition.match(/south(.*?)\-to\-north(.*?)/)) { topClipPos = this.startClip.top; bottomClipPos = this.startClip.top; if (sliding) { topPos = this.originalPos.top + elHeight;}
} else if (this.transition.match('center-to-edges')) { topClipPos = elHeight / 2; bottomClipPos = elHeight / 2;} else if (this.transition.match('center-to-horizontal-edges')) { topClipPos = elHeight / 2; bottomClipPos = elHeight / 2;} else { topClipPos = this.startClip.top; bottomClipPos = this.startClip.bottom;}
if (this.transition.match(/(.*?)west\-to\-(.*?)east/)) { leftClipPos = this.startClip.right; rightClipPos = this.startClip.right; if (sliding) { leftPos = this.originalPos.left - elWidth;}
} else if (this.transition.match(/(.*?)east\-to\-(.*?)west/)) { leftClipPos = this.startClip.left; rightClipPos = this.startClip.left; if (sliding) { leftPos = this.originalPos.left + elWidth;}
} else if (this.transition.match('center-to-edges')) { leftClipPos = elWidth / 2; rightClipPos = elWidth / 2;} else if (this.transition.match('center-to-vertical-edges')) { leftClipPos = elWidth / 2; rightClipPos = elWidth / 2;} else { leftClipPos = this.startClip.left; rightClipPos = this.startClip.right;}
this.targetClip = { 'top': topClipPos, 'right': rightClipPos, 'bottom': bottomClipPos, 'left': leftClipPos
}; this.targetPos = { 'top': topPos, 'left': leftPos
};}
this.slide();}; clipAPI.prototype.slide = function ()
{ this.clipTimer = false; var timeoutTime = this.duration / this.frames; this.currentClip = {}; var positions = ['top', 'right', 'bottom', 'left']; for (var i = 0; i < positions.length; i++) { var pos = positions[i]; if (this.startClip[pos] > this.targetClip[pos]) { var delta = (this.startClip[pos] - this.targetClip[pos]) / this.frames; this.currentClip[pos] = this.startClip[pos] - (delta * this.currentFrame); if (this.currentClip[pos] <= this.targetClip[pos]) { this.currentClip[pos] = this.targetClip[pos];}
} else if (this.targetClip[pos] > this.startClip[pos]) { var delta = (this.targetClip[pos] - this.startClip[pos]) / this.frames; this.currentClip[pos] = this.startClip[pos] + (delta * this.currentFrame); if (this.currentClip[pos] >= this.targetClip[pos]) { this.currentClip[pos] = this.targetClip[pos];}
} else { this.currentClip[pos] = this.startClip[pos];}
}
this.currentPos = {}; var positions = ['top', 'left']; for (var i in positions) { var pos = positions[i]; var position; if (this.startPos[pos] > this.targetPos[pos]) { var delta = (this.startPos[pos] - this.targetPos[pos]) / this.frames; this.currentPos[pos] = this.startPos[pos] - (delta * this.currentFrame); position = this.currentPos[pos]; if (this.direction == 'out' && pos == 'top') { position += 4;}
if (position < this.targetPos[pos]) { position = this.currentPos[pos] = this.targetPos[pos];}
if (position > this.startPos[pos]) { position = this.currentPos[pos] = (position - (position - this.startPos[pos]));}
}
else if (this.targetPos[pos] > this.startPos[pos]) { var delta = (this.targetPos[pos] - this.startPos[pos]) / this.frames; this.currentPos[pos] = this.startPos[pos] + (delta * this.currentFrame); position = this.currentPos[pos]; if (pos == 'top' && (this.currentFrame > 0 || this.direction == 'in')) { position += 4;}
if (position > this.targetPos[pos]) { position = this.currentPos[pos] = this.targetPos[pos];}
if (position < this.startPos[pos]) { position = this.currentPos[pos] = (position + (this.startPos[pos] - position));}
}
else { this.currentPos[pos] = position = this.startPos[pos];}
this.element.style[pos] = position + 'px';}
this.setClip(this.currentClip.top, this.currentClip.right, this.currentClip.bottom, this.currentClip.left); if (this.currentFrame <= this.frames) { this.clipTimer = domLib_setTimeout('thisObjs.get("'+this.timeoutId+'").slide()', timeoutTime); this.currentFrame++; this.lastTransCompleted = '';} else { this.lastTransCompleted = this.direction + this.transition; this.parent.transitionCompleted(this.element, this.direction == 'out' ? false : true);}
}; clipAPI.prototype.setClip = function (top, right, bottom, left)
{ this.element.style.clip = 'rect('+top+'px,'+right+'px,'+bottom+'px,'+left+'px)';}; clipAPI.prototype.setDirection = function (dir)
{ domLib_clearTimeout(this.clipTimer); this.startPos = this.targetPos = this.currentPos; this.startClip = this.currentClip; this.currentFrame = 0; this.direction = dir;}; function alphaAPI(element, fadeInDelay, fadeOutDelay, startAlpha, stopAlpha, offsetTime, deltaAlpha)
{ this.element = typeof(element) == 'object' ? element : document.getElementById(element); this.fadeInDelay = fadeInDelay || 40; this.fadeOutDelay = fadeOutDelay || this.fadeInDelay; this.startAlpha = startAlpha; this.stopAlpha = stopAlpha; if (typeof(this.element.filters) == 'object')
{ if (typeof(this.element.filters.alpha) == 'undefined')
{ this.element.style.filter += 'alpha(opacity=100)';}
}
this.offsetTime = (offsetTime || 0) * 1000; this.deltaAlpha = deltaAlpha || 10; this.timer = null; this.paused = false; this.started = false; this.cycle = false; this.command = function() {}; return this;}
alphaAPI.prototype.repeat = function(repeat)
{ this.cycle = repeat ? true : false;}
alphaAPI.prototype.setAlphaBy = function(deltaAlpha)
{ this.setAlpha(this.getAlpha() + deltaAlpha);}
alphaAPI.prototype.toggle = function()
{ if (!this.started)
{ this.start();}
else if (this.paused)
{ this.unpause();}
else
{ this.pause();}
}
alphaAPI.prototype.timeout = function(command, delay)
{ this.command = command; this.timer = setTimeout(command, delay);}
alphaAPI.prototype.setAlpha = function(opacity)
{ if (typeof(this.element.filters) == 'object')
{ this.element.filters.alpha.opacity = opacity; return;}
else if (this.element.style.setProperty)
{ this.element.style.setProperty('opacity', opacity / 100, ''); this.element.style.setProperty('-moz-opacity', opacity / 100, ''); this.element.style.setProperty('-khtml-opacity', opacity / 100, '');}
}
alphaAPI.prototype.getAlpha = function()
{ if (typeof(this.element.filters) == 'object')
{ return this.element.filters.alpha.opacity;}
else if (this.element.style.getPropertyValue)
{ var opacityValue = this.element.style.getPropertyValue('opacity'); if (opacityValue == '')
{ opacityValue = this.element.style.getPropertyValue('-moz-opacity');}
if (opacityValue == '')
{ opacityValue = this.element.style.getPropertyValue('-khtml-opacity');}
return opacityValue * 100;}
return 100;}
alphaAPI.prototype.start = function()
{ this.started = true; this.setAlpha(this.startAlpha); if (this.startAlpha > this.stopAlpha)
{ var instance = this; this.timeout(function() { instance.fadeOut();}, this.offsetTime);}
else
{ var instance = this; this.timeout(function() { instance.fadeIn();}, this.offsetTime);}
}
alphaAPI.prototype.stop = function()
{ this.started = false; this.setAlpha(this.stopAlpha); this.stopTimer(); this.command = function() {};}
alphaAPI.prototype.reset = function()
{ this.started = false; this.setAlpha(this.startAlpha); this.stopTimer(); this.command = function() {};}
alphaAPI.prototype.pause = function()
{ this.paused = true; this.stopTimer();}
alphaAPI.prototype.unpause = function()
{ this.paused = false; if (!this.started)
{ this.start();}
else
{ this.command();}
}
alphaAPI.prototype.stopTimer = function()
{ clearTimeout(this.timer); this.timer = null;}
alphaAPI.prototype.fadeOut = function()
{ this.stopTimer(); if (this.getAlpha() > this.stopAlpha)
{ this.setAlphaBy(-1 * this.deltaAlpha); var instance = this; this.timeout(function() { instance.fadeOut();}, this.fadeOutDelay);}
else
{ if (this.cycle)
{ var instance = this; this.timeout(function() { instance.fadeIn();}, this.fadeInDelay);}
else
{ this.element.style.visibility = 'hidden'; this.started = false;}
}
}
alphaAPI.prototype.fadeIn = function()
{ this.stopTimer(); if (this.getAlpha() < this.startAlpha)
{ this.setAlphaBy(this.deltaAlpha); var instance = this; this.timeout(function() { instance.fadeIn();}, this.fadeInDelay);}
else
{ if (this.cycle)
{ var instance = this; this.timeout(function() { instance.fadeOut();}, this.fadeOutDelay);}
else
{ this.started = false;}
}
}

