

// DBX3.0 :: Docking Boxes (dbx)
// *****************************************************
// DOM scripting by brothercake -- http://www.brothercake.com/
// GNU Lesser General Public License -- http://www.gnu.org/licenses/lgpl.html
//******************************************************
var dbx;function dbxManager(sid, useid, hide, buttontype){dbx = this;if(!/^[-_a-z0-9]+$/i.test(sid)) { throw('Error from dbxManager:\n"' + sid + '" is an invalid session ID'); return; }this.kde = navigator.vendor == 'KDE';this.safari = navigator.vendor == 'Apple Computer, Inc.';this.chrome = navigator.vendor == 'Google Inc.';this.opera = typeof window.opera != 'undefined';this.msie = typeof document.uniqueID != 'undefined';this.supported = (!(typeof document.getElementsByTagName == 'undefined'|| document.getElementsByTagName('*').length == 0|| (this.kde && typeof window.sidebar == 'undefined')|| (this.opera && parseFloat(navigator.userAgent.toLowerCase().split(/opera[\/ ]/)[1].split(' ')[0], 10) < 8)));if(!this.supported) { return; }this.etype = typeof document.addEventListener != 'undefined' ? 'addEventListener' : typeof document.attachEvent != 'undefined' ? 'attachEvent' : 'none';if(this.etype == 'none') { this.supported = false; return; }this.eprefix = (this.etype == 'attachEvent' ? 'on' : '');this.sid = sid;this.cookiename = 'dbx-' + this.sid + '=';this.useid = typeof useid != 'undefined' && useid == 'yes' ? true : false;this.hide = typeof hide != 'undefined' && hide == 'no' ? false : true;this.buttontype = typeof buttontype != 'undefined' && buttontype == 'button' ? 'button' : 'link';this.running = 0;this.gnumbers = {};this.max = 0;this.rootcookie = '';if(document.cookie && document.cookie.indexOf(this.cookiename) != -1){this.rootcookie = document.cookie.split(this.cookiename)[1].split(';')[0];this.rootcookie = this.rootcookie.replace(/\|/g, ',').replace(/:/g, '=');if(this.rootcookie.indexOf('+') == -1){this.rootcookie = this.rootcookie.replace(/(,|$|&)/ig, '+$1').replace(/(\-\+)/g, '-');}}this.savedata = {};this.cookiestate = this.getCookieState();};dbxManager.prototype.setCookieState = function(){var now = new Date();now.setTime(now.getTime() + (365*24*60*60*1000));this.compileStateString();this.cookiestring = this.state.replace(/,/g, '|').replace(/=/g, ':').replace(/\+/g, '');if(typeof this.onstatechange == 'undefined' || this.onstatechange()){document.cookie = this.cookiename+ this.cookiestring+ '; expires=' + now.toGMTString()+ '; path=/';}};dbxManager.prototype.getCookieState = function(){this.cookiestate = null;if(document.cookie){if(document.cookie.indexOf(this.cookiename) != -1){this.cookie = document.cookie.split(this.cookiename)[1].split(';')[0].split('&');for(var i in this.cookie){if(this.unwanted(this.cookie, i)) { continue; }this.cookie[i] = this.cookie[i].replace(/\|/g, ',');this.cookie[i] = this.cookie[i].replace(/:/g, '=');if(this.cookie[i].indexOf('+') == -1){this.cookie[i] = this.cookie[i].replace(/(,|$|&)/ig, '+$1').replace(/(\-\+)/g, '-');}this.cookie[i] = this.cookie[i].split('=');this.cookie[i][1] = this.cookie[i][1].split(',');}this.cookiestate = {};for(i in this.cookie){if(this.unwanted(this.cookie, i)) { continue; }this.cookiestate[this.cookie[i][0]] = this.cookie[i][1];}}}return this.cookiestate;};dbxManager.prototype.compileStateString = function(){var str = '';for(var j in this.savedata){if(this.unwanted(this.savedata, j)) { continue; }str += j + '=' + this.savedata[j] + '&'}this.state = str.replace(/^(.+)&$/, '$1');};dbxManager.prototype.createElement = function(tag){return typeof document.createElementNS != 'undefined' ? document.createElementNS('http://www.w3.org/1999/xhtml', tag) : document.createElement(tag);};dbxManager.prototype.getTarget = function(e, pattern, node){if(typeof node != 'undefined'){var target = node;}else{target = typeof e.target != 'undefined' ? e.target : e.srcElement;}while(!this.hasClass(target, pattern)){target = target.parentNode;if(this.hasClass(target, 'dbx\-group') && !this.hasClass(target, pattern)){return null;}}return target;};dbxManager.prototype.getID = function(element){if(!element || !element.className) { return null; }else if(this.hasClass(element, 'dbx\-dummy')) { return 'dummy'; }var cname = element.className.split('dbxid-');if(cname.length == 1) { return null; }return cname[1].replace(/^([a-zA-Z0-9_]+).*$/, '$1');};dbxManager.prototype.getSiblingBox = function(root, sibling){var node = root[sibling];while(node && !this.hasClass(node, 'dbx\-box')){node = node[sibling];}if(!node) { node = root; }return node;};dbxManager.prototype.getPosition = function(obj, center){var position = { 'left' : obj.offsetLeft, 'top' : obj.offsetTop };var tmp = obj.offsetParent;while(tmp){position.left += tmp.offsetLeft;position.top += tmp.offsetTop;tmp = tmp.offsetParent;}if(center){position.left += obj.offsetWidth / 2;position.top += obj.offsetHeight / 2;}return position;};dbxManager.prototype.getViewportWidth = function(){return typeof window.innerWidth != 'undefined'? window.innerWidth: (typeof document.documentElement != 'undefined'&& typeof document.documentElement.clientWidth != 'undefined'&& document.documentElement.clientWidth != 0)? document.documentElement.clientWidth: this.get('body')[0].clientWidth;};dbxManager.prototype.compileAndDispatchOnBeforeStateChange = function(){var actions = {};for(var i=0; i<arguments.length; i++){var data = arguments[i];this.dbxobject = data[1];this.group = data[2];this.gid = data[3];this.sourcebox = data[4];this.target = data[5];this.action = data[6];actions[data[0]] = this.onbeforestatechange();}return actions;};dbxManager.prototype.compileAndDispatchOnAnimate = function(box, clone, caller, count, res){dbx.sourcebox = box;dbx.clonebox = clone;dbx.dbxobject = caller;dbx.group = caller.container;dbx.anicount = count - 1;dbx.anilength = res - 1;dbx.onanimate();};dbxManager.prototype.compileAndDispatchOnAfterAnimate = function(box, caller){dbx.sourcebox = box;dbx.dbxobject = caller;dbx.group = caller.container;dbx.onafteranimate();};dbxManager.prototype.unwanted = function(obj, i){return (!obj.hasOwnProperty(i) || typeof obj[i] == 'undefined' || typeof obj[i] == 'function' || i == 'length');};dbxManager.prototype.addEvent = function(node, type, handler){node[this.etype](this.eprefix + type, handler, false);};dbxManager.prototype.trim = function(str){return str.replace(/^\s+|\s+$/g,"");};dbxManager.prototype.empty = function(data){if(typeof data == 'string' && this.trim(data) === '') { return true; }else if(typeof data == 'object'){if(data instanceof Array && data.length == 0) { return true; }else{var n = 0;for(var i in data){if(!data.hasOwnProperty(i)) { continue; }n++;}if(n == 0) { return true; }}}return false;};dbxManager.prototype.hasClass = function(element, pattern){return (element.className && new RegExp(pattern + '($|[ ])').test(element.className));};dbxManager.prototype.removeClass = function(element, pattern){if(typeof flags == 'undefined'){flags = '';}element.className = element.className.replace(new RegExp(pattern, 'g'), '');if(!/\S/.test(element.className)){element.className = '';}return element;};dbxManager.prototype.get = function(find, context){var nodes = [];if(/(previous|next|first|last)(Sibling|Child)/.test(find)){context = context[find];switch(find){case 'nextSibling' :case 'previousSibling' :while(context && context.nodeType != 1){context = context[find];}break;}return context;}else if(find.indexOf('#') != -1){return document.getElementById(find.split('#')[1]);}else {if(typeof context == 'undefined') { context = document; }return context.getElementsByTagName(find);}};function dbxGroup(){if(!dbx.supported) { return; }var args = arguments;if(!/^[-_a-z0-9]+$/i.test(args[0]) || args[0] == 'deleted') { throw('Error from dbxGroup:\n"' + args[0] + '" is an invalid container ID'); return; }this.container = dbx.get('#' + args[0]);if(!dbx.hasClass(this.container, 'dbx\-group')) { throw('Error from dbxGroup:\nGroup container (the element with id="' + args[0] + '") must contain the class name "dbx-group"'); return; }if(!this.container) { return; }this.gid = args[0];this.cacheDynamicClasses();if(typeof dbx.onbeforestatechange != 'undefined'){var actions = dbx.compileAndDispatchOnBeforeStateChange(['proceed', this, this.container, this.gid, null, null, 'load']);if(!actions.proceed){this.container = null;return;}}this.orientation = /^(freeform|confirm|horizontal|vertical|insert(\-swap|\-insert)?)/.test(args[1]) ? args[1] : 'freeform';if(this.orientation == 'insert') { this.orientation = 'freeform-insert'; }this.exchange = 'swap';if(/(freeform|confirm)\-insert/.test(this.orientation)){this.exchange = 'insert';}this.orientation = this.orientation.split('-')[0];this.confirm = false;if(this.orientation == 'confirm'){this.confirm = true;this.orientation = 'freeform';}this.threshold = parseInt(args[2], 10);if(isNaN(this.threshold)) { this.threshold = 0; }this.restrict = args[3] == 'yes' ? this.orientation : '';this.resolution = parseInt(args[4], 10);if(isNaN(this.resolution)) { this.resolution = 0; }if(this.resolution == 0) { this.resolution = 1; }this.toggles = args[5] == 'yes';this.defopen = args[6] != 'closed';this.vocab = {'open' : args[7],'close' : args[8],'move' : args[9],'toggle' : args[10],'kmove' : args[11],'ktoggle' : args[12],'syntax' : args[13],'kyes' : (typeof args[14] != 'undefined' ? args[14] : ''),'kno' : (typeof args[15] != 'undefined' ? args[15] : '')};var self = this;this.dragok = false;this.box = null;this.dialog = null;this.buffer = null;this.last = {'box' : null,'direction' : null};this.child = {'first' : null, 'last' : null};this.keytimer = null;this.currentdir = null;this.rules = { 'global' : { 'pointer' : 0, 'rule' : [], 'actual' : [] } };this.rulekey = '';this.ruledir = '';this.container.style.position = 'relative';this.container.style.display = 'block';this.initBoxes(true, true);this.keydown = false;this.mouseisdown = false;dbx.addEvent(document, 'mouseout', function(e){if(typeof e.target == 'undefined') { e.relatedTarget = e.toElement; }if(e.relatedTarget == null){self.mouseup(e);}});dbx.addEvent(document, 'mousemove', function(e){self.hover(e);self.mousemove(e);return !self.dragok;});dbx.addEvent(document, 'mousedown', function(e){self.mouseisdown = true;});dbx.addEvent(document, 'mouseup', function(e){self.mouseisdown = false;self.mouseup(e);});dbx.addEvent(document, 'keydown', function(e){self.keydown = true;if(self.dialog && !/^((3[7-9])|40|13|(1[6-8]))$/.test(e.keyCode)){self.clearDialog();}});dbx.addEvent(document, 'keyup', function(){self.keydown = false;self.currentdir = null;self.removeActiveClasses('dbx\-box\-active');});};dbxGroup.prototype.initBoxes = function(recover, getspare){this.boxes = { 'length' : 0 };this.handles = [];this.buttons = {};this.order = [];var self = this;this.eles = dbx.get('*', this.container);for(var i=0; i<this.eles.length; i++){var dbxid = this.boxes.length;if(dbx.hasClass(this.eles[i], 'dbx\-box') && !dbx.hasClass(this.eles[i], 'dbx\-(dummy|clone)')){if(dbx.useid){if(/^[a-z][a-z0-9]*$/i.test(this.eles[i].id) && !/^(length|dummy)$/.test(this.eles[i].id)){dbxid = this.eles[i].id;}else if(this.eles[i].id != ''){throw('Error from dbxGroup:\n"' + this.eles[i].id + '" is an invalid box ID');return;}}this.boxes[dbxid] = this.eles[i];this.boxes.length++;this.order.push(dbxid + '+');if(typeof this.eles[i].hashandlers == 'undefined'){dbx.addEvent(this.eles[i], 'mousedown', function(e){if(!e) { e = window.event; }self.mousedown(e, dbx.getTarget(e, 'dbx\-box'));});this.eles[i].hashandlers = true;}if(typeof this.eles[i].processed != 'undefined') { continue; }this.eles[i].style.position = 'relative';this.eles[i].style.display = 'block';this.eles[i].className += ' dbx-box-open';this.eles[i].className += ' dbxid-' + dbxid;this.eles[i].processed = true;}if(dbx.hasClass(this.eles[i], 'dbx\-handle')){this.handles.push(this.eles[i]);var parentbox = dbx.getTarget(null, 'dbx\-box', this.eles[i]);if(this.toggles){dbxid = dbx.getID(parentbox);this.buttons[dbxid] = this.addToggleBehavior(this.eles[i]);}else if(typeof this.eles[i].hashandlers == 'undefined'){var handle = this.eles[i];handle.hasfocus = dbx.opera || dbx.safari ? null : false;if(!dbx.hasClass(parentbox, 'dbx\-nograb')){dbx.addEvent(handle, 'key' + (dbx.msie || dbx.safari || dbx.chrome ? 'down' : 'press'), function(e){if(!e) { e = window.event; }return self.keypress(e, dbx.getTarget(e, 'dbx\-handle'));});dbx.addEvent(handle, 'click', function(e){if(self.dialog){self.click(e, dbx.getTarget(e, 'dbx\-handle'));if(typeof e.preventDefault != 'undefined') { e.preventDefault(); }else { return false; }}});}dbx.addEvent(handle, 'focus', function(e){if(!e) { e = window.event; }var parentbox = dbx.getTarget(e, 'dbx\-box');if(self.keydown || (dbx.kde && !self.mouseisdown)){parentbox.className += ' dbx-box-focus';}var handle = dbx.getTarget(e, 'dbx\-handle');var tooltiptext = self.vocab.kmove;if(dbx.hasClass(parentbox, 'dbx\-nograb')){tooltiptext = handle.getAttribute('oldtitle');}else if(!dbx.empty(handle.getAttribute('oldtitle'))){tooltiptext = self.vocab.syntax.replace(/%mytitle[%]?/, handle.getAttribute('oldtitle')).replace(/%dbxtitle[%]?/, tooltiptext)}if(!dbx.empty(tooltiptext)){self.createTooltip(tooltiptext,handle,(self.keydown || (dbx.kde && !self.mouseisdown)));}if(handle.hasfocus !== null) { handle.hasfocus = true; }});dbx.addEvent(handle, 'blur', function(e){if(!e) { e = window.event; }dbx.removeClass(dbx.getTarget(e, 'dbx\-box'), 'dbx\-box\-focus');self.removeTooltip();var handle = dbx.getTarget(e, 'dbx\-handle');if(handle.hasfocus !== null) { handle.hasfocus = false; }});this.eles[i].hashandlers = true;}if(typeof this.eles[i].processed != 'undefined') { continue; }var oldtitle = this.eles[i].getAttribute('title');if(oldtitle) { this.eles[i].setAttribute('oldtitle', oldtitle); }this.eles[i].style.position = 'relative';this.eles[i].style.display = 'block';if(!dbx.hasClass(parentbox, 'dbx\-nograb')){this.eles[i].className += ' dbx-handle-cursor';this.eles[i].setAttribute('title', dbx.empty(this.eles[i].getAttribute('title'))? this.vocab.move : this.vocab.syntax.replace(/%mytitle[%]?/, this.eles[i].title).replace(/%dbxtitle[%]?/, this.vocab.move));}this.eles[i].processed = true;}if(dbx.msie && dbx.hasClass(this.eles[i], 'dbx\-(content|box)')){this.eles[i].runtimeStyle.zoom = '1.0';}}this.updateChildClasses();dbx.savedata[this.gid] = this.order.join(',');var dummy = this.container.appendChild(dbx.createElement('span'));dummy.className = 'dbx-box dbx-dummy';dummy.style.display = 'block';dummy.style.width = '0';dummy.style.height = '0';dummy.style.overflow = 'hidden';dummy.className += ' dbx-offdummy';dbxid = this.boxes.length;if(typeof dbx.gnumbers[this.gid] != 'undefined'){dbxid += '_' + dbx.gnumbers[this.gid];}this.boxes[dbxid] = dummy;this.boxes.length++;if(!recover) { return; }if(dbx.cookiestate && typeof dbx.cookiestate[this.gid] != 'undefined'){var num = dbx.cookiestate[this.gid].length;for(i=0; i<num; i++){var index = dbx.cookiestate[this.gid][i].replace(/[\-\+]/g, '');if(typeof this.boxes[index] != 'undefined' && this.boxes[index] != dummy){this.container.insertBefore(this.boxes[index], dummy);if(this.toggles && /\-$/.test(dbx.cookiestate[this.gid][i])){if(typeof this.buttons[index] != 'undefined'){this.toggleBoxState(this.buttons[index], false, false, true);}}}}this.regenerateBoxOrder();}else if(!this.defopen && this.toggles){for(i in this.buttons){if(dbx.unwanted(this.buttons, i)) { continue; }this.toggleBoxState(this.buttons[i], true, false, null);}}};dbxGroup.prototype.cacheDynamicClasses = function(){var eles = [], classes = ['dbx-tooltip', 'dbx-dragclone', 'dbx-dialog'];for(var i=0; i<classes.length; i++){eles[i] = dbx.createElement('div');eles[i].className = 'dbx-clone ' + classes[i];this.container.appendChild(eles[i]);}setTimeout(function(){for(var i=0; i<eles.length; i++){if(eles[i].parentNode){eles[i].parentNode.removeChild(eles[i]);}}}, 100);};dbxGroup.prototype.addToggleBehavior = function(){var self = this;var existing = dbx.get((dbx.buttontype == 'link' ? 'a' : 'button'), arguments[0]);for(var i=0; i<existing.length; i++){if(dbx.hasClass(existing[i], 'dbx\-toggle')){var button = existing[i];break;}}if(typeof button == 'undefined'){if(dbx.buttontype == 'link'){button = arguments[0].appendChild(dbx.createElement('a'));button.appendChild(document.createTextNode('\u00a0'));button.href = 'javascript:void(null)';}else{button = arguments[0].appendChild(dbx.createElement('button'));}button.className = 'dbx-toggle dbx-toggle-open';button.setAttribute('title', this.vocab.toggle.replace(/%toggle[%]?/, this.vocab.close));}button.style.cursor = 'pointer';button.hasfocus = dbx.opera || dbx.safari || dbx.chrome ? null : false;this.tooltip = null;if(typeof button.hashandlers == 'undefined'){button.onclick = function(e){self.click(e, this);return false;};button['onkey' + (dbx.msie || dbx.safari || dbx.chrome ? 'down' : 'press')] = function(e){if(!e) { e = window.event; }return self.keypress(e, this);};button.onfocus = function(){for(var i in self.buttons){if(dbx.unwanted(self.buttons, i)) { continue; }self.buttons[i] = dbx.removeClass(self.buttons[i], '(dbx\-toggle\-hilite\-)(open|closed)');}var isopen = dbx.hasClass(this, 'dbx\-toggle\-open');this.className += ' dbx-toggle-hilite-' + (isopen ? 'open' : 'closed');if(self.keydown || (dbx.kde && !self.mouseisdown)){dbx.getTarget(null, 'dbx\-box', this).className += ' dbx-box-focus';}var tooltiptext = (!dbx.hasClass(dbx.getTarget(null, 'dbx\-box', this), 'dbx\-nograb')? self.vocab.kmove : '')+ self.vocab.ktoggle.replace(/%toggle[%]?/, (isopen ? self.vocab.close : self.vocab.open));var handle = dbx.getTarget(null, 'dbx\-handle', this);if(!dbx.empty(handle.getAttribute('oldtitle'))){tooltiptext = self.vocab.syntax.replace(/%mytitle[%]?/, handle.getAttribute('oldtitle')).replace(/%dbxtitle[%]?/, tooltiptext)}self.createTooltip(tooltiptext,this,(self.keydown || (dbx.kde && !self.mouseisdown)));this.isactive = true;if(this.hasfocus !== null) { this.hasfocus = true; }};button.onblur = function(){button = dbx.removeClass(button, '(dbx\-toggle\-hilite\-)(open|closed)');dbx.removeClass(dbx.getTarget(null, 'dbx\-box', this), 'dbx\-box\-focus');self.removeTooltip();if(this.hasfocus !== null) { this.hasfocus = false; }};button.hashandlers = true;}return button;};dbxGroup.prototype.toggleBoxState = function(button, regen, manual, forcestate){var isopen = dbx.hasClass(button, 'dbx\-toggle\-open');if(forcestate !== null) { isopen = forcestate; }var parent = dbx.getTarget(null, 'dbx\-box', button);dbx.sourcebox = parent;dbx.toggle = button;dbx.dbxobject = this;if(typeof dbx.container == 'undefined'){dbx.group = dbx.getTarget(null, 'dbx\-group', parent);}else { dbx.group = dbx.container; }if(typeof dbx.onbeforestatechange != 'undefined'){var actions = dbx.compileAndDispatchOnBeforeStateChange(['proceed', this, this.container, this.gid, parent, button, (isopen ? 'close' : 'open')]);if(!actions.proceed) { return; }}if(manual == false||(!isopen && (typeof dbx.onboxopen == 'undefined' || dbx.onboxopen()))||(isopen && (typeof dbx.onboxclose == 'undefined' || dbx.onboxclose()))){button.className = 'dbx-toggle dbx-toggle-' + (isopen ? 'closed' : 'open');button.title = this.vocab.toggle.replace(/%toggle[%]?/, isopen ? this.vocab.open : this.vocab.close);if(manual && typeof button.isactive != 'undefined'){button.className += ' dbx-toggle-hilite-' + (isopen ? 'closed' : 'open')}parent.className = parent.className.replace(/[ ](dbx-box-)(open|closed)/, ' $1' + (isopen ? 'closed' : 'open'));if(regen) { this.regenerateBoxOrder(); }}};dbxGroup.prototype.moveBoxByKeyboard = function(e, anchor, parent, direction, confirm, manual){dbx.dbxobject = this;dbx.group = this.container;dbx.gid = this.gid;dbx.sourcebox = parent;dbx.clonebox = null;dbx.event = e;var index = '-';this.positive = /[se]/i.test(direction);if(/^(Sw)$/.test(direction)) { this.positive = false; }this.removeActiveClasses('dbx\-box\-(target|active)');var clonepoint = {'x' : parent.offsetLeft,'y' : parent.offsetTop};var differences = [];var boxes = this.boxes;for(var i in boxes){if(dbx.unwanted(boxes, i) || dbx.hasClass(boxes[i], 'dbx\-dummy')) { continue; }var boxpoint = {'x' : boxes[i].offsetLeft,'y' : boxes[i].offsetTop};differences.push([i, boxpoint.x - clonepoint.x, boxpoint.y - clonepoint.y]);if(parent == boxes[i]) { index = i; }}var splitdiffs = {'positive' : [],'negative' : []};var n = /[ew]/i.test(direction) ? 1 : 2;for(i=0; i<differences.length; i++){if(differences[i][0] == index) { continue; }if(differences[i][n] >= 0){splitdiffs.positive.push(differences[i]);}else{splitdiffs.negative.push(differences[i]);}}var ary = this.positive ? splitdiffs.positive : splitdiffs.negative;ary.sort(function(a, b){ return Math.abs(a[n]) - Math.abs(b[n]); });for(i=0; i<ary.length; i++){if(ary[i][n] == 0){ary.splice(i--, 1);}}if(direction.length > 1){for(i=0; i<ary.length; i++){if((/[ew]/i.test(direction) && ary[i][2] == 0)||(/[ns]/i.test(direction) && ary[i][1] == 0)||(/(N[ew])/.test(direction) && ary[i][2] > 0)||(/(S[ew])/.test(direction) && ary[i][2] < 0)){ary.splice(i--, 1);}}}for(i=0; i<ary.length; i++){if(this.positive){if(i > 0 && Math.abs(ary[i][n]) != Math.abs(ary[0][n])){ary.splice(i--, 1);}}else{if(i > 0 && ary[i][n] != ary[0][n]){ary.splice(i--, 1);}}}n = n == 1 ? 2 : 1;ary.sort(function(a, b){ return Math.abs(a[n]) - Math.abs(b[n]); });if(ary.length == 0){index = '-';}else{index = ary[0][0];}var box = dbx.getTarget(null, 'dbx\-box', anchor);if(index == '-'){return false;}var targetbox = boxes[index];if(this.exchange == 'insert' && this.confirm == false && this.positive == true){targetbox = dbx.get('nextSibling', targetbox);if(!targetbox) { targetbox = boxes[index]; }}if(typeof dbx.onboxdrag == 'undefined' || dbx.onboxdrag()){if(box != targetbox && boxes == this.boxes){var origpoint = {'x' : box.offsetLeft + (box.offsetWidth / 2),'y' : box.offsetTop + (box.offsetHeight / 2)};var boxpoint = {'x' : targetbox.offsetLeft + (targetbox.offsetWidth / 2),'y' : targetbox.offsetTop + (targetbox.offsetHeight / 2)};var testblocks = this.getBlocksDifference(origpoint, boxpoint, box);var testcompass = this.getCompassDirection(origpoint, boxpoint);if(this.functionExists('_testRules') && !this._testRules(testcompass, testblocks, box, null)){if(confirm || this.dialog){this.updateDialog(targetbox, ' dbx-dialog-no', null, null, 'keyboard');if(this.vocab.kno != ''){this.createTooltip(this.vocab.kno,box,true);}}if(manual) { this.refocus(anchor); }return false;}}if(box != targetbox && !dbx.hasClass(targetbox, 'dbx\-(dialog|dummy)')){targetbox.className += ' dbx-box-target';}if(confirm || this.dialog){var diffs = null, group = null;if(boxes != this.boxes){group = this.dialog.group;var groupcontainer = dbx.getPosition(group.container, false);var callcontainer = dbx.getPosition(this.container, false);var diffs = {'x' : groupcontainer.left - callcontainer.left,'y' : groupcontainer.top - callcontainer.top};}this.updateDialog(targetbox, ' dbx-dialog-yes', diffs, group, 'keyboard');if(this.vocab.kyes != ''){this.createTooltip(this.vocab.kyes,box,true);}if(manual) { this.refocus(anchor); }return false;}if(this.exchange == 'swap'){return this.swapTwoBoxes(parent, targetbox, anchor, manual, this.positive);}else{return this.insertTwoBoxes(parent, targetbox, anchor, manual, direction);}}return false;};dbxGroup.prototype.insertTwoBoxes = function(original, selected, anchor, manual, positive){if(typeof dbx.onbeforestatechange != 'undefined'){var actions = dbx.compileAndDispatchOnBeforeStateChange(['proceed', this, this.container, this.gid, original, selected, 'insert']);if(!actions.proceed) { return false; }}if(this.functionExists('_updateRulePointer')) { this._updateRulePointer(); }var add = false, pointer = 0, theboxes = [], visiboxes = [];for(var i in this.boxes){if(dbx.unwanted(this.boxes, i)) { continue; }theboxes.push(this.boxes[i]);}for(i=0; i<theboxes.length; i++){if(theboxes[i] == original) { continue; }visiboxes.push(theboxes[i]); }var visiposes = [];for(i=0; i<visiboxes.length; i++){visiposes.push({'x' : visiboxes[i].offsetLeft,'y' : visiboxes[i].offsetTop});}var originalpos = { 'x' : original.offsetLeft, 'y' : original.offsetTop };original.style.visibility = 'hidden';selected = dbx.removeClass(selected, 'dbx\-box\-target');selected.parentNode.insertBefore(original, selected);if(typeof visiboxes != 'undefined' && visiboxes.length > 0){for(i=0; i<visiboxes.length; i++){new dbxAnimator(this, visiboxes[i], visiposes[i], this.resolution, false, null, true);}}new dbxAnimator(this, original, originalpos, this.resolution, true, anchor, manual);this.regenerateBoxOrder();return true;};dbxGroup.prototype.swapTwoBoxes = function(original, selected, anchor, manual, positive){if(typeof dbx.onbeforestatechange != 'undefined'){var actions = dbx.compileAndDispatchOnBeforeStateChange(['proceed', this, this.container, this.gid, original,(this.orientation != 'freeform' && positive ? dbx.getSiblingBox(selected, 'nextSibling') : selected),(this.orientation == 'freeform' ? 'swap' : 'move')]);if(!actions.proceed) { return false; }}if(this.functionExists('_updateRulePointer')) { this._updateRulePointer(); }var selectedpos = { 'x' : selected.offsetLeft, 'y' : selected.offsetTop };var originalpos = { 'x' : original.offsetLeft, 'y' : original.offsetTop };original.style.visibility = 'hidden';selected.style.visibility = 'hidden';selected = dbx.removeClass(selected, 'dbx\-box\-target');var next = selected.nextSibling;if(next == original){selected.parentNode.insertBefore(original, selected);}else{original.parentNode.insertBefore(selected, original);next.parentNode.insertBefore(original, next);}new dbxAnimator(this, selected, selectedpos, this.resolution, true, null, false);new dbxAnimator(this, original, originalpos, this.resolution, true, anchor, manual);this.regenerateBoxOrder();return true;};dbxGroup.prototype.createTooltip = function(text, anchor, okay, cname){if(okay){this.tooltip = this.container.appendChild(dbx.createElement('span'));this.tooltip.style.visibility = 'hidden';this.tooltip.className = 'dbx-tooltip';this.tooltip.appendChild(document.createTextNode(text));var parent = dbx.getTarget(null, 'dbx\-box', anchor);this.tooltip.style.left = parseInt(parent.offsetLeft, 10) + 'px';this.tooltip.style.top = parseInt(parent.offsetTop, 10) + 'px';var position = dbx.getPosition(this.tooltip);var viewsize = dbx.getViewportWidth();var tipsize = this.tooltip.offsetWidth;if(position.left + tipsize > viewsize){this.tooltip.style.left = parseInt(parent.offsetLeft - (position.left + tipsize - viewsize), 10) + 'px';}var tooltip = this.tooltip;window.setTimeout(function(){if(tooltip != null) { tooltip.style.visibility = 'visible'; }}, 400);}};dbxGroup.prototype.removeTooltip = function(){if(this.tooltip){this.tooltip.parentNode.removeChild(this.tooltip);this.tooltip = null;}};dbxGroup.prototype.hover = function(e){if(!this.keydown || (dbx.kde && !this.mouseisdown)){var found = false, target = typeof e.target != 'undefined' ? e.target : e.srcElement;for(var i=0; i<this.handles.length; i++){if(this.contains(this.handles[i], target)){found = true;var parentbox = dbx.getTarget(null, 'dbx\-box', this.handles[i]);if(!dbx.hasClass(parentbox, 'dbx\-box\-hover')){if(typeof this.hoverbox != 'undefined'){this.hoverbox = dbx.removeClass(this.hoverbox, 'dbx\-box\-hover');}this.hoverbox = parentbox;parentbox.className += ' dbx-box-hover';}break;}}if(!found){if(typeof this.hoverbox != 'undefined'){this.hoverbox = dbx.removeClass(this.hoverbox, 'dbx\-box\-hover');delete this.hoverbox;}}}};dbxGroup.prototype.refresh = function(recover){if(!dbx.supported) { return; }if(typeof recover == 'undefined') { recover = false; }this.eles = dbx.get('*', this.container);for(var i=0; i<this.eles.length; i++){if(dbx.hasClass(this.eles[i], 'dbx\-dummy')){this.container.removeChild(this.eles[i]);}}this.initBoxes(recover, true);this.regenerateBoxOrder();};dbxGroup.prototype.functionExists = function(cname){return typeof this[cname] == 'function';};dbxGroup.prototype.mousedown = function(e, box, handle, override){var node = typeof handle != 'undefined' ? handle : typeof e.target != 'undefined' ? e.target : e.srcElement;if(node.nodeName == '#text') { node = node.parentNode; }if(!dbx.hasClass(node, 'dbx\-(toggle|box|group)')){while(!dbx.hasClass(node, 'dbx\-(handle|box|group)')){node = node.parentNode;}}if(dbx.hasClass(node, 'dbx\-(toggle|handle)')){box.className += ' dbx-box-active';}if(!dbx.hasClass(box, 'dbx\-nograb') && dbx.hasClass(node, 'dbx\-handle')){this.clearDialog();box = dbx.removeClass(box, 'dbx\-box\-focus');this.removeTooltip();this.released = false;this.initial = { 'x' : e.clientX, 'y' : e.clientY };if(typeof override != 'undefined'){this.initial.x += (0 - override.x);this.initial.y += (0 - override.y);}this.current = { 'x' : 0, 'y' : 0 };this.createCloneBox(box, 'mouse');if(typeof e.preventDefault != 'undefined' ) { e.preventDefault(); }if(typeof document.onselectstart != 'undefined'){document.onselectstart = function() { return false; }}}};dbxGroup.prototype.mousemove = function(e){if(!this.dragok && (this.dialog && this.dialog.source != 'keyboard')){this.clearDialog();this.removeTooltip();this.removeActiveClasses('dbx\-box\-(target|active)');}if(this.dragok && this.box){this.direction = e.clientY == this.current.y? (e.clientX > this.current.x ? 'right' : 'left'): (e.clientY > this.current.y ? 'down' : 'up');this.current = { 'x' : e.clientX, 'y' : e.clientY };var overall = { 'x' : this.current.x - this.initial.x, 'y' : this.current.y - this.initial.y };if(((overall.x >= 0 && overall.x <= this.threshold) || (overall.x <= 0 && overall.x >= 0 - this.threshold))&&((overall.y >= 0 && overall.y <= this.threshold) || (overall.y <= 0 && overall.y >= 0 - this.threshold))){this.current.x -= overall.x;this.current.y -= overall.y;}if(this.released || overall.x > this.threshold || overall.x < (0 - this.threshold) || overall.y > this.threshold || overall.y < (0 - this.threshold)){dbx.dbxobject = this;dbx.group = this.container;dbx.sourcebox = this.box;dbx.clonebox = this.boxclone;dbx.event = e;if(typeof dbx.onboxdrag == 'undefined' || dbx.onboxdrag()){this.released = true;if(this.restrict != 'vertical' || this.orientation == 'horizontal'){this.boxclone.style.left = parseInt(this.current.x - this.difference.x, 10) + 'px';}if(this.restrict != 'horizontal' || this.orientation == 'vertical'){this.boxclone.style.top = parseInt(this.current.y - this.difference.y, 10) + 'px';}if(this.restrict == 'freeform'){var clonepoint = {'x' : this.boxclone.offsetLeft + (this.boxclone.offsetWidth / 2),'y' : this.boxclone.offsetTop + (this.boxclone.offsetHeight / 2)};var proportion = 0.2;var hypotonuse = Math.round(Math.sqrt(Math.pow(this.boxclone.offsetWidth, 2) + Math.pow(this.boxclone.offsetHeight, 2)));if(clonepoint.x < 0 || clonepoint.x > (this.container.offsetWidth - proportion * hypotonuse)|| clonepoint.y < 0 || clonepoint.y > (this.container.offsetHeight - proportion * hypotonuse)){this.mouseup(e);return true;}}this.moveBoxByMouse(this.current.x, this.current.y, this.confirm);if(typeof e.preventDefault != 'undefined' ) { e.preventDefault(); }}}}return true;};dbxGroup.prototype.mouseup = function(e){this.removeActiveClasses('dbx\-box\-(target|active)');if(this.box){if(this.dialog){if(typeof this.dialog.group != 'undefined' && typeof this.boxes[dbx.getID(this.dialog)] == 'undefined'){var xgroup = this.dialog.group;var xinsert = xgroup.boxes[dbx.getID(this.dialog)];}this.clearDialog();if(typeof xgroup != 'undefined'){dbx.mousemove(e, this, xgroup, xinsert);return;}this.moveBoxByMouse(e.clientX, e.clientY, false);}this.removeCloneBox();this.regenerateBoxOrder();if(typeof document.onselectstart != 'undefined'){document.onselectstart = function() { return true; }}}this.clearDialog();this.dragok = false;};dbxGroup.prototype.click = function(e, anchor){if(anchor.hasfocus === true || anchor.hasfocus === null){if(this.dialog){var box = dbx.getTarget(null, 'dbx\-box', anchor);var dbxid = dbx.getID(this.dialog);{var targetbox = this.boxes[dbxid];}if(this.exchange == 'insert' && this.confirm == true && this.positive == true){targetbox = dbx.get('nextSibling', targetbox);if(!targetbox) { targetbox = this.boxes[dbxid]; }}var confirmed = dbx.hasClass(this.dialog, 'dbx\-dialog\-yes');this.clearDialog();this.removeTooltip();if(typeof targetbox != 'undefined' && targetbox != box && confirmed == true){if(this.exchange == 'swap'){this.swapTwoBoxes(box, targetbox, anchor, true, false);}else{return this.insertTwoBoxes(box, targetbox, anchor, true, false);}}return false;}this.removeTooltip();this.toggleBoxState(anchor, true, true, null);}return false;};dbxGroup.prototype.keypress = function(e, anchor){var parentbox = dbx.getTarget(null, 'dbx\-box', anchor);if(/^(3[7-9])|(40)$/.test(e.keyCode.toString())){if(dbx.opera && e.shiftKey) { return true; }if(!dbx.hasClass(dbx.getTarget(null, 'dbx\-box', anchor), 'dbx\-nograb')){parentbox.className += ' dbx-box-active';this.removeTooltip();var direction = '';switch(e.keyCode){case 37 :direction = 'W';break;case 38 :direction = 'N';break;case 39 :direction = 'E';break;case 40 :direction = 'S';break;}var wait = 75;if(this.currentdir && this.currentdir != direction){direction += this.currentdir.toLowerCase();switch(direction){case 'En' : direction = 'Ne'; break;case 'Es' : direction = 'Se'; break;case 'Wn' : direction = 'Nw'; break;case 'Ws' : direction = 'Sw'; break;}clearTimeout(this.keytimer);wait = 0;}else{this.currentdir = direction;}var self = this;this.keytimer = setTimeout(function(){if(!/^(Ns|Sn|Ew|Ww)$/.test(direction)){if(self.dialog){var dbxid = dbx.getID(self.dialog);{var box = self.boxes[dbxid];}}else{box = dbx.getTarget(null, 'dbx\-box', anchor);}self.moveBoxByKeyboard(e, anchor, box, direction, self.confirm, true);}}, wait);if(typeof e.preventDefault != 'undefined') { e.preventDefault(); }else { return false; }typeof e.stopPropagation != 'undefined' ? e.stopPropagation() : e.cancelBubble = true;this.keydown = false;}}else if(dbx.kde && e.target == anchor && (e.keyCode == 13 || e.keyCode == 32)){this.click(e, anchor);e.preventDefault();}else{this.removeActiveClasses('dbx\-box\-(target|active)');}if(e.keyCode == 13 || e.keyCode == 32){parentbox.className += ' dbx-box-active';}return true;};dbxGroup.prototype.regenerateBoxOrder = function(){this.order = [];var len = this.eles.length;for(var j=0; j<len; j++){if(dbx.hasClass(this.eles[j], 'dbx\-box') && !dbx.hasClass(this.eles[j], 'dbx\-(clone|dummy)')){this.order.push(dbx.getID(this.eles[j]) + (dbx.hasClass(this.eles[j], 'dbx\-box\-open') ? '+' : '-'));}}dbx.savedata[this.gid] = this.order.join(',');dbx.dbxobject = this;dbx.group = this.container;dbx.gid = this.gid;this.updateChildClasses();dbx.setCookieState();};dbxGroup.prototype.updateChildClasses = function(){var boxids = [], eles = dbx.get('*', this.container);for(var i=0; i<eles.length; i++){if(dbx.hasClass(eles[i], 'dbx\-box') && !dbx.hasClass(eles[i], 'dbx\-(dummy|clone)')){boxids.push(dbx.getID(eles[i]));}}var children = {'first' : boxids[0], 'last' : boxids[boxids.length - 1]};for(var i in children){if(dbx.unwanted(children, i)) { continue; }var box = this.boxes[children[i]];if(this.child[i] != null){this.child[i] = dbx.removeClass(this.child[i], i + '\-child');if(this.boxclone && dbx.getID(this.boxclone) == dbx.getID(this.child[i])){this.boxclone = dbx.removeClass(this.boxclone, i + '\-child');}this.child[i] = null;}box.className += ' ' + i + '-child';this.child[i] = box;if(this.boxclone && dbx.getID(this.boxclone) == dbx.getID(this.child[i])){this.boxclone.className += ' ' + i + '-child';}}};dbxGroup.prototype.createClone = function(box, zorder, position, cname, children, source){var clone = this.container.appendChild(box.cloneNode(children));clone.source = source;clone.className += ' dbx-clone';if(cname != ''){clone.className += ' ' + cname;}clone = dbx.removeClass(clone, 'dbx\-box\-focus');clone.style.position = 'absolute';clone.style.visibility = 'hidden';clone.style.zIndex = zorder;clone.style.left = parseInt(position.x, 10) + 'px';clone.style.top = parseInt(position.y, 10) + 'px';clone.style.width = box.offsetWidth + 'px';clone.style.height = box.offsetHeight + 'px';return clone;};dbxGroup.prototype.createCloneBox = function(box, source){this.box = box;this.position = { 'x' : this.box.offsetLeft, 'y' : this.box.offsetTop };this.difference = { 'x' : (this.initial.x - this.position.x), 'y' : (this.initial.y - this.position.y) };this.boxclone = this.createClone(this.box, 30000, this.position, 'dbx-dragclone', true, source);this.boxclone.style.cursor = 'move';this.dragok = true;};dbxGroup.prototype.removeCloneBox = function(){this.container.removeChild(this.boxclone);this.box.style.visibility = 'visible';this.box = null;};dbxGroup.prototype.removeActiveClasses = function(pattern){for(var i in this.boxes){if(dbx.unwanted(this.boxes, i)) { continue; }this.boxes[i] = dbx.removeClass(this.boxes[i], pattern);}};dbxGroup.prototype.moveBoxByMouse = function(clientX, clientY, confirm){if(this.orientation == 'freeform'){var clonepoint = {'x' : clientX - this.difference.x + (this.boxclone.offsetWidth / 2),'y' : clientY - this.difference.y + (this.boxclone.offsetHeight / 2)};var differences = [];}else{var cloneprops = {'xy' : this.orientation == 'vertical' ? clientY - this.difference.y : clientX - this.difference.x,'wh' : this.orientation == 'vertical' ? this.boxclone.offsetHeight : this.boxclone.offsetWidth};}if(dbx.hide) { this.box.style.visibility = 'hidden'; }this.removeActiveClasses('dbx\-box\-(target|active)');this.boxclone.style.visibility = 'visible';for(var i in this.boxes){if(dbx.unwanted(this.boxes, i)) { continue; }if(this.orientation == 'freeform'){if(dbx.hasClass(this.boxes[i], 'dbx\-dummy') && this.exhange == 'swap') { continue; }var boxpoint = {'x' : this.boxes[i].offsetLeft + (this.boxes[i].offsetWidth / 2),'y' : this.boxes[i].offsetTop + (this.boxes[i].offsetHeight / 2)};differences.push([i, Math.round(Math.sqrt(Math.pow(Math.abs(clonepoint.x - boxpoint.x), 2) + Math.pow(Math.abs(clonepoint.y - boxpoint.y), 2)))]);if(this.boxes[i] == this.box){differences[differences.length - 1][1] = Math.pow(10, 20);if(confirm || this.dialog){this.updateDialog(this.box, '', null, null, 'mouse');}}}else{var boxprops = {'xy' : this.orientation == 'vertical' ? this.boxes[i].offsetTop : this.boxes[i].offsetLeft,'wh' : this.orientation == 'vertical' ? this.boxes[i].offsetHeight : this.boxes[i].offsetWidth};this.positive = this.direction == 'down' || this.direction == 'right';if((this.positive && cloneprops.xy + cloneprops.wh > boxprops.xy && cloneprops.xy < boxprops.xy)||(!this.positive && cloneprops.xy < boxprops.xy && cloneprops.xy + cloneprops.wh > boxprops.xy)){if(this.boxes[i] == this.box) { return; }var sibling = dbx.getSiblingBox(this.box, 'nextSibling');if(this.box == sibling || this.boxes[i] == sibling) { return; }var index = i;break;}}}if(this.orientation == 'freeform'){differences.sort(function(a, b) { return a[1] - b[1]; });index = differences[0][0];var targetbox = this.boxes[index];var originaltargetbox = targetbox;if(this.exchange == 'insert' && (this.direction == 'down' || this.direction == 'right')){targetbox = dbx.get('nextSibling', targetbox);}if(targetbox == this.box) { return; }boxprops = {'left' : originaltargetbox.offsetLeft,'top' : originaltargetbox.offsetTop};boxprops.right = boxprops.left + targetbox.offsetWidth;boxprops.bottom = boxprops.top + targetbox.offsetHeight;var proportion = confirm || this.dialog ? 0 : 0.1;var hypotonuse = Math.round(Math.sqrt(Math.pow(originaltargetbox.offsetWidth, 2) + Math.pow(originaltargetbox.offsetHeight, 2)));if(!(clonepoint.x > boxprops.left + (hypotonuse * proportion) && clonepoint.x < boxprops.right - (hypotonuse * proportion)&& clonepoint.y > boxprops.top + (hypotonuse * proportion) && clonepoint.y < boxprops.bottom - (hypotonuse * proportion))){return;}if(this.last.box == targetbox && this.last.direction == this.direction){return;}var origpoint = {'x' : this.box.offsetLeft + (this.box.offsetWidth / 2),'y' : this.box.offsetTop + (this.box.offsetHeight / 2)};boxpoint = {'x' : originaltargetbox.offsetLeft + (originaltargetbox.offsetWidth / 2),'y' : originaltargetbox.offsetTop + (originaltargetbox.offsetHeight / 2)};var blocks = this.getBlocksDifference(origpoint, boxpoint, this.box);var compass = this.getCompassDirection(origpoint, boxpoint);if(this.functionExists('_testRules') && !this._testRules(compass, blocks, this.box, null)){if(confirm || this.dialog){this.updateDialog(originaltargetbox, ' dbx-dialog-no', null, null, 'mouse');}return;}if(confirm || this.dialog){if(!dbx.hasClass(targetbox, 'dbx\-(dialog|dummy)')){originaltargetbox.className += ' dbx-box-target';}this.updateDialog(originaltargetbox, ' dbx-dialog-yes', null, null, 'mouse');return;}if(this.functionExists('_updateRulePointer')) { this._updateRulePointer(); }this.last = {'box' : originaltargetbox,'direction' : this.direction};}else{var targetbox = this.boxes[index];var originaltargetbox = targetbox;}if(typeof index == 'undefined') { return; }if(!dbx.hasClass(originaltargetbox, 'dbx\-(dialog|dummy)')){originaltargetbox.className += ' dbx-box-target';}if(typeof dbx.onbeforestatechange != 'undefined'){var actions = dbx.compileAndDispatchOnBeforeStateChange(['proceed', this, this.container, this.gid, this.box, originaltargetbox,(this.orientation == 'freeform' ? this.exchange : 'move')]);if(!actions.proceed) { return; }}if(this.orientation == 'freeform' ){if(this.exchange == 'swap'){var visibox = originaltargetbox;}else{var add = false, pointer = 0, theboxes = [], visiboxes = [];for(var i in this.boxes){if(dbx.unwanted(this.boxes, i)) { continue; }theboxes.push(this.boxes[i]);}for(i=0; i<theboxes.length; i++){if(theboxes[i] == this.box) { continue; }visiboxes.push(theboxes[i]); }}}else{if(this.positive){var visibox = dbx.getSiblingBox(targetbox, 'previousSibling');}else{visibox = targetbox;}}if(typeof visiboxes != 'undefined'){var visiposes = [];for(i=0; i<visiboxes.length; i++){visiposes.push({'x' : visiboxes[i].offsetLeft,'y' : visiboxes[i].offsetTop});}}else{var visipos = { 'x' : visibox.offsetLeft, 'y' : visibox.offsetTop };}originaltargetbox = dbx.removeClass(originaltargetbox, 'dbx\-box\-target');var prepos = { 'x' : this.box.offsetLeft, 'y' : this.box.offsetTop };if(this.orientation == 'freeform' && this.exchange == 'swap'){var next = targetbox.nextSibling;if(next == this.box){targetbox.parentNode.insertBefore(this.box, targetbox);}else{this.box.parentNode.insertBefore(targetbox, this.box);next.parentNode.insertBefore(this.box, next);}}else{this.container.insertBefore(this.box, targetbox);}this.updateChildClasses();this.initial.x += (this.box.offsetLeft - prepos.x);this.initial.y += (this.box.offsetTop - prepos.y);if(typeof visiboxes != 'undefined' && visiboxes.length > 0){for(i=0; i<visiboxes.length; i++){new dbxAnimator(this, visiboxes[i], visiposes[i], this.resolution, false, null, true);}}else if(visibox != this.box){new dbxAnimator(this, visibox, visipos, this.resolution, false, null, true);}if(!this.confirm && !dbx.hide){new dbxAnimator(this, this.box, prepos, this.resolution, false, null, true);}};dbxGroup.prototype.getCompassDirection = function(a, b){var compass = a.y < b.y ? 'S' : 'N';if(a.y == b.y){compass = a.x < b.x ? 'E' : 'W';}else if(a.x < b.x){compass += 'e';}else if(a.x > b.x){compass += 'w';}return compass;};dbxGroup.prototype.getBlocksDifference = function(a, b, box){var blocks = [parseInt(Math.abs(a.x - b.x) / box.offsetWidth, 10),parseInt(Math.abs(a.y - b.y) / box.offsetHeight, 10)];blocks.sort(function(a, b) { return a - b; });return blocks;};dbxGroup.prototype.updateDialog = function(box, state, position, group, source){if(this.buffer){clearTimeout(this.buffer);this.buffer = null;}var self = this;this.buffer = setTimeout(function(){var boxpos = { 'x' : box.offsetLeft, 'y' : box.offsetTop };if(position){boxpos.x += position.x;boxpos.y += position.y;}self.clearDialog();self.dialog = self.createClone(box, 29999, boxpos, 'dbx-dialog' + state, false, source);self.dialog = dbx.removeClass(self.dialog, 'dbx\-box\-(target|active|hover|focus)');self.dialog.style.visibility = 'visible';clearTimeout(self.buffer);self.buffer = null;}, 20);};dbxGroup.prototype.clearDialog = function(){if(this.dialog){this.container.removeChild(this.dialog);this.dialog = null;}};dbxGroup.prototype.contains = function(outer, inner){if(inner == outer) { return true; }if(inner == null) { return false; }else { return this.contains(outer, inner.parentNode); }};dbxGroup.prototype.refocus = function(target){try { target.focus(); } catch(err){}var box = dbx.getTarget(null, 'dbx\-box', target);if(!dbx.hasClass(box, 'dbx-box-focus')){box.className += ' dbx-box-focus';}};function dbxAnimator(caller, box, pos, res, kbd, anchor, manual){this.caller = caller;if(this.caller.resolution == 0) { this.caller.resolution = 1; }this.box = box;this.timer = null;var before = {'x' : pos.x,'y' : pos.y};var after = {'x' : this.box.offsetLeft,'y' : this.box.offsetTop};if(!(before.x == after.x && before.y == after.y)){if(dbx.running > this.caller.boxes.length - 1) { return; }var clone = this.caller.createClone(this.box, 29999, arguments[2], 'dbx-aniclone', true, 'animator');clone.style.visibility = 'visible';this.box.style.visibility = 'hidden';var change = {'x' : after.x > before.x ? after.x - before.x : 0 - (before.x - after.x),'y' : after.y > before.y ? after.y - before.y : 0 - (before.y - after.y)};this.animateClone(clone,before,change,res,kbd,anchor,manual);}};dbxAnimator.prototype.animateClone = function(clone, current, change, res, kbd, anchor, manual){var self = this;var count = 0;dbx.running ++;this.timer = window.setInterval(function(){count ++;current.x += change.x / res;current.y += change.y / res;clone.style.left = parseInt(current.x, 10) + 'px';clone.style.top = parseInt(current.y, 10) + 'px';if(count == res){window.clearInterval(self.timer);self.timer = null;dbx.running --;self.caller.container.removeChild(clone);self.box.style.visibility = 'visible';if(self.box.className.indexOf('dbxid') != -1){self.box = dbx.removeClass(self.box, 'dbx\-dummy');}self.caller.boxes[dbx.getID(self.box)] = self.box;if(kbd && manual){if(anchor && anchor.parentNode.style.visibility != 'hidden'){setTimeout(function() { self.caller.refocus(anchor); }, 0);}else if(self.caller.toggles){var button = self.caller.buttons[dbx.getID(self.box)];if(button && typeof button.isactive != 'undefined'){self.caller.refocus(button);}}else{if(typeof self.box.focus == 'function'){setTimeout(function() { self.caller.refocus(self.box); }, 0);}}}if(typeof dbx.onafteranimate == 'function'){setTimeout(function() { dbx.compileAndDispatchOnAfterAnimate(self.box, self.caller) }, 0);}}if(typeof dbx.onanimate == 'function' && self.caller.resolution > 1){dbx.compileAndDispatchOnAnimate(self.box, clone, self.caller, count, res)}}, 20);};if(typeof window.attachEvent != 'undefined'){window.attachEvent('onunload', function(){var ev = ['mousedown', 'mousemove', 'mouseup', 'mouseout', 'click', 'keydown', 'keyup', 'focus', 'blur', 'selectstart', 'statechange', 'boxdrag', 'boxopen', 'boxclose', 'ruletest', 'afteranimate', 'beforestatechange', 'animate'];var el = ev.length;var dl = document.all.length;for(var i=0; i<dl; i++){for(var j=0; j<el; j++){document.all[i]['on' + ev[j]] = null;}}});}

//the window.onload wrapper around these object constructors is just for demo purposes
//in practise you would put them in an existing load function, or use a scaleable solution:
//http://www.brothercake.com/site/resources/scripts/domready/
//http://www.brothercake.com/site/resources/scripts/onload/
window.onload = function()
{



	//initialise the docking boxes manager
	var manager = new dbxManager('main'); 	//session ID [/-_a-zA-Z0-9/]


	//create new docking boxes group
	var sidebar = new dbxGroup(
		'sidebar', 		// container ID [/-_a-zA-Z0-9/]
		'vertical', 		// orientation ['vertical'|'horizontal']
		'7', 			// drag threshold ['n' pixels]
		'no',			// restrict drag movement to container axis ['yes'|'no']
		'10', 			// animate re-ordering [frames per transition, or '0' for no effect]
		'yes', 			// include open/close toggle buttons ['yes'|'no']
		'open', 		// default state ['open'|'closed']

		'отвориш', 		// word for "open", as in "open this box"
		'затвориш', 		// word for "close", as in "close this box"
		'Кликни, задръж и премести с привлачване', // sentence for "move this box" by mouse
		'Кликни, за да %toggle% този компонент', // pattern-match sentence for "(open|close) this box" by mouse
		'use the arrow keys to move this box', // sentence for "move this box" by keyboard
		', or press the enter key to %toggle% it',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard
		'%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
		);
};


// Ajax Status

jQuery('document').ready(function($){
	var commentform=$('form[action$=wp-comments-post2.php]');
	commentform.prepend('<div id="wdpajax-info" ></div>');
	var infodiv=$('#wdpajax-info');
	commentform.validate({
		submitHandler: function(form){
			//serialize and store form data in a variable
			var formdata=commentform.serialize();
			//Add a status message
			infodiv.html('<p class="wdpajax-loading">Зареждане...</p>');
			//Extract action URL from commentform
			var formurl=commentform.attr('action');
			//Post Form with data
			$.ajax({
				type: 'post',
				url: formurl,
				data: formdata,
				dataType: 'html',
				error: function(xhr, textStatus, errorThrown){
					if(xhr.status==500){
						var response=xhr.responseText;
						var text=response.split('<p>')[1].split('</p>')[0];
						infodiv.html('<p class="wdpajax-error" >'+text+'</p>');
					}
					else if(xhr.status==403){
						infodiv.html('<p class="wdpajax-error" >Публикувате твърде често!</p>');
					}
					else{
						if(textStatus=='timeout')
							infodiv.html('<p class="wdpajax-error" >Заявката се обработва твърде бавно. Опитайте отново.</p>');
						else
							infodiv.html('<p class="wdpajax-error" >Непозната грешка!</p>');
					}
				},
				success: function(data, textStatus){
					if(data=="success")
						infodiv.html('<p class="wdpajax-success" >Статусът е добавен!</p>');
					else
						infodiv.html('<p class="wdpajax-error" >Грешка в публикуването на твоята форма.</p>');
					commentform.find('textarea[name=comment]').val('');
				}
			});
		}
	});
});

(function($) {
 
  $.fn.tweet = function(o){
    var s = {
      username: ["seaofclouds"],              // [string]   required, unless you want to display our tweets. :) it can be an array, just do ["username1","username2","etc"]
      list: null,                              //[string]   optional name of list belonging to username
      avatar_size: 32,                      // [integer]  height and width of avatar if displayed (48px max)
      count: 100,                               // [integer]  how many tweets to display?
      intro_text: null,                       // [string]   do you want text BEFORE your your tweets?
      outro_text: null,                       // [string]   do you want text AFTER your tweets?
      join_text: "auto",                       // [string]   optional text in between date and tweet, try setting to "auto"
      auto_join_text_default: "каза:",      // [string]   auto text for non verb: "i said" bullocks
      auto_join_text_ed: "каза:",                 // [string]   auto text for past tense: "i" surfed
      auto_join_text_ing: "i am",             // [string]   auto tense for present tense: "i was" surfing
      auto_join_text_reply: "отговори на",   // [string]   auto tense for replies: "i replied to" @someone "with"
      auto_join_text_url: "i was looking at", // [string]   auto tense for urls: "i was looking at" http:...
      loading_text: "Зареждане на съдържание...",                     // [string]   optional loading text, displayed while tweets load
      query: null                             // [string]   optional search query
    };
    
    if(o) $.extend(s, o);
    
    $.fn.extend({
      linkUrl: function() {
        var returning = [];
        var regexp = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
        this.each(function() {
          returning.push(this.replace(regexp,"<a href=\"$1\">$1</a>"));
        });
        return $(returning);
      },
      linkUser: function() {
        var returning = [];
        var regexp = /[\@]+([A-Za-z0-9-_]+)/gi;
        this.each(function() {
          returning.push(this.replace(regexp,"<a href=\"http://twitter.com/$1\">@$1</a>"));
        });
        return $(returning);
      },
      linkHash: function() {
        var returning = [];
        var regexp = / [\#]+([A-Za-z0-9-_]+)/gi;
        this.each(function() {
          returning.push(this.replace(regexp, ' <a href="http://search.twitter.com/search?q=&tag=$1&lang=all&from='+s.username.join("%2BOR%2B")+'">#$1</a>'));
        });
        return $(returning);
      },
      capAwesome: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/\b(awesome)\b/gi, '<span class="awesome">$1</span>'));
        });
        return $(returning);
      },
      capEpic: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/\b(epic)\b/gi, '<span class="epic">$1</span>'));
        });
        return $(returning);
      },
      makeHeart: function() {
        var returning = [];
        this.each(function() {
          returning.push(this.replace(/(&lt;)+[3]/gi, "<tt class='heart'>&#x2665;</tt>"));
        });
        return $(returning);
      }
    });

    function parse_date(date_str) {
      // The non-search twitter APIs return inconsistently-formatted dates, which Date.parse
      // cannot handle in IE. We therefore perform the following transformation:
      // "Wed Apr 29 08:53:31 +0000 2009" => "Wed, Apr 29 2009 08:53:31 +0000"
      return Date.parse(date_str.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i, '$1,$2$4$3'));
    }

    function relative_time(time_value) {
      var parsed_date = parse_date(time_value);
      var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
      var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
      var pluralize = function (singular, n) {
        return '' + n + ' ' + singular + (n == 1 ? '' : 'и');
      };
	  var pluralizem = function (singular, n) {
        return '' + n + ' ' + singular + (n == 1 ? '' : '');
      };
      if(delta < 60) {
      return 'Преди по-малко от минута';
      } else if(delta < (60*60)) {
      return 'Преди ' + pluralize("минут", parseInt(delta / 60));
      } else if(delta < (23*60*60)) {
      return 'Преди ' + pluralizem("часа", parseInt(delta / 3600));
	  } else if(delta < (48*60*60)) {
      return 'Преди ' + pluralizem("ден", parseInt(delta / 86400));
      } else {
      return 'Преди ' + pluralizem("дни", parseInt(delta / 86400));
      }
    }

    function build_url() {
      var proto = ('https:' == document.location.protocol ? 'https:' : 'http:');
      if (s.list) {
        return proto+"//api.twitter.com/1/"+s.username[0]+"/lists/"+s.list+"/statuses.json?per_page="+s.count+"&callback=?";
      } else if (s.query == null && s.username.length == 1) {
        return proto+'//api.twitter.com/1/statuses/user_timeline.json?screen_name='+s.username[0]+'&count='+s.count+'&callback=?';
      } else {
        var query = (s.query || 'from:'+s.username.join(' OR from:'));
        return proto+'//search.twitter.com/search.json?&q='+escape(query)+'&rpp='+s.count+'&callback=?';
      }
    }

    return this.each(function(i, widget){
      var list = $('<ul class="tweet_list">').appendTo(widget);
      var intro = '<p class="tweet_intro">'+s.intro_text+'</p>';
      var outro = '<p class="tweet_outro">'+s.outro_text+'</p>';
      var loading = $('<p class="loading">'+s.loading_text+'</p>');

      if(typeof(s.username) == "string"){
        s.username = [s.username];
      }

      if (s.loading_text) $(widget).append(loading);
      $.getJSON(build_url(), function(data){
        if (s.loading_text) loading.remove();
        if (s.intro_text) list.before(intro);
        var tweets = (data.results || data);
        $.each(tweets, function(i,item){
          // auto join text based on verb tense and content
          if (s.join_text == "auto") {
            if (item.text.match(/^(@([A-Za-z0-9-_]+)) .*/i)) {
              var join_text = s.auto_join_text_reply;
            } else if (item.text.match(/(^\w+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+) .*/i)) {
              var join_text = s.auto_join_text_url;
            } else if (item.text.match(/^((\w+ed)|just) .*/im)) {
              var join_text = s.auto_join_text_ed;
            } else if (item.text.match(/^(\w*ing) .*/i)) {
              var join_text = s.auto_join_text_ing;
            } else {
              var join_text = s.auto_join_text_default;
            }
          } else {
            var join_text = s.join_text;
          };

          var from_user = item.from_user || item.user.screen_name;
          var profile_image_url = item.profile_image_url || item.user.profile_image_url;
          var join_template = '<span class="tweet_join"> '+join_text+' </span>';
          var join = ((s.join_text) ? join_template : ' ');
          var avatar_template = '<a class="tweet_avatar" href="http://twitter.com/'+from_user+'"><img src="'+profile_image_url+'" height="'+s.avatar_size+'" width="'+s.avatar_size+'" alt="'+from_user+'\'s avatar" title="'+from_user+'\'s avatar" border="0"/></a>';
          var avatar = (s.avatar_size ? avatar_template : '');
          var date = '<span class="tweet_time"><a href="http://twitter.com/'+from_user+'/statuses/'+item.id+'" title="view tweet on twitter">'+relative_time(item.created_at)+'</a></span>';
          var text = '<span class="tweet_text">' +$([item.text]).linkUrl().linkUser().linkHash().makeHeart().capAwesome().capEpic()[0]+ '</span>';

          // until we create a template option, arrange the items below to alter a tweet's display.
          list.append('<li>' + avatar + date + join + text + '</li>');

          list.children('li:first').addClass('tweet_first');
          list.children('li:odd').addClass('tweet_even');
          list.children('li:even').addClass('tweet_odd');
        });
        if (s.outro_text) list.after(outro);
        $(widget).trigger("loaded").trigger((tweets.length == 0 ? "empty" : "full"));
      });

    });
  };
})(jQuery);

$(document).ready(function(){
	$(".tweet").load("http://www.gamingneo.com/gametwitter/tweet-all.html");
	$("#playstationeu").click(function() {
	$(".tweet").load("http://www.gamingneo.com/gametwitter/tweet1.html");
	});
	
	$("#tweet_all").click(function() {
	$(".tweet").load("http://www.gamingneo.com/gametwitter/tweet2.html");
	});

	$("#xbox360").click(function() {
	$(".tweet").load("http://www.gamingneo.com/gametwitter/tweet2.html");
	});

	$("#nintendo_news").click(function() {
	$(".tweet").load("http://www.gamingneo.com/gametwitter/tweet3.html");
	});

	$("#gametrailers").click(function() {
	$(".tweet").load("http://www.gamingneo.com/gametwitter/tweet4.html");
	});

	$("#ign").click(function() {
	$(".tweet").load("http://www.gamingneo.com/gametwitter/tweet5.html");
	});

});

;(function($){$.fn.fixPNG=function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage': 'none','filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod="+($(this).css('backgroundRepeat')=='no-repeat'?'crop' : 'scale')+",src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});};var elem,opts,busy=false,imagePreloader=new Image,loadingTimer,loadingFrame=1,imageRegExp=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i;var ieQuirks=null,IE6=$.browser.msie&&$.browser.version.substr(0,1)==6&&!window.XMLHttpRequest,oldIE=IE6||($.browser.msie&&$.browser.version.substr(0,1)==7);$.fn.fancybox=function(o){var settings=$.extend({},$.fn.fancybox.defaults,o);var matchedGroup=this;function _initialize(){elem=this;opts=$.extend({},settings);_start();return false;};function _start(){if(busy)return;if($.isFunction(opts.callbackOnStart)){opts.callbackOnStart();}opts.itemArray=[];opts.itemCurrent=0;if(settings.itemArray.length>0){opts.itemArray=settings.itemArray;}else{var item={};if(!elem.rel||elem.rel==''){var item={href: elem.href,title: elem.title};if($(elem).children("img:first").length){item.orig=$(elem).children("img:first");}else{item.orig=$(elem);}if(item.title==''||typeof item.title=='undefined'){item.title=item.orig.attr('alt');}opts.itemArray.push(item);}else{var subGroup=$(matchedGroup).filter("a[rel="+elem.rel+"]");var item={};for(var i=0;i<subGroup.length;i++){item={href: subGroup[i].href,title: subGroup[i].title};if($(subGroup[i]).children("img:first").length){item.orig=$(subGroup[i]).children("img:first");}else{item.orig=$(subGroup[i]);}if(item.title==''||typeof item.title=='undefined'){item.title=item.orig.attr('alt');}opts.itemArray.push(item);}}}while(opts.itemArray[opts.itemCurrent].href!=elem.href){opts.itemCurrent++;}if(opts.overlayShow){if(IE6){$('embed,object,select').css('visibility','hidden');$("#fancy_overlay").css('height',$(document).height());}$("#fancy_overlay").css({'background-color'	: opts.overlayColor,'opacity' : opts.overlayOpacity}).show();}$(window).bind("resize.fb scroll.fb",$.fn.fancybox.scrollBox);_change_item();};function _change_item(){$("#fancy_right,#fancy_left,#fancy_close,#fancy_title").hide();var href=opts.itemArray[opts.itemCurrent].href;if(href.match("iframe")||elem.className.indexOf("iframe")>=0){$.fn.fancybox.showLoading();_set_content('<iframe id="fancy_frame" onload="jQuery.fn.fancybox.showIframe()" name="fancy_iframe'+Math.round(Math.random()*1000)+'" frameborder="0" hspace="0" src="'+href+'"></iframe>',opts.frameWidth,opts.frameHeight);}else if(href.match(/#/)){var target=window.location.href.split('#')[0];target=href.replace(target,'');target=target.substr(target.indexOf('#'));_set_content('<div id="fancy_div">'+$(target).html()+'</div>',opts.frameWidth,opts.frameHeight);}else if(href.match(imageRegExp)){imagePreloader=new Image;imagePreloader.src=href;if(imagePreloader.complete){_proceed_image();}else{$.fn.fancybox.showLoading();$(imagePreloader).unbind().bind('load',function(){$("#fancy_loading").hide();_proceed_image();});}}else{$.fn.fancybox.showLoading();$.get(href,function(data){$("#fancy_loading").hide();_set_content('<div id="fancy_ajax">'+data+'</div>',opts.frameWidth,opts.frameHeight);});}};function _proceed_image(){var width=imagePreloader.width;var height=imagePreloader.height;var horizontal_space=(opts.padding*2)+40;var vertical_space=(opts.padding*2)+60;var w=$.fn.fancybox.getViewport();if(opts.imageScale&&(width>(w[0]-horizontal_space)||height>(w[1]-vertical_space))){var ratio=Math.min(Math.min(w[0]-horizontal_space,width)/width,Math.min(w[1]-vertical_space,height)/height);width=Math.round(ratio*width);height=Math.round(ratio*height);}_set_content('<img alt="" id="fancy_img" src="'+imagePreloader.src+'"/>',width,height);};function _preload_neighbor_images(){if((opts.itemArray.length-1)>opts.itemCurrent){var href=opts.itemArray[opts.itemCurrent+1].href||false;if(href&&href.match(imageRegExp)){objNext=new Image();objNext.src=href;}}if(opts.itemCurrent>0){var href=opts.itemArray[opts.itemCurrent-1].href||false;if(href&&href.match(imageRegExp)){objNext=new Image();objNext.src=href;}}};function _set_content(value,width,height){busy=true;var pad=opts.padding;if(oldIE||ieQuirks){$("#fancy_content")[0].style.removeExpression("height");$("#fancy_content")[0].style.removeExpression("width");}if(pad>0){width+=pad*2;height+=pad*2;$("#fancy_content").css({'top' : pad+'px','right' : pad+'px','bottom'	: pad+'px','left' : pad+'px','width' : 'auto','height'	: 'auto'});if(oldIE||ieQuirks){$("#fancy_content")[0].style.setExpression('height','(this.parentNode.clientHeight-'+pad*2+')');$("#fancy_content")[0].style.setExpression('width','(this.parentNode.clientWidth-'+pad*2+')');}}else{$("#fancy_content").css({'top' : 0,'right' : 0,'bottom'	: 0,'left' : 0,'width' : '100%','height'	: '100%'});}if($("#fancy_outer").is(":visible")&&width==$("#fancy_outer").width()&&height==$("#fancy_outer").height()){$("#fancy_content").fadeOut('fast',function(){$("#fancy_content").empty().append($(value)).fadeIn("normal",function(){_finish();});});return;}var w=$.fn.fancybox.getViewport();var itemTop=(height+60)>w[1]?w[3]:(w[3]+Math.round((w[1]-height-60)*0.5));var itemLeft=(width+40)>w[0]?w[2]:(w[2]+Math.round((w[0]-width-40)*0.5));var itemOpts={'left': itemLeft,'top': itemTop,'width':	width+'px','height':	height+'px'};if($("#fancy_outer").is(":visible")){$("#fancy_content").fadeOut("normal",function(){$("#fancy_content").empty();$("#fancy_outer").animate(itemOpts,opts.zoomSpeedChange,opts.easingChange,function(){$("#fancy_content").append($(value)).fadeIn("normal",function(){_finish();});});});}else{if(opts.zoomSpeedIn>0&&opts.itemArray[opts.itemCurrent].orig!==undefined){$("#fancy_content").empty().append($(value));var orig_item=opts.itemArray[opts.itemCurrent].orig;var orig_pos=$.fn.fancybox.getPosition(orig_item);$("#fancy_outer").css({'left':(orig_pos.left-20-opts.padding)+'px','top':(orig_pos.top-20-opts.padding)+'px','width':	$(orig_item).width()+(opts.padding*2),'height':	$(orig_item).height()+(opts.padding*2)});if(opts.zoomOpacity){itemOpts.opacity='show';}$("#fancy_outer").animate(itemOpts,opts.zoomSpeedIn,opts.easingIn,function(){_finish();});}else{$("#fancy_content").hide().empty().append($(value)).show();$("#fancy_outer").css(itemOpts).fadeIn("normal",function(){_finish();});}}};function _set_navigation(){if(opts.itemCurrent!==0){$("#fancy_left,#fancy_left_ico").unbind().bind("click",function(e){e.stopPropagation();opts.itemCurrent--;_change_item();return false;});$("#fancy_left").show();}if(opts.itemCurrent!=(opts.itemArray.length-1)){$("#fancy_right,#fancy_right_ico").unbind().bind("click",function(e){e.stopPropagation();opts.itemCurrent++;_change_item();return false;});$("#fancy_right").show();}};function _finish(){if($.browser.msie){$("#fancy_content")[0].style.removeAttribute('filter');$("#fancy_outer")[0].style.removeAttribute('filter');}_set_navigation();_preload_neighbor_images();$(document).bind("keydown.fb",function(e){if(e.keyCode==27&&opts.enableEscapeButton){$.fn.fancybox.close();}else if(e.keyCode==37&&opts.itemCurrent!==0){$(document).unbind("keydown.fb");opts.itemCurrent--;_change_item();}else if(e.keyCode==39&&opts.itemCurrent!=(opts.itemArray.length-1)){$(document).unbind("keydown.fb");opts.itemCurrent++;_change_item();}});if(opts.hideOnContentClick){$("#fancy_content").click($.fn.fancybox.close);}if(opts.overlayShow&&opts.hideOnOverlayClick){$("#fancy_overlay").bind("click",$.fn.fancybox.close);}if(opts.showCloseButton){$("#fancy_close").bind("click",$.fn.fancybox.close).show();}if(typeof opts.itemArray[opts.itemCurrent].title!=='undefined'&&opts.itemArray[opts.itemCurrent].title.length>0){var pos=$("#fancy_outer").position();$('#fancy_title div').text(opts.itemArray[opts.itemCurrent].title).html();$('#fancy_title').css({'top'	: pos.top+$("#fancy_outer").outerHeight()-32,'left'	: pos.left+(($("#fancy_outer").outerWidth()*0.5)-($('#fancy_title').width()*0.5))}).show();}if(opts.overlayShow&&IE6){$('embed,object,select',$('#fancy_content')).css('visibility','visible');}if($.isFunction(opts.callbackOnShow)){opts.callbackOnShow(opts.itemArray[opts.itemCurrent]);}if($.browser.msie){$("#fancy_outer")[0].style.removeAttribute('filter');$("#fancy_content")[0].style.removeAttribute('filter');}busy=false;};return this.unbind('click.fb').bind('click.fb',_initialize);};$.fn.fancybox.scrollBox=function(){var w=$.fn.fancybox.getViewport();if(opts.centerOnScroll&&$("#fancy_outer").is(':visible')){var ow=$("#fancy_outer").outerWidth();var oh=$("#fancy_outer").outerHeight();var pos={'top'	:(oh>w[1]?w[3]: w[3]+Math.round((w[1]-oh)*0.5)),'left'	:(ow>w[0]?w[2]: w[2]+Math.round((w[0]-ow)*0.5))};$("#fancy_outer").css(pos);$('#fancy_title').css({'top'	: pos.top+oh-32,'left'	: pos.left+((ow*0.5)-($('#fancy_title').width()*0.5))});}if(IE6&&$("#fancy_overlay").is(':visible')){$("#fancy_overlay").css({'height' : $(document).height()});}if($("#fancy_loading").is(':visible')){$("#fancy_loading").css({'left':((w[0]-40)*0.5+w[2]),'top':((w[1]-40)*0.5+w[3])});}};$.fn.fancybox.getNumeric=function(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};$.fn.fancybox.getPosition=function(el){var pos=el.offset();pos.top+=$.fn.fancybox.getNumeric(el,'paddingTop');pos.top+=$.fn.fancybox.getNumeric(el,'borderTopWidth');pos.left+=$.fn.fancybox.getNumeric(el,'paddingLeft');pos.left+=$.fn.fancybox.getNumeric(el,'borderLeftWidth');return pos;};$.fn.fancybox.showIframe=function(){$("#fancy_loading").hide();$("#fancy_frame").show();};$.fn.fancybox.getViewport=function(){return[$(window).width(),$(window).height(),$(document).scrollLeft(),$(document).scrollTop()];};$.fn.fancybox.animateLoading=function(){if(!$("#fancy_loading").is(':visible')){clearInterval(loadingTimer);return;}$("#fancy_loading>div").css('top',(loadingFrame*-40)+'px');loadingFrame=(loadingFrame+1)%12;};$.fn.fancybox.showLoading=function(){clearInterval(loadingTimer);var w=$.fn.fancybox.getViewport();$("#fancy_loading").css({'left':((w[0]-40)*0.5+w[2]),'top':((w[1]-40)*0.5+w[3])}).show();$("#fancy_loading").bind('click',$.fn.fancybox.close);loadingTimer=setInterval($.fn.fancybox.animateLoading,66);};$.fn.fancybox.close=function(){busy=true;$(imagePreloader).unbind();$(document).unbind("keydown.fb");$(window).unbind("resize.fb scroll.fb");$("#fancy_overlay,#fancy_content,#fancy_close").unbind();$("#fancy_close,#fancy_loading,#fancy_left,#fancy_right,#fancy_title").hide();__cleanup=function(){if($("#fancy_overlay").is(':visible')){$("#fancy_overlay").fadeOut("fast");}$("#fancy_content").empty();if(opts.centerOnScroll){$(window).unbind("resize.fb scroll.fb");}if(IE6){$('embed,object,select').css('visibility','visible');}if($.isFunction(opts.callbackOnClose)){opts.callbackOnClose();}busy=false;};if($("#fancy_outer").is(":visible")!==false){if(opts.zoomSpeedOut>0&&opts.itemArray[opts.itemCurrent].orig!==undefined){var orig_item=opts.itemArray[opts.itemCurrent].orig;var orig_pos=$.fn.fancybox.getPosition(orig_item);var itemOpts={'left':(orig_pos.left-20-opts.padding)+'px','top':(orig_pos.top-20-opts.padding)+'px','width':	$(orig_item).width()+(opts.padding*2),'height':	$(orig_item).height()+(opts.padding*2)};if(opts.zoomOpacity){itemOpts.opacity='hide';}$("#fancy_outer").stop(false,true).animate(itemOpts,opts.zoomSpeedOut,opts.easingOut,__cleanup);}else{$("#fancy_outer").stop(false,true).fadeOut('fast',__cleanup);}}else{__cleanup();}return false;};$.fn.fancybox.build=function(){var html='';html+='<div id="fancy_overlay"></div>';html+='<div id="fancy_loading"><div></div></div>';html+='<div id="fancy_outer">';html+='<div id="fancy_inner">';html+='<div id="fancy_close"></div>';html+='<div id="fancy_bg"><div class="fancy_bg" id="fancy_bg_n"></div><div class="fancy_bg" id="fancy_bg_ne"></div><div class="fancy_bg" id="fancy_bg_e"></div><div class="fancy_bg" id="fancy_bg_se"></div><div class="fancy_bg" id="fancy_bg_s"></div><div class="fancy_bg" id="fancy_bg_sw"></div><div class="fancy_bg" id="fancy_bg_w"></div><div class="fancy_bg" id="fancy_bg_nw"></div></div>';html+='<a href="javascript:;" id="fancy_left"><span class="fancy_ico" id="fancy_left_ico"></span></a><a href="javascript:;" id="fancy_right"><span class="fancy_ico" id="fancy_right_ico"></span></a>';html+='<div id="fancy_content"></div>';html+='</div>';html+='</div>';html+='<div id="fancy_title"></div>';$(html).appendTo("body");$('<table cellspacing="0" cellpadding="0" border="0"><tr><td class="fancy_title" id="fancy_title_left"></td><td class="fancy_title" id="fancy_title_main"><div></div></td><td class="fancy_title" id="fancy_title_right"></td></tr></table>').appendTo('#fancy_title');if($.browser.msie){$(".fancy_bg").fixPNG();}if(IE6){$("div#fancy_overlay").css("position","absolute");$("#fancy_loading div,#fancy_close,.fancy_title,.fancy_ico").fixPNG();$("#fancy_inner").prepend('<iframe id="fancy_bigIframe" src="javascript:false;" scrolling="no" frameborder="0"></iframe>');var frameDoc=$('#fancy_bigIframe')[0].contentWindow.document;frameDoc.open();frameDoc.close();}};$.fn.fancybox.defaults={padding :	10,imageScale :	true,zoomOpacity :	true,zoomSpeedIn :	0,zoomSpeedOut :	0,zoomSpeedChange :	300,easingIn :	'swing',easingOut :	'swing',easingChange :	'swing',frameWidth :	560,frameHeight :	340,overlayShow :	true,overlayOpacity :	0.3,overlayColor :	'#666',enableEscapeButton	:	true,showCloseButton :	true,hideOnOverlayClick	:	true,hideOnContentClick	:	true,centerOnScroll :	true,itemArray :[],callbackOnStart :	null,callbackOnShow :	null,callbackOnClose :	null};$(document).ready(function(){ieQuirks=$.browser.msie&&!$.boxModel;if($("#fancy_outer").length<1){$.fn.fancybox.build();}});})(jQuery);

// Options
	jQuery(function(){

				jQuery.fn.getTitle = function() {
			var arr = jQuery("a.fancybox");
		}

		// Supported file extensions
		var thumbnails = 'a:has(img)[href$=".bmp"],a:has(img)[href$=".gif"],a:has(img)[href$=".jpg"],a:has(img)[href$=".jpeg"],a:has(img)[href$=".png"],a:has(img)[href$=".BMP"],a:has(img)[href$=".GIF"],a:has(img)[href$=".JPG"],a:has(img)[href$=".JPEG"],a:has(img)[href$=".PNG"]';

	
		jQuery(thumbnails).addClass("fancybox").attr("rel","fancybox").getTitle();

			jQuery("a.fancybox").fancybox({
			'imageScale': true,
			'padding': 10,
			'zoomOpacity': false,
			'zoomSpeedIn': 0,
			'zoomSpeedOut': 0,
			'zoomSpeedChange': 0,
			'overlayShow': true,
			'overlayColor': "#666666",
			'overlayOpacity': 0.3,
			'enableEscapeButton': true,
			'showCloseButton': true,
			'hideOnOverlayClick': true,
			'hideOnContentClick': false,
			'frameWidth':  560,
			'frameHeight':  340,
			'callbackOnStart': null,
			'callbackOnShow': null,
			'callbackOnClose': null,
			'centerOnScroll': true
		});

})

//# Login and Profile Modal Box
    $(function(){
	$('#profile-b').click(function(){
		$("#darken").css({ opacity: 0.6 });
		$('#darken').fadeIn('fast');
		$('#profile').fadeIn('fast');
	});

	$('#close-profile').click(function(){
		$('#darken').fadeOut('fast');
		$('#profile').fadeOut('fast');
	});

});

$(function(){
	$('#login-b').click(function(){
		$("#darken").css({ opacity: 0.6 });
		$('#darken').fadeIn('fast');
		$('#login-box').fadeIn('fast');
	});

	$('#close-login').click(function(){
		$('#darken').fadeOut('fast');
		$('#login-box').fadeOut('fast');
	});

});

$(function(){
	$('#comment-login-b').click(function(){
		$("#darken").css({ opacity: 0.6 });
		$('#darken').fadeIn('fast');
		$('#login-box').fadeIn('fast');
	});
});

// Ajax Pagination
jQuery(document).ready(function(){
	jQuery('.wp-pagenavi a').live('click', function(e){
		$(".content_last").append("<img src='http://www.gamingneo.com/theme/images/page-loader.gif' class='content_last_loading' alt='Зареждане...' />");
		$.scrollTo("div.content_left", 1 );
		e.preventDefault();
		var link = jQuery(this).attr('href');
		$('.wp-pagenavi').load(link+" .wp-pagenavi");
		$('.content_last').load(link+' .content_last');
	});

});

// This function deletes a cookie for DBX
function sdefault(sidebar) {
	document.cookie = 'dbx-main=dbx-main; expires=Fri, 27 Jul 2001 02:47:11 UTC; path=/'
	document.cookie = 'dbx-main2=dbx-main2; expires=Fri, 27 Jul 2001 02:47:11 UTC; path=/'
	var msg = "Всички настройки на дясната лента са върнати по подразбиране!";
	alert(msg);
}
//--> 

// Slider
$(document).ready(function(){
  var currentPosition = 0;
  var slideWidth = 642;
  var slides = $('.screen');
  var numberOfSlides = 2;

  // Remove scrollbar in JS
  $('#slidesContainer').css('overflow', 'hidden');

  // Wrap all .slides with #slideInner div
  slides
  .wrapAll('<div id="slideInner"></div>')
  // Float left to display horizontally, readjust .slides width


  // Set #slideInner width equal to total width of all slides
  $('#slideInner').css('width', slideWidth * numberOfSlides);

  // Insert left and right arrow controls in the DOM
  $('#slideshow');

  // Hide left arrow control on first load
  manageControls(currentPosition);

  // Create event listeners for .controls clicks
  $('.control')
    .bind('click', function(){
    // Determine new position
      currentPosition = ($(this).attr('id')=='rightControl') ? currentPosition+1 : currentPosition-1;

      // Hide / show controls
      manageControls(currentPosition);
      // Move slideInner using margin-left
      $('#slideInner').animate({
        'marginLeft' : slideWidth*(-currentPosition)
      });
    });

  // manageControls: Hides and Shows controls depending on currentPosition
  function manageControls(position){
    // Hide left arrow if position is first slide
	
	if(currentPosition==0 )
	{
		$("#leftControl").click(function () { 
		currentPosition = currentPosition+2; 
		});
	}

	// Hide right arrow if position is last slide
	
		if(position == numberOfSlides){
		currentPosition = 0;
	}
  }	
});

//# jQuery - Horizontal Accordion
//# Version 2.00.00 Alpha 1
//#
//# portalZINE(R) - New Media Network
//# http://www.portalzine.de
//#
//# Alexander Graef
//# portalzine@gmail.com
//#
//# Copyright 2007-2009
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.I={16:7(i,c,d,e){$("#"+c+"4"+i).J(e.y,7(){8 b=$(\'[6=\'+c+\'p]\').t(\'z\');9(b==1&&e.17===K){L u}9($("#"+c+"4"+i).5("6")!=c+"D"){e.18;$(\'[n*=\'+c+\'4]\').5("6","");$(\'[n*=\'+c+\'4]\').5("q",e.s);$("#"+c+"4"+i).19(e.1a);$("."+e.E).F({o:d+"M"});1b(e.1c){v 1:9($(\'[6=\'+c+\'p]\').1u(0)){$(\'[6=\'+c+\'p]\').t(\'z\',1);$(\'[6=\'+c+\'p]\').N({o:"1d",G:"0"},{O:u,P:e.Q,R:e.S,T:7(){$(\'[6=\'+c+\'p]\').t(\'z\',0)},1v:7(a){o=$(3).o();1e=d-o;$(\'#\'+c+\'r\'+i).o(1e).F("G","1")}})}A{$(\'[6=\'+c+\'p]\').t(\'z\',1);$(\'#\'+c+\'r\'+i).N({o:d,G:"1"},{O:u,P:e.Q,R:e.S,T:7(){$(\'[6=\'+c+\'p]\').t(\'z\',0)}})}w;v 2:$(\'[n*=\'+c+\'r]\').F({o:"1d"});$(\'#\'+c+\'r\'+i).N({o:d+"M",G:"1"},{O:u,P:e.1f,R:e.1g,T:e.1h});w}$(\'[n*=\'+c+\'r]\').5("6","");$("#"+c+"4"+i).5("6",c+"D");$("#"+c+"r"+i).5("6",c+"p")}})}};$.1w.1i({1j:7(f){L 3.U(7(a){8 b=$(3).5("n")||$(3).5("q");8 c=$(\'#\'+b+\' > x, .\'+b+\' > x\').1k();8 d=$(3).t(\'B\');1l="1x"+b;8 i=0;8 e="H";1l=1y.1z(7(){$("#"+b+"4"+i).V(d.y);9(e=="H"){i=i+1}A{i=i-1}9(i==c&&e=="H"){e="1m";i=c-1}9(i==0&&e=="1m"){e="H";i=0}},d.1n)})},I:7(k){3.B={y:"1A",W:"1B",1o:"1C",1p:"1D",E:"E",X:"X",s:"1E",Y:"1F",1a:"1G",Z:"1q",10:"",S:"",Q:1r,1g:"",1f:1r,C:2,11:"1H",18:7(){},1h:7(){},1c:1,1s:u,1n:1I,12:"",17:K};9(k){$.1i(3.B,k)}8 l=3.B;L 3.U(7(a){8 d=$(3).5("n")||$(3).5("q");$(3).t(\'B\',l);$(3).1J("<m q=\'"+l.W+"\'></m>");8 e=$(\'#\'+d+\' > x, .\'+d+\' > x\').1k();8 f=$("."+l.W).o();8 g=$("."+l.s).F("o");g=g.13(/M/,"");8 h;8 j;9(l.12){h=l.12}A{h=f-(e*g)-g}$(\'#\'+d+\' > x, .\'+d+\' > x\').U(7(i){$(3).5(\'n\',d+"1K"+i);$(3).5(\'q\',l.1o);$(3).14("<m q=\'"+l.1p+"\' n=\'"+d+"r"+i+"\'>"+"<m q=\\""+l.E+"\\">"+"<m q=\\""+l.X+"\\">"+$(3).14()+"</m></m></m>");9($("m",3).1L(l.s)){8 a=$("m."+l.s,3).5("n",""+d+"4"+i+"").14();$("m."+l.s,3).1M();j="<m q=\\""+l.s+"\\" n=\'"+d+"4"+i+"\'>"+a+"</m>"}A{j="<m q=\\""+l.s+"\\" n=\'"+d+"4"+i+"\'></m>"}9(l.10){1t=l.10.1N(",");l.Z=1t[i]}1b(l.Z){v"1O":$(3).1P(j);w;v"1q":$(3).15(j);w;v"1Q":$("."+d+"1R").15(j);w;v"1S":$("."+d+"1T").15(j);w}$("#"+d+"4"+i).J("1U",7(){$("#"+d+"4"+i).19(l.Y)});$("#"+d+"4"+i).J("1V",7(){9($("#"+d+"4"+i).5("6")!="1W"){$("#"+d+"4"+i).1X(l.Y)}});$.I.16(i,d,h,l);9(i==e-1){$(\'#\'+d+",."+d).1Y()}9(l.C!==u&&i==e-1){8 b=1Z.20;b=b.13("#","");9(b.21(l.11)!=\'-1\'){8 c=1;b=b.13(l.11,"")}9(b&&c==1){$("#"+d+"4"+(b)).5("6",d+"D");$("#"+d+"r"+(b)).5("6",d+"p");$("#"+d+"4"+(b-1)).V(l.y)}A{$("#"+d+"4"+(l.C)).5("6",d+"D");$("#"+d+"r"+(l.C)).5("6",d+"p");$("#"+d+"4"+(l.C-1)).V(l.y)}}});9(l.1s===K){$(3).1j()}})}})})(22);',62,127,'|||this|Handle|attr|rel|function|var|if|||||||||||||div|id|width|ContainerSelected|class|Content|handleClass|data|false|case|break|li|eventTrigger|status|else|settings|openOnLoad|HandleSelected|contentWrapper|css|opacity|start|hrzAccordion|bind|true|return|px|animate|queue|duration|closeEaseSpeed|easing|closeEaseAction|complete|each|trigger|containerClass|contentInnerWrapper|handleClassOver|handlePosition|handlePositionArray|hashPrefix|fixedWidth|replace|html|append|setOnEvent|eventWaitForAnim|eventAction|addClass|handleClassSelected|switch|closeOpenAnimation|0px|new_width|openEaseSpeed|openEaseAction|completeAction|extend|hrzAccordionLoop|size|variable_holder|end|cycleInterval|listItemClass|contentContainerClass|right|500|cycle|splitthis|get|step|fn|interval|window|setInterval|click|container|listItem|contentContainer|handle|handleOver|handleSelected|tab|10000|wrap|ListItem|hasClass|remove|split|left|prepend|top|Top|bottom|Bottom|mouseover|mouseout|selected|removeClass|show|location|hash|search|jQuery'.split('|'),0,{}))

$(document).ready(function() {
  
	$(".option-menu").hrzAccordion({eventTrigger:"click",openOnLoad:"1",handlePositionArray: "left,left,left,left,left"});
	
});
 
 //# jQuery - Validation
// validate the comment form when it is submitted
jQuery(document).ready(function() {
// validate the comment form when it is submitted
$("#commentform").validate();
jQuery.extend(jQuery.validator.messages, {
	required: "Полето е задължително!"
});
});
 
//# Scrollto -version 1.4.2
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

/* <![CDATA[ */
var pollsL10n = {
	ajax_url: "http://www.gamingneo.com",
	text_wait: "Your last request is still being processed. Please wait a while ...",
	text_valid: "Please choose a valid poll answer.",
	text_multiple: "Maximum number of choices allowed: ",
	show_loading: "1",
	show_fading: "1"
};
/* ]]> */

var poll_id=0;var poll_answer_id="";var is_being_voted=false;pollsL10n.show_loading=parseInt(pollsL10n.show_loading);pollsL10n.show_fading=parseInt(pollsL10n.show_fading);function poll_vote(a){if(!is_being_voted){set_is_being_voted(true);poll_id=a;poll_answer_id="";poll_multiple_ans=0;poll_multiple_ans_count=0;if(jQuery("#poll_multiple_ans_"+poll_id).length){poll_multiple_ans=parseInt(jQuery("#poll_multiple_ans_"+poll_id).val())}jQuery("#polls_form_"+poll_id+" :checkbox, #polls_form_"+poll_id+" :radio").each(function(b){if(jQuery(this).is(":checked")){if(poll_multiple_ans>0){poll_answer_id=jQuery(this).val()+","+poll_answer_id;poll_multiple_ans_count++}else{poll_answer_id=parseInt(jQuery(this).val())}}});if(poll_multiple_ans>0){if(poll_multiple_ans_count>0&&poll_multiple_ans_count<=poll_multiple_ans){poll_answer_id=poll_answer_id.substring(0,(poll_answer_id.length-1));poll_process()}else{if(poll_multiple_ans_count==0){set_is_being_voted(false);alert(pollsL10n.text_valid)}else{set_is_being_voted(false);alert(pollsL10n.text_multiple+" "+poll_multiple_ans)}}}else{if(poll_answer_id>0){poll_process()}else{set_is_being_voted(false);alert(pollsL10n.text_valid)}}}else{alert(pollsL10n.text_wait)}}function poll_process(){if(pollsL10n.show_fading){jQuery("#polls-"+poll_id).fadeTo("def",0,function(){if(pollsL10n.show_loading){jQuery("#polls-"+poll_id+"-loading").show()}jQuery.ajax({type:"POST",url:pollsL10n.ajax_url,data:"vote=true&poll_id="+poll_id+"&poll_"+poll_id+"="+poll_answer_id,cache:false,success:poll_process_success})})}else{if(pollsL10n.show_loading){jQuery("#polls-"+poll_id+"-loading").show()}jQuery.ajax({type:"POST",url:pollsL10n.ajax_url,data:"vote=true&poll_id="+poll_id+"&poll_"+poll_id+"="+poll_answer_id,cache:false,success:poll_process_success})}}function poll_result(a){if(!is_being_voted){set_is_being_voted(true);poll_id=a;if(pollsL10n.show_fading){jQuery("#polls-"+poll_id).fadeTo("def",0,function(){if(pollsL10n.show_loading){jQuery("#polls-"+poll_id+"-loading").show()}jQuery.ajax({type:"GET",url:pollsL10n.ajax_url,data:"pollresult="+poll_id,cache:false,success:poll_process_success})})}else{if(pollsL10n.show_loading){jQuery("#polls-"+poll_id+"-loading").show()}jQuery.ajax({type:"GET",url:pollsL10n.ajax_url,data:"pollresult="+poll_id,cache:false,success:poll_process_success})}}else{alert(pollsL10n.text_wait)}}function poll_booth(a){if(!is_being_voted){set_is_being_voted(true);poll_id=a;if(pollsL10n.show_fading){jQuery("#polls-"+poll_id).fadeTo("def",0,function(){if(pollsL10n.show_loading){jQuery("#polls-"+poll_id+"-loading").show()}jQuery.ajax({type:"GET",url:pollsL10n.ajax_url,data:"pollbooth="+poll_id,cache:false,success:poll_process_success})})}else{if(pollsL10n.show_loading){jQuery("#polls-"+poll_id+"-loading").show()}jQuery.ajax({type:"GET",url:pollsL10n.ajax_url,data:"pollbooth="+poll_id,cache:false,success:poll_process_success})}}else{alert(pollsL10n.text_wait)}}function poll_process_success(a){jQuery("#polls-"+poll_id).html(a);if(pollsL10n.show_loading){jQuery("#polls-"+poll_id+"-loading").hide()}if(pollsL10n.show_fading){jQuery("#polls-"+poll_id).fadeTo("def",1,function(){set_is_being_voted(false)})}else{set_is_being_voted(false)}}function set_is_being_voted(a){is_being_voted=a};

/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-12-20 08:43:48 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 4257 $
 *
 * Version: 1.2
 *
 * Requires: jQuery 1.2+
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){$.19={P:\'1.2\'};$.u([\'j\',\'w\'],5(i,d){$.q[\'O\'+d]=5(){p(!3[0])6;g a=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';6 3.B(\':y\')?3[0][\'L\'+d]:4(3,d.x())+4(3,\'n\'+a)+4(3,\'n\'+e)};$.q[\'I\'+d]=5(b){p(!3[0])6;g c=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';b=$.F({t:Z},b||{});g a=3.B(\':y\')?3[0][\'8\'+d]:4(3,d.x())+4(3,\'E\'+c+\'w\')+4(3,\'E\'+e+\'w\')+4(3,\'n\'+c)+4(3,\'n\'+e);6 a+(b.t?(4(3,\'t\'+c)+4(3,\'t\'+e)):0)}});$.u([\'m\',\'s\'],5(i,b){$.q[\'l\'+b]=5(a){p(!3[0])6;6 a!=W?3.u(5(){3==h||3==r?h.V(b==\'m\'?a:$(h)[\'U\'](),b==\'s\'?a:$(h)[\'T\']()):3[\'l\'+b]=a}):3[0]==h||3[0]==r?S[(b==\'m\'?\'R\':\'Q\')]||$.N&&r.M[\'l\'+b]||r.A[\'l\'+b]:3[0][\'l\'+b]}});$.q.F({z:5(){g a=0,f=0,o=3[0],8,9,7,v;p(o){7=3.7();8=3.8();9=7.8();8.f-=4(o,\'K\');8.k-=4(o,\'J\');9.f+=4(7,\'H\');9.k+=4(7,\'Y\');v={f:8.f-9.f,k:8.k-9.k}}6 v},7:5(){g a=3[0].7;G(a&&(!/^A|10$/i.16(a.15)&&$.14(a,\'z\')==\'13\'))a=a.7;6 $(a)}});5 4(a,b){6 12($.11(a.17?a[0]:a,b,18))||0}})(X);',62,72,'|||this|num|function|return|offsetParent|offset|parentOffset|||||borr|top|var|window||Height|left|scroll|Left|padding|elem|if|fn|document|Top|margin|each|results|Width|toLowerCase|visible|position|body|is|Right|Bottom|border|extend|while|borderTopWidth|outer|marginLeft|marginTop|client|documentElement|boxModel|inner|version|pageYOffset|pageXOffset|self|scrollTop|scrollLeft|scrollTo|undefined|jQuery|borderLeftWidth|false|html|curCSS|parseInt|static|css|tagName|test|jquery|true|dimensions'.split('|'),0,{}))

addComment={moveForm:function(d,f,i,c){var m=this,a,h=m.I(d),b=m.I(i),l=m.I("cancel-comment-reply-link"),j=m.I("comment_parent"),k=m.I("comment_post_ID");if(!h||!b||!l||!j){return}m.respondId=i;c=c||false;if(!m.I("wp-temp-form-div")){a=document.createElement("div");a.id="wp-temp-form-div";a.style.display="none";b.parentNode.insertBefore(a,b)}h.parentNode.insertBefore(b,h.nextSibling);if(k&&c){k.value=c}j.value=f;l.style.display="";l.onclick=function(){var n=addComment,e=n.I("wp-temp-form-div"),o=n.I(n.respondId);if(!e||!o){return}n.I("comment_parent").value="0";e.parentNode.insertBefore(o,e);e.parentNode.removeChild(e);this.style.display="none";this.onclick=null;return false};try{m.I("comment").focus()}catch(g){}return false},I:function(a){return document.getElementById(a)}};