/*
Script: Core.js
MooTools - My Object Oriented JavaScript Tools.
License:
MIT-style license.
Copyright:
Copyright (c) 2006-2008 [Valerio Proietti](http://mad4milk.net/).
Code & Documentation:
[The MooTools production team](http://mootools.net/developers/).
Inspiration:
- Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php)
- Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php)
*/
var MooTools = {
'version': '1.2.1',
'build': '0d4845aab3d9a4fdee2f0d4a6dd59210e4b697cf'
};
var Native = function(options){
options = options || {};
var name = options.name;
var legacy = options.legacy;
var protect = options.protect;
var methods = options.implement;
var generics = options.generics;
var initialize = options.initialize;
var afterImplement = options.afterImplement || function(){};
var object = initialize || legacy;
generics = generics !== false;
object.constructor = Native;
object.$family = {name: 'native'};
if (legacy && initialize) object.prototype = legacy.prototype;
object.prototype.constructor = object;
if (name){
var family = name.toLowerCase();
object.prototype.$family = {name: family};
Native.typize(object, family);
}
var add = function(obj, name, method, force){
if (!protect || force || !obj.prototype[name]) obj.prototype[name] = method;
if (generics) Native.genericize(obj, name, protect);
afterImplement.call(obj, name, method);
return obj;
};
object.alias = function(a1, a2, a3){
if (typeof a1 == 'string'){
if ((a1 = this.prototype[a1])) return add(this, a2, a1, a3);
}
for (var a in a1) this.alias(a, a1[a], a2);
return this;
};
object.implement = function(a1, a2, a3){
if (typeof a1 == 'string') return add(this, a1, a2, a3);
for (var p in a1) add(this, p, a1[p], a2);
return this;
};
if (methods) object.implement(methods);
return object;
};
Native.genericize = function(object, property, check){
if ((!check || !object[property]) && typeof object.prototype[property] == 'function') object[property] = function(){
var args = Array.prototype.slice.call(arguments);
return object.prototype[property].apply(args.shift(), args);
};
};
Native.implement = function(objects, properties){
for (var i = 0, l = objects.length; i < l; i++) objects[i].implement(properties);
};
Native.typize = function(object, family){
if (!object.type) object.type = function(item){
return ($type(item) === family);
};
};
(function(){
var natives = {'Array': Array, 'Date': Date, 'Function': Function, 'Number': Number, 'RegExp': RegExp, 'String': String};
for (var n in natives) new Native({name: n, initialize: natives[n], protect: true});
var types = {'boolean': Boolean, 'native': Native, 'object': Object};
for (var t in types) Native.typize(types[t], t);
var generics = {
'Array': ["concat", "indexOf", "join", "lastIndexOf", "pop", "push", "reverse", "shift", "slice", "sort", "splice", "toString", "unshift", "valueOf"],
'String': ["charAt", "charCodeAt", "concat", "indexOf", "lastIndexOf", "match", "replace", "search", "slice", "split", "substr", "substring", "toLowerCase", "toUpperCase", "valueOf"]
};
for (var g in generics){
for (var i = generics[g].length; i--;) Native.genericize(window[g], generics[g][i], true);
};
})();
var Hash = new Native({
name: 'Hash',
initialize: function(object){
if ($type(object) == 'hash') object = $unlink(object.getClean());
for (var key in object) this[key] = object[key];
return this;
}
});
Hash.implement({
forEach: function(fn, bind){
for (var key in this){
if (this.hasOwnProperty(key)) fn.call(bind, this[key], key, this);
}
},
getClean: function(){
var clean = {};
for (var key in this){
if (this.hasOwnProperty(key)) clean[key] = this[key];
}
return clean;
},
getLength: function(){
var length = 0;
for (var key in this){
if (this.hasOwnProperty(key)) length++;
}
return length;
}
});
Hash.alias('forEach', 'each');
Array.implement({
forEach: function(fn, bind){
for (var i = 0, l = this.length; i < l; i++) fn.call(bind, this[i], i, this);
}
});
Array.alias('forEach', 'each');
function $A(iterable){
if (iterable.item){
var array = [];
for (var i = 0, l = iterable.length; i < l; i++) array[i] = iterable[i];
return array;
}
return Array.prototype.slice.call(iterable);
};
function $arguments(i){
return function(){
return arguments[i];
};
};
function $chk(obj){
return !!(obj || obj === 0);
};
function $clear(timer){
clearTimeout(timer);
clearInterval(timer);
return null;
};
function $defined(obj){
return (obj != undefined);
};
function $each(iterable, fn, bind){
var type = $type(iterable);
((type == 'arguments' || type == 'collection' || type == 'array') ? Array : Hash).each(iterable, fn, bind);
};
function $empty(){};
function $extend(original, extended){
for (var key in (extended || {})) original[key] = extended[key];
return original;
};
function $H(object){
return new Hash(object);
};
function $lambda(value){
return (typeof value == 'function') ? value : function(){
return value;
};
};
function $merge(){
var mix = {};
for (var i = 0, l = arguments.length; i < l; i++){
var object = arguments[i];
if ($type(object) != 'object') continue;
for (var key in object){
var op = object[key], mp = mix[key];
mix[key] = (mp && $type(op) == 'object' && $type(mp) == 'object') ? $merge(mp, op) : $unlink(op);
}
}
return mix;
};
function $pick(){
for (var i = 0, l = arguments.length; i < l; i++){
if (arguments[i] != undefined) return arguments[i];
}
return null;
};
function $random(min, max){
return Math.floor(Math.random() * (max - min + 1) + min);
};
function $splat(obj){
var type = $type(obj);
return (type) ? ((type != 'array' && type != 'arguments') ? [obj] : obj) : [];
};
var $time = Date.now || function(){
return +new Date;
};
function $try(){
for (var i = 0, l = arguments.length; i < l; i++){
try {
return arguments[i]();
} catch(e){}
}
return null;
};
function $type(obj){
if (obj == undefined) return false;
if (obj.$family) return (obj.$family.name == 'number' && !isFinite(obj)) ? false : obj.$family.name;
if (obj.nodeName){
switch (obj.nodeType){
case 1: return 'element';
case 3: return (/\S/).test(obj.nodeValue) ? 'textnode' : 'whitespace';
}
} else if (typeof obj.length == 'number'){
if (obj.callee) return 'arguments';
else if (obj.item) return 'collection';
}
return typeof obj;
};
function $unlink(object){
var unlinked;
switch ($type(object)){
case 'object':
unlinked = {};
for (var p in object) unlinked[p] = $unlink(object[p]);
break;
case 'hash':
unlinked = new Hash(object);
break;
case 'array':
unlinked = [];
for (var i = 0, l = object.length; i < l; i++) unlinked[i] = $unlink(object[i]);
break;
default: return object;
}
return unlinked;
};
/*
Script: Browser.js
The Browser Core. Contains Browser initialization, Window and Document, and the Browser Hash.
License:
MIT-style license.
*/
var Browser = $merge({
Engine: {name: 'unknown', version: 0},
Platform: {name: (window.orientation != undefined) ? 'ipod' : (navigator.platform.match(/mac|win|linux/i) || ['other'])[0].toLowerCase()},
Features: {xpath: !!(document.evaluate), air: !!(window.runtime), query: !!(document.querySelector)},
Plugins: {},
Engines: {
presto: function(){
return (!window.opera) ? false : ((arguments.callee.caller) ? 960 : ((document.getElementsByClassName) ? 950 : 925));
},
trident: function(){
return (!window.ActiveXObject) ? false : ((window.XMLHttpRequest) ? 5 : 4);
},
webkit: function(){
return (navigator.taintEnabled) ? false : ((Browser.Features.xpath) ? ((Browser.Features.query) ? 525 : 420) : 419);
},
gecko: function(){
return (document.getBoxObjectFor == undefined) ? false : ((document.getElementsByClassName) ? 19 : 18);
}
}
}, Browser || {});
Browser.Platform[Browser.Platform.name] = true;
Browser.detect = function(){
for (var engine in this.Engines){
var version = this.Engines[engine]();
if (version){
this.Engine = {name: engine, version: version};
this.Engine[engine] = this.Engine[engine + version] = true;
break;
}
}
return {name: engine, version: version};
};
Browser.detect();
Browser.Request = function(){
return $try(function(){
return new XMLHttpRequest();
}, function(){
return new ActiveXObject('MSXML2.XMLHTTP');
});
};
Browser.Features.xhr = !!(Browser.Request());
Browser.Plugins.Flash = (function(){
var version = ($try(function(){
return navigator.plugins['Shockwave Flash'].description;
}, function(){
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
}) || '0 r0').match(/\d+/g);
return {version: parseInt(version[0] || 0 + '.' + version[1] || 0), build: parseInt(version[2] || 0)};
})();
function $exec(text){
if (!text) return text;
if (window.execScript){
window.execScript(text);
} else {
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script[(Browser.Engine.webkit && Browser.Engine.version < 420) ? 'innerText' : 'text'] = text;
document.head.appendChild(script);
document.head.removeChild(script);
}
return text;
};
Native.UID = 1;
var $uid = (Browser.Engine.trident) ? function(item){
return (item.uid || (item.uid = [Native.UID++]))[0];
} : function(item){
return item.uid || (item.uid = Native.UID++);
};
var Window = new Native({
name: 'Window',
legacy: (Browser.Engine.trident) ? null: window.Window,
initialize: function(win){
$uid(win);
if (!win.Element){
win.Element = $empty;
if (Browser.Engine.webkit) win.document.createElement("iframe"); //fixes safari 2
win.Element.prototype = (Browser.Engine.webkit) ? window["[[DOMElement.prototype]]"] : {};
}
win.document.window = win;
return $extend(win, Window.Prototype);
},
afterImplement: function(property, value){
window[property] = Window.Prototype[property] = value;
}
});
Window.Prototype = {$family: {name: 'window'}};
new Window(window);
var Document = new Native({
name: 'Document',
legacy: (Browser.Engine.trident) ? null: window.Document,
initialize: function(doc){
$uid(doc);
doc.head = doc.getElementsByTagName('head')[0];
doc.html = doc.getElementsByTagName('html')[0];
if (Browser.Engine.trident && Browser.Engine.version <= 4) $try(function(){
doc.execCommand("BackgroundImageCache", false, true);
});
if (Browser.Engine.trident) doc.window.attachEvent('onunload', function() {
doc.window.detachEvent('onunload', arguments.callee);
doc.head = doc.html = doc.window = null;
});
return $extend(doc, Document.Prototype);
},
afterImplement: function(property, value){
document[property] = Document.Prototype[property] = value;
}
});
Document.Prototype = {$family: {name: 'document'}};
new Document(document);
/*
Script: Array.js
Contains Array Prototypes like each, contains, and erase.
License:
MIT-style license.
*/
Array.implement({
every: function(fn, bind){
for (var i = 0, l = this.length; i < l; i++){
if (!fn.call(bind, this[i], i, this)) return false;
}
return true;
},
filter: function(fn, bind){
var results = [];
for (var i = 0, l = this.length; i < l; i++){
if (fn.call(bind, this[i], i, this)) results.push(this[i]);
}
return results;
},
clean: function() {
return this.filter($defined);
},
indexOf: function(item, from){
var len = this.length;
for (var i = (from < 0) ? Math.max(0, len + from) : from || 0; i < len; i++){
if (this[i] === item) return i;
}
return -1;
},
map: function(fn, bind){
var results = [];
for (var i = 0, l = this.length; i < l; i++) results[i] = fn.call(bind, this[i], i, this);
return results;
},
some: function(fn, bind){
for (var i = 0, l = this.length; i < l; i++){
if (fn.call(bind, this[i], i, this)) return true;
}
return false;
},
associate: function(keys){
var obj = {}, length = Math.min(this.length, keys.length);
for (var i = 0; i < length; i++) obj[keys[i]] = this[i];
return obj;
},
link: function(object){
var result = {};
for (var i = 0, l = this.length; i < l; i++){
for (var key in object){
if (object[key](this[i])){
result[key] = this[i];
delete object[key];
break;
}
}
}
return result;
},
contains: function(item, from){
return this.indexOf(item, from) != -1;
},
extend: function(array){
for (var i = 0, j = array.length; i < j; i++) this.push(array[i]);
return this;
},
getLast: function(){
return (this.length) ? this[this.length - 1] : null;
},
getRandom: function(){
return (this.length) ? this[$random(0, this.length - 1)] : null;
},
include: function(item){
if (!this.contains(item)) this.push(item);
return this;
},
combine: function(array){
for (var i = 0, l = array.length; i < l; i++) this.include(array[i]);
return this;
},
erase: function(item){
for (var i = this.length; i--; i){
if (this[i] === item) this.splice(i, 1);
}
return this;
},
empty: function(){
this.length = 0;
return this;
},
flatten: function(){
var array = [];
for (var i = 0, l = this.length; i < l; i++){
var type = $type(this[i]);
if (!type) continue;
array = array.concat((type == 'array' || type == 'collection' || type == 'arguments') ? Array.flatten(this[i]) : this[i]);
}
return array;
},
hexToRgb: function(array){
if (this.length != 3) return null;
var rgb = this.map(function(value){
if (value.length == 1) value += value;
return value.toInt(16);
});
return (array) ? rgb : 'rgb(' + rgb + ')';
},
rgbToHex: function(array){
if (this.length < 3) return null;
if (this.length == 4 && this[3] == 0 && !array) return 'transparent';
var hex = [];
for (var i = 0; i < 3; i++){
var bit = (this[i] - 0).toString(16);
hex.push((bit.length == 1) ? '0' + bit : bit);
}
return (array) ? hex : '#' + hex.join('');
}
});
/*
Script: Function.js
Contains Function Prototypes like create, bind, pass, and delay.
License:
MIT-style license.
*/
Function.implement({
extend: function(properties){
for (var property in properties) this[property] = properties[property];
return this;
},
create: function(options){
var self = this;
options = options || {};
return function(event){
var args = options.arguments;
args = (args != undefined) ? $splat(args) : Array.slice(arguments, (options.event) ? 1 : 0);
if (options.event) args = [event || window.event].extend(args);
var returns = function(){
return self.apply(options.bind || null, args);
};
if (options.delay) return setTimeout(returns, options.delay);
if (options.periodical) return setInterval(returns, options.periodical);
if (options.attempt) return $try(returns);
return returns();
};
},
run: function(args, bind){
return this.apply(bind, $splat(args));
},
pass: function(args, bind){
return this.create({bind: bind, arguments: args});
},
bind: function(bind, args){
return this.create({bind: bind, arguments: args});
},
bindWithEvent: function(bind, args){
return this.create({bind: bind, arguments: args, event: true});
},
attempt: function(args, bind){
return this.create({bind: bind, arguments: args, attempt: true})();
},
delay: function(delay, bind, args){
return this.create({bind: bind, arguments: args, delay: delay})();
},
periodical: function(periodical, bind, args){
return this.create({bind: bind, arguments: args, periodical: periodical})();
}
});
/*
Script: Number.js
Contains Number Prototypes like limit, round, times, and ceil.
License:
MIT-style license.
*/
Number.implement({
limit: function(min, max){
return Math.min(max, Math.max(min, this));
},
round: function(precision){
precision = Math.pow(10, precision || 0);
return Math.round(this * precision) / precision;
},
times: function(fn, bind){
for (var i = 0; i < this; i++) fn.call(bind, i, this);
},
toFloat: function(){
return parseFloat(this);
},
toInt: function(base){
return parseInt(this, base || 10);
}
});
Number.alias('times', 'each');
(function(math){
var methods = {};
math.each(function(name){
if (!Number[name]) methods[name] = function(){
return Math[name].apply(null, [this].concat($A(arguments)));
};
});
Number.implement(methods);
})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']);
/*
Script: String.js
Contains String Prototypes like camelCase, capitalize, test, and toInt.
License:
MIT-style license.
*/
String.implement({
test: function(regex, params){
return ((typeof regex == 'string') ? new RegExp(regex, params) : regex).test(this);
},
contains: function(string, separator){
return (separator) ? (separator + this + separator).indexOf(separator + string + separator) > -1 : this.indexOf(string) > -1;
},
trim: function(){
return this.replace(/^\s+|\s+$/g, '');
},
clean: function(){
return this.replace(/\s+/g, ' ').trim();
},
camelCase: function(){
return this.replace(/-\D/g, function(match){
return match.charAt(1).toUpperCase();
});
},
hyphenate: function(){
return this.replace(/[A-Z]/g, function(match){
return ('-' + match.charAt(0).toLowerCase());
});
},
capitalize: function(){
return this.replace(/\b[a-z]/g, function(match){
return match.toUpperCase();
});
},
escapeRegExp: function(){
return this.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
},
toInt: function(base){
return parseInt(this, base || 10);
},
toFloat: function(){
return parseFloat(this);
},
hexToRgb: function(array){
var hex = this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);
return (hex) ? hex.slice(1).hexToRgb(array) : null;
},
rgbToHex: function(array){
var rgb = this.match(/\d{1,3}/g);
return (rgb) ? rgb.rgbToHex(array) : null;
},
stripScripts: function(option){
var scripts = '';
var text = this.replace(/
(end)
Note:
The title of the element will always be used as the tooltip body. If you put :: on your title, the text before :: will become the tooltip title.
If you put DOM:someElementID in your title, $('someElementID').innerHTML will be used as your tooltip contents (same syntax as above).
If you put AJAX:http://www.example.com/path/to/ajax_file.php in your title, the response text will be used as tooltip contents (same syntax as above). Either absolute or relative paths are ok.
*/
var Garbage = {
elements: [],
collect: function(el){
if (!el.$tmp){
Garbage.elements.push(el);
el.$tmp = {'opacity': 1};
}
return el;
},
trash: function(elements){
for (var i = 0, j = elements.length, el; i < j; i++){
if (!(el = elements[i]) || !el.$tmp) continue;
if (el.$events) el.fireEvent('trash').removeEvents();
for (var p in el.$tmp) el.$tmp[p] = null;
for (var p in Element.prototype) el[p] = null;
el.htmlElement = el.$tmp = el = null;
Garbage.elements.remove(el);
}
},
empty: function(){
Garbage.collect(window);
Garbage.collect(document);
Garbage.trash(Garbage.elements);
}
};
var TipsX3 = new Class({
options: { // modded for X3
onShow: function(tip){
//tip.fade('in');
tip.setStyle('visibility', 'visible');
},
onHide: function(tip){
//tip.fade('out');
tip.setStyle('visibility', 'hidden');
},
maxTitleChars: 8,
showDelay: 100,
hideDelay: 100,
className: 'armory-tooltip',
offsets: {'x': 8, 'y': 8},
fixed: false,
loadingText: 'Please wait...',
errTitle: 'Error',
errText: 'There was a problem retrieving the item from the WoW Armory',
maxWidth: 250,
idName: ''
},
initialize: function(elements, options){
this.setOptions(options);
this.toolTip = new Element('div', {
'class': this.options.className + '-tip',
'styles': {
'position': 'absolute',
'top': '0',
'left': '0',
'visibility': 'hidden',
'max-width' : this.options.maxWidth,
'z-index' : 5000
}
}).inject(document.body);
this.wrapper = new Element('div').inject(this.toolTip);
$$(elements).each(this.build, this);
if (this.options.initialize) this.options.initialize.call(this);
},
build: function(el){
if (!el)
return false;
if (el)
Garbage.collect( el );
if( !el.$tmp || el.$tmp == undefined )
return;
el.$tmp.myTitle = (el.href && el.getTag() == 'a') ? el.href.replace('http://', '') : (el.rel || false);
if (el.title){
// check if we need to extract contents from a DOM element
if (el.title.test('^DOM:', 'i')) {
el.title = $(el.title.split(':')[1].trim()).innerHTML;
}
// check for an URL to retrieve content from
if (el.title.test('^AJAX:', 'i')) {
el.title = this.options.loadingText + '::' + el.title;
}
// check for an URL to retrieve content from
if (el.title.test('^Item:', 'i')) {
el.title = this.options.loadingText + '::' + el.title;
}
// check for an URL to retrieve content from
if (el.title.test('^WoWArmory:', 'i')) {
el.title = this.options.loadingText + '::' + el.title;
}
// check for an URL to retrieve content from
if (el.title.test('^Character:', 'i')) {
el.title = this.options.loadingText + '::' + el.title;
}
var dual = el.title.split('::');
if (dual.length > 1) {
el.$tmp.myTitle = dual[0].trim();
el.$tmp.myText = dual[1].trim();
} else {
el.$tmp.myText = el.title;
}
el.removeAttribute('title');
} else {
el.$tmp.myText = false;
}
if (el.$tmp.myTitle && el.$tmp.myTitle.length > this.options.maxTitleChars) el.$tmp.myTitle = el.$tmp.myTitle.substr(0, this.options.maxTitleChars - 1) + "…";
el.addEvent('mouseenter', function(event){
this.start(el);
if (!this.options.fixed) this.locate(event);
else this.position(el);
}.bind(this));
if (!this.options.fixed) el.addEvent('mousemove', this.locate.bindWithEvent(this));
var end = this.end.bind(this);
el.addEvent('mouseleave', end);
el.addEvent('trash', end);
},
modify: function( element, newTitle, newText ){
element.$tmp.myTitle = newTitle;
element.$tmp.myText = newText;
this.startFinal( element, false );
},
modifyItem: function( element, newTitle, newText, itemIcon ){
element.$tmp.myTitle = newTitle;
element.$tmp.myText = newText;
element.$tmp.itemIcon = itemIcon;
this.startFinal( element, false );
},
modifyNotActive: function( element, newTitle, newText ){
element.$tmp.myTitle = newTitle;
element.$tmp.myText = newText;
},
start: function( el ) {
this.startFinal( el, true );
},
startFinal: function( el, show ) {
this.wrapper.empty();
// check if we have an AJAX Item request - if so, show a loading animation and launch the request
if (el.$tmp.myText && el.$tmp.myText.test('^Item:', 'i')) {
var linkObj = this;
this.ajax = new Request.JSON( { link: 'cancel', evalScripts: false, url: el.$tmp.myText.replace(/Item:/i,'/powered/items/'), onComplete: function( item ){
linkObj.modifyItem( el, '', item.html, item.icon )
}}).get();
el.$tmp.myText = '
';
}
// check if we have an AJAX Char request - if so, show a loading animation and launch the request
if (el.$tmp.myText && el.$tmp.myText.test('^Character:', 'i')) {
var linkObj = this;
this.ajax = new Request.HTML( { link: 'cancel', evalScripts: false, url: el.$tmp.myText.replace(/Character:/i,'/powered/characters/'), onSuccess: function( var1, var2, response, var3 ) {
linkObj.modify( el, '', response )
}}).get();
el.$tmp.myText = '';
}
// check if we have an AJAX wow armory item request - if so, show a loading animation and launch the request
if (el.$tmp.myText && el.$tmp.myText.test('^WoWArmory:', 'i')) {
var linkObj = this;
var myArmoryUrl = el.$tmp.myText.replace(/WoWArmory:/i,'');
myArmoryUrl = '/wowArmoryProxy.php?url=' + escape( myArmoryUrl );
this.ajax = new Request.HTML( { link: 'cancel', evalScripts: false, url: myArmoryUrl, onSuccess: function( var1, var2, response, var3 ) {
linkObj.modify( el, '', response )
}}).get();
el.$tmp.myText = '';
}
if( el.$tmp.itemIcon ) {
this.wrapper.set( 'html', '
' );
} else {
this.wrapper.set( 'html', '' );
}
this.theTip = $( this.options.idName );
if (el.$tmp.myTitle){
this.title = new Element('span').inject(
new Element('div', {'class': this.options.className + '-title'}).inject( this.theTip )
).set( 'html', el.$tmp.myTitle );
}
if (el.$tmp.myText){
this.text = new Element('span').inject(
new Element('div', {'class': this.options.className + '-text'}).inject( this.theTip )
).set( 'html', el.$tmp.myText );
}
if( show == true ) {
$clear(this.timer);
this.timer = this.show.delay( this.options.showDelay, this);
}
},
end: function(event){
$clear(this.timer);
this.timer = this.hide.delay( this.options.hideDelay, this);
},
position: function(element){
var pos = element.getPosition();
this.toolTip.setStyles({
'left': pos.x + this.options.offsets.x,
'top': pos.y + this.options.offsets.y
});
},
locate: function(event){
var win = {'x': window.getWidth(), 'y': window.getHeight()};
var scroll = {'x': window.getScrollLeft(), 'y': window.getScrollTop()};
var tip = {'x': this.toolTip.offsetWidth, 'y': this.toolTip.offsetHeight};
var prop = {'x': 'left', 'y': 'top'};
for (var z in prop){
var pos = event.page[z] + this.options.offsets[z];
if ((pos + tip[z] - scroll[z]) > win[z])
pos =event.page[z] - this.options.offsets[z] - tip[z];
if( z == 'y' && pos - scroll.y < 10 ) {
pos = scroll.y + 10;
}
this.toolTip.setStyle(prop[z], pos);
};
},
show: function(){
if (this.options.timeout) this.timer = this.hide.delay( this.options.timeout, this );
this.fireEvent( 'onShow', [this.toolTip] );
},
hide: function(){
this.fireEvent( 'onHide', [this.toolTip] );
}
});
TipsX3.implement( new Events, new Options );var MorphList = new Class({
Implements: [Events, Options],
options: {/*
onClick: $empty,
onMorph: $empty,*/
morph: { 'link': 'cancel' }
},
initialize: function(menu, options) {
var that = this;
this.setOptions(options);
this.menu = $(menu);
this.menuitems = this.menu.getChildren();
this.menuitems.addEvents({
mouseenter: function(){ that.morphTo(this); },
mouseleave: function(){ that.morphTo(that.current); },
click: function(ev){ that.click(ev, this); }
});
this.bg = new Element('li', {'class': 'background'}).adopt(new Element('div', {'class': 'left'}));
this.bg.inject(this.menu).set('morph', this.options.morph);
this.setCurrent(this.menu.getElement('.current'));
},
click: function(ev, item) {
this.setCurrent(item, true);
this.fireEvent('onClick', [ev, item]);
},
setCurrent: function(el, effect){
if(el && ! this.current) {
this.bg.set('styles', { left: el.offsetLeft, width: el.offsetWidth, height: el.offsetHeight, top: el.offsetTop });
(effect) ? this.bg.fade('hide').fade('in') : this.bg.fade('show');
}
if(this.current) this.current.removeClass('current');
if(el) this.current = el.addClass('current');
},
morphTo: function(to) {
if(! this.current) return;
this.bg.morph({
left: to.offsetLeft, top: to.offsetTop,
width: to.offsetWidth, height: to.offsetHeight
});
this.fireEvent('onMorph', to);
}
});
window.addEvent('domready', function() {
// attach fancy menu for browsers other than ie6
if( !Browser.Engine.trident4 ) {
new MorphList(
$('nav'), {
transition: Fx.Transitions.backOut,
duration: 700
}
);
}
// Check all links for item links or character links
var allLinks = $$( 'a' );
for (var i = allLinks.length - 1; i >= 0; i--){
var currentLink = allLinks[i];
if( !currentLink.href || currentLink.href == '' )
continue;
if( currentLink.rel && currentLink.rel == 'notooltip' )
continue;
if( currentLink.id && currentLink.id == 'fdbk_tab' )
continue;
var regExp1 = new RegExp( "^http://" + window.location.hostname + "\/items\/", "mi" );
var regExp2 = new RegExp( "^\/items\/", "mi" );
var regExp3 = new RegExp( "^http://" + window.location.hostname + "\/eu\/", "mi" );
var regExp4 = new RegExp( "^\/eu\/", "mi" );
var regExp5 = new RegExp( "^http://" + window.location.hostname + "\/us\/", "mi" );
var regExp6 = new RegExp( "^\/us\/", "mi" );
var regExp7 = new RegExp( "^http://" + window.location.hostname + "\/cn\/", "mi" );
var regExp8 = new RegExp( "^\/cn\/", "mi" );
var regExp9 = new RegExp( "^http://" + window.location.hostname + "\/kr\/", "mi" );
var regExp10 = new RegExp( "^\/kr\/", "mi" );
var regExp11 = new RegExp( "^http://" + window.location.hostname + "\/tw\/", "mi" );
var regExp12 = new RegExp( "^\/tw\/", "mi" );
// Check whether it starts with Armory Light
if( regExp1.test( currentLink.href ) == false &&
regExp2.test( currentLink.href ) == false &&
regExp3.test( currentLink.href ) == false &&
regExp4.test( currentLink.href ) == false &&
regExp5.test( currentLink.href ) == false &&
regExp6.test( currentLink.href ) == false &&
regExp7.test( currentLink.href ) == false &&
regExp8.test( currentLink.href ) == false &&
regExp9.test( currentLink.href ) == false &&
regExp10.test( currentLink.href ) == false &&
regExp11.test( currentLink.href ) == false &&
regExp12.test( currentLink.href ) == false )
continue;
var linkElements = currentLink.href.split( '/' );
var linkRel = currentLink.rel;
for (var j=linkElements.length; j <= 6; j++) {
linkElements[j] = '';
};
var LinkType = linkElements[3].toLowerCase();
var ItemId = linkElements[4].toLowerCase();
var ServerName = linkElements[4];
var CharacterName = linkElements[5];
var JSONRequestUrl = false;
if( LinkType == 'items' && ItemId != '' && ItemId > 0 && linkRel != 'notip' && linkRel.match('wowarmory') == null ) {
// Ok it's an item Link, create a span wrapper
var mySpan = new Element('span', {
'title': 'Item:' + ItemId,
'class': 'armoryitemtip' }
);
mySpan.wraps( currentLink );
} else if( LinkType == 'items' && ItemId != '' && ItemId > 0 && linkRel.match('wowarmory') == 'wowarmory' ) {
// Ok it's an item Link for the wow armory, create a span wrapper
var linkRelElements = currentLink.rel.split( ':' );
var armoryRegion = linkRelElements[1];
if( armoryRegion == 'us' )
armoryRegion = 'www';
var mySpan = new Element('span', {
'title': 'WoWArmory:http://' + armoryRegion + '.wowarmory.com/item-tooltip.xml?i=' + ItemId + '&s=' + linkRelElements[4] + '&r=' + linkRelElements[2] + '&n=' + linkRelElements[3],
'class': 'armoryitemtip' }
);
mySpan.wraps( currentLink );
} else if( ( LinkType == 'eu' || LinkType == 'us' || LinkType == 'kr' || LinkType == 'cn' || LinkType == 'tw' )&& ServerName != '' && CharacterName != '' ) {
// Ok it's an item Link, create a span wrapper
var mySpan = new Element('span', {
'title': 'Character:' + LinkType + '/' + ServerName + '/' + CharacterName,
'class': 'armoryitemtip' }
);
mySpan.wraps( currentLink );
} else {
continue;
}
};
// Preload tooltip background
new Element('img',{ src: 'http://static.armory-light.com/images/tooltip-trans.png' });
// Attach tooltips to all armorytip elements
var ArmoryLightTips = new TipsX3(
$$('.armorytip'), {
maxTitleChars: 100,
showDelay: 0,
maxWidth: 265,
idName: 'armoryGenericTipContent'
}
);
// Attach item tooltips to all armoryitemtip elements
var ArmoryLightTips = new TipsX3(
$$('.armoryitemtip'), {
maxTitleChars: 100,
maxWidth: 335,
showDelay: 0,
idName: 'armoryItemTipContent',
loadingText: 'Loading...'
}
);
// Set highslide options
if( undefined !== window.hs ) {
hs.graphicsDir = 'http://static.armory-light.com/images/highslide/';
hs.outlineType = 'rounded-black';
hs.wrapperClassName = 'draggable-header no-footer wide-border';
hs.allowSizeReduction = false;
hs.preserveContent = false;
hs.align = 'center';
hs.dimmingOpacity = 0.35;
hs.dragByHeading = false;
hs.fadeInOut = true;
hs.dimmingGeckoFix = true;
hs.dimmingDuration = 20;
hs.showCredits = false;
hs.objectLoadTime = 'after';
hs.transitions = ["expand"];
hs.Expander.prototype.onDrag = function (sender, e) {
return false;
};
hs.Expander.prototype.onBeforeClose = function (sender, e) {
window.location.hash = '#';
return true;
};
}
});
Array.prototype.inArray = function( value ) {
var i;
for (i=0; i < this.length; i++) {
// Matches identical (===), not just similar (==).
if (this[i] === value) {
return true;
}
}
return false;
};
/*
TableSort revisited v4.9 by frequency-decoder.com
Released under a creative commons Attribution-ShareAlike 2.5 license (http://creativecommons.org/licenses/by-sa/2.5/)
Please credit frequency decoder in any derivative work - thanks
You are free:
* to copy, distribute, display, and perform the work
* to make derivative works
* to make commercial use of the work
Under the following conditions:
by Attribution.
--------------
You must attribute the work in the manner specified by the author or licensor.
sa
--
Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one.
* For any reuse or distribution, you must make clear to others the license terms of this work.
* Any of these conditions can be waived if you get permission from the copyright holder.
*/
(function() {
fdTableSort = {
regExp_Currency: /^[£$€¥¤]/,
regExp_Number: /^(\-)?[0-9]+(\.[0-9]*)?$/,
pos: -1,
uniqueHash: 1,
thNode: null,
tableId: null,
tableCache: {},
tmpCache: {},
sortActiveClass: "sort-active",
/*@cc_on
/*@if (@_win32)
colspan: "colSpan",
rowspan: "rowSpan",
@else @*/
colspan: "colspan",
rowspan: "rowspan",
/*@end
@*/
addEvent: function(obj, type, fn, tmp) {
tmp || (tmp = true);
if( obj.attachEvent ) {
obj["e"+type+fn] = fn;
obj[type+fn] = function(){obj["e"+type+fn]( window.event );};
obj.attachEvent( "on"+type, obj[type+fn] );
} else {
obj.addEventListener( type, fn, true );
};
},
removeEvent: function(obj, type, fn, tmp) {
tmp || (tmp = true);
try {
if( obj.detachEvent ) {
obj.detachEvent( "on"+type, obj[type+fn] );
obj[type+fn] = null;
} else {
obj.removeEventListener( type, fn, true );
};
} catch(err) {};
},
stopEvent: function(e) {
e = e || window.event;
if(e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
};
/*@cc_on@*/
/*@if(@_win32)
e.cancelBubble = true;
e.returnValue = false;
/*@end@*/
return false;
},
parseClassName: function(head, tbl) {
var colMatch = tbl.className.match(new RegExp(head + "((-[\\d]+([r]){0,1})+)"));
return colMatch && colMatch.length ? colMatch[0].replace(head, "").split("-") : [];
},
disableSelection: function(element) {
element.onselectstart = function() {
return false;
};
element.unselectable = "on";
element.style.MozUserSelect = "none";
},
removeTableCache: function(tableId) {
if(!(tableId in fdTableSort.tableCache)) return;
fdTableSort.tableCache[tableId] = null;
delete fdTableSort.tableCache[tableId];
var tbl = document.getElementById(tableId);
if(!tbl) return;
var ths = tbl.getElementsByTagName("th");
var a;
for(var i = 0, th; th = ths[i]; i++) {
a = th.getElementsByTagName("a");
if(a.length) a[0].onkeydown = a[0].onclick = null;
th.onclick = th.onselectstart = th = a = null;
};
},
removeTmpCache: function(tableId) {
if(!(tableId in fdTableSort.tmpCache)) return;
var headers = fdTableSort.tmpCache[tableId].headers;
var a;
for(var i = 0, row; row = headers[i]; i++) {
for(var j = 0, th; th = row[j]; j++) {
a = th.getElementsByTagName("a");
if(a.length) a[0].onkeydown = a[0].onclick = null;
th.onclick = th.onselectstart = th = a = null;
};
};
fdTableSort.tmpCache[tableId] = null;
delete fdTableSort.tmpCache[tableId];
},
initEvt: function(e) {
fdTableSort.init(false);
},
init: function(tableId) {
if (!document.getElementsByTagName || !document.createElement || !document.getElementById) return;
var tables = tableId && document.getElementById(tableId) ? [document.getElementById(tableId)] : document.getElementsByTagName("table");
var c, ii, len, colMatch, showOnly, match, showArrow, columnNumSortObj, obj, workArr, headers, thtext, aclone, multi, colCnt, cel, allRowArr, rowArr, sortableTable, celCount, colspan, rowspan, rowLength;
var a = document.createElement("a");
a.href = "#";
a.className = "fdTableSortTrigger";
var span = document.createElement("span");
for(var k = 0, tbl; tbl = tables[k]; k++) {
if(tbl.id) {
fdTableSort.removeTableCache(tbl.id);
fdTableSort.removeTmpCache(tbl.id);
};
allRowArr = tbl.getElementsByTagName('thead').length ? tbl.getElementsByTagName('thead')[0].getElementsByTagName('tr') : tbl.getElementsByTagName('tr');
rowArr = [];
sortableTable = false;
for(var i = 0, tr; tr = allRowArr[i]; i++) {
if(tr.getElementsByTagName('td').length || !tr.getElementsByTagName('th').length) { continue; };
rowArr[rowArr.length] = tr.getElementsByTagName('th');
for(var j = 0, th; th = rowArr[rowArr.length - 1][j]; j++) {
if(th.className.search(/sortable/) != -1) { sortableTable = true; };
};
};
if(!sortableTable) continue;
if(!tbl.id) { tbl.id = "fd-table-" + fdTableSort.uniqueHash++; };
showArrow = tbl.className.search("no-arrow") == -1;
showOnly = tbl.className.search("sortable-onload-show") != -1;
columnNumSortObj = {};
colMatch = fdTableSort.parseClassName(showOnly ? "sortable-onload-show" : "sortable-onload", tbl);
for(match = 1; match < colMatch.length; match++) {
columnNumSortObj[parseInt(colMatch[match], 10)] = { "reverse":colMatch[match].search("r") != -1 };
};
rowLength = rowArr[0].length;
for(c = 0;c < rowArr[0].length;c++){
if(rowArr[0][c].getAttribute(fdTableSort.colspan) && rowArr[0][c].getAttribute(fdTableSort.colspan) > 1){
rowLength = rowLength + (rowArr[0][c].getAttribute(fdTableSort.colspan) - 1);
};
};
workArr = new Array(rowArr.length);
for(c = rowArr.length;c--;){ workArr[c]= new Array(rowLength); };
for(c = 0;c < workArr.length;c++){
celCount = 0;
for(i = 0;i < rowLength;i++){
if(!workArr[c][i]){
cel = rowArr[c][celCount];
colspan = (cel.getAttribute(fdTableSort.colspan) > 1) ? cel.getAttribute(fdTableSort.colspan):1;
rowspan = (cel.getAttribute(fdTableSort.rowspan) > 1) ? cel.getAttribute(fdTableSort.rowspan):1;
for(var t = 0;((t < colspan)&&((i+t) < rowLength));t++){
for(var n = 0;((n < rowspan)&&((c+n) < workArr.length));n++) {
workArr[(c+n)][(i+t)] = cel;
};
};
if(++celCount == rowArr[c].length) break;
};
};
};
for(c = 0;c < workArr.length;c++) {
for(i = 0;i < workArr[c].length;i++){
if(workArr[c][i].className.search("fd-column-") == -1 && workArr[c][i].className.search("sortable") != -1) workArr[c][i].className = workArr[c][i].className + " fd-column-" + i;
if(workArr[c][i].className.match('sortable')) {
workArr[c][i].className = workArr[c][i].className.replace(/forwardSort|reverseSort/, "");
if(i in columnNumSortObj) {
columnNumSortObj[i]["thNode"] = workArr[c][i];
columnNumSortObj["active"] = true;
};
thtext = fdTableSort.getInnerText(workArr[c][i]);
for(var cn = workArr[c][i].childNodes.length; cn--;) {
// Skip image nodes and links created by the filter script.
if(workArr[c][i].childNodes[cn].nodeType == 1 && (workArr[c][i].childNodes[cn].className == "fdFilterTrigger" || /img/i.test(workArr[c][i].childNodes[cn].nodeName))) {
continue;
};
if(workArr[c][i].childNodes[cn].nodeType == 1 && /^a$/i.test(workArr[c][i].childNodes[cn].nodeName)) {
workArr[c][i].childNodes[cn].onclick = workArr[c][i].childNodes[cn].onkeydown = null;
};
workArr[c][i].removeChild(workArr[c][i].childNodes[cn]);
};
aclone = a.cloneNode(true);
aclone.appendChild(document.createTextNode(thtext));
aclone.title = "Sort on \u201c" + thtext + "\u201d";
aclone.onclick = aclone.onkeydown = workArr[c][i].onclick = fdTableSort.initWrapper;
workArr[c][i].appendChild(aclone);
if(showArrow) workArr[c][i].appendChild(span.cloneNode(false));
workArr[c][i].className = workArr[c][i].className.replace(/fd-identical|fd-not-identical/, "");
fdTableSort.disableSelection(workArr[c][i]);
aclone = null;
};
};
};
fdTableSort.tmpCache[tbl.id] = {cols:rowLength, headers:workArr};
workArr = null;
multi = 0;
if("active" in columnNumSortObj) {
fdTableSort.tableId = tbl.id;
fdTableSort.prepareTableData(document.getElementById(fdTableSort.tableId));
delete columnNumSortObj["active"];
for(col in columnNumSortObj) {
obj = columnNumSortObj[col];
if(!("thNode" in obj)) { continue; };
fdTableSort.multi = true;
len = obj.reverse ? 2 : 1;
for(ii = 0; ii < len; ii++) {
fdTableSort.thNode = obj.thNode;
if(!showOnly) {
fdTableSort.initSort(false, true);
} else {
fdTableSort.addThNode();
};
};
if(showOnly) {
fdTableSort.removeClass(obj.thNode, "(forwardSort|reverseSort)");
fdTableSort.addClass(obj.thNode, obj.reverse ? "reverseSort" : "forwardSort");
if(showArrow) {
span = fdTableSort.thNode.getElementsByTagName('span')[0];
if(span.firstChild) { span.removeChild(span.firstChild); };
span.appendChild(document.createTextNode(len == 1 ? " \u2193" : " \u2191"));
};
};
};
if(showOnly && (fdTableSort.tableCache[tbl.id].colStyle || fdTableSort.tableCache[tbl.id].rowStyle)) {
fdTableSort.redraw(tbl.id, false);
};
} else if(tbl.className.search(/onload-zebra/) != -1) {
fdTableSort.tableId = tbl.id;
fdTableSort.prepareTableData(tbl);
if(fdTableSort.tableCache[tbl.id].rowStyle) { fdTableSort.redraw(tbl.id, false); };
};
};
fdTableSort.thNode = aclone = a = span = columnNumSortObj = thNode = tbl = allRowArr = rowArr = null;
},
initWrapper: function(e) {
e = e || window.event;
var kc = e.type == "keydown" ? e.keyCode != null ? e.keyCode : e.charCode : -1;
if(fdTableSort.thNode == null && (e.type == "click" || kc == 13)) {
var targ = this;
while(targ.tagName.toLowerCase() != "th") { targ = targ.parentNode; };
fdTableSort.thNode = targ;
while(targ.tagName.toLowerCase() != "table") { targ = targ.parentNode; };
fdTableSort.tableId = targ.id;
fdTableSort.multi = e.shiftKey;
fdTableSort.addSortActiveClass();
setTimeout(fdTableSort.initSort,5,false);
return fdTableSort.stopEvent(e);
};
return kc != -1 ? true : fdTableSort.stopEvent(e);
},
jsWrapper: function(tableid, colNums) {
if(!(tableid in fdTableSort.tmpCache)) { return false; };
if(!(tableid in fdTableSort.tableCache)) { fdTableSort.prepareTableData(document.getElementById(tableid)); };
if(!(colNums instanceof Array)) { colNums = [colNums]; };
fdTableSort.tableId = tableid;
var len = colNums.length, colNum;
if(fdTableSort.tableCache[tableid].thList.length == colNums.length) {
var identical = true;
var th;
for(var i = 0; i < len; i++) {
colNum = colNums[i];
th = fdTableSort.tmpCache[tableid].headers[0][colNum];
if(th != fdTableSort.tableCache[tableid].thList[i]) {
identical = false;
break;
};
};
if(identical) {
fdTableSort.thNode = th;
fdTableSort.initSort(true);
return;
};
};
fdTableSort.addSortActiveClass();
for(var i = 0; i < len; i++) {
fdTableSort.multi = i;
colNum = colNums[i];
fdTableSort.thNode = fdTableSort.tmpCache[tableid].headers[0][colNum];
fdTableSort.initSort(true);
};
},
addSortActiveClass: function() {
if(fdTableSort.thNode == null) { return; };
fdTableSort.addClass(fdTableSort.thNode, fdTableSort.sortActiveClass);
fdTableSort.addClass(document.getElementsByTagName('body')[0], fdTableSort.sortActiveClass);
},
removeSortActiveClass: function() {
if(fdTableSort.thNode == null) return;
fdTableSort.removeClass(fdTableSort.thNode, fdTableSort.sortActiveClass);
fdTableSort.removeClass(document.getElementsByTagName('body')[0], fdTableSort.sortActiveClass);
},
doCallback: function(init) {
if(!fdTableSort.tableId || !(fdTableSort.tableId in fdTableSort.tableCache)) { return; };
fdTableSort.callback(fdTableSort.tableId, init ? fdTableSort.tableCache[fdTableSort.tableId].initiatedCallback : fdTableSort.tableCache[fdTableSort.tableId].completeCallback);
},
addClass: function(e,c) {
if(new RegExp("(^|\\s)" + c + "(\\s|$)").test(e.className)) { return; };
e.className += ( e.className ? " " : "" ) + c;
},
/*@cc_on
/*@if (@_win32)
removeClass: function(e,c) {
e.className = !c ? "" : e.className.replace(new RegExp("(^|\\s)" + c + "(\\s|$)"), " ").replace(/^\s*((?:[\S\s]*\S)?)\s*$/, '$1');
},
@else @*/
removeClass: function(e,c) {
e.className = !c ? "" : e.className.replace(new RegExp("(^|\\s)" + c + "(\\s|$)"), " ").replace(/^\s\s*/, '').replace(/\s\s*$/, '');
},
/*@end
@*/
callback: function(tblId, cb) {
var func;
if(cb.indexOf(".") != -1) {
var split = cb.split(".");
func = window;
for(var i = 0, f; f = split[i]; i++) {
if(f in func) {
func = func[f];
} else {
func = "";
break;
};
};
} else if(cb + tblId in window) {
func = window[cb + tblId];
} else if(cb in window) {
func = window[cb];
};
if(typeof func == "function") { func(tblId, fdTableSort.tableCache[tblId].thList); };
func = null;
},
prepareTableData: function(table) {
var data = [];
var start = table.getElementsByTagName('tbody');
start = start.length ? start[0] : table;
var trs = start.rows;
var ths = table.getElementsByTagName('th');
var numberOfRows = trs.length;
var numberOfCols = fdTableSort.tmpCache[table.id].cols;
var data = [];
var identical = new Array(numberOfCols);
var identVal = new Array(numberOfCols);
for(var tmp = 0; tmp < numberOfCols; tmp++) identical[tmp] = true;
var tr, td, th, txt, tds, col, row;
var re = new RegExp(/fd-column-([0-9]+)/);
var rowCnt = 0;
var sortableColumnNumbers = [];
for(var tmp = 0, th; th = ths[tmp]; tmp++) {
if(th.className.search(re) == -1) continue;
sortableColumnNumbers[sortableColumnNumbers.length] = th;
};
for(row = 0; row < numberOfRows; row++) {
tr = trs[row];
if(tr.parentNode != start || tr.getElementsByTagName("th").length || (tr.parentNode && tr.parentNode.tagName.toLowerCase().search(/thead|tfoot/) != -1)) continue;
data[rowCnt] = [];
tds = tr.cells;
for(var tmp = 0, th; th = sortableColumnNumbers[tmp]; tmp++) {
col = th.className.match(re)[1];
td = tds[col];
txt = fdTableSort.getInnerText(td) + " ";
txt = txt.replace(/^\s+/,'').replace(/\s+$/,'');
if(th.className.search(/sortable-date/) != -1) {
txt = fdTableSort.dateFormat(txt, th.className.search(/sortable-date-dmy/) != -1);
} else if(th.className.search(/sortable-numeric|sortable-currency/) != -1) {
txt = parseFloat(txt.replace(/[^0-9\.\-]/g,''));
if(isNaN(txt)) txt = "";
} else if(th.className.search(/sortable-text/) != -1) {
txt = txt.toLowerCase();
} else if (th.className.search(/sortable-keep/) != -1) {
txt = rowCnt;
} else if(th.className.search(/sortable-([a-zA-Z\_]+)/) != -1) {
if((th.className.match(/sortable-([a-zA-Z\_]+)/)[1] + "PrepareData") in window) {
txt = window[th.className.match(/sortable-([a-zA-Z\_]+)/)[1] + "PrepareData"](td, txt);
};
} else if(txt != "") {
fdTableSort.removeClass(th, "sortable");
if(fdTableSort.dateFormat(txt) != 0) {
fdTableSort.addClass(th, "sortable-date");
txt = fdTableSort.dateFormat(txt);
} else if(txt.search(fdTableSort.regExp_Number) != -1 || txt.search(fdTableSort.regExp_Currency) != -1) {
fdTableSort.addClass(th, "sortable-numeric");
txt = parseFloat(txt.replace(/[^0-9\.\-]/g,''));
if(isNaN(txt)) txt = "";
} else {
fdTableSort.addClass(th, "sortable-text");
txt = txt.toLowerCase();
};
};
if(rowCnt > 0 && identical[col] && identVal[col] != txt) { identical[col] = false; };
identVal[col] = txt;
data[rowCnt][col] = txt;
};
data[rowCnt][numberOfCols] = tr;
rowCnt++;
};
var colStyle = table.className.search(/colstyle-([\S]+)/) != -1 ? table.className.match(/colstyle-([\S]+)/)[1] : false;
var rowStyle = table.className.search(/rowstyle-([\S]+)/) != -1 ? table.className.match(/rowstyle-([\S]+)/)[1] : false;
var iCBack = table.className.search(/sortinitiatedcallback-([\S-]+)/) == -1 ? "sortInitiatedCallback" : table.className.match(/sortinitiatedcallback-([\S]+)/)[1];
var cCBack = table.className.search(/sortcompletecallback-([\S-]+)/) == -1 ? "sortCompleteCallback" : table.className.match(/sortcompletecallback-([\S]+)/)[1];
iCBack = iCBack.replace("-", ".");
cCBack = cCBack.replace("-", ".");
fdTableSort.tableCache[table.id] = { hook:start, initiatedCallback:iCBack, completeCallback:cCBack, thList:[], colOrder:{}, data:data, identical:identical, colStyle:colStyle, rowStyle:rowStyle, noArrow:table.className.search(/no-arrow/) != -1 };
sortableColumnNumbers = data = tr = td = th = trs = identical = identVal = null;
},
onUnload: function() {
for(tbl in fdTableSort.tableCache) { fdTableSort.removeTableCache(tbl); };
for(tbl in fdTableSort.tmpCache) { fdTableSort.removeTmpCache(tbl); };
fdTableSort.removeEvent(window, "load", fdTableSort.initEvt);
fdTableSort.removeEvent(window, "unload", fdTableSort.onUnload);
fdTableSort.tmpCache = fdTableSort.tableCache = null;
},
addThNode: function() {
var dataObj = fdTableSort.tableCache[fdTableSort.tableId];
var pos = fdTableSort.thNode.className.match(/fd-column-([0-9]+)/)[1];
var alt = false;
if(!fdTableSort.multi) {
if(dataObj.colStyle) {
var len = dataObj.thList.length;
for(var i = 0; i < len; i++) {
dataObj.colOrder[dataObj.thList[i].className.match(/fd-column-([0-9]+)/)[1]] = false;
};
};
if(dataObj.thList.length && dataObj.thList[0] == fdTableSort.thNode) alt = true;
dataObj.thList = [];
};
var found = false;
var l = dataObj.thList.length;
for(var i = 0, n; n = dataObj.thList[i]; i++) {
if(n == fdTableSort.thNode) {
found = true;
break;
};
};
if(!found) {
dataObj.thList.push(fdTableSort.thNode);
if(dataObj.colStyle) { dataObj.colOrder[pos] = true; };
};
var ths = document.getElementById(fdTableSort.tableId).getElementsByTagName("th");
for(var i = 0, th; th = ths[i]; i++) {
found = false;
for(var z = 0, n; n = dataObj.thList[z]; z++) {
if(n == th) {
found = true;
break;
};
};
if(!found) {
fdTableSort.removeClass(th, "(forwardSort|reverseSort)");
if(!dataObj.noArrow) {
span = th.getElementsByTagName('span');
if(span.length) {
span = span[0];
while(span.firstChild) span.removeChild(span.firstChild);
};
};
};
};
if(dataObj.thList.length > 1) {
classToAdd = fdTableSort.thNode.className.search(/forwardSort/) != -1 ? "reverseSort" : "forwardSort";
fdTableSort.removeClass(fdTableSort.thNode, "(forwardSort|reverseSort)");
fdTableSort.addClass(fdTableSort.thNode, classToAdd);
dataObj.pos = -1
} else if(alt) { dataObj.pos = fdTableSort.thNode };
},
initSort: function(noCallback, ident) {
var thNode = fdTableSort.thNode;
var tableElem = document.getElementById(fdTableSort.tableId);
if(!(fdTableSort.tableId in fdTableSort.tableCache)) { fdTableSort.prepareTableData(document.getElementById(fdTableSort.tableId)); };
fdTableSort.addThNode();
if(!noCallback) { fdTableSort.doCallback(true); };
fdTableSort.pos = thNode.className.match(/fd-column-([0-9]+)/)[1];
var dataObj = fdTableSort.tableCache[tableElem.id];
var lastPos = dataObj.pos && dataObj.pos.className ? dataObj.pos.className.match(/fd-column-([0-9]+)/)[1] : -1;
var len1 = dataObj.data.length;
var len2 = dataObj.data.length > 0 ? dataObj.data[0].length - 1 : 0;
var identical = dataObj.identical[fdTableSort.pos];
var classToAdd = "forwardSort";
if(dataObj.thList.length > 1) {
var js = "var sortWrapper = function(a,b) {\n";
var l = dataObj.thList.length;
var cnt = 0;
var e,d,th,p,f;
for(var i=0; i < l; i++) {
th = dataObj.thList[i];
p = th.className.match(/fd-column-([0-9]+)/)[1];
if(dataObj.identical[p]) { continue; };
cnt++;
if(th.className.match(/sortable-(numeric|currency|date|keep)/)) {
f = "fdTableSort.sortNumeric";
} else if(th.className.match('sortable-text')) {
f = "fdTableSort.sortText";
} else if(th.className.search(/sortable-([a-zA-Z\_]+)/) != -1 && th.className.match(/sortable-([a-zA-Z\_]+)/)[1] in window) {
f = "window['" + th.className.match(/sortable-([a-zA-Z\_]+)/)[1] + "']";
} else f = "fdTableSort.sortText";
e = "e" + i;
d = th.className.search('forwardSort') != -1 ? "a,b" : "b,a";
js += "fdTableSort.pos = " + p + ";\n";
js += "var " + e + " = "+f+"(" + d +");\n";
js += "if(" + e + ") return " + e + ";\n";
js += "else { \n";
};
js += "return 0;\n";
for(var i=0; i < cnt; i++) {
js += "};\n";
};
if(cnt) js += "return 0;\n";
js += "};\n";
eval(js);
dataObj.data.sort(sortWrapper);
identical = false;
} else if((lastPos == fdTableSort.pos && !identical) || (thNode.className.search(/sortable-keep/) != -1 && lastPos == -1)) {
dataObj.data.reverse();
classToAdd = thNode.className.search(/reverseSort/) != -1 ? "forwardSort" : "reverseSort";
if(thNode.className.search(/sortable-keep/) != -1 && lastPos == -1) fdTableSort.tableCache[tableElem.id].pos = thNode;
} else {
fdTableSort.tableCache[tableElem.id].pos = thNode;
classToAdd = thNode.className.search(/forwardSort/) != -1 ? "reverseSort" : "forwardSort";
if(!identical) {
if(thNode.className.match(/sortable-(numeric|currency|date|keep)/)) {
dataObj.data.sort(fdTableSort.sortNumeric);
} else if(thNode.className.match('sortable-text')) {
dataObj.data.sort(fdTableSort.sortText);
} else if(thNode.className.search(/sortable-([a-zA-Z\_]+)/) != -1 && thNode.className.match(/sortable-([a-zA-Z\_]+)/)[1] in window) {
dataObj.data.sort(window[thNode.className.match(/sortable-([a-zA-Z\_]+)/)[1]]);
};
if(thNode.className.search(/(^|\s)favour-reverse($|\s)/) != -1) {
classToAdd = classToAdd == "forwardSort" ? "reverseSort" : "forwardSort";
dataObj.data.reverse();
};
};
};
if(ident) { identical = false; };
if(dataObj.thList.length == 1) {
fdTableSort.removeClass(thNode, "(forwardSort|reverseSort)");
fdTableSort.addClass(thNode, classToAdd);
};
if(!dataObj.noArrow) {
var span = fdTableSort.thNode.getElementsByTagName('span')[0];
if(span.firstChild) span.removeChild(span.firstChild);
span.appendChild(document.createTextNode(fdTableSort.thNode.className.search(/forwardSort/) != -1 ? " \u2193" : " \u2191"));
};
if(!dataObj.rowStyle && !dataObj.colStyle && identical) {
fdTableSort.removeSortActiveClass();
if(!noCallback) { fdTableSort.doCallback(false); };
fdTableSort.thNode = null;
return;
};
if("tablePaginater" in window && "tableInfo" in tablePaginater && fdTableSort.tableId in tablePaginater.tableInfo) {
tablePaginater.redraw(fdTableSort.tableId, identical);
} else {
fdTableSort.redraw(fdTableSort.tableId, identical);
};
fdTableSort.removeSortActiveClass();
if(!noCallback) { fdTableSort.doCallback(false); };
fdTableSort.thNode = null;
},
redraw: function(tableid, identical) {
if(!tableid || !(tableid in fdTableSort.tableCache)) { return; };
var dataObj = fdTableSort.tableCache[tableid];
var data = dataObj.data;
var len1 = data.length;
var len2 = len1 ? data[0].length - 1 : 0;
var hook = dataObj.hook;
var colStyle = dataObj.colStyle;
var rowStyle = dataObj.rowStyle;
var colOrder = dataObj.colOrder;
var highLight = 0;
var reg = /(^|\s)invisibleRow(\s|$)/;
var tr, tds;
for(var i = 0; i < len1; i++) {
tr = data[i][len2];
if(colStyle) {
tds = tr.cells;
for(thPos in colOrder) {
if(!colOrder[thPos]) fdTableSort.removeClass(tds[thPos], colStyle);
else fdTableSort.addClass(tds[thPos], colStyle);
};
};
if(!identical) {
if(rowStyle && tr.className.search(reg) == -1) {
if(highLight++ & 1) fdTableSort.addClass(tr, rowStyle);
else fdTableSort.removeClass(tr, rowStyle);
};
// Netscape 8.1.2 requires the removeChild call or it freaks out, so add the line if you want to support this browser
// hook.removeChild(tr);
hook.appendChild(tr);
};
};
tr = tds = hook = null;
},
getInnerText: function(el) {
if (typeof el == "string" || typeof el == "undefined") return el;
if(el.innerText) return el.innerText;
var txt = '', i;
for(i = el.firstChild; i; i = i.nextSibling) {
if(i.nodeType == 3) txt += i.nodeValue;
else if(i.nodeType == 1) txt += fdTableSort.getInnerText(i);
};
return txt;
},
dateFormat: function(dateIn, favourDMY) {
var dateTest = [
{ regExp:/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/, d:3, m:1, y:5 }, // mdy
{ regExp:/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, d:1, m:3, y:5 }, // dmy
{ regExp:/^(\d\d\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/, d:5, m:3, y:1 } // ymd
];
var start, cnt = 0, numFormats = dateTest.length;
while(cnt < numFormats) {
start = (cnt + (favourDMY ? numFormats + 1 : numFormats)) % numFormats;
if(dateIn.match(dateTest[start].regExp)) {
res = dateIn.match(dateTest[start].regExp);
y = res[dateTest[start].y];
m = res[dateTest[start].m];
d = res[dateTest[start].d];
if(m.length == 1) m = "0" + String(m);
if(d.length == 1) d = "0" + String(d);
if(y.length != 4) y = (parseInt(y) < 50) ? "20" + String(y) : "19" + String(y);
return y+String(m)+d;
};
cnt++;
};
return 0;
},
sortNumeric:function(a,b) {
var aa = a[fdTableSort.pos];
var bb = b[fdTableSort.pos];
if(aa == bb) return 0;
if(aa === "" && !isNaN(bb)) return -1;
if(bb === "" && !isNaN(aa)) return 1;
return aa - bb;
},
sortText:function(a,b) {
var aa = a[fdTableSort.pos];
var bb = b[fdTableSort.pos];
if(aa == bb) return 0;
if(aa < bb) return -1;
return 1;
}
};
})();
fdTableSort.addEvent(window, "load", fdTableSort.initEvt);
fdTableSort.addEvent(window, "unload", fdTableSort.onUnload);
/* SWFObject v2.1
Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
This software is released under the MIT License
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("', 'gi'), '');
if (this.iframe) {
var doc = this.iframe.contentDocument;
if (!doc && this.iframe.contentWindow) doc = this.iframe.contentWindow.document;
if (!doc) { // Opera
var pThis = this;
setTimeout(function() { pThis.loadHTML(); }, 25);
return;
}
doc.open();
doc.write(s);
doc.close();
try { s = doc.getElementById(this.id).innerHTML; } catch (e) {
try { s = this.iframe.document.getElementById(this.id).innerHTML; } catch (e) {} // opera
}
} else {
s = s.replace(new RegExp('^.*?]*>(.*?).*?$', 'i'), '$1');
}
}
hs.getElementByClass(this.content, 'DIV', 'highslide-body').innerHTML = s;
this.onLoad();
for (var x in this) this[x] = null;
}
};
hs.Slideshow = function (exp, options) {
if (hs.dynamicallyUpdateAnchors !== false) hs.updateAnchors();
this.exp = exp;
for (var x in options) this[x] = options[x];
if (this.useControls) this.getControls();
if (this.thumbstrip) this.thumbstrip = hs.Thumbstrip(this);
};
hs.Slideshow.prototype = {
getControls: function() {
this.controls = hs.createElement('div', { innerHTML: hs.replaceLang(hs.skin.controls) },
null, hs.container);
var buttons = ['play', 'pause', 'previous', 'next', 'move', 'full-expand', 'close'];
this.btn = {};
var pThis = this;
for (var i = 0; i < buttons.length; i++) {
this.btn[buttons[i]] = hs.getElementByClass(this.controls, 'li', 'highslide-'+ buttons[i]);
this.enable(buttons[i]);
}
this.btn.pause.style.display = 'none';
//this.disable('full-expand');
},
checkFirstAndLast: function() {
if (this.repeat || !this.controls) return;
var cur = this.exp.getAnchorIndex(), re = /disabled$/;
if (cur == 0)
this.disable('previous');
else if (re.test(this.btn.previous.getElementsByTagName('a')[0].className))
this.enable('previous');
if (cur + 1 == hs.anchors.groups[this.exp.slideshowGroup || 'none'].length) {
this.disable('next');
this.disable('play');
} else if (re.test(this.btn.next.getElementsByTagName('a')[0].className)) {
this.enable('next');
this.enable('play');
}
},
enable: function(btn) {
if (!this.btn) return;
var sls = this, a = this.btn[btn].getElementsByTagName('a')[0], re = /disabled$/;
a.onclick = function() {
sls[btn]();
return false;
};
if (re.test(a.className)) a.className = a.className.replace(re, '');
},
disable: function(btn) {
if (!this.btn) return;
var a = this.btn[btn].getElementsByTagName('a')[0];
a.onclick = function() { return false; };
if (!/disabled$/.test(a.className)) a.className += ' disabled';
},
hitSpace: function() {
if (this.autoplay) this.pause();
else this.play();
},
play: function(wait) {
if (this.btn) {
this.btn.play.style.display = 'none';
this.btn.pause.style.display = '';
}
this.autoplay = true;
if (!wait) hs.next(this.exp.key);
},
pause: function() {
if (this.btn) {
this.btn.pause.style.display = 'none';
this.btn.play.style.display = '';
}
clearTimeout(this.autoplay);
this.autoplay = null;
},
previous: function() {
this.pause();
hs.previous(this.btn.previous);
},
next: function() {
this.pause();
hs.next(this.btn.next);
},
move: function() {},
'full-expand': function() {
hs.getExpander().doFullExpand();
},
close: function() {
hs.close(this.btn.close);
}
};
hs.Thumbstrip = function(slideshow) {
function add (exp) {
hs.extend(options || {}, {
overlayId: dom,
hsId: 'thumbstrip'
});
if (hs.ieLt7) options.fade = 0;
exp.createOverlay(options);
hs.setStyles(dom.parentNode, { overflow: 'hidden' });
};
function scroll (delta) {
selectThumb(undefined, Math.round(delta * dom[isX ? 'offsetWidth' : 'offsetHeight'] * 0.7));
};
function selectThumb (i, scrollBy) {
if (i === undefined) for (var j = 0; j < group.length; j++) {
if (group[j] == slideshow.exp.a) {
i = j;
break;
}
}
var as = dom.getElementsByTagName('a'),
active = as[i],
cell = active.parentNode,
left = isX ? 'Left' : 'Top',
right = isX ? 'Right' : 'Bottom',
width = isX ? 'Width' : 'Height',
offsetLeft = 'offset' + left,
offsetWidth = 'offset' + width,
minTblPos = div.parentNode.parentNode[offsetWidth] - table[offsetWidth],
curTblPos = parseInt(table.style[isX ? 'left' : 'top']) || 0,
tblPos = curTblPos,
mgnRight = 20;
if (scrollBy !== undefined) {
tblPos = curTblPos - scrollBy;
if (tblPos > 0) tblPos = 0;
if (tblPos < minTblPos) tblPos = minTblPos;
} else {
for (var j = 0; j < as.length; j++) as[j].className = '';
active.className = 'highslide-active-anchor';
var activeLeft = i > 0 ? as[i - 1].parentNode[offsetLeft] : cell[offsetLeft],
activeRight = cell[offsetLeft] + cell[offsetWidth] +
(as[i + 1] ? as[i + 1].parentNode[offsetWidth] : 0);
if (activeRight > div[offsetWidth] - curTblPos) tblPos = div[offsetWidth] - activeRight;
else if (activeLeft < -curTblPos) tblPos = -activeLeft;
}
var markerPos = cell[offsetLeft] + (cell[offsetWidth] - marker[offsetWidth]) / 2 + tblPos;
hs.animate(table, isX ? { left: tblPos } : { top: tblPos }, null, 'easeOutQuad');
hs.animate(marker, isX ? { left: markerPos } : { top: markerPos }, null, 'easeOutQuad');
scrollUp.style.display = tblPos < 0 ? 'block' : 'none';
scrollDown.style.display = (tblPos > minTblPos) ? 'block' : 'none';
};
// initialize
var group = hs.anchors.groups[slideshow.exp.slideshowGroup || 'none'],
options = slideshow.thumbstrip,
mode = options.mode || 'horizontal',
floatMode = (mode == 'float'),
tree = floatMode ? ['div', 'ul', 'li', 'span'] : ['table', 'tbody', 'tr', 'td'],
isX = (mode == 'horizontal'),
dom = hs.createElement('div', {
className: 'highslide-thumbstrip highslide-thumbstrip-'+ mode,
innerHTML:
''+
'<'+ tree[0] +'><'+ tree[1] +'>'+ tree[1] +'>'+ tree[0] +'>
'+
''+
''+
''
}, {
display: 'none'
}, hs.container),
domCh = dom.childNodes,
div = domCh[0],
scrollUp = domCh[1],
scrollDown = domCh[2],
marker = domCh[3],
table = div.firstChild,
tbody = dom.getElementsByTagName(tree[1])[0],
tr;
for (var i = 0; i < group.length; i++) {
if (i == 0 || !isX) tr = hs.createElement(tree[2], null, null, tbody);
(function(){
var a = group[i],
cell = hs.createElement(tree[3], null, null, tr),
pI = i;
hs.createElement('a', {
href: a.href,
onclick: function() {
return hs.transit(a);
},
innerHTML: hs.stripItemFormatter ? hs.stripItemFormatter(a) : a.innerHTML
}, null, cell);
})();
}
if (!floatMode) {
scrollUp.onclick = function () { scroll(-1); };
scrollDown.onclick = function() { scroll(1); };
hs.addEventListener(tbody, document.onmousewheel !== undefined ?
'mousewheel' : 'DOMMouseScroll', function(e) {
var delta = 0;
e = e || window.event;
if (e.wheelDelta) {
delta = e.wheelDelta/120;
if (hs.opera) delta = -delta;
} else if (e.detail) {
delta = -e.detail/3;
}
if (delta) scroll(-delta * 0.2);
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
});
}
return {
add: add,
selectThumb: selectThumb
}
};
if (document.readyState && hs.ie) {
(function () {
try {
document.documentElement.doScroll('left');
} catch (e) {
setTimeout(arguments.callee, 50);
return;
}
hs.domReady();
})();
}
hs.langDefaults = hs.lang;
// history
var HsExpander = hs.Expander;
// set handlers
hs.addEventListener(window, 'load', function() {
if (hs.expandCursor) {
var sel = '.highslide img',
dec = 'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;';
var style = hs.createElement('style', { type: 'text/css' }, null,
document.getElementsByTagName('HEAD')[0]);
if (!hs.ie) {
style.appendChild(document.createTextNode(sel + " {" + dec + "}"));
} else {
var last = document.styleSheets[document.styleSheets.length - 1];
if (typeof(last.addRule) == "object") last.addRule(sel, dec);
}
}
});
hs.addEventListener(window, 'resize', function() {
hs.page = hs.getPageSize();
if (hs.viewport) for (var i = 0; i < hs.viewport.childNodes.length; i++) {
var node = hs.viewport.childNodes[i],
exp = hs.getExpander(node);
exp.positionOverlay(node);
if (node.hsId == 'thumbstrip') exp.slideshow.thumbstrip.selectThumb();
}
});
hs.addEventListener(document, 'mousemove', function(e) {
hs.mouse = { x: e.clientX, y: e.clientY };
});
hs.addEventListener(document, 'mousedown', hs.mouseClickHandler);
hs.addEventListener(document, 'mouseup', hs.mouseClickHandler);
hs.addEventListener(window, 'load', hs.preloadImages);
hs.addEventListener(window, 'load', hs.preloadAjax);
hs.addEventListener(window, 'load', function() { hs.pageLoaded = true; });
hs.setClickEvents();/*
Unobtrusive Slider Control by frequency decoder v2.4 (http://www.frequency-decoder.com/)
Released under a creative commons Attribution-Share Alike 3.0 Unported license (http://creativecommons.org/licenses/by-sa/3.0/)
You are free:
* to copy, distribute, display, and perform the work
* to make derivative works
* to make commercial use of the work
Under the following conditions:
by Attribution.
--------------
You must attribute the work in the manner specified by the author or licensor.
sa
--
Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one.
* For any reuse or distribution, you must make clear to others the license terms of this work.
* Any of these conditions can be waived if you get permission from the copyright holder.
*/
var fdSliderController = (function() {
var sliders = {},
uniqueid = 0,
mouseWheelEnabled = true;
var removeMouseWheelSupport = function() {
mouseWheelEnabled = false;
};
var addEvent = function(obj, type, fn) {
if( obj.attachEvent ) {
obj["e"+type+fn] = fn;
obj[type+fn] = function(){obj["e"+type+fn]( window.event );};
obj.attachEvent( "on"+type, obj[type+fn] );
} else { obj.addEventListener( type, fn, true ); }
};
var removeEvent = function(obj, type, fn) {
if( obj.detachEvent ) {
try {
obj.detachEvent( "on"+type, obj[type+fn] );
obj[type+fn] = null;
} catch(err) { };
} else { obj.removeEventListener( type, fn, true ); }
};
var stopEvent = function(e) {
if(e == null) e = document.parentWindow.event;
if(e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
};
/*@cc_on@*/
/*@if(@_win32)
e.cancelBubble = true;
e.returnValue = false;
/*@end@*/
return false;
};
var joinNodeLists = function() {
if(!arguments.length) { return []; };
var nodeList = [];
for (var i = 0; i < arguments.length; i++) {
for (var j = 0, item; item = arguments[i][j]; j++) { nodeList[nodeList.length] = item; };
};
return nodeList;
};
// Function by Artem B. with a minor change by f.d.
var parseCallbacks = function(cbs) {
if(cbs == null) { return {}; };
var func,
type,
cbObj = {},
parts,
obj;
for(var i = 0, fn; fn = cbs[i]; i++) {
type = fn.match(/(fd_slider_cb_(update|create|destroy|redraw|move|focus|blur)_)([^\s|$]+)/i)[1];
fn = fn.replace(new RegExp("^"+type), "").replace(/-/g, ".");
type = type.replace(/^fd_slider_cb_/i, "").replace(/_$/, "");
try {
if(fn.indexOf(".") != -1) {
parts = fn.split('.');
obj = window;
for (var x = 0, part; part = obj[parts[x]]; x++) {
if(part instanceof Function) {
(function() {
var method = part;
func = function (data) { method.apply(obj, [data]) };
})();
} else {
obj = part;
};
};
} else {
func = window[fn];
};
if(!(func instanceof Function)) continue;
if(!(type in cbObj)) { cbObj[type] = []; };
cbObj[type][cbObj[type].length] = func;
} catch (err) {};
};
return cbObj;
};
var parseClassNames = function(cbs) {
if(cbs == null) { return ""; };
var cns = [];
for(var i = 0, cn; cn = cbs[i]; i++) {
cns[cns.length] = cn.replace(/^fd_slider_cn_/, "");
};
return cns.join(" ");
};
var createSlider = function(options) {
if(!options.inp || !options.inp.id) { return false; };
destroySingleSlider(options.inp.id);
sliders[options.inp.id] = new fdSlider(options);
return true;
};
var init = function( elem ) {
var ranges = /fd_range_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}/i,
increment = /fd_inc_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}/,
kIncrement = /fd_maxinc_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}/,
callbacks = /((fd_slider_cb_(update|create|destroy|redraw|move|focus|blur)_)([^\s|$]+))/ig,
classnames = /(fd_slider_cn_([a-zA-Z0-9_\-]+))/ig,
inputs = elem && elem.tagName && elem.tagName.search(/input|select/i) != -1 ? [elem] : joinNodeLists(document.getElementsByTagName('input'), document.getElementsByTagName('select')),
range,
tmp,
options;
for(var i = 0, inp; inp = inputs[i]; i++) {
if((inp.tagName.toLowerCase() == "input" && inp.type == "text" && (inp.className.search(ranges) != -1 || inp.className.search(/fd_slider/) != -1)) || (inp.tagName.toLowerCase() == "select" && inp.className.search(/fd_slider/) != -1)) {
// If we haven't been passed a specific id and the slider exists then continue
if(!elem && inp.id && document.getElementById("fd-slider-"+inp.id)) { continue; };
// Create an id if necessary
if(!inp.id) { inp.id == "sldr" + uniqueid++; };
options = {
inp: inp,
inc: inp.className.search(increment) != -1 ? inp.className.match(increment)[0].replace("fd_inc_", "").replace("d",".") : "1",
maxInc: inp.className.search(kIncrement) != -1 ? inp.className.match(kIncrement)[0].replace("fd_maxinc_", "").replace("d",".") : false,
range: [0,100],
callbacks: parseCallbacks(inp.className.match(callbacks)),
classNames: parseClassNames(inp.className.match(classnames)),
tween: inp.className.search(/fd_tween/i) != -1,
vertical: inp.className.search(/fd_vertical/i) != -1,
hideInput: inp.className.search(/fd_hide_input/i) != -1,
clickJump: inp.className.search(/fd_jump/i) != -1,
fullARIA: inp.className.search(/fd_full_aria/i) != -1,
noMouseWheel: inp.className.search(/fd_disable_mousewheel/i) != -1
};
if(inp.tagName.toLowerCase() == "select") {
options.range = [0, inp.options.length - 1];
} else if(inp.className.search(ranges) != -1) {
range = inp.className.match(ranges)[0].replace("fd_range_", "").replace(/d/g,".").split("_");
options.range = [range[0], range[1]];
};
createSlider(options);
};
};
return true;
};
var destroySingleSlider = function(id) {
if(id in sliders) {
sliders[id].destroy();
delete sliders[id];
return true;
};
return false;
};
var destroyAllsliders = function(e) {
for(slider in sliders) { sliders[slider].destroy(); };
};
var unload = function(e) {
destroyAllsliders();
sliders = null;
removeEvent(window, "unload", unload);
removeEvent(window, "resize", resize);
removeOnloadEvent();
};
var resize = function(e) {
for(slider in sliders) { sliders[slider].onResize(); };
};
var removeOnloadEvent = function() {
removeEvent(window, "load", init);
/*@cc_on@*/
/*@if(@_win32)
removeEvent(window, "load", function() { setTimeout(onload, 200) });
/*@end@*/
};
function fdSlider(options) {
var inp = options.inp,
tagName = inp.tagName.toLowerCase(),
min = +options.range[0],
max = +options.range[1],
range = Math.abs(max - min),
inc = tagName == "select" ? 1 : +options.inc||1,
maxInc = options.maxInc ? options.maxInc : inc * 2,
precision = options.inc.search(".") != -1 ? options.inc.substr(options.inc.indexOf(".")+1, options.inc.length - 1).length : 0,
steps = Math.ceil(range / inc),
useTween = !!options.tween,
fullARIA = !!options.fullARIA,
hideInput = !!options.hideInput,
clickJump = useTween ? false : !!options.clickJump,
vertical = !!options.vertical,
callbacks = options.callbacks,
classNames = options.classNames,
noMWheel = !!options.noMouseWheel,
timer = null,
kbEnabled = true,
sliderH = 0,
sliderW = 0,
tweenX = 0,
tweenB = 0,
tweenC = 0,
tweenD = 0,
frame = 0,
x = 0,
y = 0,
maxPx = 0,
handlePos = 0,
destPos = 0,
mousePos = 0,
deltaPx = 0,
stepPx = 0,
self = this,
changeList = {},
initVal = null,
outerWrapper,
wrapper,
handle,
bar;
if(max < min) {
inc = -inc;
maxInc = -maxInc;
};
function destroySlider() {
try {
removeEvent(outerWrapper, "mouseover", onMouseOver);
removeEvent(outerWrapper, "mouseout", onMouseOut);
removeEvent(outerWrapper, "mousedown", onMouseDown);
removeEvent(handle, "focus", onFocus);
removeEvent(handle, "blur", onBlur);
if(!window.opera) {
removeEvent(handle, "keydown", onKeyDown);
removeEvent(handle, "keypress", onKeyPress);
} else {
removeEvent(handle, "keypress", onKeyDown);
};
removeEvent(handle, "mousedown", onHandleMouseDown);
removeEvent(handle, "mouseup", onHandleMouseUp);
if(mouseWheelEnabled && !noMWheel) {
if (window.addEventListener && !window.devicePixelRatio) window.removeEventListener('DOMMouseScroll', trackMouseWheel, false);
else {
removeEvent(document, "mousewheel", trackMouseWheel);
removeEvent(window, "mousewheel", trackMouseWheel);
};
};
} catch(err) {};
wrapper = bar = handle = outerWrapper = timer = null;
callback("destroy");
callbacks = null;
};
function redraw() {
locate();
// Internet Explorer requires the try catch
try {
var sW = outerWrapper.offsetWidth,
sH = outerWrapper.offsetHeight,
hW = handle.offsetWidth,
hH = handle.offsetHeight,
bH = bar.offsetHeight,
bW = bar.offsetWidth;
maxPx = vertical ? sH - hH : sW - hW;
stepPx = maxPx / steps;
deltaPx = maxPx / Math.ceil(range / maxInc);
sliderW = sW;
sliderH = sH;
valueToPixels();
} catch(err) { };
callback("redraw");
};
function callback(type) {
var cbObj = {"elem":inp, "value":tagName == "select" ? inp.options[inp.selectedIndex].value : inp.value};
if(type in callbacks) {
for(var i = 0, func; func = callbacks[type][i]; i++) {
func(cbObj);
};
};
};
function onFocus(e) {
outerWrapper.className = outerWrapper.className.replace('focused','') + ' focused';
if(mouseWheelEnabled && !noMWheel) {
addEvent(window, 'DOMMouseScroll', trackMouseWheel);
addEvent(document, 'mousewheel', trackMouseWheel);
if(!window.opera) addEvent(window, 'mousewheel', trackMouseWheel);
};
callback("focus");
};
function onBlur(e) {
outerWrapper.className = outerWrapper.className.replace(/focused|fd-fc-slider-hover|fd-slider-hover/g,'');
if(mouseWheelEnabled && !noMWheel) {
removeEvent(document, 'mousewheel', trackMouseWheel);
removeEvent(window, 'DOMMouseScroll', trackMouseWheel);
if(!window.opera) removeEvent(window, 'mousewheel', trackMouseWheel);
};
callback("blur");
};
function trackMouseWheel(e) {
if(!kbEnabled) return;
e = e || window.event;
var delta = 0;
if (e.wheelDelta) {
delta = e.wheelDelta/120;
if (window.opera && window.opera.version() < 9.2) delta = -delta;
} else if(e.detail) {
delta = -e.detail/3;
};
if(vertical) { delta = -delta; };
if(delta) {
var xtmp = vertical ? handle.offsetTop : handle.offsetLeft;
xtmp = (delta < 0) ? Math.ceil(xtmp + deltaPx) : Math.floor(xtmp - deltaPx);
pixelsToValue(Math.min(Math.max(xtmp, 0), maxPx));
}
return stopEvent(e);
};
function onKeyPress(e) {
e = e || document.parentWindow.event;
if ((e.keyCode >= 33 && e.keyCode <= 40) || !kbEnabled || e.keyCode == 45 || e.keyCode == 46) {
return stopEvent(e);
};
return true;
};
function onKeyDown(e) {
if(!kbEnabled) return true;
e = e || document.parentWindow.event;
var kc = e.keyCode != null ? e.keyCode : e.charCode;
if ( kc < 33 || (kc > 40 && (kc != 45 && kc != 46))) return true;
var value = tagName == "input" ? parseFloat(inp.value) : inp.selectedIndex;
if(isNaN(value) || value < Math.min(min,max)) value = Math.min(min,max);
if( kc == 37 || kc == 40 || kc == 46 || kc == 34) {
// left, down, ins, page down
value -= (e.ctrlKey || kc == 34 ? maxInc : inc)
} else if( kc == 39 || kc == 38 || kc == 45 || kc == 33) {
// right, up, del, page up
value += (e.ctrlKey || kc == 33 ? maxInc : inc)
} else if( kc == 35 ) {
// max
value = max;
} else if( kc == 36 ) {
// min
value = min;
};
valueToPixels(value);
callback("update");
// Opera doesn't let us cancel key events so the up/down arrows and home/end buttons will scroll the screen - which sucks
return stopEvent(e);
};
function onMouseOver( e ) {
/*@cc_on@*/
/*@if(@_jscript_version <= 5.6)
if(this.className.search(/focused/) != -1) {
this.className = this.className.replace("fd-fc-slider-hover", "") +' fd-fc-slider-hover';
return;
}
/*@end@*/
this.className = this.className.replace(/fd\-slider\-hover/g,"") +' fd-slider-hover';
};
function onMouseOut( e ) {
/*@cc_on@*/
/*@if(@_jscript_version <= 5.6)
if(this.className.search(/focused/) != -1) {
this.className = this.className.replace("fd-fc-slider-hover", "");
return;
}
/*@end@*/
this.className = this.className.replace(/fd\-slider\-hover/g,"");
};
function onHandleMouseUp(e) {
e = e || window.event;
removeEvent(document, 'mousemove', trackMouse);
removeEvent(document, 'mouseup', onHandleMouseUp);
kbEnabled = true;
// Opera fires the blur event when the mouseup event occurs on a button, so we attept to force a focus
if(window.opera) try { setTimeout(function() { onfocus(); }, 0); } catch(err) {};
document.body.className = document.body.className.replace(/slider-drag-vertical|slider-drag-horizontal/g, "");
return stopEvent(e);
};
function onHandleMouseDown(e) {
e = e || window.event;
mousePos = vertical ? e.clientY : e.clientX;
handlePos = parseInt(vertical ? handle.offsetTop : handle.offsetLeft)||0;
kbEnabled = false;
clearTimeout(timer);
timer = null;
addEvent(document, 'mousemove', trackMouse);
addEvent(document, 'mouseup', onHandleMouseUp);
// Force a "focus" on the button on mouse events
if(window.devicePixelRatio || (document.all && !window.opera)) try { setTimeout(function() { handle.focus(); }, 0); } catch(err) {};
document.body.className += " slider-drag-" + (vertical ? "vertical" : "horizontal");
};
function onMouseUp( e ) {
e = e || window.event;
removeEvent(document, 'mouseup', onMouseUp);
if(!useTween) {
clearTimeout(timer);
timer = null;
kbEnabled = true;
};
return stopEvent(e);
};
function trackMouse( e ) {
e = e || window.event;
pixelsToValue(snapToNearestValue(handlePos + (vertical ? e.clientY - mousePos : e.clientX - mousePos)));
};
function onMouseDown( e ) {
e = e || window.event;
var targ;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) targ = targ.parentNode;
if(targ.className.search("fd-slider-handle") != -1) { return true; };
try { setTimeout(function() { handle.focus(); }, 0); } catch(err) { };
clearTimeout(timer);
locate();
timer = null;
kbEnabled = false;
var posx = 0,
sLft = 0,
sTop = 0;
// Internet Explorer doctype woes
if (document.documentElement && document.documentElement.scrollTop) {
sTop = document.documentElement.scrollTop;
sLft = document.documentElement.scrollLeft;
} else if (document.body) {
sTop = document.body.scrollTop;
sLft = document.body.scrollLeft;
};
if (e.pageX) posx = vertical ? e.pageY : e.pageX;
else if (e.clientX) posx = vertical ? e.clientY + sTop : e.clientX + sLft;
posx -= vertical ? y + Math.round(handle.offsetHeight / 2) : x + Math.round(handle.offsetWidth / 2);
posx = snapToNearestValue(posx);
if(useTween) {
tweenTo(posx);
} else if(clickJump) {
pixelsToValue(posx);
} else {
addEvent(document, 'mouseup', onMouseUp);
destPos = posx;
onTimer();
};
};
function incrementHandle(numOfSteps) {
var value = tagName == "input" ? parseFloat(inp.value) : inp.selectedIndex;
if(isNaN(value) || value < Math.min(min,max)) value = Math.min(min,max);
value += inc * numOfSteps;
valueToPixels(value);
};
function snapToNearestValue(px) {
var rem = px % stepPx;
if(rem && rem >= (stepPx / 2)) { px += (stepPx - rem); }
else { px -= rem; };
return Math.min(Math.max(parseInt(px, 10), 0), maxPx);
};
function locate(){
var curleft = 0,
curtop = 0,
obj = outerWrapper;
// Try catch for IE's benefit
try {
while (obj.offsetParent) {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
obj = obj.offsetParent;
};
} catch(err) {};
x = curleft;
y = curtop;
};
function onTimer() {
var xtmp = vertical ? handle.offsetTop : handle.offsetLeft;
xtmp = Math.round((destPos < xtmp) ? Math.max(destPos, Math.floor(xtmp - deltaPx)) : Math.min(destPos, Math.ceil(xtmp + deltaPx)));
pixelsToValue(xtmp);
if(xtmp != destPos) timer = setTimeout(onTimer, steps > 20 ? 50 : 100);
else kbEnabled = true;
};
var tween = function(){
frame++;
var c = tweenC,
d = 20,
t = frame,
b = tweenB,
x = Math.ceil((t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b);
pixelsToValue(t == d ? tweenX : x);
callback("move");
if(t!=d) timer = setTimeout(tween, 20);
else {
clearTimeout(timer);
timer = null;
kbEnabled = true;
};
};
function tweenTo(tx){
kbEnabled = false;
tweenX = parseInt(tx, 10);
tweenB = parseInt(vertical ? handle.style.top : handle.style.left, 10);
tweenC = tweenX - tweenB;
tweenD = 20;
frame = 0;
if(!timer) timer = setTimeout(tween, 20);
};
function pixelsToValue(px) {
handle.style[vertical ? "top" : "left"] = px + "px";
var val = min + (Math.round(px / stepPx) * inc);
setInputValue((tagName == "select" || inc == 1) ? Math.round(val) : val);
};
function valueToPixels(val) {
var value = isNaN(val) ? tagName == "input" ? parseFloat(inp.value) : inp.selectedIndex : val;
if(isNaN(value) || value < Math.min(min,max)) value = Math.min(min,max);
else if(value > Math.max(min,max)) value = Math.max(min,max);
setInputValue(value);
handle.style[vertical ? "top" : "left"] = Math.round(((value - min) / inc) * stepPx) + "px";
};
function setInputValue(val) {
val = isNaN(val) ? min : val;
if(tagName == "select") {
try {
val = parseInt(val, 10);
if(inp.selectedIndex == val) return;
inp.options[val].selected = true;
} catch (err) {};
} else {
val = (min + (Math.round((val - min) / inc) * inc)).toFixed(precision);
if(inp.value == val) return;
inp.value = val;
};
updateAriaValues();
callback("update");
};
function findLabel() {
var label;
if(inp.parentNode && inp.parentNode.tagName.toLowerCase() == "label") label = inp.parentNode;
else {
var labelList = document.getElementsByTagName('label');
// loop through label array attempting to match each 'for' attribute to the id of the current element
for(var i = 0, lbl; lbl = labelList[i]; i++) {
// Internet Explorer requires the htmlFor test
if((lbl['htmlFor'] && lbl['htmlFor'] == inp.id) || (lbl.getAttribute('for') == inp.id)) {
label = lbl;
break;
};
};
};
if(label && !label.id) { label.id = inp.id + "_label"; };
return label;
};
function updateAriaValues() {
handle.setAttribute("aria-valuenow", tagName == "select" ? inp.options[inp.selectedIndex].value : inp.value);
handle.setAttribute("aria-valuetext", tagName == "select" ? inp.options[inp.selectedIndex].text : inp.value);
};
function onChange( e ) {
valueToPixels();
callback("update");
return true;
};
(function() {
if(hideInput) { inp.className += " fd_hide_slider_input"; }
else { addEvent(inp, 'change', onChange); };
outerWrapper = document.createElement('div');
outerWrapper.className = "fd-slider" + (vertical ? "-vertical " : " ") + classNames;
outerWrapper.id = "fd-slider-" + inp.id;
wrapper = document.createElement('span');
wrapper.className = "fd-slider-inner";
bar = document.createElement('span');
bar.className = "fd-slider-bar";
if(fullARIA) {
handle = document.createElement('span');
handle.setAttribute(!/*@cc_on!@*/false ? "tabIndex" : "tabindex", "0");
} else {
handle = document.createElement('button');
handle.setAttribute("type", "button");
};
handle.className = "fd-slider-handle";
handle.appendChild(document.createTextNode(String.fromCharCode(160)));
outerWrapper.appendChild(wrapper);
outerWrapper.appendChild(bar);
outerWrapper.appendChild(handle);
inp.parentNode.insertBefore(outerWrapper, inp);
/*@cc_on@*/
/*@if(@_win32)
handle.unselectable = "on";
bar.unselectable = "on";
wrapper.unselectable = "on";
outerWrapper.unselectable = "on";
/*@end@*/
addEvent(outerWrapper, "mouseover", onMouseOver);
addEvent(outerWrapper, "mouseout", onMouseOut);
addEvent(outerWrapper, "mousedown", onMouseDown);
if(!window.opera) {
addEvent(handle, "keydown", onKeyDown);
addEvent(handle, "keypress", onKeyPress);
} else {
addEvent(handle, "keypress", onKeyDown);
};
addEvent(handle, "focus", onFocus);
addEvent(handle, "blur", onBlur);
addEvent(handle, "mousedown", onHandleMouseDown);
addEvent(handle, "mouseup", onHandleMouseUp);
// Add ARIA accessibility info programmatically
handle.setAttribute("role", "slider");
handle.setAttribute("aria-valuemin", min);
handle.setAttribute("aria-valuemax", max);
var lbl = findLabel();
if(lbl) {
handle.setAttribute("aria-labelledby", lbl.id);
handle.id = "fd-slider-handle-" + inp.id;
/*@cc_on
/*@if(@_win32)
lbl.setAttribute("htmlFor", handle.id);
@else @*/
lbl.setAttribute("for", handle.id);
/*@end
@*/
};
// Are there page instructions - the creation of the instructions has been left up to you fine reader...
if(document.getElementById("fd_slider_describedby")) {
handle.setAttribute("aria-describedby", "fd_slider_describedby"); // aaa:describedby
};
updateAriaValues();
callback("create");
redraw();
})();
return {
onResize: function(e) { if(outerWrapper.offsetHeight != sliderH || outerWrapper.offsetWidth != sliderW) { redraw(); }; },
destroy: function() { destroySlider(); },
reset: function() { valueToPixels(); },
increment: function(n) { incrementHandle(n); }
};
};
addEvent(window, "load", init);
addEvent(window, "unload", unload);
addEvent(window, "resize", resize);
/*@cc_on@*/
/*@if(@_win32)
var onload = function(e) {
for(slider in sliders) { sliders[slider].reset(); }
};
addEvent(window, "load", function() { setTimeout(onload, 200) });
/*@end@*/
return {
create: function(elem) { init(elem) },
destroyAll: function() { destroyAllsliders(); },
destroySlider: function(id) { return destroySingleSlider(id); },
redrawAll: function() { resize(); },
increment: function(id, numSteps) { if(!(id in sliders)) { return false; }; sliders[id].increment(numSteps); },
addEvent: addEvent,
removeEvent: removeEvent,
stopEvent: stopEvent,
disableMouseWheel: function() { removeMouseWheelSupport(); },
removeOnLoadEvent: function() { removeOnloadEvent(); }
}
})();
if(typeof $WowheadPower=="undefined"){var $WowheadPower=new function(){function s(AS,AR){var AQ=document.createElement(AS);if(AR){AK(AQ,AR)}return AQ}function N(AQ,AR){return AQ.appendChild(AR)}function r(AR,AS,AQ){if(window.attachEvent){AR.attachEvent("on"+AS,AQ)}else{AR.addEventListener(AS,AQ,false)}}function AK(AS,AQ){for(var AR in AQ){if(typeof AQ[AR]=="object"){if(!AS[AR]){AS[AR]={}}AK(AS[AR],AQ[AR])}else{AS[AR]=AQ[AR]}}}function l(AQ){if(!AQ){AQ=event}if(!AQ._button){AQ._button=AQ.which?AQ.which:AQ.button;AQ._target=AQ.target?AQ.target:AQ.srcElement}return AQ}function AA(){var AR=0,AQ=0;if(typeof window.innerWidth=="number"){AR=window.innerWidth;AQ=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){AR=document.documentElement.clientWidth;AQ=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){AR=document.body.clientWidth;AQ=document.body.clientHeight}}}return{w:AR,h:AQ}}function Z(){var AQ=0,AR=0;if(typeof (window.pageYOffset)=="number"){AQ=window.pageXOffset;AR=window.pageYOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){AQ=document.body.scrollLeft;AR=document.body.scrollTop}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){AQ=document.documentElement.scrollLeft;AR=document.documentElement.scrollTop}}}return{x:AQ,y:AR}}function AG(AS){var AR,AT;if(window.innerHeight){AR=AS.pageX;AT=AS.pageY}else{var AQ=Z();AR=AS.clientX+AQ.x;AT=AS.clientY+AQ.y}return{x:AR,y:AT}}function a(AR){var AQ=a.L;return(AQ[AR]?AQ[AR]:0)}a.L={fr:2,de:3,es:6,ru:7,wotlk:0};function AE(AQ){var AR=AE.L;return(AR[AQ]?AR[AQ]:-1)}AE.L={npc:1,object:2,item:3,itemset:4,quest:5,spell:6,zone:7,faction:8,pet:9,achievement:10};function n(AV,AR,AU){var AT={12:1.5,13:12,14:15,15:5,16:10,17:10,18:8,19:14,20:14,21:14,22:10,23:10,24:0,25:0,26:0,27:0,28:10,29:10,30:10,31:10,32:14,33:0,34:0,35:25,36:10,37:2.5,44:4.69512176513672};if(AV<0){AV=1}else{if(AV>80){AV=80}}if((AR==14||AR==12||AR==15)&&AV<34){AV=34}if(AU<0){AU=0}var AS;if(AT[AR]==null){AS=0}else{var AQ;if(AV>70){AQ=(82/52)*Math.pow((131/63),((AV-70)/10))}else{if(AV>60){AQ=(82/(262-3*AV))}else{if(AV>10){AQ=((AV-8)/52)}else{AQ=2/52}}}AS=AU/AT[AR]/AQ}return AS}var Y={applyto:3},I,x,AF,q,h,AH,i,v,t,Q=document.getElementsByTagName("head")[0],c={},X={},J={},AO={},w,W,C,d,AI,F=1,m=0,y=!!(window.attachEvent&&!window.opera),S=navigator.userAgent.indexOf("MSIE 7.0")!=-1,U=navigator.userAgent.indexOf("MSIE 6.0")!=-1&&!S,g={loading:"Loading...",noresponse:"No response from server :("},AC=0,M=1,K=2,p=3,AB=4,f=3,o=5,V=6,z=10,P=15,k=15,R={3:[c,"item","Item"],5:[X,"quest","Quest"],6:[J,"spell","Spell"],10:[AO,"achievement","Achievement"]},H={0:"enus",2:"frfr",3:"dede",6:"eses",7:"ruru"};function AM(){N(Q,s("link",{type:"text/css",href:"http://www.wowhead.com/widgets/power/power.css?3",rel:"stylesheet"}));if(y){N(Q,s("link",{type:"text/css",href:"http://www.wowhead.com/widgets/power/power_ie.css?3",rel:"stylesheet"}));if(U){N(Q,s("link",{type:"text/css",href:"http://www.wowhead.com/widgets/power/power_ie6.css?3",rel:"stylesheet"}))}}r(document,"mouseover",e)}function O(AQ){var AR=AG(AQ);v=AR.x;t=AR.y}function AN(AZ,AX){if(AZ.nodeName!="A"&&AZ.nodeName!="AREA"){return -2323}if(!AZ.href.length){return }var AW,AU,AS,AR,AT={};var AQ=function(Aa,Ac,Ab){if(Ac=="buff"){AT[Ac]=true}else{if(Ac=="rand"||Ac=="ench"||Ac=="lvl"){AT[Ac]=parseInt(Ab)}else{if(Ac=="gems"||Ac=="pcs"){AT[Ac]=Ab.split(":")}}}};if(Y.applyto&1){AW=1;AU=2;AS=3;AR=AZ.href.match(/^http:\/\/(www|dev|fr|es|de|ru|wotlk)?\.?wowhead\.com\/\?(item|quest|spell|achievement)=([0-9]+)/);m=0}if(AR==null&&(Y.applyto&2)&&AZ.rel){AW=0;AU=1;AS=2;AR=AZ.rel.match(/(item|quest|spell|achievement).?([0-9]+)/);m=1}AZ.href.replace(/([a-zA-Z]+).?([0-9:\\-]*)/g,AQ);if(AZ.rel){AZ.rel.replace(/([a-zA-Z]+).?([0-9:\\-]*)/g,AQ)}if(AR){var AY,AV="www";if(AW&&AR[AW]){AV=AR[AW]}AY=a(AV);if(AV=="wotlk"){AV="www"}q=AV;if(!AZ.onmousemove){AZ.onmousemove=B;AZ.onmouseout=D}O(AX);j(AE(AR[AU]),AR[AS],AY,AT)}}function e(AS){AS=l(AS);var AR=AS._target;var AQ=0;while(AR!=null&&AQ<3&&AN(AR,AS)==-2323){AR=AR.parentNode;++AQ}}function B(AQ){AQ=l(AQ);O(AQ);b()}function D(){I=null;h=[];AH=null;i=null;T()}function G(){if(!w){var AV=s("div"),AZ=s("table"),AS=s("tbody"),AU=s("tr"),AR=s("tr"),AQ=s("td"),AY=s("th"),AX=s("th"),AW=s("th");AV.className="wowhead-tooltip";AY.style.backgroundPosition="top right";AX.style.backgroundPosition="bottom left";AW.style.backgroundPosition="bottom right";N(AU,AQ);N(AU,AY);N(AS,AU);N(AR,AX);N(AR,AW);N(AS,AR);N(AZ,AS);d=s("p");d.style.display="none";N(d,s("div"));N(AV,d);N(AV,AZ);N(document.body,AV);w=AV;W=AZ;C=AQ;var AT=s("div");AT.className="wowhead-tooltip-powered";N(AV,AT);AI=AT;T()}}function AP(AT,AU,AV,AR){if(!w){G()}if(!AT){AT=R[I][2]+" not found :(";AU="Temp"}else{if(AV&&AV.length){var AW=0;for(var AS=0,AQ=AV.length;AS")!=-1){AT=AT.replace("",'');++AW}}if(AW>0){AT=AT.replace("(0/","("+AW+"/");AT=AT.replace(new RegExp("\\(([0-"+AW+"])\\) Set:","g"),'($1) Set:')}}if(AR){AT=AT.replace(/\(([0-9.%]+)(.+?)([0-9]+)\)/g,function(AY,AY,AZ,AX,AY,Ab,AY){var Aa=n(AR,AZ,AX);Aa=(Math.round(Aa*100)/100);if(AZ!=12&&AZ!=37){Aa+="%"}return"("+Aa+Ab+AR+")"})}}if(AI){AI.style.display=(m?"":"none")}if(F&&AU){d.style.backgroundImage="url(http://static.wowhead.com/images/icons/medium/"+AU.toLowerCase()+".jpg)";d.style.display=""}else{d.style.backgroundImage="none";d.style.display="none"}w.style.display="";w.style.width="320px";C.innerHTML=AT;AL();b();w.style.visibility="visible"}function T(){if(!w){return }w.style.display="none";w.style.visibility="hidden"}function AL(){var AR=C.childNodes;if(AR.length>=2&&AR[0].nodeName=="TABLE"&&AR[1].nodeName=="TABLE"){AR[0].style.whiteSpace="nowrap";var AQ;if(AR[1].offsetWidth>300){AQ=Math.max(300,AR[0].offsetWidth)+20}else{AQ=Math.max(AR[0].offsetWidth,AR[1].offsetWidth)+20}if(AQ>20){w.style.width=AQ+"px";AR[0].style.width=AR[1].style.width="100%"}}else{w.style.width=W.offsetWidth+"px"}}function b(){if(!w){return }if(v==null){return }var AZ=AA(),Aa=Z(),AW=AZ.w,AT=AZ.h,AV=Aa.x,AS=Aa.y,AU=W.offsetWidth,AQ=W.offsetHeight,AR=v+P,AY=t-AQ-k;if(AR+P+AU+4>=AV+AW){var AX=v-AU-P;if(AX>=0){AR=AX}else{AR=AV+AW-AU-P-4}}if(AYAS+AT){AY=AS+AT-AQ;if(F){if(v>=AR-48&&v<=AR&&t>=AY-4&&t<=AY+48){AY-=48-(t-AY)}}}}w.style.left=AR+"px";w.style.top=AY+"px"}function AJ(AQ){return(i?"buff_":"tooltip_")+H[AQ]}function AD(AS,AT,AR){var AQ=R[AS][0];if(AQ[AT]==null){AQ[AT]={}}if(AQ[AT].status==null){AQ[AT].status={}}if(AQ[AT].status[AR]==null){AQ[AT].status[AR]=AC}}function j(AT,AV,AR,AU){if(!AU){AU={}}var AS=AV+(AU.rand?"r"+AU.rand:"")+(AU.ench?"e"+AU.ench:"")+(AU.gems?"g"+AU.gems.join(","):"");I=AT;x=AS;AF=AR;h=AU.pcs;AH=AU.lvl;i=AU.buff;AD(AT,AS,AR);var AQ=R[AT][0];if(AQ[AS].status[AR]==AB||AQ[AS].status[AR]==p){AP(AQ[AS][AJ(AR)],AQ[AS].icon,h,AH)}else{if(AQ[AS].status[AR]==M){AP(g.tooltip_loading)}else{E(AT,AV,AR,null,AU)}}}function E(AW,AQ,AY,AV,AS){var AX=AQ+(AS.rand?"r"+AS.rand:"")+(AS.ench?"e"+AS.ench:"")+(AS.gems?"g"+AS.gems.join(","):"");var AU=R[AW][0];if(AU[AX].status[AY]!=AC&&AU[AX].status[AY]!=K){return }AU[AX].status[AY]=M;if(!AV){AU[AX].timer=setTimeout(function(){L.apply(this,[AW,AX,AY])},333)}var AR="";for(var AT in AS){if(AT!="rand"&&AT!="ench"&&AT!="gems"){continue}if(typeof AS[AT]=="object"){AR+="&"+AT+"="+AS[AT].join(":")}else{AR+="&"+AT+"="+AS[AT]}}A("http://"+q+".wowhead.com/?"+R[AW][1]+"="+AQ+AR+"&power&lol")}function A(AQ){N(Q,s("script",{type:"text/javascript",src:AQ}))}function L(AS,AT,AR){if(I==AS&&x==AT&&AF==AR){AP(g.loading);var AQ=R[AS][0];AQ[AT].timer=setTimeout(function(){u.apply(this,[AS,AT,AR])},3850)}}function u(AS,AT,AR){var AQ=R[AS][0];AQ[AT].status[AR]=K;if(I==AS&&x==AT&&AF==AR){AP(g.tooltip_noresponse)}}this.register=function(AT,AU,AR,AS){var AQ=R[AT][0];clearTimeout(AQ[AU].timer);AK(AQ[AU],AS);if(AQ[AU][AJ(AR)]){AQ[AU].status[AR]=AB}else{AQ[AU].status[AR]=p}if(I==AT&&AU==x&&AF==AR){AP(AQ[AU][AJ(AR)],AQ[AU].icon,h,AH)}};this.registerItem=function(AS,AQ,AR){this.register(f,AS,AQ,AR)};this.registerQuest=function(AS,AQ,AR){this.register(o,AS,AQ,AR)};this.registerSpell=function(AS,AQ,AR){this.register(V,AS,AQ,AR)};this.registerAchievement=function(AS,AQ,AR){this.register(z,AS,AQ,AR)};this.set=function(AQ){AK(Y,AQ)};this.showTooltip=function(AS,AR,AQ){O(AS);AP(AR,AQ)};this.hideTooltip=function(){T()};this.moveTooltip=function(AQ){B(AQ)};AM()}};