/*!
* jQuery JavaScript Library v1.4.2
* http://jquery.com/
*
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2010, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Sat Feb 13 22:33:48 2010 -0500
*/
(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
"&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
!c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
" ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
"events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
!a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
!h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
(function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
{},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
"olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
function kinekOptionTrue(){
document.getElementById("kinekOption").value = "true";
}
function kinekOptionFalse(){
document.getElementById("kinekOption").value = "false";
}
function kinekCheckBoxHidden() {
if (document.getElementById("kinekCheckBox").checked == 0) {
document.getElementById("kinekCheckBoxHidden").value = "false";
} else {
document.getElementById("kinekCheckBoxHidden").value = "true";
}
}
//Enable or disable Kinek option in billing and shipping pages
function enableKinekOption(){
kinekOptionTrue();
document.getElementById("currency").value = "USD";
document.getElementById("paymentMethod").value = "CC";
}
function disableKinekOption(){
kinekOptionFalse();
document.getElementById("currency").value = "USD";
document.getElementById("paymentMethod").value = "";
}
function switchCheckoutType(selectedType) {
if (selectedType=='US') {
disableKinekOption();
} else {
enableKinekOption();
}
document.basketform.submit();
return true;
}
$(document).ready( function(){
$("#clubVoucherBalance").click( showDialog );
//variable to reference window
$myWindow = $('#voucherPopup');
//instantiate the dialog
$myWindow.dialog({
zIndex:1000,
width:395,
height:285,
draggable:false,
resizable:false,
autoOpen: false,
title: 'Thompson Cigar: Club Voucher',
modal: true
});
}
);
//function to show dialog
var showDialog = function() {
//if the contents have been hidden with css, you need this
$myWindow.show();
//open the dialog
$myWindow.dialog("open");
}
//function to close dialog, probably called by a button in the dialog
var closeDialog = function() {
$myWindow.dialog("close");
}
/*
Copyright (C) 2002 Fry Inc., All Rights Reserved.
Purpose:
Generates the client-side javascript include file for
common utility functions that we'll use for doing image
roll-overs, redirects, popup windows, etc.
*/
function showTabCom(objComDivId,imgPath  ) {
var objComDivArr = new Array("tab-more-info","tab-files","tab-review","tab-email-friend","tab-products");
for (i = 0; i < objComDivArr.length; i++) {
if (document.getElementById(objComDivArr[i] + "-img")) {
document.getElementById(objComDivArr[i] + "-img").src = imgPath + objComDivArr[i] + "-off.gif";
document.getElementById(objComDivArr[i]).style.display = "none";
}
}
document.getElementById(objComDivId + "-img").src = imgPath + objComDivId + ".gif";
document.getElementById(objComDivId).style.display = "block";
}
utilityBrowserVer = parseInt(navigator.appVersion);
function imgOn(imgName) {
if (utilityBrowserVer >= 3) {
imgOnString = eval(imgName + "_on.src");
document.images[imgName].src = imgOnString;
}
}
function imgOff(imgName) {
if (utilityBrowserVer >= 3) {
imgOffString = eval(imgName + "_off.src");
document.images[imgName].src = imgOffString;
}
}
function goToLink(address) {
var linkURL = address.options[address.selectedIndex].value;
window.top.location.href = linkURL;
address.selectedIndex=0;
}
function confirmWindow(url, text) {
if (confirm(text)) {
window.go = url;
window.location = url;
}
}
function setAddTo(addToType) {
document.productForm.addTo.value = addToType;
}
/* This function is called when a subject is changed so that actual subject text can be
* stored in to a hidden subject field. Since value of the subject list is a keyword define
* in the command configuration file to identify it's email address.
*/
function setSubject(thisRef)
{
var formRef = document.forms["contactUsForm"];
//set subject value
formRef.elements["subject"].value = (thisRef.options[thisRef.selectedIndex]).text;
}
/**
* These functions make it possible to make the forms a bit more interactive
*/
function setClass(field, addClass, removeClass) {
if (document.documentElement){
if(!field.className)
field.className = '';
var clsnm = field.className;
if(clsnm.match(removeClass))
clsnm = clsnm.replace(removeClass,addClass);
else if(!clsnm.match(addClass))
clsnm = clsnm + " " + addClass + " ";
field.className = clsnm;
}
}
function makeCurrent(field) {
setClass(field, "form-field-current", "form-field-normal");
}
function makeNormal(field) {
setClass(field, "form-field-normal", "form-field-current");
}
function styleToggle(rdoVar) {
for ( var i = 0; i < rdoVar.form.length; i++){
if (rdoVar.form[i].name == rdoVar.name) {
if(rdoVar.form[i].checked) {
setClass(rdoVar.form[i].parentNode, "form-field-radio-on", "form-field-radio-off");
} else {
setClass(rdoVar.form[i].parentNode, "form-field-radio-off", "form-field-radio-on");
}
}
}
}
function showBMLInfoPopup(url)
{
var bmlInfoWnd = openWindow(url, 503 ,480,"scrollbars", "BMLInfoWnd");
}
function showBMLTnCPopup(url)
{
var bmlTnCWnd = openWindow(url, 503 ,480,"scrollbars", "BMLTnCWnd");
}
function showBMLTnCPrintPopup(url)
{
var bmlTnCPWnd = openWindow(url, 503 ,480,"scrollbars", "BMLTnCPWnd");
}
// Find the vertical position of the tab -- will be called later
function findPos(obj) {
var curtop = 0;
if (obj.offsetParent) {
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curtop += obj.offsetTop
}
}
return [curtop];
}
function getTabPos(categoryReviewId){
// Loop through the tabs and identify which one is the reviews.
var tabs=document.getElementById('ProdTabCollectionNav').getElementsByTagName('a');
for(i=0; i<tabs.length; i++){
if(tabs[i].name == 'ratings'){
window.scrollTo(0, findPos(tabs[i])-120);
// IE6 Hackery
site.func.pwrReadReview();
cmCreatePageElementTag("REVIEWS: Read a Review",categoryReviewId);
}
}
}
function NewWindow2(mypage2,myname2,w2,h2,scroll2,pos2){
var win2=null;
if (h2 == "none")
{
h2 = (screen.height * 90) / 100;
}
if (w2 == "none")
{
w2 = (screen.width * 90) / 100;
}
var LeftPos = (screen.width-w2) / 2;
var TopPos = (screen.height-h2) / 2;
settings2='width='+w2+',height='+h2+',top='+TopPos+',left='+LeftPos+',scrollbars='+scroll2+',location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes';
win2=window.open(mypage2,myname2,settings2);
var navBrowser = navigator.appName.indexOf("Microsoft");
if (navBrowser == -1 )
{
self.blur();
}
win2.focus();
}
function updateDays()
{
var monthsObj = document.forms["bmlForm"].elements["dobMonth"];
var daysObj = document.forms["bmlForm"].elements["dobDay"];
var currentDays = (daysObj.length - 1);
var month = monthsObj.options[monthsObj.selectedIndex].value;
var daysToUpdate = 0;
if(month == 2)
{
/*
** Check if year is given if so find if its a leap year
*/
var yearObj = document.forms["bmlForm"].elements["dobYear"];
var year = yearObj.value;
if (year > 0 && (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)))
daysToUpdate = 29;
else
daysToUpdate = 28;
}
else
{
if(month % 2 == 1)
daysToUpdate = ((month < 8) ? 31 : 30);
else
daysToUpdate = ((month < 8) ? 30 : 31);
}
if(currentDays < daysToUpdate)
{
//Add Days
for(count = currentDays; count <= daysToUpdate; count++)
{
var value = ("" + count);
var optionObj = new Option(value);
optionObj.text = value;
optionObj.value = value;
daysObj.options[count] = optionObj;
}
}
else if(currentDays > daysToUpdate)
{
//remove
for(count = currentDays; count > daysToUpdate; count--)
{
daysObj.remove(count);
}
}
}
function processData()
{
}
function displaymessage()
{
window.opener.chatCM();
}
function validateDate(day,month,year){
var validateDate = true;
if (month > 12 || day > 31) {
validateDate = false;
} else if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) {
validateDate = false;
} else if (month == 2) {
var isLeap = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
if (day > 29 || (day >= 29 && !isLeap)) {
validateDate = false;
}
}
return validateDate;
}
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
function setCookie(c_name,value,expiredays){
setCookie(c_name,value,expiredays,true);
}
function setCookie(c_name,value,expiredays,escape){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
var cookieValue = value;
if (escape){
cookieValue =  escape(value);
}
document.cookie=c_name+ "=" + cookieValue +
((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) + ";path=/";
}
/*
* This function launches a new web browser window to a specified width, height and features.
* Features string is a comma separated window's feature needed for this new window. For Instance
* If a new window needs a toolbar the feature string must be "toolbar" like needs scroll bar and
* and toolbar then it must be "toolbar,scrollbar". Note that the order of the feature is not required.
* Also it's case insensitive. Therefore, "scrollbar,toolbar" is identical to "Toolbar,ScrollBar".
*
* If the features string is ommitted then all the features are turned off. To turn all the features on
* use the word "all" for features instead of specifying each feature.
*/
function openWindow(address, width, height,features)
{
/* Find out what features need to be enable
*
*/
if(features)
features = features.toLowerCase();
else
features = "";
var toolbar = (features == "all" ? 1 : 0);
var menubar = (features == "all" ? 1 : 0);
var location = (features == "all" ? 1 : 0);
var directories = (features == "all" ? 1 : 0);
var status = (features == "all" ? 1 : 0);
var scrollbars = (features == "all" ? 1 : 0);
var resizable = (features == "all" ? 1 : 0);
if(features != "all")
{
//split features
var feature = features.split(",");
for(i = 0; i < feature.length; i++)
{
if(feature[i] == "toolbar")
toolbar = 1;
else if(feature[i] == "menubar")
menubar = 1;
else if(feature[i] == "location")
location = 1;
else if(feature[i] == "directories")
directories = 1;
else if(feature[i] == "status")
status = 1;
else if(feature[i] == "scrollbars")
scrollbars = 1;
else if(feature[i] == "resizable")
resizable = 1;
}
}
features = "toolbar=" + toolbar + ",";
features += "menubar=" + menubar + ",";
features += "location=" + location + ",";
features += "directories=" + directories + ",";
features += "status=" + status + ",";
features += "scrollbars=" + scrollbars + ",";
features += "resizable=" + resizable;
var newWindow = window.open(address, 'Popup_Window', 'width=' + width + ',height=' + height + ',"' + features + '"');
newWindow.focus();
}
(function($) {
var site = window.site = function() {
return {
data : {
searchFieldText : "Enter keyword or item #",
fieldHighlightClass : "FieldHighlightColor",
fieldErrorClass: "FieldErrorHighlight",
globalErrorClass: "ErrorText",
menuShowTimer : null,
menuHideTimer : null,
menuDropdownDelay : 100,
menuImagesOn : [],
menuImagesOff : [],
menuDividerClass : [],
refinementFormName : "sortItemsForm",
resizeInterval : null,
resizeCounter : 0
},
func : {
bookmark : function( settings ) {
if (window.sidebar)  // Mozilla Firefox Bookmark
{ window.sidebar.addPanel(settings.title, settings.url,""); }
else if( window.external ) // IE Favorite
{ window.external.AddFavorite( settings.url, settings.title); }
else if(window.opera && window.print) // Opera Hotlist
{ return true; }
},
emailSubscribeFooter : function() {
$("#WidgetFooterSubscribe").unbind("click").click(function(evt) {
evt.preventDefault();
var url = $(this).attr("href");
$.post( url, { isAjaxCall : "true", rid : lib.utils.timestamp(), unSubscribe : false, dateOfBirth : $("input[name=dateOfBirthEntry]").val(), userEmail : $("input[name=subscribeEmailAddress]").val() }, function(data) {
$("#FooterEmailSignup *").remove();
$("#FooterEmailSignup").html("");
$("#FooterEmailSignup").append(data);
site.func.emailSubscribeFooter();
});
});
},
fieldErrors : function(selector) {
$(selector + " ." + site.data.globalErrorClass).each(function() {
$(this).parent().addClass( site.data.fieldErrorClass );
});
},
fieldHighlight : function(selector) {
var inputs = "input, select, textarea";
$(inputs, $(selector)).bind("focus.fields", function(evt) {
if( (!$(evt.target).is("input[type=image]")) && (!$(evt.target).is("input[type=radio]")) )
{ $(evt.target).addClass( site.data.fieldHighlightClass ); }
});
$(inputs, $(selector)).bind("blur.fields", function(evt) {
$(evt.target).removeClass( site.data.fieldHighlightClass );
});
$("select", $(selector)).mousedown(function(evt) {
$(evt.target).addClass( site.data.fieldHighlightClass );
});
},
genericHoverHighlight : function(selector, newclass) {
$(selector).hover(
function() { $(this).addClass(newclass); },
function() { $(this).removeClass(newclass); }
);
},
showGlobalDropdown : function(thisMenu, index) {
$(".WidgetSectionButton", $(thisMenu)).attr("src", site.data.menuImagesOn[index]);
$(".SectionNavDivider").eq(index-1).addClass("SectionNavDividerOn");
$(".SectionNavDivider").eq(index).addClass("SectionNavDividerOn");
site.data.menuShowTimer = setTimeout(function() {
$("ul", $(".SectionNavButton")).hide();
$("ul", $(thisMenu)).show();
}, site.data.menuDropdownDelay);
},
hideGlobalDropdown : function(thisMenu, index) {
$(".WidgetSectionButton", $(thisMenu)).attr("src", site.data.menuImagesOff[index]);
$(".SectionNavDivider").eq(index-1).attr("class", site.data.menuDividerClass[index-1]);
$(".SectionNavDivider").eq(index).attr("class", site.data.menuDividerClass[index]);
site.data.menuHideTimer = setTimeout(function() {
$("ul", $(thisMenu)).hide();
}, site.data.menuDropdownDelay);
},
pwrOpenProductPage : function(url, type) {
var fullURL = ( type == "r" ) ? url + "?readReview=1" : url + "?writeReview=1";
window.location = fullURL;
},
pwrReadReview : function() {
productTabs.activateTab("ratings");
$(".ProdTabContent[name=ratings] .ProdReviewContent").eq(0).show();
$(".ProdTabContent[name=ratings] .ProdReviewContent").eq(1).hide();
},
pwrWriteReview : function(pageId, merchantId, cssOverride) {
productTabs.activateTab("ratings");
$(".ProdTabContent[name=ratings] .ProdReviewContent").eq(0).hide();
$(".ProdTabContent[name=ratings] .ProdReviewContent").eq(1).show();
$("*", $(".ProdTabContent[name=ratings] .ProdReviewContent").eq(1)).remove();
$(".ProdTabContent[name=ratings] .ProdReviewContent").eq(1).html("<span id='WidgetPWRLoading'>Loading <br /> Loading <br /> Loading <br /></span>");
$(".ProdTabContent[name=ratings] .ProdReviewContent").eq(1).show();
var iframeHTML = '<iframe onLoad="site.func.pwrStopLoad()" name="PWRReviewsIframe" id="PWRReviewsIframe" src="http://services.powerreviews.com/SubmitReview.do?pageId=' + pageId + '&merchantId=' + merchantId + '&source=web&merchantUserId=' + merchantId + '&cssOverride=' + cssOverride + '" frameborder="0"></iframe>';
$(".ProdTabContent[name=ratings] .ProdReviewContent").eq(1).append( iframeHTML );
setTimeout( function() { window.location = "#tabs"; }, 100);
},
pwrStopLoad : function() {
$("#WidgetPWRLoading").remove();
$("#PWRReviewsIframe").show();
},
setupRefinements : function() {
if( $(".WidgetRefinementSelected").size() > 0 )
{ $("#RefinementsClearAll").show(); }
$(".RefinementEntry select").change(function() {
$("form[name=" + site.data.refinementFormName + "]").submit();
});
$(".RefinementsLarge a").click(function(evt) {
evt.preventDefault();
$("input", $(this).parent().parent().parent()).val($(this).attr("href").split("#")[1]);
$("form[name=" + site.data.refinementFormName + "]").submit();
});
$(".RefinementsLargeSearch input").keyup(function() {
var currentText = $(this).val().toLowerCase();
//if price need to pre-pend a '$'
if( $(this).is(".isPriceRefinement") && (currentText.indexOf("$") != 0) )
{
currentText = "$" + currentText;
$(this).val( currentText );
}
var currentRefinement = "";
if( currentText != "" )
{
$(".RefinementsLarge li a", $(this).parent().parent()).each(function(i) {
currentRefinement = $(this).text().toLowerCase();
if(currentRefinement.indexOf(currentText) == 0)
{ $(this).parent().show(); }
else
{ $(this).parent().hide(); }
});
}
else
{ $(".RefinementsLarge li", $(this).parent().parent()).show(); }
});
$(".RefinementsLargeSearch input").keyup();
$(".WidgetClearRefinement").click(function(evt) {
evt.preventDefault();
$("input", $(this).parent()).val("");
$("form[name=" + site.data.refinementFormName + "]").submit();
});
},
iframeShim : function( elementToShimSelector, shimIdSelector, action ) {
if((action=="r")) {
$("#recentlyViewedDiv").css("visibility","visible");
}
else {
$("#recentlyViewedDiv").css("visibility","hidden");
}
if(lib.utils.isIE6())
{
var exists = $(shimIdSelector).size() > 0 ? true : false;
if((action == "r") && exists)
{ $(shimIdSelector).remove(); }
else if(action == "a" && !exists)
{
fixHTML = '<div id="' + shimIdSelector.split("#")[1] + '"><iframe width="100%" height="100%" frameborder="0" src="/blank.gif"><!-- --></iframe></div>';
$(elementToShimSelector).parent().append(fixHTML);
exists = $(shimIdSelector).size() > 0 ? true : false;
}
if((action == "a" || "u") && exists)
{
$(shimIdSelector).css("position", $(elementToShimSelector).css("position"));
$(shimIdSelector).css("height", $(elementToShimSelector).height());
$(shimIdSelector).css("width", $(elementToShimSelector).width());
$(shimIdSelector).css("margin-left", $(elementToShimSelector).css("margin-left"));
$(shimIdSelector).css("margin-right", $(elementToShimSelector).css("margin-right"));
$(shimIdSelector).css("margin-top", $(elementToShimSelector).css("margin-top"));
$(shimIdSelector).css("margin-bottom", $(elementToShimSelector).css("margin-bottom"));
$(shimIdSelector).css("top", $(elementToShimSelector).css("top"));
$(shimIdSelector).css("left", $(elementToShimSelector).css("left"));
$(shimIdSelector).css("z-index", $(elementToShimSelector).css("z-index")-1);
}
}
},
openPopup : function( url, settings ) {
$("body").append('<a style="display: none;" id="js-instantlink" href="' + url + '"></a>');
lib.link.popupWindow("#js-instantlink", settings);
$("#js-instantlink").triggerHandler("click");
$("#js-instantlink").remove();
}
},
obj : {
swatch : function(settings) {
if(arguments.length > 0)
{ this.init(settings); }
}
}
};
}($)
})($);
site.obj.swatch.prototype.init = function(settings) {
settings = jQuery.extend({
swatchImageURL : "#",
mainImageURL : "#",
colorName : "Color Name",
colorDropdownSelector : "#_null"
}, settings );
this.swatchImageURL = settings.swatchImageURL;
this.mainImageURL = settings.mainImageURL;
this.colorName = settings.colorName;
this.colorDropdownSelector = settings.colorDropdownSelector;
};
$(function() {
/* size the footer to be full page if needed */
site.data.resizeInterval = setInterval( function() {
if( lib.image.isComplete("img") || (site.data.resizeCounter == 20) ) // all image loaded or waited 5 seconds
{
clearInterval(site.data.resizeInterval);
var dif = lib.screen.size()[1] - $("body").height();
if( dif > 0  )
{ $("#FooterBottom").css("padding-bottom",  (parseInt($("#FooterBottom").css("padding-bottom")) + dif) + "px"); }
}
site.data.resizeCounter++;
}, 250);
/* Setup the Global Nav */
$(".SectionNavButton").each(function(i) {
// 1. Build out the Images Paths
site.data.menuImagesOff[i] = $(this).find("img").attr("src");
site.data.menuImagesOn[i] = $(this).find("img").attr("src").split("but-nav")[0] + "but-nav-" + $(this).find("img").attr("name") + "-on.gif";
lib.image.preload(site.data.menuImagesOn[i]);
// 2. Setup the Dropdown Functionality
$(this).hover(
function() {
site.func.showGlobalDropdown( $(this), i );
site.func.iframeShim( $(".SectionNavLevel1",this), "#dropdown-iframe", "a" );
},
function() {
if( typeof site.data.menuShowTimer != "undefined" ){
site.func.iframeShim( $(".SectionNavLevel1",this), "#dropdown-iframe", "r" );
clearTimeout(site.data.menuShowTimer);
}
site.func.hideGlobalDropdown( $(this), i );
}
);
$("ul", $(this)).hover(
function() {
if( typeof site.data.menuHideTimer != "undefined" )
{ clearTimeout(site.data.menuHideTimer); }
},
function() { site.func.hideGlobalDropdown( $(this), i ); }
);
});
$(".SectionNavDivider").each(function(i) { site.data.menuDividerClass[i] = $(this).attr("class"); });
/* ------------------- */
/* setup the search input field functionality. */
lib.input.defaultText( "#HeaderSearchKeyword", { defaultText : site.data.searchFieldText });
$("#searchForm").submit(function() {
searchVal = $("#HeaderSearchKeyword").val();
if( (searchVal == site.data.searchFieldText) || (searchVal == "") )
{
alert("Please enter a search term and try your search again");
return false;
}
});
/* ---------------------- */
/* setup the newletter input field functionality. */
lib.input.defaultText( "#FooterEmailSignup #emailAddress", { defaultText : "your e-mail address"});
/* ---------------------- */
/* Run Refinement setup */
setTimeout(function() {
if ( $("#Refinements").size() > 0 )
{ site.func.setupRefinements(); }
},50);
/* --------------- */
/* Popups (global) */
//Online Catalog
lib.link.popupWindow(".WidgetOnlineCatalog", {
width: 800,
height: 500,
scrollbars: 1
});
// Check Gift Card Balance
lib.link.popupWindow("#WidgetCheckGiftCardBalance", {
width: 450,
height: 250,
scrollbars: 1
});
// Contact Us
lib.link.popupWindow("#WidgetContactus", {
width: 550,
height: 330,
scrollbars: 1
});
/* ----------------------------- */
/* Leftnavigation Rollovers */
$("#PosLeftNav li span").each(function() {
if( !$(this).is(".active") )
{
$(this).hover(
function() {
$(this).addClass("active");
},
function() {
$(this).removeClass("active");
}
);
}
});
/* ---------------- */
/* Setup the Email Subscription */
site.func.emailSubscribeFooter();
});
function printCurrentYear(){
var mydate=new Date();
var year=mydate.getYear();
if (year < 1000)
year+=1900
document.write(year);
}
(function($) {
var lib = window.lib = function($) {
return {
image : {
preload : function(images) {
var tImageArr = [];
var tImages = images.split(",");
$(tImages).each(function(i) {
tImageArr[i] = new Image();
tImageArr[i].src = tImages[i];
});
},
isComplete : function( selector ) {
var complete = true;
$(selector).each(function() {
if( !$(this).get(0).complete )
{ complete = false; }
});
return complete;
}
},
input : {
defaultText : function(selector, settings) {
settings = $.extend({
defaultText: "enter keyword or item"
}, settings);
return $(selector).each(function(){
$(this).focus( function() {
if( $(this).val() == settings.defaultText )
{ $(this).val(""); }
});
$(this).blur(function() {
$(this).val( lib.utils.strTrim($(this).val()) );
if( $(this).val() == "" )
{ $(this).val( settings.defaultText ); }
});
$(this).blur();
});
},
setMaxCharacters : function(selector, settings) {
settings = $.extend({
limit: 500,
results : "#_donotplace"
}, settings);
$(selector).bind("keyup.max_characters", function() {
if( $(this).val().length > settings.limit )
{ $(this).val( $(this).val().substring(0, settings.limit) ); }
var remainingCount = ((settings.limit - $(this).val().length) == 0) ? "0" : settings.limit - $(this).val().length;
$(settings.results).html(remainingCount);
});
$(selector).keyup();
},
autoAdvance : function(selector) {
$(selector).each(function(i) {
$(this).keyup(function() {
if( $(this).val().length >= $(this).attr("maxlength") )
{
$(this).blur();
$(selector).eq(i+1).focus();
}
});
});
}
},
link : {
disable : function(selector) {
$(selector).attr("href","#jsLink");
$(selector).click(function(evt) {
evt.preventDefault();
});
},
popupWindow : function(selector, settings) {
settings = jQuery.extend({
width: 500,
height: 500,
toolbar: 0,
menubar: 0,
location: 0,
directories: 0,
status: 0,
scrollbars: 0,
resizable: 0,
name: "Popup_Window"
}, settings);
return $(selector).each(function() {
var features = 	"toolbar=" + settings.toolbar + "," +
"menubar=" + settings.menubar + "," +
"location=" + settings.location + "," +
"directories=" + settings.directories + "," +
"status=" + settings.status + "," +
"scrollbars=" + settings.scrollbars + "," +
"resizable=" + settings.resizable;
if (settings.name == "LoyaltyPopup" ){
features = features +  ",top=" + (screen.height-settings.height) / 2;
features = features +  ",left=" + (screen.width-settings.width) / 2;
}
$(this).click(function(evt) {
evt.preventDefault();
var newWindow = window.open($(this).attr("href"), settings.name, 'width=' + settings.width + ',height=' + settings.height + ',"' + features + '"');
newWindow.focus();
});
});
}
},
screen : {
position : function() {
if( typeof( window.pageYOffset ) == 'number' ) {
//Netscape compliant
return [ window.pageXOffset, window.pageYOffset ];
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
//DOM compliant
return [ document.body.scrollLeft, document.body.scrollTop ];
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
//IE6 standards compliant mode
return [ document.documentElement.scrollLeft, document.documentElement.scrollTop ];
} else {
return [ -1, -1 ];
}
},
size : function() {
var vpW = 0, vpH = 0;
if (typeof window.innerWidth != 'undefined')
{ return [ window.innerWidth, window.innerHeight ]; }
else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
{ return [ document.documentElement.clientWidth, document.documentElement.clientHeight ]; }
else
{ return [ document.getElementsByTagName('body')[0].clientWidth, document.getElementsByTagName('body')[0].clientHeight ]; }
}
},
layer : {
add : function(selector, defaultHTML, closeButton) {
lib.layer.remove(selector);
addHTML = '<div id="' + selector.split("#")[1] + '"></div>';
$("body").append(addHTML);
$(selector).append(defaultHTML);
lib.layer.vCenter(selector);
lib.layer.ie6Fix(selector, "a");
lib.layer.closeButton(closeButton, selector);
},
remove : function(selector) {
if( $(selector).size() > 0 )
{
$(selector).remove();
lib.layer.ie6Fix(selector,"r");
}
},
loadHTML : function(selector,page,closeButton) {
$.get(page,function(data) {
$(selector + " *").remove();
$(selector).html("");
$(selector).append(data);
lib.layer.vCenter(selector);
lib.layer.ie6Fix(selector,"u");
lib.layer.closeButton(closeButton, selector);
});
},
vCenter : function(selector) {
var wPosition = lib.screen.position();
var wSize = lib.screen.size();
var top = ((wSize[1] / 2) - ($(selector).height() / 2)) + wPosition[1];
top = (top < 0) ? 100 : top;
$(selector).css("top",top+"px");
lib.layer.ie6Fix(selector,"u");
},
closeButton : function( selector, layerSelector ) {
lib.link.disable(layerSelector + " " + selector);
$(layerSelector + " " + selector).unbind("click.lib.layer.close").bind("click.lib.layer.close", function() { lib.layer.remove(layerSelector); });
},
ie6Fix : function(selector,action) {
if(lib.utils.isIE6())
{
var fixId = selector.split("#")[1] + "-iframe";
var exists = $("#" + fixId).size() > 0 ? true : false;
if(action == "r" && exists)
{ 	$("#" + fixId).remove(); }
if(action == "a" && !exists)
{
fixHTML = '<div id="' + fixId + '"><iframe width="100%" height="100%" frameborder="0" src="/assets/blank.gif"><!-- --></iframe></div>';
$("body").append(fixHTML);
exists = $("#" + fixId).size() > 0 ? true : false;
}
if( (action == "a" || "u") && exists)
{
$("#" + fixId).css("position", $(selector).css("position"));
$("#" + fixId).css("height", $(selector).height());
$("#" + fixId).css("width", $(selector).width());
$("#" + fixId).css("margin-left", $(selector).css("margin-left"));
$("#" + fixId).css("margin-right", $(selector).css("margin-right"));
$("#" + fixId).css("margin-top", $(selector).css("margin-top"));
$("#" + fixId).css("margin-bottom", $(selector).css("margin-bottom"));
$("#" + fixId).css("top", $(selector).css("top"));
$("#" + fixId).css("left", $(selector).css("left"));
$("#" + fixId).css("bottom", $(selector).css("bottom"));
$("#" + fixId).css("right", $(selector).css("right"));
$("#" + fixId).css("z-index", $(selector).css("z-index")-1);
}
}
}
},
json : {
get : function(url, data, func) {
$.getJSON(url, data, function(data) { func(data); });
}
},
utils : {
isIE6 : function() {
if($.browser.msie && (parseFloat($.browser.version) < 7))
{ return true; }
return false;
},
timestamp : function() {
return new Date().getTime();
},
strTrim : function(s) {
return s.replace(/^\s+|\s+$/g, "");
},
getPosition : function( selector ) {
var positions = [];
$(selector).each(function(i) {
thisObj = $(this).get(0);
var curleft = curtop = 0;
if (thisObj.offsetParent) {
do {
curleft += thisObj.offsetLeft;
curtop += thisObj.offsetTop;
} while (thisObj = thisObj.offsetParent);
}
positions[positions.length] = new Array(2);
positions[i][0] = curleft;
positions[i][1] = curtop;
});
return positions
}
},
func : {
formSetup : function() {
/* Basicly Stylesheet Entries */
/*
div.FormArea {}
div.FormArea div.FormEntry { border: 1px solid #fff; padding: 5px; margin-bottom: 15px; }
div.FormArea div.FormEntry label { display: block; margin-bottom: 5px; font-weight: bold; }
div.FormArea div.FormEntry label.optional { font-weight: normal; }
div.FormArea div.FormError { border: 1px solid red; background-color: #fff; }
div.FormArea div.FormError .ErrorText { display: block; margin-bottom: 5px; }
.FormFieldHighlight { background-color: yellow; }
*/
var formSelector = ".FormArea";
var globalErrorClass = "ErrorText";
var formFieldHighlightClass = "FormFieldHighlight";
var formEntryErrorClass = "FormError";
var formEntryClass = "FormEntry";
var inputs = "input, select, textarea";
$(formSelector + " ." + globalErrorClass).each(function() {
var formEntry = $(this).parent();
while( !$(formEntry).is(".FormEntry") )
{ formEntry = $(formEntry).parent(); }
$(formEntry).addClass( formEntryErrorClass );
});
$(inputs, $(formSelector)).bind("focus.fields", function(evt) {
if( (!$(evt.target).is("input[type=image]")) && (!$(evt.target).is("input[type=radio]")) )
{ $(evt.target).addClass( formFieldHighlightClass ); }
});
$(inputs, $(formSelector)).bind("blur.fields", function(evt) {
$(evt.target).removeClass( formFieldHighlightClass );
});
$("select", $(formSelector)).mousedown(function(evt) {
$(evt.target).addClass( formFieldHighlightClass );
});
}
},
obj : {
tabCollection : function(settings) {
if(arguments.length > 0)
{ this.init(settings); }
},
itemSlider : function(settings) {
if(arguments.length > 0)
{ this.init(settings); }
},
buttonCollection : function(settings) {
if(arguments.length > 0)
{ this.init(settings); }
}
},
about : function() {
alert("Property: Fry, Inc.");
}
};
}($);
/* button Code */
lib.obj.buttonCollection.prototype.init = function(settings) {
settings = jQuery.extend({
off: "but-off.gif",
on: "but-on.gif",
hover: "but-hover.gif",
hasClick: false,
hasHover: true,
activeId: "but-active",
cssButton: false,
cssOff: "glo-but-css-off",
cssOn: "glo-but-css-on",
cssHover: "glo-but-css-hover",
buttonSelector: ".but-class"
}	, settings);
this.buttonSelector = settings.buttonSelector;
this.activeId = settings.activeId;
this.hasClick = settings.hasClick;
this.hasHover = settings.hasHover;
if( settings.cssButton )
{
this.type = "CSSBUTTON";
this.cssOff = settings.cssOff;
this.cssOn = settings.cssOn;
this.cssHover = settings.cssHover;
var pObj = this;
$(this.buttonSelector).each(function() {
// make sure the right styles are on the button by default.
if( $(this).attr("id") != pObj.activeId )
{ $(this).addClass(pObj.cssOff);}
else
{
$(this).removeClass(pObj.cssOff);
$(this).addClass(pObj.cssOn);
}
//setup the hover
if( pObj.hasHover )
{
$(this).unbind("mouseover.buttonCollection").bind("mouseover.buttonCollection", function() {
if( $(this).attr("id") != pObj.activeId )
{
$(this).removeClass(pObj.cssOff);
$(this).addClass(pObj.cssHover);
}
});
$(this).unbind("mouseout.buttonCollection").bind("mouseout.buttonCollection", function() {
if( $(this).attr("id") != pObj.activeId )
{
$(this).removeClass(pObj.cssHover);
$(this).addClass(pObj.cssOff);
}
});
}
//setup the click
if( pObj.hasClick )
{
$(this).unbind("click.buttonCollection").bind("click.buttonCollection", function() {
if( $(this).attr("id") != pObj.activeId )
{
$(pObj.buttonSelector).attr("id","");
$(pObj.buttonSelector).removeClass(pObj.cssHover);
$(pObj.buttonSelector).removeClass(pObj.cssOn);
$(pObj.buttonSelector).trigger("mouseout.buttonCollection");
$(this).removeClass(pObj.cssOff);
$(this).addClass(pObj.cssOn);
$(this).attr("id",pObj.activeId);
}
});
}
});
}
else
{
this.type = "IMAGEBUTTON";
this.off = settings.off;
this.on = settings.on;
this.hover = settings.hover;
var pObj = this;
$(this.buttonSelector).each(function() {
// always have the mouseout
$(this).unbind("mouseout.buttonCollection").bind("mouseout.buttonCollection", function() {
if( $(this).attr("id") != pObj.activeId )
{ $(this).attr("src",pObj.off); }
});
//setup the hover
if( this.hasHover )
{
$(this).unbind("mouseover.buttonCollection").bind("mouseover.buttonCollection", function() {
if( $(this).attr("id") != pObj.activeId )
{ $(this).attr("src",pObj.hover); }
});
}
//setup the click
if( this.hasClick )
{
$(this).unbind("click.buttonCollection").bind("click.buttonCollection", function() {
if( $(this).attr("id") != pObj.activeId )
{
$(pObj.buttonSelector).attr("id","");
$(pObj.buttonSelector).trigger("mouseout.buttonCollection");
$(this).attr("src",pObj.on);
$(this).attr("id",pObj.activeId);
}
});
}
});
lib.image.preload(pObj.off);
if( pObj.hasClick )
{lib.images.preload(pObj.on); }
if (pObj.hasHover )
{ lib.images.preload(pObj.hover); }
}
};
/* ------------- */
/* itemSlider Object Code */
lib.obj.itemSlider.prototype.init = function(settings) {
settings = $.extend({
viewport: "#widget-slider-viewport",
content: "#widget-slider-content",
next: "#widget-slider-next",
prev: "#widget-slider-prev",
item: "div",
direction: "vertical",
showAmount: 3
}, settings);
this.viewport = settings.viewport;
this.content = settings.content;
this.next = settings.next;
this.prev = settings.prev;
this.item = settings.item;
this.direction = settings.direction;
this.showAmount = settings.showAmount;
this.sliderInfo = new Object();
this.sliderInfo.index = 0;
// fix overflwo for items not showing (should be FF only?)
$(this.item + " *").each(function(i) {
if( $(this).css("overflow") == "auto" )
{ $(this).addClass("is__overflow"); }
});
$(".is__overflow", $(this.item).slice(this.sliderInfo.index+this.showAmount, $(this.item).size())).css("overflow", "hidden");
// --------------------------------
if ( $(this.viewport).size() > 0 )
{
$(this.next).hide();
$(this.prev).hide();
if( $(this.item).size() > this.showAmount )
{ $(this.next).show(); }
if( this.direction == "vertical" )
{
this.sliderInfo.start = 0;
this.sliderInfo.end = ($(this.item).size() - this.showAmount) * $(this.item).eq(0).height() * -1;
this.sliderInfo.itemSize = $(this.item).eq(0).height();
this.sliderInfo.top = 0;
}
else
{
//setup the vars.
this.sliderInfo.start = 0;
this.sliderInfo.end = ($(this.item).size() - this.showAmount) * $(this.item).eq(0).width() * -1;
this.sliderInfo.itemSize = $(this.item).eq(0).width();
this.sliderInfo.left = 0;
}
this.nextSetup();
this.prevSetup();
}
};
lib.obj.itemSlider.prototype.nextSetup = function() {
$(this.next).unbind("click");
var currObj = this;
setTimeout(function() {
$(".is__overflow", $(currObj.item).slice(currObj.sliderInfo.index, currObj.sliderInfo.index+currObj.showAmount)).css("overflow", "auto");
$(currObj.next).click(function(evt) {
evt.preventDefault();
$(".is__overflow", $(currObj.item).eq(currObj.sliderInfo.index)).css("overflow","hidden");
currObj.sliderInfo.index++;
if(currObj.direction == "vertical")
{
currObj.sliderInfo.top = parseInt($(currObj.content).css("top").split("px")[0]) - currObj.sliderInfo.itemSize;
$(currObj.content).animate( { top:currObj.sliderInfo.top+"px"}, 350 );
if( currObj.sliderInfo.top == currObj.sliderInfo.end )
{ $(currObj.next).hide(); }
if( currObj.sliderInfo.top != 0 )
{ $(currObj.prev).show();  }
}
else
{
currObj.sliderInfo.left = parseInt($(currObj.content).css("left").split("px")[0]) - currObj.sliderInfo.itemSize;
$(currObj.content).animate( { left:currObj.sliderInfo.left+"px"}, 350 );
if( currObj.sliderInfo.left == currObj.sliderInfo.end )
{ $(currObj.next).hide(); }
if( currObj.sliderInfo.left != 0 )
{ $(currObj.prev).show();  }
}
currObj.nextSetup();
});
}, 351);
};
lib.obj.itemSlider.prototype.prevSetup = function() {
$(this.prev).unbind("click");
var currObj = this;
setTimeout(function() {
$(".is__overflow", $(currObj.item).slice(currObj.sliderInfo.index, currObj.sliderInfo.index+currObj.showAmount)).css("overflow", "auto");
$(currObj.prev).click(function(evt) {
evt.preventDefault();
$(".is__overflow", $(currObj.item).eq(currObj.sliderInfo.index + currObj.showAmount-1)).css("overflow","hidden");
currObj.sliderInfo.index--;
if( currObj.direction == "vertical")
{
currObj.sliderInfo.top = parseInt($(currObj.content).css("top").split("px")[0]) + currObj.sliderInfo.itemSize;
$(currObj.content).animate( { top:currObj.sliderInfo.top+"px"}, 350 );
if( currObj.sliderInfo.top != currObj.sliderInfo.end )
{ $(currObj.next).show(); }
if( currObj.sliderInfo.top == 0 )
{ $(currObj.prev).hide();  }
}
else
{
currObj.sliderInfo.left = parseInt($(currObj.content).css("left").split("px")[0]) + currObj.sliderInfo.itemSize;
$(currObj.content).animate( { left:currObj.sliderInfo.left+"px"}, 350 );
if( currObj.sliderInfo.left != currObj.sliderInfo.end )
{ $(currObj.next).show(); }
if( currObj.sliderInfo.left == 0 )
{ $(currObj.prev).hide();  }
}
currObj.prevSetup();
});
}, 351);
};
/* ----------------------- */
/* tabCollection Object */
lib.obj.tabCollection.prototype.init = function(settings) {
settings = jQuery.extend({
selectorTabCollection: "#tcollection",
selectorTabContent: ".tcontent",
selectorTabNav: "#tnav",
activeTabClass: "tactive",
evtIdentifier: "a",
defaultTab: "tab1"
}, settings);
this.sTabCollection = settings.selectorTabCollection;
this.sTabContent = settings.selectorTabContent;
this.sTabNav = settings.selectorTabNav;
this.activeTabClass = settings.activeTabClass;
this.evtIdentifier = settings.evtIdentifier;
this.evtName = "EV" + lib.utils.timestamp();
// setup
this.activateTab(settings.defaultTab);
this.bindEvt();
};
lib.obj.tabCollection.prototype.activateTab = function(name) {
$(this.sTabCollection  + " " + this.sTabNav + " a").removeClass(this.activeTabClass);
$(this.sTabCollection + " " + this.sTabContent).hide();
$(this.sTabCollection + " " + this.sTabNav + " a[name="+name+"]").addClass(this.activeTabClass);
$(this.sTabCollection + " " + this.sTabContent+"[name="+name+"]").show();
};
lib.obj.tabCollection.prototype.bindEvt = function() {
var tabObj = this;
tabObj.unbindEvt();
$(tabObj.sTabCollection + " " + tabObj.sTabNav).bind("click."+tabObj.evtName, function(evt) {
var target = $(evt.target);
if( $(target).is(tabObj.evtIdentifier) )
{
evt.preventDefault();
tabObj.activateTab( $(target).attr("name") );
}
});
};
lib.obj.tabCollection.prototype.unbindEvt = function() {
$(this.sTabCollection + " " + this.sTabNav).unbind("click."+this.evtName);
};
/* ------------------------------- */
})($);/**
* SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
*
* SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*/
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
*       used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
*                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
*                             If set to null or omitted, the cookie will be a session cookie and will not be retained
*                             when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
*                        require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
function getJCookie(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', value, expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};
//  dw_event.js version date Apr 2008
//  basic event handling file from dyn-web.com
var dw_Event = {
add: function(obj, etype, fp, cap) {
cap = cap || false;
if (obj.addEventListener) obj.addEventListener(etype, fp, cap);
else if (obj.attachEvent) obj.attachEvent("on" + etype, fp);
},
remove: function(obj, etype, fp, cap) {
cap = cap || false;
if (obj.removeEventListener) obj.removeEventListener(etype, fp, cap);
else if (obj.detachEvent) obj.detachEvent("on" + etype, fp);
},
DOMit: function(e) {
e = e? e: window.event; // e IS passed when using attachEvent though ...
if (!e.target) e.target = e.srcElement;
if (!e.preventDefault) e.preventDefault = function () { e.returnValue = false; return false; }
if (!e.stopPropagation) e.stopPropagation = function () { e.cancelBubble = true; }
return e;
},
getTarget: function(e) {
e = dw_Event.DOMit(e); var tgt = e.target;
if (tgt.nodeType != 1) tgt = tgt.parentNode; // safari...
return tgt;
}
}
// Danny Goodman's version (DHTML def ref)
function addLoadEvent(func) {
var oldQueue = window.onload? window.onload: function() {};
window.onload = function() {
oldQueue();
func();
}
}
/*************************************************************************
This code is from Dynamic Web Coding at dyn-web.com
Copyright 2001-2008 by Sharon Paine
See Terms of Use at www.dyn-web.com/business/terms.php
regarding conditions under which you may use this code.
This notice must be retained in the code as is!
version date: Feb 2009 (opera mousewheel)
printEnabled property added Nov 2008
*************************************************************************/
// horizId only needed for horizontal scrolling
function dw_scrollObj(wndoId, lyrId, horizId) {
var wn = document.getElementById(wndoId);
this.id = wndoId; dw_scrollObj.col[this.id] = this;
this.animString = "dw_scrollObj.col." + this.id;
this.load(lyrId, horizId);
if (wn.addEventListener) {
wn.addEventListener('DOMMouseScroll', dw_scrollObj.doOnMouseWheel, false);
}
wn.onmousewheel = dw_scrollObj.doOnMouseWheel;
}
// If set true, position scrolling content div's absolute in style sheet (see documentation)
// set false in download file with position absolute set in .load method due to support issues
// (Too many people remove the specification and then complain that the code doesn't work!)
dw_scrollObj.printEnabled = false;
dw_scrollObj.defaultSpeed = dw_scrollObj.prototype.speed = 100; // default for mouseover or mousedown scrolling
dw_scrollObj.defaultSlideDur = dw_scrollObj.prototype.slideDur = 500; // default duration of glide onclick
dw_scrollObj.isSupported = function () {
if ( document.getElementById && document.getElementsByTagName
&& document.addEventListener || document.attachEvent ) {
return true;
}
return false;
}
dw_scrollObj.col = {}; // collect instances
// custom events
dw_scrollObj.prototype.on_load = function() {} // when dw_scrollObj initialized or new layer loaded
dw_scrollObj.prototype.on_scroll = function() {}
dw_scrollObj.prototype.on_scroll_start = function() {}
dw_scrollObj.prototype.on_scroll_stop = function() {} // when scrolling has ceased (mouseout/up)
dw_scrollObj.prototype.on_scroll_end = function() {} // reached end
dw_scrollObj.prototype.on_update = function() {} // called in updateDims
dw_scrollObj.prototype.on_glidescroll = function() {}
dw_scrollObj.prototype.on_glidescroll_start = function() {}
dw_scrollObj.prototype.on_glidescroll_stop = function() {} // destination (to/by) reached
dw_scrollObj.prototype.on_glidescroll_end = function() {} // reached end
dw_scrollObj.prototype.load = function(lyrId, horizId) {
var wndo, lyr;
if (this.lyrId) { // layer currently loaded?
lyr = document.getElementById(this.lyrId);
lyr.style.visibility = "hidden";
}
this.lyr = lyr = document.getElementById(lyrId); // hold this.lyr?
if ( !dw_scrollObj.printEnabled ) {
this.lyr.style.position = 'absolute';
}
this.lyrId = lyrId; // hold id of currently visible layer
this.horizId = horizId || null; // hold horizId for update fn
wndo = document.getElementById(this.id);
this.y = 0; this.x = 0; this.shiftTo(0,0);
this.getDims(wndo, lyr);
lyr.style.visibility = "visible";
this.ready = true; this.on_load();
}
dw_scrollObj.prototype.shiftTo = function(x, y) {
if (this.lyr) {
this.lyr.style.left = (this.x = x) + "px";
this.lyr.style.top = (this.y = y) + "px";
}
}
dw_scrollObj.prototype.getX = function() { return this.x; }
dw_scrollObj.prototype.getY = function() { return this.y; }
dw_scrollObj.prototype.getDims = function(wndo, lyr) {
this.wd = this.horizId? document.getElementById( this.horizId ).offsetWidth: lyr.offsetWidth;
this.maxX = (this.wd - wndo.offsetWidth > 0)? this.wd - wndo.offsetWidth: 0;
this.maxY = (lyr.offsetHeight - wndo.offsetHeight > 0)? lyr.offsetHeight - wndo.offsetHeight: 0;
}
dw_scrollObj.prototype.updateDims = function() {
var wndo = document.getElementById(this.id);
var lyr = document.getElementById( this.lyrId );
this.getDims(wndo, lyr);
this.on_update();
}
// for mouseover/mousedown scrolling
dw_scrollObj.prototype.initScrollVals = function(deg, speed) {
if (!this.ready) return;
if (this.timerId) {
clearInterval(this.timerId); this.timerId = 0;
}
this.speed = speed || dw_scrollObj.defaultSpeed;
this.fx = (deg == 0)? -1: (deg == 180)? 1: 0;
this.fy = (deg == 90)? 1: (deg == 270)? -1: 0;
this.endX = (deg == 90 || deg == 270)? this.x: (deg == 0)? -this.maxX: 0;
this.endY = (deg == 0 || deg == 180)? this.y: (deg == 90)? 0: -this.maxY;
this.lyr = document.getElementById(this.lyrId);
this.lastTime = new Date().getTime();
this.on_scroll_start(this.x, this.y);
this.timerId = setInterval(this.animString + ".scroll()", 10);
}
dw_scrollObj.prototype.scroll = function() {
var now = new Date().getTime();
var d = (now - this.lastTime)/1000 * this.speed;
if (d > 0) {
var x = this.x + Math.round(this.fx * d); var y = this.y + Math.round(this.fy * d);
if ( ( this.fx == -1 && x > -this.maxX ) || ( this.fx == 1 && x < 0 ) ||
( this.fy == -1 && y > -this.maxY ) || ( this.fy == 1 && y < 0 ) )
{
this.lastTime = now;
this.shiftTo(x, y);
this.on_scroll(x, y);
} else {
clearInterval(this.timerId); this.timerId = 0;
this.shiftTo(this.endX, this.endY);
this.on_scroll(this.endX, this.endY);
this.on_scroll_end(this.endX, this.endY);
}
}
}
// when scrolling has ceased (mouseout/up)
dw_scrollObj.prototype.ceaseScroll = function() {
if (!this.ready) return;
if (this.timerId) {
clearInterval(this.timerId); this.timerId = 0;
}
this.on_scroll_stop(this.x, this.y);
}
// glide onclick scrolling
dw_scrollObj.prototype.initScrollByVals = function(dx, dy, dur) {
if ( !this.ready || this.sliding ) return;
this.startX = this.x; this.startY = this.y;
this.destX = this.destY = this.distX = this.distY = 0;
if (dy < 0) {
this.distY = (this.startY + dy >= -this.maxY)? dy: -(this.startY  + this.maxY);
} else if (dy > 0) {
this.distY = (this.startY + dy <= 0)? dy: -this.startY;
}
if (dx < 0) {
this.distX = (this.startX + dx >= -this.maxX)? dx: -(this.startX + this.maxX);
} else if (dx > 0) {
this.distX = (this.startX + dx <= 0)? dx: -this.startX;
}
this.destX = this.startX + this.distX; this.destY = this.startY + this.distY;
this.glideScrollPrep(this.destX, this.destY, dur);
}
dw_scrollObj.prototype.initScrollToVals = function(destX, destY, dur) {
if ( !this.ready || this.sliding ) return;
this.startX = this.x; this.startY = this.y;
this.destX = -Math.max( Math.min(destX, this.maxX), 0);
this.destY = -Math.max( Math.min(destY, this.maxY), 0);
this.distY = this.destY - this.startY;
this.distX = this.destX - this.startX;
this.glideScrollPrep(this.destX, this.destY, dur);
}
dw_scrollObj.prototype.glideScrollPrep = function(destX, destY, dur) {
this.slideDur = (typeof dur == 'number')? dur: dw_scrollObj.defaultSlideDur;
this.per = Math.PI/(2 * this.slideDur); this.sliding = true;
this.lyr = document.getElementById(this.lyrId);
this.startTime = new Date().getTime();
this.timerId = setInterval(this.animString + ".doGlideScroll()",10);
this.on_glidescroll_start(this.startX, this.startY);
}
dw_scrollObj.prototype.doGlideScroll = function() {
var elapsed = new Date().getTime() - this.startTime;
if (elapsed < this.slideDur) {
var x = this.startX + Math.round( this.distX * Math.sin(this.per*elapsed) );
var y = this.startY + Math.round( this.distY * Math.sin(this.per*elapsed) );
this.shiftTo(x, y);
this.on_glidescroll(x, y);
} else {	// if time's up
clearInterval(this.timerId); this.timerId = 0; this.sliding = false;
this.shiftTo(this.destX, this.destY);
this.on_glidescroll(this.destX, this.destY);
this.on_glidescroll_stop(this.destX, this.destY);
// end of axis reached ?
if ( this.distX && (this.destX == 0 || this.destX == -this.maxX)
|| this.distY && (this.destY == 0 || this.destY == -this.maxY) ) {
this.on_glidescroll_end(this.destX, this.destY);
}
}
}
//  resource: http://adomas.org/javascript-mouse-wheel/
dw_scrollObj.handleMouseWheel = function(id, delta) {
var wndo = dw_scrollObj.col[id];
var x = wndo.x;
var y = wndo.y;
wndo.on_scroll_start(x,y);
var ny;
ny = 12  * delta + y
ny = (ny < 0 && ny >= -wndo.maxY)? ny: (ny < -wndo.maxY)? -wndo.maxY: 0;
wndo.shiftTo(x, ny);
wndo.on_scroll(x, ny);
}
dw_scrollObj.doOnMouseWheel = function(e) {
var delta = 0;
if (!e) e = window.event;
if (e.wheelDelta) { /* IE/Opera. */
delta = e.wheelDelta/120;
//if (window.opera) delta = -delta; // not needed as of v 9.2
} else if (e.detail) { // Mozilla
delta = -e.detail/3;
}
if (delta) { // > 0 up, < 0 down
dw_scrollObj.handleMouseWheel(this.id, delta);
}
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
}
dw_scrollObj.GeckoTableBugFix = function() {} // no longer need old bug fix
// Get position of el within layer (oCont) sOff: 'left' or 'top'
// Assumes el is within oCont
function dw_getLayerOffset(el, oCont, sOff) {
var off = "offset" + sOff.charAt(0).toUpperCase() + sOff.slice(1);
var val = el[off];
while ( (el = el.offsetParent) != oCont )
val += el[off];
var clientOff = off.replace("offset", "client");
if ( el[clientOff] ) val += el[clientOff];
return val;
}/*************************************************************************
This code is from Dynamic Web Coding at dyn-web.com
Copyright 2008 by Sharon Paine
See Terms of Use at www.dyn-web.com/business/terms.php
regarding conditions under which you may use this code.
This notice must be retained in the code as is!
unobtrusive event handling for use with dw_scroll.js
version date: Nov 2008
*************************************************************************/
/////////////////////////////////////////////////////////////////////
// two ways to add style sheet for capable browsers
// Nov 2008 revision adds screen as option
// (may want printed copy to appear as on screen?)
dw_writeStyleSheet = function(file, screen) {
var css = '<link rel="stylesheet" href="' + file + '"';
if (screen !== false) {
css += ' media="screen"';
}
document.write(css + ' />');
}
// slower, may flash unstyled ?
function dw_addLinkCSS(file, screen) {
if ( !document.createElement ) return;
var el = document.createElement("link");
el.setAttribute("rel", "stylesheet");
el.setAttribute("type", "text/css");
if (screen !== false) {
el.setAttribute("media", "screen");
}
el.setAttribute("href", file);
document.getElementsByTagName('head')[0].appendChild(el);
}
/////////////////////////////////////////////////////////////////////
// Example class names: load_wn_lyr1, load_wn_lyr2_t2
dw_scrollObj.prototype.setUpLoadLinks = function(controlsId) {
var wndoId = this.id; var el = document.getElementById(controlsId);
var links = el.getElementsByTagName('a');
var cls, parts;
for (var i=0; links[i]; i++) {
cls = dw_scrollObj.get_DelimitedClass( links[i].className );
parts = cls.split('_');
if ( parts[0] == 'load' && parts[1] == wndoId && parts.length > 2 ) {
// no checks on lyrId, horizId
var lyrId = parts[2]; var horizId = parts[3]? parts[3]: null;
dw_Event.add( links[i], 'click', function (wndoId, lyrId, horizId) {
return function (e) {
dw_scrollObj.col[wndoId].load(lyrId, horizId);
if (e && e.preventDefault) e.preventDefault();
return false;
}
}(wndoId, lyrId, horizId) ); // see Crockford js good parts pg 39
}
}
}
dw_scrollObj.prototype.setUpScrollControls = function(controlsId, autoHide, axis) {
var wndoId = this.id; var el = document.getElementById(controlsId);
if ( autoHide && axis == 'v' || axis == 'h' ) {
dw_scrollObj.handleControlVis(controlsId, wndoId, axis);
dw_Scrollbar_Co.addEvent( this, 'on_load', function() { dw_scrollObj.handleControlVis(controlsId, wndoId, axis); } );
dw_Scrollbar_Co.addEvent( this, 'on_update', function() { dw_scrollObj.handleControlVis(controlsId, wndoId, axis); } );
}
var links = el.getElementsByTagName('a'), cls, eType;
for (var i=0; links[i]; i++) {
cls = dw_scrollObj.get_DelimitedClass( links[i].className );
eType = dw_scrollObj.getEv_FnType( cls.slice(0, cls.indexOf('_') ) );
switch ( eType ) {
case 'mouseover' :
case 'mousedown' :
dw_scrollObj.handleMouseOverDownLinks(links[i], wndoId, cls);
break;
case 'scrollToId':
dw_scrollObj.handleScrollToId(links[i], wndoId, cls);
break;
case 'scrollTo' :
case 'scrollBy':
case 'click':
dw_scrollObj.handleClick(links[i], wndoId, cls) ;
break;
}
}
}
dw_scrollObj.handleMouseOverDownLinks = function (linkEl, wndoId, cls) {
var parts = cls.split('_'); var eType = parts[0];
var re = /^(mouseover|mousedown)_(up|down|left|right)(_[\d]+)?$/;
if ( re.test(cls) ) {
var eAlt = (eType == 'mouseover')? 'mouseout': 'mouseup';
var dir = parts[1];  var speed = parts[2] || null;
var deg = (dir == 'up')? 90: (dir == 'down')? 270: (dir == 'left')? 180: 0;
dw_Event.add(linkEl, eType, function (e) { dw_scrollObj.col[wndoId].initScrollVals(deg, speed); } );
dw_Event.add(linkEl, eAlt, function (e) { dw_scrollObj.col[wndoId].ceaseScroll(); } );
if ( eType == 'mouseover') {
dw_Event.add( linkEl, 'mousedown', function (e) { dw_scrollObj.col[wndoId].speed *= 3; } );
dw_Event.add( linkEl, 'mouseup', function (e) {
dw_scrollObj.col[wndoId].speed = dw_scrollObj.prototype.speed; } );
}
dw_Event.add( linkEl, 'click', function(e) { if (e && e.preventDefault) e.preventDefault(); return false; } );
}
}
// scrollToId_smile, scrollToId_smile_100, scrollToId_smile_lyr1_100
dw_scrollObj.handleScrollToId = function (linkEl, wndoId, cls) {
var parts = cls.split('_'); var id = parts[1], lyrId, dur;
if ( parts[2] ) {
if ( isNaN( parseInt(parts[2]) ) ) {
lyrId = parts[2];
dur = ( parts[3] && !isNaN( parseInt(parts[3]) ) )? parseInt(parts[3]): null;
} else {
dur = parseInt( parts[2] );
}
}
dw_Event.add( linkEl, 'click', function (e) {
dw_scrollObj.scrollToId(wndoId, id, lyrId, dur);
if (e && e.preventDefault) e.preventDefault();
return false;
} );
}
// doesn't checks if lyrId in wndo, el in lyrId
dw_scrollObj.scrollToId = function(wndoId, id, lyrId, dur) {
var wndo = dw_scrollObj.col[wndoId];
var el = document.getElementById(id);
if (el) {
if ( lyrId ) {
if ( document.getElementById(lyrId) && wndo.lyrId != lyrId ) {
wndo.load(lyrId);
}
}
var lyr = document.getElementById(wndo.lyrId);
var x = dw_getLayerOffset(el, lyr, 'left');
var y = dw_getLayerOffset(el, lyr, 'top');
wndo.initScrollToVals(x, y, dur);
}
}
dw_scrollObj.handleClick = function (linkEl, wndoId, cls) {
var wndo = dw_scrollObj.col[wndoId];
var parts = cls.split('_'); var eType = parts[0];
var dur_re = /^([\d]+)$/; var fn, re, x, y, dur;
switch (eType) {
case 'scrollTo' :
fn = 'scrollTo';  re = /^(null|end|[\d]+)$/;
x = re.test( parts[1] )? parts[1]: '';
y = re.test( parts[2] )? parts[2]: '';
dur = ( parts[3] && dur_re.test(parts[3]) )? parts[3]: null;
break;
case 'scrollBy': // scrollBy_m30_m40, scrollBy_null_m100, scrollBy_100_null
fn = 'scrollBy';  re = /^(([m]?[\d]+)|null)$/;
x = re.test( parts[1] )? parts[1]: '';
y = re.test( parts[2] )? parts[2]: '';
// negate numbers (m not - but vice versa)
if ( !isNaN( parseInt(x) ) ) {
x = -parseInt(x);
} else if ( typeof x == 'string' ) {
x = x.indexOf('m') !=-1 ? x.replace('m', ''): x;
}
if ( !isNaN( parseInt(y) ) ) {
y = -parseInt(y);
} else if ( typeof y == 'string' ) {
y = y.indexOf('m') !=-1 ? y.replace('m', ''): y;
}
dur = ( parts[3] && dur_re.test(parts[3]) )? parts[3]: null;
break;
case 'click':
var o = dw_scrollObj.getClickParts(cls);
fn = o.fn; x = o.x; y = o.y; dur = o.dur;
break;
}
if ( x !== '' && y !== '' ) {
if (x == 'end') { x = wndo.maxX; }
if (y == 'end') { y = wndo.maxY; }
if (x === 'null' || x === null) { x = wndo.x; }
if (y === 'null' || y === null) { y = wndo.y; }
x = parseInt(x); y = parseInt(y);
dur = !isNaN( parseInt(dur) )? parseInt(dur): null;
if (fn == 'scrollBy') {
dw_Event.add( linkEl, 'click', function (e) {
dw_scrollObj.col[wndoId].initScrollByVals(x, y, dur);
if (e && e.preventDefault) e.preventDefault();
return false;
} );
} else if (fn == 'scrollTo') {
dw_Event.add( linkEl, 'click', function (e) {
dw_scrollObj.col[wndoId].initScrollToVals(x, y, dur);
if (e && e.preventDefault) e.preventDefault();
return false;
} );
}
}
}
// get info from className (e.g., click_down_by_100)
dw_scrollObj.getClickParts = function(cls) {
var parts = cls.split('_');
var re = /^(up|down|left|right)$/;
var dir, fn = '', dur, ar, val, x = '', y = '';
if ( parts.length >= 4 ) {
ar = parts[1].match(re);
dir = ar? ar[1]: null;
re = /^(to|by)$/;
ar = parts[2].match(re);
if (ar) {
fn = (ar[0] == 'to')? 'scrollTo': 'scrollBy';
}
val = parts[3]; // value on x or y axis
re = /^([\d]+)$/;
dur = ( parts[4] && re.test(parts[4]) )? parts[4]: null;
switch (fn) {
case 'scrollBy' :
if ( !re.test( val ) ) {
x = ''; y = ''; break;
}
switch (dir) { // 0 for unspecified axis
case 'up' : x = 0; y = val; break;
case 'down' : x = 0; y = -val; break;
case 'left' : x = val; y = 0; break;
case 'right' : x = -val; y = 0;
}
break;
case 'scrollTo' :
re = /^(end|[\d]+)$/;
if ( !re.test( val ) ) {
x = ''; y = ''; break;
}
switch (dir) { // null for unspecified axis
case 'up' : x = null; y = val; break;
case 'down' : x = null; y = (val == 'end')? val: -val; break;
case 'left' : x = val; y = null; break;
case 'right' : x = (val == 'end')? val: -val; y = null;
}
break;
}
}
return { fn: fn, x: x, y: y, dur: dur }
}
dw_scrollObj.getEv_FnType = function(str) {
var re = /^(mouseover|mousedown|scrollBy|scrollTo|scrollToId|click)$/;
if (re.test(str) ) {
return str;
}
return '';
}
// return class name with underscores in it
dw_scrollObj.get_DelimitedClass = function(cls) {
if ( cls.indexOf('_') == -1 ) {
return '';
}
var whitespace = /\s+/;
if ( !whitespace.test(cls) ) {
return cls;
} else {
var classes = cls.split(whitespace);
for(var i = 0; classes[i]; i++) {
if ( classes[i].indexOf('_') != -1 ) {
return classes[i];
}
}
}
}
dw_scrollObj.handleControlVis = function(controlsId, wndoId, axis) {
var wndo = dw_scrollObj.col[wndoId];
var el = document.getElementById(controlsId);
if ( ( axis == 'v' && wndo.maxY > 0 ) || ( axis == 'h' && wndo.maxX > 0 ) ) {
el.style.visibility = 'visible';
} else {
el.style.visibility = 'hidden';
}
}// This is an example of sending product data from the server
// to the client, then formatting the variants on the client-side
// based on certain criteria.
function cbFormatter(list, attribute, opt)
{
// Get the price for this variant.. If this is the primary list, get all related
// variants from the group and get their prices as well so we can build a range.
var pvds = list.productVariantDropdownSupport;
// Get all of the product variants for this attribute
var variantGroup = attribute.getVariant().getProductVariantGroup();
var groupVariants = variantGroup.getAllVariants()
// Are all of the prices the same within the group?
var lowGroupPrice = 999999.00;
var highGroupPrice = -1.00;
for (var idx = 0; idx < groupVariants.length; idx++)
{
lowGroupPrice = groupVariants[idx].numericPrice < lowGroupPrice ? groupVariants[idx].numericPrice : lowGroupPrice;
highGroupPrice = groupVariants[idx].numericPrice > highGroupPrice ? groupVariants[idx].numericPrice : highGroupPrice;
}
// Are all of the prices the same within the variant?
var variants = variantGroup.getVariantsMatching(attribute.name, attribute.value);
var lowVariantPrice = 999999.00;
var highVariantPrice = -1.00;
var lowVariantDisplay = variants[0].displayPrice;
var highVariantDisplay = variants[0].displayPrice;
for (var idx = 0; idx < variants.length; idx++)
{
// Display really needs to be done before the re-assignment...
lowVariantDisplay = variants[idx].numericPrice < lowVariantPrice ? variants[idx].displayPrice : lowVariantDisplay;
lowVariantPrice = variants[idx].numericPrice < lowVariantPrice ? variants[idx].numericPrice : lowVariantPrice;
highVariantDisplay = variants[idx].numericPrice > highVariantPrice ? variants[idx].displayPrice : highVariantDisplay;
highVariantPrice = variants[idx].numericPrice > highVariantPrice ? variants[idx].numericPrice : highVariantPrice;
}
if (lowGroupPrice != highGroupPrice)
{
// Primary list should display a range
if (pvds.isPrimary){
if (lowVariantPrice != highVariantPrice){
opt.text = opt.text + " " + lowVariantDisplay + " - " + highVariantDisplay;
} else {
if (attribute.getVariant().isDealOfTheDay == "Y"){
opt.text = opt.text + " " + attribute.getVariant().displayPrice + " Deal of the Day";
}
else{
opt.text = opt.text + " " + attribute.getVariant().displayPrice;
}
}
} else {  // Secondary lists should show exact price
if (attribute.getVariant().isDealOfTheDay == "Y"){
opt.text = opt.text + " " + attribute.getVariant().displayPrice + " Deal of the Day";
} else {
opt.text = opt.text + " " + attribute.getVariant().displayPrice;
}
}
}
return opt;
}
// -------------------------------------------------------------------
// DHTML Window Widget- By Dynamic Drive, available at: http://www.dynamicdrive.com
// v1.0: Script created Feb 15th, 07'
// v1.01: Feb 21th, 07' (see changelog.txt)
// v1.02: March 26th, 07' (see changelog.txt)
// v1.03: May 5th, 07' (see changelog.txt)
// v1.1:  Oct 29th, 07' (see changelog.txt)
// -------------------------------------------------------------------
var dhtmlwindow={
imagefiles:['/assets/images/windowfiles/min.gif', '/assets/images/windowfiles/close.gif', '/assets/images/windowfiles/restore.gif', '/assets/images/windowfiles/resize.gif'], //Path to 4 images used by script, in that order
ajaxbustcache: true, //Bust caching when fetching a file via Ajax?
ajaxloadinghtml: '<b>Loading Page. Please wait...</b>', //HTML to show while window fetches Ajax Content?
minimizeorder: 0,
zIndexvalue:100,
tobjects: [], //object to contain references to dhtml window divs, for cleanup purposes
lastactivet: {}, //reference to last active DHTML window
init:function(t){
var domwindow=document.createElement("div") //create dhtml window div
domwindow.id=t
domwindow.className="dhtmlwindow"
var domwindowdata=''
domwindowdata='<div class="drag-handle">'
domwindowdata+='DHTML Window <div class="drag-controls"><img src="'+this.imagefiles[0]+'" title="Minimize" /><img src="'+this.imagefiles[1]+'" title="Close" /></div>'
domwindowdata+='</div>'
domwindowdata+='<div class="drag-contentarea"></div>'
domwindowdata+='<div class="drag-statusarea"><div class="drag-resizearea" style="background: transparent url('+this.imagefiles[3]+') top right no-repeat;">&nbsp;</div></div>'
domwindowdata+='</div>'
domwindow.innerHTML=domwindowdata
document.getElementById("dhtmlwindowholder").appendChild(domwindow)
//this.zIndexvalue=(this.zIndexvalue)? this.zIndexvalue+1 : 100 //z-index value for DHTML window: starts at 0, increments whenever a window has focus
var t=document.getElementById(t)
var divs=t.getElementsByTagName("div")
for (var i=0; i<divs.length; i++){ //go through divs inside dhtml window and extract all those with class="drag-" prefix
if (/drag-/.test(divs[i].className))
t[divs[i].className.replace(/drag-/, "")]=divs[i] //take out the "drag-" prefix for shorter access by name
}
//t.style.zIndex=this.zIndexvalue //set z-index of this dhtml window
t.handle._parent=t //store back reference to dhtml window
t.resizearea._parent=t //same
t.controls._parent=t //same
t.onclose=function(){return true} //custom event handler "onclose"
t.onmousedown=function(){dhtmlwindow.setfocus(this)} //Increase z-index of window when focus is on it
t.handle.onmousedown=dhtmlwindow.setupdrag //set up drag behavior when mouse down on handle div
t.resizearea.onmousedown=dhtmlwindow.setupdrag //set up drag behavior when mouse down on resize div
t.controls.onclick=dhtmlwindow.enablecontrols
t.show=function(){dhtmlwindow.show(this)} //public function for showing dhtml window
t.hide=function(){dhtmlwindow.hide(this)} //public function for hiding dhtml window
t.close=function(){dhtmlwindow.close(this)} //public function for closing dhtml window (also empties DHTML window content)
t.setSize=function(w, h){dhtmlwindow.setSize(this, w, h)} //public function for setting window dimensions
t.moveTo=function(x, y){dhtmlwindow.moveTo(this, x, y)} //public function for moving dhtml window (relative to viewpoint)
t.isResize=function(bol){dhtmlwindow.isResize(this, bol)} //public function for specifying if window is resizable
t.isScrolling=function(bol){dhtmlwindow.isScrolling(this, bol)} //public function for specifying if window content contains scrollbars
t.load=function(contenttype, contentsource, title){dhtmlwindow.load(this, contenttype, contentsource, title)} //public function for loading content into window
this.tobjects[this.tobjects.length]=t
return t //return reference to dhtml window div
},
open:function(t, contenttype, contentsource, title, attr, recalonload){
var d=dhtmlwindow //reference dhtml window object
function getValue(Name){
var config=new RegExp(Name+"=([^,]+)", "i") //get name/value config pair (ie: width=400px,)
return (config.test(attr))? parseInt(RegExp.$1) : 0 //return value portion (int), or 0 (false) if none found
}
if (document.getElementById(t)==null) //if window doesn't exist yet, create it
t=this.init(t) //return reference to dhtml window div
else
t=document.getElementById(t)
this.setfocus(t)
t.setSize(getValue(("width")), (getValue("height"))) //Set dimensions of window
var xpos=getValue("center")? "middle" : getValue("left") //Get x coord of window
var ypos=getValue("center")? "middle" : getValue("top") //Get y coord of window
//t.moveTo(xpos, ypos) //Position window
if (typeof recalonload!="undefined" && recalonload=="recal" && this.scroll_top==0){ //reposition window when page fully loads with updated window viewpoints?
if (window.attachEvent && !window.opera) //In IE, add another 400 milisecs on page load (viewpoint properties may return 0 b4 then)
this.addEvent(window, function(){setTimeout(function(){t.moveTo(xpos, ypos)}, 400)}, "load")
else
this.addEvent(window, function(){t.moveTo(xpos, ypos)}, "load")
}
t.isResize(getValue("resize")) //Set whether window is resizable
t.isScrolling(getValue("scrolling")) //Set whether window should contain scrollbars
t.style.visibility="visible"
t.style.display="block"
t.contentarea.style.display="block"
t.moveTo(xpos, ypos) //Position window
t.load(contenttype, contentsource, title)
if (t.state=="minimized" && t.controls.firstChild.title=="Restore"){ //If window exists and is currently minimized?
t.controls.firstChild.setAttribute("src", dhtmlwindow.imagefiles[0]) //Change "restore" icon within window interface to "minimize" icon
t.controls.firstChild.setAttribute("title", "Minimize")
t.state="fullview" //indicate the state of the window as being "fullview"
}
return t
},
setSize:function(t, w, h){ //set window size (min is 150px wide by 100px tall)
t.style.width=Math.max(parseInt(w), 150)+"px"
t.contentarea.style.height=Math.max(parseInt(h), 100)+"px"
},
moveTo:function(t, x, y){ //move window. Position includes current viewpoint of document
this.getviewpoint() //Get current viewpoint numbers
t.style.left=(x=="middle")? this.scroll_left+(this.docwidth-t.offsetWidth)/2+"px" : this.scroll_left+parseInt(x)+"px"
t.style.top=(y=="middle")? this.scroll_top+(this.docheight-t.offsetHeight)/2+"px" : this.scroll_top+parseInt(y)+"px"
},
isResize:function(t, bol){ //show or hide resize inteface (part of the status bar)
t.statusarea.style.display=(bol)? "block" : "none"
t.resizeBool=(bol)? 1 : 0
},
isScrolling:function(t, bol){ //set whether loaded content contains scrollbars
t.contentarea.style.overflow=(bol)? "auto" : "hidden"
},
load:function(t, contenttype, contentsource, title){ //loads content into window plus set its title (3 content types: "inline", "iframe", or "ajax")
if (t.isClosed){
alert("DHTML Window has been closed, so no window to load contents into. Open/Create the window again.")
return
}
var contenttype=contenttype.toLowerCase() //convert string to lower case
if (typeof title!="undefined")
t.handle.firstChild.nodeValue=title
if (contenttype=="inline")
t.contentarea.innerHTML=contentsource
else if (contenttype=="div"){
var inlinedivref=document.getElementById(contentsource)
t.contentarea.innerHTML=(inlinedivref.defaultHTML || inlinedivref.innerHTML) //Populate window with contents of inline div on page
if (!inlinedivref.defaultHTML)
inlinedivref.defaultHTML=inlinedivref.innerHTML //save HTML within inline DIV
inlinedivref.innerHTML="" //then, remove HTML within inline DIV (to prevent duplicate IDs, NAME attributes etc in contents of DHTML window
inlinedivref.style.display="none" //hide that div
}
else if (contenttype=="iframe"){
t.contentarea.style.overflow="hidden" //disable window scrollbars, as iframe already contains scrollbars
if (!t.contentarea.firstChild || t.contentarea.firstChild.tagName!="IFRAME") //If iframe tag doesn't exist already, create it first
t.contentarea.innerHTML='<iframe src="'+contentsource+'" style="margin:0; padding:0; width:100%; height: 100%" name="_iframe-'+t.id+'"></iframe>'
//window.frames["_iframe-"+t.id].location.replace(contentsource) //set location of iframe window to specified URL
}
else if (contenttype=="ajax"){
this.ajax_connect(contentsource, t) //populate window with external contents fetched via Ajax
}
t.contentarea.datatype=contenttype //store contenttype of current window for future reference
},
setupdrag:function(e){
var d=dhtmlwindow //reference dhtml window object
var t=this._parent //reference dhtml window div
d.etarget=this //remember div mouse is currently held down on ("handle" or "resize" div)
var e=window.event || e
d.initmousex=e.clientX //store x position of mouse onmousedown
d.initmousey=e.clientY
d.initx=parseInt(t.offsetLeft) //store offset x of window div onmousedown
d.inity=parseInt(t.offsetTop)
d.width=parseInt(t.offsetWidth) //store width of window div
d.contentheight=parseInt(t.contentarea.offsetHeight) //store height of window div's content div
if (t.contentarea.datatype=="iframe"){ //if content of this window div is "iframe"
t.style.backgroundColor="#F8F8F8" //colorize and hide content div (while window is being dragged)
t.contentarea.style.visibility="hidden"
}
document.onmousemove=d.getdistance //get distance travelled by mouse as it moves
document.onmouseup=function(){
if (t.contentarea.datatype=="iframe"){ //restore color and visibility of content div onmouseup
t.contentarea.style.backgroundColor="white"
t.contentarea.style.visibility="visible"
}
d.stop()
}
return false
},
getdistance:function(e){
var d=dhtmlwindow
var etarget=d.etarget
var e=window.event || e
d.distancex=e.clientX-d.initmousex //horizontal distance travelled relative to starting point
d.distancey=e.clientY-d.initmousey
if (etarget.className=="drag-handle") //if target element is "handle" div
d.move(etarget._parent, e)
else if (etarget.className=="drag-resizearea") //if target element is "resize" div
d.resize(etarget._parent, e)
return false //cancel default dragging behavior
},
getviewpoint:function(){ //get window viewpoint numbers
var ie=document.all && !window.opera
var domclientWidth=document.documentElement && parseInt(document.documentElement.clientWidth) || 100000 //Preliminary doc width in non IE browsers
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
this.scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
this.scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
this.docwidth=(ie)? this.standardbody.clientWidth : (/Safari/i.test(navigator.userAgent))? window.innerWidth : Math.min(domclientWidth, window.innerWidth-16)
this.docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
},
rememberattrs:function(t){ //remember certain attributes of the window when it's minimized or closed, such as dimensions, position on page
this.getviewpoint() //Get current window viewpoint numbers
t.lastx=parseInt((t.style.left || t.offsetLeft))-dhtmlwindow.scroll_left //store last known x coord of window just before minimizing
t.lasty=parseInt((t.style.top || t.offsetTop))-dhtmlwindow.scroll_top
t.lastwidth=parseInt(t.style.width) //store last known width of window just before minimizing/ closing
},
move:function(t, e){
t.style.left=dhtmlwindow.distancex+dhtmlwindow.initx+"px"
t.style.top=dhtmlwindow.distancey+dhtmlwindow.inity+"px"
},
resize:function(t, e){
t.style.width=Math.max(dhtmlwindow.width+dhtmlwindow.distancex, 150)+"px"
t.contentarea.style.height=Math.max(dhtmlwindow.contentheight+dhtmlwindow.distancey, 100)+"px"
},
enablecontrols:function(e){
var d=dhtmlwindow
var sourceobj=window.event? window.event.srcElement : e.target //Get element within "handle" div mouse is currently on (the controls)
if (/Minimize/i.test(sourceobj.getAttribute("title"))) //if this is the "minimize" control
d.minimize(sourceobj, this._parent)
else if (/Restore/i.test(sourceobj.getAttribute("title"))) //if this is the "restore" control
d.restore(sourceobj, this._parent)
else if (/Close/i.test(sourceobj.getAttribute("title"))) //if this is the "close" control
d.close(this._parent)
return false
},
minimize:function(button, t){
dhtmlwindow.rememberattrs(t)
button.setAttribute("src", dhtmlwindow.imagefiles[2])
button.setAttribute("title", "Restore")
t.state="minimized" //indicate the state of the window as being "minimized"
t.contentarea.style.display="none"
t.statusarea.style.display="none"
if (typeof t.minimizeorder=="undefined"){ //stack order of minmized window on screen relative to any other minimized windows
dhtmlwindow.minimizeorder++ //increment order
t.minimizeorder=dhtmlwindow.minimizeorder
}
t.style.left="10px" //left coord of minmized window
t.style.width="200px"
var windowspacing=t.minimizeorder*10 //spacing (gap) between each minmized window(s)
t.style.top=dhtmlwindow.scroll_top+dhtmlwindow.docheight-(t.handle.offsetHeight*t.minimizeorder)-windowspacing+"px"
},
restore:function(button, t){
dhtmlwindow.getviewpoint()
button.setAttribute("src", dhtmlwindow.imagefiles[0])
button.setAttribute("title", "Minimize")
t.state="fullview" //indicate the state of the window as being "fullview"
t.style.display="block"
t.contentarea.style.display="block"
if (t.resizeBool) //if this window is resizable, enable the resize icon
t.statusarea.style.display="block"
t.style.left=parseInt(t.lastx)+dhtmlwindow.scroll_left+"px" //position window to last known x coord just before minimizing
t.style.top=parseInt(t.lasty)+dhtmlwindow.scroll_top+"px"
t.style.width=parseInt(t.lastwidth)+"px"
},
close:function(t){
try{
var closewinbol=t.onclose()
}
catch(err){ //In non IE browsers, all errors are caught, so just run the below
var closewinbol=true
}
finally{ //In IE, not all errors are caught, so check if variable isn't defined in IE in those cases
if (typeof closewinbol=="undefined"){
alert("An error has occured somwhere inside your \"onclose\" event handler")
var closewinbol=true
}
}
if (closewinbol){ //if custom event handler function returns true
if (t.state!="minimized") //if this window isn't currently minimized
dhtmlwindow.rememberattrs(t) //remember window's dimensions/position on the page before closing
if (window.frames["_iframe-"+t.id]) //if this is an IFRAME DHTML window
//window.frames["_iframe-"+t.id].location.replace("about:blank")
{}
else
t.contentarea.innerHTML=""
t.style.display="none"
t.isClosed=true //tell script this window is closed (for detection in t.show())
}
return closewinbol
},
setopacity:function(targetobject, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
if (!targetobject)
return
if (targetobject.filters && targetobject.filters[0]){ //IE syntax
if (typeof targetobject.filters[0].opacity=="number") //IE6
targetobject.filters[0].opacity=value*100
else //IE 5.5
targetobject.style.filter="alpha(opacity="+value*100+")"
}
else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
targetobject.style.MozOpacity=value
else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
targetobject.style.opacity=value
},
setfocus:function(t){ //Sets focus to the currently active window
this.zIndexvalue++
t.style.zIndex=this.zIndexvalue
t.isClosed=false //tell script this window isn't closed (for detection in t.show())
this.setopacity(this.lastactivet.handle, 0.5) //unfocus last active window
this.setopacity(t.handle, 1) //focus currently active window
this.lastactivet=t //remember last active window
},
show:function(t){
if (t.isClosed){
alert("DHTML Window has been closed, so nothing to show. Open/Create the window again.")
return
}
if (t.lastx) //If there exists previously stored information such as last x position on window attributes (meaning it's been minimized or closed)
dhtmlwindow.restore(t.controls.firstChild, t) //restore the window using that info
else
t.style.display="block"
this.setfocus(t)
t.state="fullview" //indicate the state of the window as being "fullview"
},
hide:function(t){
t.style.display="none"
},
ajax_connect:function(url, t){
var page_request = false
var bustcacheparameter=""
if (window.XMLHttpRequest) // if Mozilla, IE7, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE6 or below
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
t.contentarea.innerHTML=this.ajaxloadinghtml
page_request.onreadystatechange=function(){dhtmlwindow.ajax_loadpage(page_request, t)}
if (this.ajaxbustcache) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
},
ajax_loadpage:function(page_request, t){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
t.contentarea.innerHTML=page_request.responseText
}
},
stop:function(){
dhtmlwindow.etarget=null //clean up
document.onmousemove=null
document.onmouseup=null
},
addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
},
cleanup:function(){
for (var i=0; i<dhtmlwindow.tobjects.length; i++){
dhtmlwindow.tobjects[i].handle._parent=dhtmlwindow.tobjects[i].resizearea._parent=dhtmlwindow.tobjects[i].controls._parent=null
}
window.onload=null
}
} //End dhtmlwindow object
document.write('<div id="dhtmlwindowholder"><span style="display:none">.</span></div>') //container that holds all dhtml window divs on page
window.onunload=dhtmlwindow.cleanup
/****************************************************************
*                                                              *
*  CurvyCorners                                                *
*  ------------                                                *
*                                                              *
*  This script generates rounded corners for your boxes.       *
*                                                              *
*  Version 2.1pre5                                             *
*  Copyright (c) 2010 Cameron Cooke                            *
*  Contributors: Tim Hutchison, CPK Smithies, Terry Riegel,    *
*                Sim� Albert.                                  *
*                                                              *
*  Website: http://www.curvycorners.net                        *
*  SVN:     http://curvycorners.googlecode.com/                *
*  Email:   cameron@curvycorners.net                           *
*  Discuss: http://groups.google.com/group/curvycorners        *
*                                                              *
*  Please consult the SVN for a list of changes since the last *
*  revision.                                                   *
*                                                              *
*  This library is free software; you can redistribute         *
*  it and/or modify it under the terms of the GNU              *
*  Lesser General Public License as published by the           *
*  Free Software Foundation; either version 2.1 of the         *
*  License, or (at your option) any later version.             *
*                                                              *
*  This library is distributed in the hope that it will        *
*  be useful, but WITHOUT ANY WARRANTY; without even the       *
*  implied warranty of MERCHANTABILITY or FITNESS FOR A        *
*  PARTICULAR PURPOSE. See the GNU Lesser General Public       *
*  License for more details.                                   *
*                                                              *
*  You should have received a copy of the GNU Lesser           *
*  General Public License along with this library;             *
*  Inc., 59 Temple Place, Suite 330, Boston,                   *
*  MA 02111-1307 USA                                           *
*                                                              *
****************************************************************/
/*
Version 2.x now autoMagically applies borders via CSS rules.
Opera and Chrome support rounded corners via
border-radius
Safari and Mozilla support rounded borders via
-webkit-border-radius, -moz-border-radius
We let these browsers render their borders natively.
Firefox for Windows renders non-antialiased
borders so they look a bit ugly. Google's Chrome will render its "ugly"
borders as well. So if we let FireFox, Safari, Opera and Chrome render
their borders natively, then we only have to support IE
for rounded borders. Fortunately IE reads CSS properties
that it doesn't understand (Opera, Firefox and Safari discard them);
so for IE we find and apply -moz-border-radius and friends.
So to make curvycorners work with any major browser simply add the
following CSS declarations and it should be good to go...
.round {
border-radius: 3ex;
-webkit-border-radius: 3ex;
-moz-border-radius: 3ex;
}
*/
var curvyCornersVerbose = false;
function browserdetect() {
var agent = navigator.userAgent.toLowerCase();
this.isIE = agent.indexOf("msie") > -1;
if (this.isIE) {
this.ieVer = /msie\s(\d\.\d)/.exec(agent)[1];
this.quirksMode = !document.compatMode || document.compatMode.indexOf("BackCompat") > -1;
this.get_style = function(obj, prop) {
if (!(prop in obj.currentStyle)) return "";
var matches = /^([\d.]+)(\w*)/.exec(obj.currentStyle[prop]);
if (!matches) return obj.currentStyle[prop];
if (matches[1] == 0) return '0';
// now convert to pixels if necessary
if (matches[2] && matches[2] !== 'px') {
var style = obj.style.left;
var rtStyle = obj.runtimeStyle.left;
obj.runtimeStyle.left = obj.currentStyle.left;
obj.style.left = matches[1] + matches[2];
matches[0] = obj.style.pixelLeft;
obj.style.left = style;
obj.runtimeStyle.left = rtStyle;
}
return matches[0];
};
this.supportsCorners = false;
}
else {
this.ieVer = this.quirksMode = 0;
this.get_style = function(obj, prop) {
prop = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
return document.defaultView.getComputedStyle(obj, '').getPropertyValue(prop);
};
this.isSafari  = agent.indexOf('safari') != -1;
this.isWebKit  = agent.indexOf('webkit') != -1;
this.isOp      = 'opera' in window;
if (this.isOp)
this.supportsCorners =  (this.isOp = window.opera.version()) >= 10.5;
else {
if (!this.isWebkit) { // firefox check
if (!(this.isMoz = agent.indexOf('firefox') !== -1)) {
for (var i = document.childNodes.length; --i >= 0; ) if ('style' in document.childNodes[i]) {
this.isMoz = 'MozBorderRadius' in document.childNodes[i].style;
break;
}
}
}
this.supportsCorners = this.isWebKit || this.isMoz;
}
}
}
var curvyBrowser = new browserdetect;
/* Force caching of bg images in IE6 */
if (curvyBrowser.isIE) {
try {
document.execCommand("BackgroundImageCache", false, true);
}
catch(e) {};
}
// object that parses border-radius properties for a box
function curvyCnrSpec(selText) {
this.selectorText = selText;
this.tlR = this.trR = this.blR = this.brR = 0;
this.tlu = this.tru = this.blu = this.bru = "";
this.antiAlias = true; // default true
}
curvyCnrSpec.prototype.setcorner = function(tb, lr, radius, unit) {
if (!tb) { // no corner specified
this.tlR = this.trR = this.blR = this.brR = parseInt(radius);
this.tlu = this.tru = this.blu = this.bru = unit;
}
else { // corner specified
propname = tb.charAt(0) + lr.charAt(0);
this[propname + 'R'] = parseInt(radius);
this[propname + 'u'] = unit;
}
}
/*
get(propstring)
where propstring is:
- 'tR' or 'bR' : returns top or bottom radius.
- 'tlR', 'trR', 'blR' or 'brR' : returns top/bottom left/right radius.
- 'tlu', 'tru', 'blr' or 'bru' : returns t/b l/r unit (px, em...)
- 'tRu' or 'bRu' : returns top/bottom radius+unit
- 'tlRu', 'trRu', 'blRu', 'brRu' : returns t/b l/r radius+unit
*/
curvyCnrSpec.prototype.get = function(prop) {
if (/^(t|b)(l|r)(R|u)$/.test(prop)) return this[prop];
if (/^(t|b)(l|r)Ru$/.test(prop)) {
var pname = prop.charAt(0) + prop.charAt(1);
return this[pname + 'R'] + this[pname + 'u'];
}
if (/^(t|b)Ru?$/.test(prop)) {
var tb = prop.charAt(0);
tb += this[tb + 'lR'] > this[tb + 'rR'] ? 'l' : 'r';
var retval = this[tb + 'R'];
if (prop.length === 3 && prop.charAt(2) === 'u')
retval += this[tb = 'u'];
return retval;
}
throw new Error('Don\'t recognize property ' + prop);
}
curvyCnrSpec.prototype.radiusdiff = function(tb) {
if (tb !== 't' && tb !== 'b') throw new Error("Param must be 't' or 'b'");
return Math.abs(this[tb + 'lR'] - this[tb + 'rR']);
}
curvyCnrSpec.prototype.setfrom = function(obj) {
this.tlu = this.tru = this.blu = this.bru = 'px'; // default to px
if ('tl' in obj) this.tlR = obj.tl.radius;
if ('tr' in obj) this.trR = obj.tr.radius;
if ('bl' in obj) this.blR = obj.bl.radius;
if ('br' in obj) this.brR = obj.br.radius;
if ('antiAlias' in obj) this.antiAlias = obj.antiAlias;
};
curvyCnrSpec.prototype.cloneOn = function(box) { // not needed by IE
var props = ['tl', 'tr', 'bl', 'br'];
var converted = 0;
var i, propu;
for (i in props) if (!isNaN(i)) {
propu = this[props[i] + 'u'];
if (propu !== '' && propu !== 'px') {
converted = new curvyCnrSpec;
break;
}
}
if (!converted)
converted = this; // no need to clone
else {
var propi, propR, save = curvyBrowser.get_style(box, 'left');
for (i in props) if (!isNaN(i)) {
propi = props[i];
propu = this[propi + 'u'];
propR = this[propi + 'R'];
if (propu !== 'px') {
var save = box.style.left;
box.style.left = propR + propu;
propR = box.style.pixelLeft;
box.style.left = save;
}
converted[propi + 'R'] = propR;
converted[propi + 'u'] = 'px';
}
box.style.left = save;
}
return converted;
}
curvyCnrSpec.prototype.radiusSum = function(tb) {
if (tb !== 't' && tb !== 'b') throw new Error("Param must be 't' or 'b'");
return this[tb + 'lR'] + this[tb + 'rR'];
}
curvyCnrSpec.prototype.radiusCount = function(tb) {
var count = 0;
if (this[tb + 'lR']) ++count;
if (this[tb + 'rR']) ++count;
return count;
}
curvyCnrSpec.prototype.cornerNames = function() {
var ret = [];
if (this.tlR) ret.push('tl');
if (this.trR) ret.push('tr');
if (this.blR) ret.push('bl');
if (this.brR) ret.push('br');
return ret;
}
/*
Object that parses Opera CSS
*/
function operasheet(sheetnumber) {
var txt = document.styleSheets.item(sheetnumber).ownerNode.text;
txt = txt.replace(/\/\*(\n|\r|.)*?\*\//g, ''); // strip comments
// this pattern extracts all border-radius-containing rulesets
// matches will be:
// [0] = the whole lot
// [1] = the selector text
// [2] = all the rule text between braces
// [3] = top/bottom and left/right parts if present (only if webkit/CSS3)
// [4] = top|bottom
// [5] = left|right
// .. but 3..5 are useless as they're only the first match.
var pat = new RegExp("^\\s*([\\w.#][-\\w.#, ]+)[\\n\\s]*\\{([^}]+border-((top|bottom)-(left|right)-)?radius[^}]*)\\}", "mg");
var matches;
this.rules = [];
while ((matches = pat.exec(txt)) !== null) {
var pat2 = new RegExp("(..)border-((top|bottom)-(left|right)-)?radius:\\s*([\\d.]+)(in|em|px|ex|pt)", "g");
var submatches, cornerspec = new curvyCnrSpec(matches[1]);
while ((submatches = pat2.exec(matches[2])) !== null)
if (submatches[1] !== "z-")
cornerspec.setcorner(submatches[3], submatches[4], submatches[5], submatches[6]);
this.rules.push(cornerspec);
}
}
// static class function to determine if the sheet is worth parsing
operasheet.contains_border_radius = function(sheetnumber) {
return /border-((top|bottom)-(left|right)-)?radius/.test(document.styleSheets.item(sheetnumber).ownerNode.text);
}
/*
Usage:
curvyCorners(settingsObj, "selectorStr");
curvyCorners(settingsObj, domObj1[, domObj2[, domObj3[, . . . [, domObjN]]]]);
selectorStr::= "<complexSelector>[, <complexSelector>]..."
complexSelector::= <selector>[ <selector]
selector::= "[<elementname>].classname" | "#id"
*/
function curvyCorners() {
var i, j, boxCol, settings, startIndex;
// Check parameters
if (typeof arguments[0] !== "object") throw curvyCorners.newError("First parameter of curvyCorners() must be an object.");
if (arguments[0] instanceof curvyCnrSpec) {
settings = arguments[0];
if (!settings.selectorText && typeof arguments[1] === 'string')
settings.selectorText = arguments[1];
}
else {
if (typeof arguments[1] !== "object" && typeof arguments[1] !== "string") throw curvyCorners.newError("Second parameter of curvyCorners() must be an object or a class name.");
j = arguments[1];
if (typeof j !== 'string') j = '';
if (j !== '' && j.charAt(0) !== '.' && 'autoPad' in arguments[0]) j = '.' + j; // for compatibility, prefix with dot
settings = new curvyCnrSpec(j);
settings.setfrom(arguments[0]);
}
// Get object(s)
if (settings.selectorText) {
startIndex = 0;
var args = settings.selectorText.replace(/\s+$/,'').split(/,\s*/); // handle comma-separated selector list
boxCol = new Array;
for (i = 0; i < args.length; ++i) {
if ((j = args[i].lastIndexOf('#')) !== -1)
args[i] = args[i].substr(j); // ignore everything on LHS of ID
boxCol = boxCol.concat(curvyCorners.getElementsBySelector(args[i].split(/\s+/)));
}
}
else {
startIndex = 1;
boxCol = arguments;
}
// Loop through each object
for (i = startIndex, j = boxCol.length; i < j; ++i) {
var theBox = boxCol[i];
var skipCorners = false;
if (!theBox.className)
theBox.className = 'curvyIgnore'; // don't do it twice
else {
skipCorners = theBox.className.indexOf('curvyIgnore') !== -1;
if (!skipCorners) theBox.className += ' curvyIgnore'; // prevent repeats
}
if (!skipCorners) {
if (theBox.className.indexOf('curvyRedraw') !== -1) {
if (typeof curvyCorners.redrawList === 'undefined') curvyCorners.redrawList = new Array;
curvyCorners.redrawList.push({
node : theBox,
spec : settings,
copy : theBox.cloneNode(false)
});
}
var obj = new curvyObject(settings, theBox);
obj.applyCorners();
}
}
}
curvyCorners.prototype.applyCornersToAll = function () { // now redundant
throw curvyCorners.newError('This function is now redundant. Just call curvyCorners(). See documentation.');
};
curvyCorners.redraw = function() {
if (curvyBrowser.supportsCorners) return;
if (!curvyCorners.redrawList) throw curvyCorners.newError('curvyCorners.redraw() has nothing to redraw.');
var old_block_value = curvyCorners.block_redraw;
curvyCorners.block_redraw = true;
for (var i in curvyCorners.redrawList) {
if (isNaN(i)) continue; // in case of added prototype methods
var o = curvyCorners.redrawList[i];
if (!o.node.clientWidth) continue; // don't resize hidden boxes
var newchild = o.copy.cloneNode(false);
for (var contents = o.node.firstChild; contents != null; contents = contents.nextSibling)
if (contents.className.indexOf('autoPadDiv') !== -1) break;
if (!contents) {
curvyCorners.alert('Couldn\'t find autoPad DIV');
break;
}
o.node.parentNode.replaceChild(newchild, o.node);
// remove script elements, if any
var scripts = contents.getElementsByTagName('script');
for (var j = scripts.length - 1; j >= 0; --j)
scripts[j].parentNode.removeChild(scripts[j]);
while (contents.firstChild) newchild.appendChild(contents.removeChild(contents.firstChild));
o = new curvyObject(o.spec, o.node = newchild);
o.applyCorners();
}
curvyCorners.block_redraw = old_block_value;
}
curvyCorners.adjust = function(obj, prop, newval) {
if (!curvyBrowser.supportsCorners) {
if (!curvyCorners.redrawList) throw curvyCorners.newError('curvyCorners.adjust() has nothing to adjust.');
var i, j = curvyCorners.redrawList.length;
for (i = 0; i < j; ++i) if (curvyCorners.redrawList[i].node === obj) break;
if (i === j) throw curvyCorners.newError('Object not redrawable');
obj = curvyCorners.redrawList[i].copy;
}
if (prop.indexOf('.') === -1)
obj[prop] = newval;
else eval('obj.' + prop + "='" + newval + "'");
}
curvyCorners.handleWinResize = function() {
if (!curvyCorners.block_redraw) curvyCorners.redraw();
}
curvyCorners.setWinResize = function(onoff) {
curvyCorners.block_redraw = !onoff;
}
curvyCorners.newError = function(errorMessage) {
return new Error("curvyCorners Error:\n" + errorMessage)
}
curvyCorners.alert = function(errorMessage) {
if (typeof curvyCornersVerbose === 'undefined' || curvyCornersVerbose) alert(errorMessage);
}
// curvyCorners object (can be called directly)
function curvyObject() {
var boxDisp;
this.box              = arguments[1];
this.settings         = arguments[0];
this.topContainer = this.bottomContainer = this.shell = boxDisp = null;
var boxWidth = this.box.clientWidth; // browser-independent IE-emulation (NB includes padding)
if (('canHaveChildren' in this.box && !this.box.canHaveChildren) || this.box.tagName === 'TABLE')
throw new Error(this.errmsg("You cannot apply corners to " + this.box.tagName + " elements.", "Error"));
if (!boxWidth && curvyBrowser.isIE) {
this.box.style.zoom = 1; // can force IE to calculate width
boxWidth = this.box.clientWidth;
}
// try to handle attempts to style inline elements
if (!boxWidth && curvyBrowser.get_style(this.box, 'display') === 'inline') {
this.box.style.display = 'inline-block';
curvyCorners.alert(this.errmsg("Converting inline element to inline-block", "warning"));
boxWidth = this.box.clientWidth;
}
// if still no clientWidth, maybe the box or a parent has 'display:none'.
if (!boxWidth) {
if (!this.box.parentNode) throw this.newError("box has no parent!"); // unlikely...
for (boxDisp = this.box; ; boxDisp = boxDisp.parentNode) {
if (!boxDisp || boxDisp.tagName === 'BODY') { // we've hit the buffers
this.applyCorners = function() {} // make the error benign
curvyCorners.alert(this.errmsg("zero-width box with no accountable parent", "warning"));
return;
}
if (curvyBrowser.get_style(boxDisp, 'display') === 'none') break;
}
// here, we've found the box whose display is set to 'none'.
var boxDispSave = boxDisp.style.display;
boxDisp.style.display = 'block'; // display in order to get browser to calculate clientWidth
boxWidth = this.box.clientWidth;
}
// all attempts have failed
if (!boxWidth) {
curvyCorners.alert(this.errmsg("zero-width box, cannot display", "error"));
this.applyCorners = function() {} // make the error harmless
return;
}
if (arguments[0] instanceof curvyCnrSpec)
this.spec = arguments[0].cloneOn(this.box); // convert non-pixel units
else {
this.spec = new curvyCnrSpec('');
this.spec.setfrom(this.settings); // no need for unit conversion, use settings param. directly
}
// Get box formatting details
var borderWidth     = curvyBrowser.get_style(this.box, "borderTopWidth");
var borderWidthB    = curvyBrowser.get_style(this.box, "borderBottomWidth");
var borderWidthL    = curvyBrowser.get_style(this.box, "borderLeftWidth");
var borderWidthR    = curvyBrowser.get_style(this.box, "borderRightWidth");
var borderColour    = curvyBrowser.get_style(this.box, "borderTopColor");
var borderColourB   = curvyBrowser.get_style(this.box, "borderBottomColor");
var borderColourL   = curvyBrowser.get_style(this.box, "borderLeftColor");
var borderColourR   = curvyBrowser.get_style(this.box, "borderRightColor");
var borderStyle     = curvyBrowser.get_style(this.box, "borderTopStyle");
var borderStyleB    = curvyBrowser.get_style(this.box, "borderBottomStyle");
var borderStyleL    = curvyBrowser.get_style(this.box, "borderLeftStyle");
var borderStyleR    = curvyBrowser.get_style(this.box, "borderRightStyle");
var boxColour       = curvyBrowser.get_style(this.box, "backgroundColor");
var backgroundImage = curvyBrowser.get_style(this.box, "backgroundImage");
var backgroundRepeat= curvyBrowser.get_style(this.box, "backgroundRepeat");
var backgroundPosX, backgroundPosY;
if (this.box.currentStyle && this.box.currentStyle.backgroundPositionX) {
backgroundPosX  = curvyBrowser.get_style(this.box, "backgroundPositionX");
backgroundPosY  = curvyBrowser.get_style(this.box, "backgroundPositionY");
}
else {
backgroundPosX = curvyBrowser.get_style(this.box, 'backgroundPosition');
backgroundPosX = backgroundPosX.split(' ');
backgroundPosY = backgroundPosX.length === 2 ? backgroundPosX[1] : 0;
backgroundPosX = backgroundPosX[0];
}
var boxPosition     = curvyBrowser.get_style(this.box, "position");
var topPadding      = curvyBrowser.get_style(this.box, "paddingTop");
var bottomPadding   = curvyBrowser.get_style(this.box, "paddingBottom");
var leftPadding     = curvyBrowser.get_style(this.box, "paddingLeft");
var rightPadding    = curvyBrowser.get_style(this.box, "paddingRight");
var border          = curvyBrowser.get_style(this.box, "border");
var filter = curvyBrowser.ieVer > 7 ? curvyBrowser.get_style(this.box, 'filter') : null; // IE8 bug fix
var topMaxRadius    = this.spec.get('tR');
var botMaxRadius    = this.spec.get('bR');
var styleToNPx = function(val) {
if (typeof val === 'number') return val;
if (typeof val !== 'string') throw new Error('unexpected styleToNPx type ' + typeof val);
var matches = /^[-\d.]([a-z]+)$/.exec(val);
if (matches && matches[1] != 'px') throw new Error('Unexpected unit ' + matches[1]);
if (isNaN(val = parseInt(val))) val = 0;
return val;
}
var min0Px = function(val) {
return val <= 0 ? "0" : val + "px";
}
// Set formatting properties
try {
this.borderWidth     = styleToNPx(borderWidth);
this.borderWidthB    = styleToNPx(borderWidthB);
this.borderWidthL    = styleToNPx(borderWidthL);
this.borderWidthR    = styleToNPx(borderWidthR);
this.boxColour       = curvyObject.format_colour(boxColour);
this.topPadding      = styleToNPx(topPadding);
this.bottomPadding   = styleToNPx(bottomPadding);
this.leftPadding     = styleToNPx(leftPadding);
this.rightPadding    = styleToNPx(rightPadding);
this.boxWidth        = boxWidth;
this.boxHeight       = this.box.clientHeight;
this.borderColour    = curvyObject.format_colour(borderColour);
this.borderColourB   = curvyObject.format_colour(borderColourB);
this.borderColourL   = curvyObject.format_colour(borderColourL);
this.borderColourR   = curvyObject.format_colour(borderColourR);
this.borderString    = this.borderWidth + "px" + " " + borderStyle + " " + this.borderColour;
this.borderStringB   = this.borderWidthB + "px" + " " + borderStyleB + " " + this.borderColourB;
this.borderStringL   = this.borderWidthL + "px" + " " + borderStyleL + " " + this.borderColourL;
this.borderStringR   = this.borderWidthR + "px" + " " + borderStyleR + " " + this.borderColourR;
this.backgroundImage = ((backgroundImage != "none")? backgroundImage : "");
this.backgroundRepeat= backgroundRepeat;
}
catch(e) {
throw this.newError(e.message);
}
var clientHeight = this.boxHeight;
var clientWidth = boxWidth; // save it as it gets trampled on later
if (curvyBrowser.isOp) {
backgroundPosX = styleToNPx(backgroundPosX);
backgroundPosY = styleToNPx(backgroundPosY);
if (backgroundPosX) {
var t = clientWidth + this.borderWidthL + this.borderWidthR;
if (backgroundPosX > t) backgroundPosX = t;
backgroundPosX = (t / backgroundPosX * 100) + '%'; // convert to percentage
}
if (backgroundPosY) {
var t = clientHeight + this.borderWidth + this.borderWidthB;
if (backgroundPosY > t) backgroundPosY = t;
backgroundPosY = (t / backgroundPosY * 100) + '%'; // convert to percentage
}
}
if (curvyBrowser.quirksMode) {
}
else {
this.boxWidth -= this.leftPadding + this.rightPadding;
this.boxHeight -= this.topPadding + this.bottomPadding;
}
// Create content container
this.contentContainer = document.createElement("div");
if (filter) this.contentContainer.style.filter = filter; // IE8 bug fix
while (this.box.firstChild) this.contentContainer.appendChild(this.box.removeChild(this.box.firstChild));
if (boxPosition != "absolute") this.box.style.position = "relative";
this.box.style.padding = '0';
this.box.style.border = this.box.style.backgroundImage = 'none';
this.box.style.backgroundColor = 'transparent';
this.box.style.width   = (clientWidth + this.borderWidthL + this.borderWidthR) + 'px';
this.box.style.height  = (clientHeight + this.borderWidth + this.borderWidthB) + 'px';
// Ok we add an inner div to actually put things into this will allow us to keep the height
var newMainContainer = document.createElement("div");
newMainContainer.style.position = "absolute";
if (filter) newMainContainer.style.filter = filter; // IE8 bug fix
if (curvyBrowser.quirksMode) {
newMainContainer.style.width  = (clientWidth + this.borderWidthL + this.borderWidthR) + 'px';
} else {
newMainContainer.style.width  = clientWidth + 'px';
}
newMainContainer.style.height = min0Px(clientHeight + this.borderWidth + this.borderWidthB - topMaxRadius - botMaxRadius);
newMainContainer.style.padding  = "0";
newMainContainer.style.top    = topMaxRadius + "px";
newMainContainer.style.left   = "0";
if (this.borderWidthL)
newMainContainer.style.borderLeft = this.borderStringL;
if (this.borderWidth && !topMaxRadius)
newMainContainer.style.borderTop = this.borderString;
if (this.borderWidthR)
newMainContainer.style.borderRight = this.borderStringR;
if (this.borderWidthB && !botMaxRadius)
newMainContainer.style.borderBottom = this.borderStringB;
newMainContainer.style.backgroundColor    = boxColour;
newMainContainer.style.backgroundImage    = this.backgroundImage;
newMainContainer.style.backgroundRepeat   = this.backgroundRepeat;
newMainContainer.style.direction = 'ltr';
this.shell = this.box.appendChild(newMainContainer);
boxWidth = curvyBrowser.get_style(this.shell, "width");
if (boxWidth === "" || boxWidth === "auto" || boxWidth.indexOf("%") !== -1) throw this.newError('Shell width is ' + boxWidth);
this.boxWidth = (boxWidth != "" && boxWidth != "auto" && boxWidth.indexOf("%") == -1) ? parseInt(boxWidth) : this.shell.clientWidth;
/*
This method creates the corners and
applies them to the div element.
*/
this.applyCorners = function() {
/*
Set up background offsets. This may need to be delayed until
the background image is loaded.
*/
this.backgroundPosX = this.backgroundPosY = 0;
if (this.backgroundObject) {
var bgOffset = function(style, imglen, boxlen) {
if (style === 0) return 0;
var retval;
if (style === 'right' || style === 'bottom') return boxlen - imglen;
if (style === 'center') return (boxlen - imglen) / 2;
if (style.indexOf('%') > 0) return (boxlen - imglen) * 100 / parseInt(style);
return styleToNPx(style);
}
this.backgroundPosX  = bgOffset(backgroundPosX, this.backgroundObject.width, clientWidth);
this.backgroundPosY  = bgOffset(backgroundPosY, this.backgroundObject.height, clientHeight);
}
else if (this.backgroundImage) {
this.backgroundPosX = styleToNPx(backgroundPosX);
this.backgroundPosY = styleToNPx(backgroundPosY);
}
/*
Create top and bottom containers.
These will be used as a parent for the corners and bars.
*/
// Build top bar only if a top corner is to be drawn
if (topMaxRadius) {
newMainContainer = document.createElement("div");
newMainContainer.style.width = this.boxWidth + "px";
newMainContainer.style.fontSize = "1px";
newMainContainer.style.overflow = "hidden";
newMainContainer.style.position = "absolute";
newMainContainer.style.paddingLeft  = this.borderWidth + "px";
newMainContainer.style.paddingRight = this.borderWidth + "px";
newMainContainer.style.height = topMaxRadius + "px";
newMainContainer.style.top    = -topMaxRadius + "px";
newMainContainer.style.left   = -this.borderWidthL + "px";
this.topContainer = this.shell.appendChild(newMainContainer);
}
// Build bottom bar only if a bottom corner is to be drawn
if (botMaxRadius) {
var newMainContainer = document.createElement("div");
newMainContainer.style.width = this.boxWidth + "px";
newMainContainer.style.fontSize = "1px";
newMainContainer.style.overflow = "hidden";
newMainContainer.style.position = "absolute";
newMainContainer.style.paddingLeft  = this.borderWidthB + "px";
newMainContainer.style.paddingRight = this.borderWidthB + "px";
newMainContainer.style.height   =  botMaxRadius + "px";
newMainContainer.style.bottom   = -botMaxRadius + "px";
newMainContainer.style.left     = -this.borderWidthL + "px";
this.bottomContainer = this.shell.appendChild(newMainContainer);
}
var corners = this.spec.cornerNames();  // array of available corners
/*
Loop for each corner
*/
for (var i in corners) if (!isNaN(i)) {
// Get current corner type from array
var cc = corners[i];
var specRadius = this.spec[cc + 'R'];
// Has the user requested the currentCorner be round?
// Code to apply correct color to top or bottom
var bwidth, bcolor, borderRadius, borderWidthTB;
if (cc == "tr" || cc == "tl") {
bwidth = this.borderWidth;
bcolor = this.borderColour;
borderWidthTB = this.borderWidth;
} else {
bwidth = this.borderWidthB;
bcolor = this.borderColourB;
borderWidthTB = this.borderWidthB;
}
borderRadius = specRadius - borderWidthTB;
var newCorner = document.createElement("div");
newCorner.style.height = this.spec.get(cc + 'Ru');
newCorner.style.width  = this.spec.get(cc + 'Ru');
newCorner.style.position = "absolute";
newCorner.style.fontSize = "1px";
newCorner.style.overflow = "hidden";
// THE FOLLOWING BLOCK OF CODE CREATES A ROUNDED CORNER
// ---------------------------------------------------- TOP
var intx, inty, outsideColour;
var trans = filter ? parseInt(/alpha\(opacity.(\d+)\)/.exec(filter)[1]) : 100; // IE8 bug fix
// Cycle the x-axis
for (intx = 0; intx < specRadius; ++intx) {
// Calculate the value of y1 which identifies the pixels inside the border
var y1 = (intx + 1 >= borderRadius) ? -1 : Math.floor(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow(intx + 1, 2))) - 1;
// Calculate y2 and y3 only if there is a border defined
if (borderRadius != specRadius) {
var y2 = (intx >= borderRadius) ? -1 : Math.ceil(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow(intx, 2)));
var y3 = (intx + 1 >= specRadius) ? -1 : Math.floor(Math.sqrt(Math.pow(specRadius, 2) - Math.pow((intx+1), 2))) - 1;
}
// Calculate y4
var y4 = (intx >= specRadius) ? -1 : Math.ceil(Math.sqrt(Math.pow(specRadius, 2) - Math.pow(intx, 2)));
// Draw bar on inside of the border with foreground colour
if (y1 > -1) this.drawPixel(intx, 0, this.boxColour, trans, (y1 + 1), newCorner, true, specRadius);
// Draw border/foreground antialiased pixels and border only if there is a border defined
if (borderRadius != specRadius) {
// Cycle the y-axis
if (this.spec.antiAlias) {
for (inty = y1 + 1; inty < y2; ++inty) {
// For each of the pixels that need anti aliasing between the foreground and border colour draw single pixel divs
if (this.backgroundImage != "") {
var borderFract = curvyObject.pixelFraction(intx, inty, borderRadius) * 100;
this.drawPixel(intx, inty, bcolor, trans, 1, newCorner, borderFract >= 30, specRadius);
}
else if (this.boxColour !== 'transparent') {
var pixelcolour = curvyObject.BlendColour(this.boxColour, bcolor, curvyObject.pixelFraction(intx, inty, borderRadius));
this.drawPixel(intx, inty, pixelcolour, trans, 1, newCorner, false, specRadius);
}
else this.drawPixel(intx, inty, bcolor, trans >> 1, 1, newCorner, false, specRadius);
}
// Draw bar for the border
if (y3 >= y2) {
if (y2 == -1) y2 = 0;
this.drawPixel(intx, y2, bcolor, trans, (y3 - y2 + 1), newCorner, false, 0);
}
outsideColour = bcolor;  // Set the colour for the outside AA curve
inty = y3;               // start_pos - 1 for y-axis AA pixels
}
else { // no antiAlias
if (y3 > y1) { // NB condition was >=, changed to avoid zero-height divs
this.drawPixel(intx, (y1 + 1), bcolor, trans, (y3 - y1), newCorner, false, 0);
}
}
}
else {
outsideColour = this.boxColour;  // Set the colour for the outside curve
inty = y1;               // start_pos - 1 for y-axis AA pixels
}
// Draw aa pixels?
if (this.spec.antiAlias && this.boxColour !== 'transparent') {
// Cycle the y-axis and draw the anti aliased pixels on the outside of the curve
while (++inty < y4) {
// For each of the pixels that need anti aliasing between the foreground/border colour & background draw single pixel divs
this.drawPixel(intx, inty, outsideColour, (curvyObject.pixelFraction(intx, inty , specRadius) * trans), 1, newCorner, borderWidthTB <= 0, specRadius);
}
}
}
// END OF CORNER CREATION
// ---------------------------------------------------- END
/*
Now we have a new corner we need to reposition all the pixels unless
the current corner is the bottom right.
*/
// Loop through all children (pixel bars)
for (var t = 0, k = newCorner.childNodes.length; t < k; ++t) {
// Get current pixel bar
var pixelBar = newCorner.childNodes[t];
// Get current top and left properties
var pixelBarTop    = parseInt(pixelBar.style.top);
var pixelBarLeft   = parseInt(pixelBar.style.left);
var pixelBarHeight = parseInt(pixelBar.style.height);
// Reposition pixels
if (cc == "tl" || cc == "bl") {
pixelBar.style.left = (specRadius - pixelBarLeft - 1) + "px"; // Left
}
if (cc == "tr" || cc == "tl"){
pixelBar.style.top =  (specRadius - pixelBarHeight - pixelBarTop) + "px"; // Top
}
pixelBar.style.backgroundRepeat = this.backgroundRepeat;
if (this.backgroundImage) switch(cc) {
case "tr":
pixelBar.style.backgroundPosition = (this.backgroundPosX - this.borderWidthL + specRadius - clientWidth - pixelBarLeft) + "px " + (this.backgroundPosY + pixelBarHeight + pixelBarTop + this.borderWidth - specRadius) + "px";
break;
case "tl":
pixelBar.style.backgroundPosition = (this.backgroundPosX - specRadius + pixelBarLeft + 1 + this.borderWidthL) + "px " + (this.backgroundPosY - specRadius + pixelBarHeight + pixelBarTop + this.borderWidth) + "px";
break;
case "bl":
pixelBar.style.backgroundPosition = (this.backgroundPosX - specRadius + pixelBarLeft + 1 + this.borderWidthL) + "px " + (this.backgroundPosY - clientHeight - this.borderWidth + (curvyBrowser.quirksMode ? pixelBarTop : -pixelBarTop) + specRadius) + "px";
break;
case "br":
if (curvyBrowser.quirksMode) {
pixelBar.style.backgroundPosition = (this.backgroundPosX - this.borderWidthL - clientWidth + specRadius - pixelBarLeft) + "px " + (this.backgroundPosY - clientHeight - this.borderWidth + pixelBarTop + specRadius) + "px";
} else {
pixelBar.style.backgroundPosition = (this.backgroundPosX - this.borderWidthL - clientWidth + specRadius - pixelBarLeft) + "px " + (this.backgroundPosY - clientHeight - this.borderWidth + specRadius - pixelBarTop) + "px";
}
//break;
}
}
// Position the container
switch (cc) {
case "tl":
newCorner.style.top = newCorner.style.left = "0";
this.topContainer.appendChild(newCorner);
break;
case "tr":
newCorner.style.top = newCorner.style.right = "0";
this.topContainer.appendChild(newCorner);
break;
case "bl":
newCorner.style.bottom = newCorner.style.left = "0";
this.bottomContainer.appendChild(newCorner);
break;
case "br":
newCorner.style.bottom = newCorner.style.right = "0";
this.bottomContainer.appendChild(newCorner);
//break;
}
}
/*
The last thing to do is draw the rest of the filler DIVs.
*/
// Find out which corner has the bigger radius and get the difference amount
var radiusDiff = {
t : this.spec.radiusdiff('t'),
b : this.spec.radiusdiff('b')
};
for (z in radiusDiff) {
if (typeof z === 'function') continue; // for prototype, mootools frameworks
if (!this.spec.get(z + 'R')) continue; // no need if no corners
if (radiusDiff[z]) {
// Get the type of corner that is the smaller one
var smallerCornerType = (this.spec[z + "lR"] < this.spec[z + "rR"]) ? z + "l" : z + "r";
// First we need to create a DIV for the space under the smaller corner
var newFiller = document.createElement("div");
newFiller.style.height = radiusDiff[z] + "px";
newFiller.style.width  =  this.spec.get(smallerCornerType + 'Ru');
newFiller.style.position = "absolute";
newFiller.style.fontSize = "1px";
newFiller.style.overflow = "hidden";
newFiller.style.backgroundColor = this.boxColour;
if (filter) newFiller.style.filter = filter; // IE8 bug fix
// Set background image with original features
newFiller.style.backgroundImage = this.backgroundImage;
newFiller.style.backgroundRepeat = this.backgroundRepeat;
// Position filler
switch (smallerCornerType) {
case "tl":
newFiller.style.bottom =
newFiller.style.left   = "0";
newFiller.style.borderLeft = this.borderStringL;
// Set background image in original position
newFiller.style.backgroundPosition = this.backgroundPosX + "px " + (this.borderWidth + this.backgroundPosY - this.spec.tlR) + "px";
this.topContainer.appendChild(newFiller);
break;
case "tr":
newFiller.style.bottom =
newFiller.style.right  = "0";
newFiller.style.borderRight = this.borderStringR;
// Set background image in original position
newFiller.style.backgroundPosition = (this.backgroundPosX - this.boxWidth + this.spec.trR) + "px " + (this.borderWidth + this.backgroundPosY - this.spec.trR) + "px";
this.topContainer.appendChild(newFiller);
break;
case "bl":
newFiller.style.top    =
newFiller.style.left   = "0";
newFiller.style.borderLeft = this.borderStringL;
// Set background image in original position
newFiller.style.backgroundPosition = this.backgroundPosX + "px " + (this.backgroundPosY - this.borderWidth - this.boxHeight + radiusDiff[z] + this.spec.blR) + "px";
this.bottomContainer.appendChild(newFiller);
break;
case "br":
newFiller.style.top    =
newFiller.style.right  = "0";
newFiller.style.borderRight = this.borderStringR;
// Set background image in original position.
newFiller.style.backgroundPosition = (this.borderWidthL + this.backgroundPosX - this.boxWidth + this.spec.brR) + "px " + (this.backgroundPosY - this.borderWidth - this.boxHeight + radiusDiff[z] + this.spec.brR) + "px";
this.bottomContainer.appendChild(newFiller);
//break;
}
}
// Create the bar to fill the gap between each corner horizontally
var newFillerBar = document.createElement("div");
if (filter) newFillerBar.style.filter = filter; // IE8 bug fix
newFillerBar.style.position = "relative";
newFillerBar.style.fontSize = "1px";
newFillerBar.style.overflow = "hidden";
newFillerBar.style.width = this.fillerWidth(z);
newFillerBar.style.backgroundColor = this.boxColour;
newFillerBar.style.backgroundImage = this.backgroundImage;
newFillerBar.style.backgroundRepeat= this.backgroundRepeat;
switch (z) {
case "t":
// Top Bar
if (this.topContainer) {
if (curvyBrowser.quirksMode) {
newFillerBar.style.height = 100 + topMaxRadius + "px";
} else {
newFillerBar.style.height = 100 + topMaxRadius - this.borderWidth + "px";
}
newFillerBar.style.marginLeft  = this.spec.tlR ? (this.spec.tlR - this.borderWidthL) + "px" : "0";
newFillerBar.style.borderTop   = this.borderString;
if (this.backgroundImage) {
var x_offset = this.spec.tlR ?
(this.borderWidthL + this.backgroundPosX - this.spec.tlR) + "px " : this.backgroundPosX + "px ";
newFillerBar.style.backgroundPosition  = x_offset + this.backgroundPosY + "px";
// Reposition the box's background image
this.shell.style.backgroundPosition = this.backgroundPosX + "px " + (this.backgroundPosY - topMaxRadius + this.borderWidthL) + "px";
}
this.topContainer.appendChild(newFillerBar);
}
break;
case "b":
if (this.bottomContainer) {
// Bottom Bar
if (curvyBrowser.quirksMode) {
newFillerBar.style.height     = botMaxRadius + "px";
} else {
newFillerBar.style.height     = botMaxRadius - this.borderWidthB + "px";
}
newFillerBar.style.marginLeft   = this.spec.blR ? (this.spec.blR - this.borderWidthL) + "px" : "0";
newFillerBar.style.borderBottom = this.borderStringB;
if (this.backgroundImage) {
var x_offset = this.spec.blR ?
(this.backgroundPosX + this.borderWidthL - this.spec.blR) + "px " : this.backgroundPosX + "px ";
newFillerBar.style.backgroundPosition = x_offset + (this.backgroundPosY - clientHeight - this.borderWidth + botMaxRadius) + "px";
}
this.bottomContainer.appendChild(newFillerBar);
}
//break;
}
}
// style content container
this.contentContainer.style.position = "absolute";
// contentContainer.style.border = "1px dotted #000"; // DEBUG, comment for production
this.contentContainer.className    = "autoPadDiv";
this.contentContainer.style.left   = this.borderWidthL + "px";
// Get padding amounts
// Apply top padding
this.contentContainer.style.paddingTop = this.topPadding + "px";
this.contentContainer.style.top = this.borderWidth + "px";
// skip bottom padding - it doesn't show!
// Apply left and right padding
this.contentContainer.style.paddingLeft = this.leftPadding + "px";
this.contentContainer.style.paddingRight = this.rightPadding + "px";
z = clientWidth;
if (!curvyBrowser.quirksMode) z -= this.leftPadding + this.rightPadding;
this.contentContainer.style.width = z + "px";
this.contentContainer.style.textAlign = curvyBrowser.get_style(this.box, 'textAlign');
this.box.style.textAlign = 'left'; // important otherwise layout goes wild
this.box.appendChild(this.contentContainer);
if (boxDisp) boxDisp.style.display = boxDispSave;
}
if (this.backgroundImage) {
backgroundPosX = this.backgroundCheck(backgroundPosX);
backgroundPosY = this.backgroundCheck(backgroundPosY);
if (this.backgroundObject) {
this.backgroundObject.holdingElement = this;
this.dispatch = this.applyCorners;
this.applyCorners = function() {
if (this.backgroundObject.complete)
this.dispatch();
else this.backgroundObject.onload = new Function('curvyObject.dispatch(this.holdingElement);');
}
}
}
}
curvyObject.prototype.backgroundCheck = function(style) {
if (style === 'top' || style === 'left' || parseInt(style) === 0) return 0;
if (!(/^[-\d.]+px$/.test(style))  && !this.backgroundObject) {
this.backgroundObject = new Image;
var imgName = function(str) {
var matches = /url\("?([^'"]+)"?\)/.exec(str);
return (matches ? matches[1] : str);
}
this.backgroundObject.src = imgName(this.backgroundImage);
}
return style;
}
curvyObject.dispatch = function(obj) {
if ('dispatch' in obj)
obj.dispatch();
else throw obj.newError('No dispatch function');
}
// append a pixel DIV to newCorner
curvyObject.prototype.drawPixel = function(intx, inty, colour, transAmount, height, newCorner, image, cornerRadius) {
var pixel = document.createElement("div");
pixel.style.height   = height + "px";
pixel.style.width    = "1px";
pixel.style.position = "absolute";
pixel.style.fontSize = "1px";
pixel.style.overflow = "hidden";
var topMaxRadius = this.spec.get('tR');
pixel.style.backgroundColor = colour;
// Don't apply background image to border pixels
if (image && this.backgroundImage != "") {
pixel.style.backgroundImage = this.backgroundImage;
pixel.style.backgroundPosition  = "-" + (this.boxWidth - (cornerRadius - intx) + this.borderWidth) + "px -" + ((this.boxHeight + topMaxRadius + inty) - this.borderWidth) + "px";
}
// Set opacity if the transparency is anything other than 100
if (transAmount != 100) curvyObject.setOpacity(pixel, transAmount);
// Set position
pixel.style.top = inty + "px";
pixel.style.left = intx + "px";
newCorner.appendChild(pixel);
}
curvyObject.prototype.fillerWidth = function(tb) {
var b_width, f_width;
b_width = curvyBrowser.quirksMode ? 0 : this.spec.radiusCount(tb) * this.borderWidthL;
if ((f_width = this.boxWidth - this.spec.radiusSum(tb) + b_width) < 0)
throw this.newError("Radius exceeds box width");
return f_width + 'px';
}
curvyObject.prototype.errmsg = function(msg, gravity) {
var extradata = "\ntag: " + this.box.tagName;
if (this.box.id) extradata += "\nid: " + this.box.id;
if (this.box.className) extradata += "\nclass: " + this.box.className;
var parent;
if ((parent = this.box.parentNode) === null)
extradata += "\n(box has no parent)";
else {
extradata += "\nParent tag: " + parent.tagName;
if (parent.id) extradata += "\nParent ID: " + parent.id;
if (parent.className) extradata += "\nParent class: " + parent.className;
}
if (gravity === undefined) gravity = 'warning';
return 'curvyObject ' + gravity + ":\n" + msg + extradata;
}
curvyObject.prototype.newError = function(msg) {
return new Error(this.errmsg(msg, 'exception'));
}
// ------------- UTILITY FUNCTIONS
//  Convert a number 0..255 to hex
curvyObject.IntToHex = function(strNum) {
var hexdig = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' ];
return hexdig[strNum >>> 4] + '' + hexdig[strNum & 15];
}
/*
Blends the two colours by the fraction
returns the resulting colour as a string in the format "#FFFFFF"
*/
curvyObject.BlendColour = function(Col1, Col2, Col1Fraction) {
if (Col1 === 'transparent' || Col2 === 'transparent') throw this.newError('Cannot blend with transparent');
if (Col1.charAt(0) !== '#') {
//curvyCorners.alert('Found colour1 ' + Col1 + ': please let us know you saw this report.');
Col1 = curvyObject.format_colour(Col1);
}
if (Col2.charAt(0) !== '#') {
//curvyCorners.alert('Found colour2 ' + Col2 + ': please let us know you saw this report.');
Col2 = curvyObject.format_colour(Col2);
}
var red1 = parseInt(Col1.substr(1, 2), 16);
var green1 = parseInt(Col1.substr(3, 2), 16);
var blue1 = parseInt(Col1.substr(5, 2), 16);
var red2 = parseInt(Col2.substr(1, 2), 16);
var green2 = parseInt(Col2.substr(3, 2), 16);
var blue2 = parseInt(Col2.substr(5, 2), 16);
if (Col1Fraction > 1 || Col1Fraction < 0) Col1Fraction = 1;
var endRed = Math.round((red1 * Col1Fraction) + (red2 * (1 - Col1Fraction)));
if (endRed > 255) endRed = 255;
if (endRed < 0) endRed = 0;
var endGreen = Math.round((green1 * Col1Fraction) + (green2 * (1 - Col1Fraction)));
if (endGreen > 255) endGreen = 255;
if (endGreen < 0) endGreen = 0;
var endBlue = Math.round((blue1 * Col1Fraction) + (blue2 * (1 - Col1Fraction)));
if (endBlue > 255) endBlue = 255;
if (endBlue < 0) endBlue = 0;
return "#" + curvyObject.IntToHex(endRed) + curvyObject.IntToHex(endGreen)+ curvyObject.IntToHex(endBlue);
}
/*
For a pixel cut by the line determines the fraction of the pixel on the 'inside' of the
line.  Returns a number between 0 and 1
*/
curvyObject.pixelFraction = function(x, y, r) {
var fraction;
var rsquared = r * r;
/*
determine the co-ordinates of the two points on the perimeter of the pixel that the
circle crosses
*/
var xvalues = new Array(2);
var yvalues = new Array(2);
var point = 0;
var whatsides = "";
// x + 0 = Left
var intersect = Math.sqrt(rsquared - Math.pow(x, 2));
if (intersect >= y && intersect < (y + 1)) {
whatsides = "Left";
xvalues[point] = 0;
yvalues[point] = intersect - y;
++point;
}
// y + 1 = Top
intersect = Math.sqrt(rsquared - Math.pow(y + 1, 2));
if (intersect >= x && intersect < (x + 1)) {
whatsides += "Top";
xvalues[point] = intersect - x;
yvalues[point] = 1;
++point;
}
// x + 1 = Right
intersect = Math.sqrt(rsquared - Math.pow(x + 1, 2));
if (intersect >= y && intersect < (y + 1)) {
whatsides += "Right";
xvalues[point] = 1;
yvalues[point] = intersect - y;
++point;
}
// y + 0 = Bottom
intersect = Math.sqrt(rsquared - Math.pow(y, 2));
if (intersect >= x && intersect < (x + 1)) {
whatsides += "Bottom";
xvalues[point] = intersect - x;
yvalues[point] = 0;
}
/*
depending on which sides of the perimeter of the pixel the circle crosses calculate the
fraction of the pixel inside the circle
*/
switch (whatsides) {
case "LeftRight":
fraction = Math.min(yvalues[0], yvalues[1]) + ((Math.max(yvalues[0], yvalues[1]) - Math.min(yvalues[0], yvalues[1])) / 2);
break;
case "TopRight":
fraction = 1 - (((1 - xvalues[0]) * (1 - yvalues[1])) / 2);
break;
case "TopBottom":
fraction = Math.min(xvalues[0], xvalues[1]) + ((Math.max(xvalues[0], xvalues[1]) - Math.min(xvalues[0], xvalues[1])) / 2);
break;
case "LeftBottom":
fraction = yvalues[0] * xvalues[1] / 2;
break;
default:
fraction = 1;
}
return fraction;
}
// Returns an array of rgb values
curvyObject.rgb2Array = function(rgbColour) {
// Remove rgb()
var rgbValues = rgbColour.substring(4, rgbColour.indexOf(")"));
// Split RGB into array
return rgbValues.split(/,\s*/);
}
// This function converts CSS rgb(x, x, x) to hexadecimal
curvyObject.rgb2Hex = function(rgbColour) {
try {
// Get array of RGB values
var rgbArray = curvyObject.rgb2Array(rgbColour);
// Get RGB values
var red   = parseInt(rgbArray[0]);
var green = parseInt(rgbArray[1]);
var blue  = parseInt(rgbArray[2]);
// Build hex colour code
var hexColour = "#" + curvyObject.IntToHex(red) + curvyObject.IntToHex(green) + curvyObject.IntToHex(blue);
}
catch (e) {
var msg = 'getMessage' in e ? e.getMessage() : e.message;
throw new Error("Error (" + msg + ") converting RGB value to Hex in rgb2Hex");
}
return hexColour;
}
/*
Function by Simon Willison from sitepoint.com
Modified by Cameron Cooke adding Safari's rgba support
*/
curvyObject.setOpacity = function(obj, opacity) {
opacity = (opacity == 100) ? 99.999 : opacity;
if (curvyBrowser.isSafari && obj.tagName != "IFRAME") {
// Get array of RGB values
var rgbArray = curvyObject.rgb2Array(obj.style.backgroundColor);
// Get RGB values
var red   = parseInt(rgbArray[0]);
var green = parseInt(rgbArray[1]);
var blue  = parseInt(rgbArray[2]);
// Safari using RGBA support
obj.style.backgroundColor = "rgba(" + red + ", " + green + ", " + blue + ", " + opacity/100 + ")";
}
else if (typeof obj.style.opacity !== "undefined") { // W3C
obj.style.opacity = opacity / 100;
}
else if (typeof obj.style.MozOpacity !== "undefined") { // Older Mozilla
obj.style.MozOpacity = opacity / 100;
}
else if (typeof obj.style.filter !== "undefined") { // IE
obj.style.filter = "alpha(opacity=" + opacity + ")";
}
else if (typeof obj.style.KHTMLOpacity !== "undefined") { // Older KHTML-based browsers
obj.style.KHTMLOpacity = opacity / 100;
}
}
// Cross browser add event wrapper
curvyCorners.addEvent = function(elm, evType, fn, useCapture) {
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
}
if (elm.attachEvent) return elm.attachEvent('on' + evType, fn);
elm['on' + evType] = fn;
return false;
}
if (typeof addEvent === 'undefined') addEvent = curvyCorners.addEvent; // only if necessary
// Gets the computed colour.
curvyObject.getComputedColour = function(colour) {
var d = document.createElement('DIV');
d.style.backgroundColor = colour;
document.body.appendChild(d);
if (window.getComputedStyle) { // Mozilla, Opera, Chrome, Safari
var rtn = document.defaultView.getComputedStyle(d, null).getPropertyValue('background-color');
d.parentNode.removeChild(d);
if (rtn.substr(0, 3) === "rgb") rtn = curvyObject.rgb2Hex(rtn);
return rtn;
}
else { // IE
var rng = document.body.createTextRange();
rng.moveToElementText(d);
rng.execCommand('ForeColor', false, colour);
var iClr = rng.queryCommandValue('ForeColor');
var rgb = "rgb("+(iClr & 0xFF)+", "+((iClr & 0xFF00)>>8)+", "+((iClr & 0xFF0000)>>16)+")";
d.parentNode.removeChild(d);
rng = null;
return curvyObject.rgb2Hex(rgb);
}
}
// convert colour name, rgb() and #RGB to #RRGGBB
curvyObject.format_colour = function(colour) {
// Make sure colour is set and not transparent
if (colour != "" && colour != "transparent") {
// RGB Value?
if (colour.substr(0, 3) === "rgb") {
// Get HEX aquiv.
colour = curvyObject.rgb2Hex(colour);
}
else if (colour.charAt(0) !== '#') {
// Convert colour name to hex value
colour = curvyObject.getComputedColour(colour);
}
else if (colour.length === 4) {
// 3 chr colour code add remainder
colour = "#" + colour.charAt(1) + colour.charAt(1) + colour.charAt(2) + colour.charAt(2) + colour.charAt(3) + colour.charAt(3);
}
}
return colour;
}
// Get elements by class by Dustin Diaz / CPKS
// NB if searchClass is a class name, it MUST be preceded by '.'
curvyCorners.getElementsByClass = function(searchClass, node) {
var classElements = new Array;
if (node === undefined) node = document;
searchClass = searchClass.split('.'); // see if there's a tag in there
var tag = '*'; // prepare for no tag
if (searchClass.length === 1) {
tag = searchClass[0];
searchClass = false;
}
else {
if (searchClass[0]) tag = searchClass[0];
searchClass = searchClass[1];
}
var i, els, elsLen;
if (tag.charAt(0) === '#') {
els = document.getElementById(tag.substr(1));
if (els) classElements.push(els);
}
else {
els = node.getElementsByTagName(tag);
elsLen = els.length;
if (searchClass) {
var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");
for (i = 0; i < elsLen; ++i) {
if (pattern.test(els[i].className)) classElements.push(els[i]);
}
}
else for (i = 0; i < elsLen; ++i) classElements.push(els[i]);
}
return classElements;
}
curvyCorners.getElementsBySelector = function(selectors, parent) {
var ret;
var sel = selectors[0];
if (parent === undefined) parent = document;
if (sel.indexOf('#') === -1)
ret = curvyCorners.getElementsByClass(sel, parent);
else {
var t = parent.getElementById(sel.substr(1));
if (!t) return [];
ret = [t];
}
if (selectors.length > 1) {
var subret = [];
for (var i = ret.length; --i >= 0; )
subret = subret.concat(curvyCorners.getElementsBySelector(selectors.slice(1), ret[i]));
ret = subret;
}
return ret;
}
if (curvyBrowser.supportsCorners) {
var curvyCornersNoAutoScan = true; // it won't do anything anyway.
curvyCorners.init = function() {}; // make it harmless
}
else {
// autoscan code
curvyCorners.scanStyles = function() {
function units(num) {
if (!parseInt(num)) return 'px'; // '0' becomes '0px' for simplicity's sake
var matches = /^[\d.]+(\w+)$/.exec(num);
return matches[1];
}
var t, i, j;
if (curvyBrowser.isIE) {
function procIEStyles(rule) {
var style = rule.style;
if (curvyBrowser.ieVer > 6.0) {
var allR = style['-moz-border-radius'] || 0;
var tR   = style['-moz-border-radius-topright'] || 0;
var tL   = style['-moz-border-radius-topleft'] || 0;
var bR   = style['-moz-border-radius-bottomright'] || 0;
var bL   = style['-moz-border-radius-bottomleft'] || 0;
}
else {
var allR = style['moz-border-radius'] || 0;
var tR   = style['moz-border-radius-topright'] || 0;
var tL   = style['moz-border-radius-topleft'] || 0;
var bR   = style['moz-border-radius-bottomright'] || 0;
var bL   = style['moz-border-radius-bottomleft'] || 0;
}
if (allR) {
var t = allR.split('/'); // ignore elliptical spec.
t = t[0].split(/\s+/);
if (t[t.length - 1] === '') t.pop();
switch (t.length) {
case 3:
tL = t[0];
tR = bL = t[1];
bR = t[2];
allR = false;
break;
case 2:
tL = bR = t[0];
tR = bL = t[1];
allR = false;
case 1:
break;
case 4:
tL = t[0];
tR = t[1];
bR = t[2];
bL = t[3];
allR = false;
break;
default:
curvyCorners.alert('Illegal corners specification: ' + allR);
//break;
}
}
if (allR || tL || tR || bR || bL) {
var settings = new curvyCnrSpec(rule.selectorText);
if (allR)
settings.setcorner(null, null, parseInt(allR), units(allR));
else {
if (tR) settings.setcorner('t', 'r', parseInt(tR), units(tR));
if (tL) settings.setcorner('t', 'l', parseInt(tL), units(tL));
if (bL) settings.setcorner('b', 'l', parseInt(bL), units(bL));
if (bR) settings.setcorner('b', 'r', parseInt(bR), units(bR));
}
curvyCorners(settings);
}
}
for (t = 0; t < document.styleSheets.length; ++t) {
try {
if (document.styleSheets[t].imports) {
for (i = 0; i < document.styleSheets[t].imports.length; ++i)
for (j = 0; j < document.styleSheets[t].imports[i].rules.length; ++j)
procIEStyles(document.styleSheets[t].imports[i].rules[j]);
}
for (i = 0; i < document.styleSheets[t].rules.length; ++i)
procIEStyles(document.styleSheets[t].rules[i]);
}
catch (e) {
if (typeof curvyCornersVerbose !== 'undefined' && curvyCornersVerbose)
alert(e.message + " - ignored");
} // catch but ignore any permission error
}
}
else if (curvyBrowser.isOp) {
for (t = 0; t < document.styleSheets.length; ++t) {
if (operasheet.contains_border_radius(t)) {
j = new operasheet(t);
for (i in j.rules) if (!isNaN(i))
curvyCorners(j.rules[i]);
}
}
}
else curvyCorners.alert('Scanstyles does nothing in Webkit/Firefox/Opera');
};
// Dean Edwards/Matthias Miller/John Resig
curvyCorners.init = function() {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
// kill the timer
if (curvyBrowser.isWebKit && curvyCorners.init.timer) {
clearInterval(curvyCorners.init.timer);
curvyCorners.init.timer = null;
}
// do stuff
curvyCorners.scanStyles();
};
}
if (typeof curvyCornersNoAutoScan === 'undefined' || curvyCornersNoAutoScan === false) {
if (curvyBrowser.isOp)
document.addEventListener("DOMContentLoaded", curvyCorners.init, false);
else curvyCorners.addEvent(window, 'load', curvyCorners.init, false);
}
/**
* jquery.hintbox.js v1.4 - www.wiipass.com
*
* @author Tiziano Treccani <treccani.tiziano@tiscali.it>
* Copyright (c) 2010 Tiziano Treccani - released under MIT License
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
(function($){
$.fn.hintbox = function(options){
// selector
inputs = this;
// press actions
var ACTIONS = {
ENTER: 13,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
SPACE: 32,
PAGEDOWN: 34
}
// match rules
var MATCHRULE = {
STARTS_WITH: "S",
ENDS_WITH: "E",
CONTAINS: "C"
}
// default options
var defaults = {
backgroundColor: '#3369F9',
color: '#FFF',
autoDimentions: true,
minChars: 1,
immediateList: false,
width: '100%',
separator: '\n',
delay: 400, //milliseconds,
slideDownTime: 0, //milliseconds
slideUpTime: 0,
inputClass: 'hintbox_input',
inputLoadingClass: 'hintbox_loading',
hintboxContainerClass: 'hintbox_list_container',
zIndex: 100,
url: '',
params: { },
extraParams: '',
json: false,
useCache: true,
matchHint: false,
matchRule: MATCHRULE.STARTS_WITH, // options can be: S (Starts with), E (Ends with), C (Contains)
sort: false,
limit: 10,
onBeforeListLoad: function(){ },
onListRetrieved: function(){ },
onListLoaded: function(){ },
onItemSelected: function(){document.searchForm.submit()}
}
// check  given options
if (options.matchRule != undefined){
options.matchRule = options.matchRule.toUpperCase();
if(options.matchRule != MATCHRULE.STARTS_WITH && options.matchRule != MATCHRULE.ENDS_WITH && options.matchRule != MATCHRULE.CONTAINS){
options.matchRule = defaults.matchRule;
}
}
// merge options
var options = jQuery.extend(defaults, options);
// levenshtein distance between words 'a' and 'b'
var levenshtein = function(a, b){
var i;
var j;
var cost;
var d = new Array();
if (a.length == 0){ return b.length; }
if (b.length == 0){ return a.length; }
for (i = 0; i <= a.length; i++){
d[i] = new Array();
d[i][0] = i;
}
for (j = 0; j <= b.length; j++){
d[0][j] = j;
}
for (i = 1; i <= a.length; i++){
for (j = 1; j <= b.length; j++){
cost = (a.charAt(i - 1) == b.charAt(j - 1)) ? 0 : 1;
d[ i ][ j ] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
if(i > 1 && j > 1 &&  a.charAt(i - 1) == b.charAt(j - 2) && a.charAt(i - 2) == b.charAt(j - 1)){
d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + cost);
}
}
}
return d[a.length][b.length];
}
// start service functions
var bindKeyboard = function(input){
// manage keyboard behaviours
jQuery(document).bind('keydown', function(event){
selectHintElement(event, input);
});
}
var unbindKeyboard = function(){
jQuery(document).unbind('keydown');
}
var rebindKeyboard = function(input){
unbindKeyboard();
bindKeyboard(input);
}
var getUnsortedList = function(input){
return getHintListContainer(input).find('ul');
}
var getHintListContainer = function(input){
return input.next('.' + options.hintboxContainerClass);
}
var hintListContainerExists = function(input){
return getHintListContainer(input).get() != '';
}
// end service functions
// init and manage hintbox
var init = function(input){
input.attr('autocomplete', 'off');
var prevQueryString = "";
var currentQueryString = "";
input.keyup(function(event){
if (event.keyCode != ACTIONS.UP && event.keyCode != ACTIONS.DOWN &&
event.keyCode != ACTIONS.ENTER && event.keyCode != ACTIONS.LEFT &&
event.keyCode != ACTIONS.RIGHT && event.keyCode != ACTIONS.PAGEDOWN){
currentQueryString = jQuery.trim(input.val());
if(currentQueryString == ""){
getHintListContainer(input).slideUp(options.slideUpTime);
}
else {
if (currentQueryString != prevQueryString){
if(currentQueryString.length >= options.minChars){
// load ajax list
setTimeout(function(){
loadList(input, currentQueryString);
}, options.delay);
}
else {
// hide ajax list
getHintListContainer(input).slideUp(options.slideUpTime);
}
}
}
// update prevQueryString
prevQueryString = currentQueryString;
}
// hide dropdown list when pressed enter from input text
if (event.keyCode == ACTIONS.ENTER){
prevQueryString = "";
currentQueryString = "";
var container = getHintListContainer(input);
if (container.get() != ""){
closeHintResults(input);
}
}
//if immediateList option is enabled
if(options.immediateList){
if (event.keyCode == ACTIONS.PAGEDOWN){
currentQueryString = jQuery.trim(input.val());
if(currentQueryString == ""){
loadList(input, currentQueryString);
}
}
}
});
}
// select li lement by click
var selectHintElementByClick = function(input){
if (hintListContainerExists(input)){
var unsortedList = getUnsortedList(input);
unsortedList.find('li').click(function(){
var item = jQuery(this);
input.val(item.text());
closeHintResults(input);
// execute onItemSelected event
options.onItemSelected(item);
});
}
}
// navigte into hint list and manage li element selection by keyboard
var selectHintElement = function(event, input){
if (hintListContainerExists(input)){
var cssBackup = jQuery.data(input, "cssBackup");
var unsortedList = getUnsortedList(input);
var firstLi = unsortedList.find('li:first');
var lastLi = unsortedList.find('li:last');
// selectd proper li element
var selectedLi = unsortedList.find('.selected');
// select fist navication li element
if (selectedLi.get() == ''){
if (event.keyCode == ACTIONS.DOWN){
selectedLi = firstLi;
}
else if (event.keyCode == ACTIONS.UP){
selectedLi = lastLi;
}
selectLi(selectedLi);
return;
}
// move selection down
if (event.keyCode == ACTIONS.DOWN){
deselectLi(selectedLi, cssBackup);
var nextLi = selectedLi.next('li');
if (nextLi.get() == ''){
nextLi = firstLi;
input.focus();
unsortedList.find('.selected').removeClass('selected');
}
else {
selectedLi = nextLi;
selectLi(selectedLi);
}
}
// move selection up
else if (event.keyCode == ACTIONS.UP){
deselectLi(selectedLi, cssBackup);
var prevLi = selectedLi.prev('li');
if (prevLi.get() == ''){
prevLi = lastLi;
input.focus();
unsortedList.find('.selected').removeClass('selected');
}
else {
selectLi(prevLi);
selectedLi = prevLi;
}
}
// select list value enter
else if (event.keyCode == ACTIONS.ENTER){
if (selectedLi.get() != ''){
input.val(selectedLi.text());
}
closeHintResults(input);
options.onItemSelected(selectedLi);
}
}
}
// build URL
var buildUrl = function(queryString){
var url = options.url;
url.indexOf('?') != -1 ? url += '&' : url += '?';
url += 'q=' + escape(queryString);
// add params
for (i in options.params){
url += '&' + i + '=' + escape(jQuery.trim(options.params[i]));
}
var extraParams = jQuery.trim(options.extraParams);
if(extraParams.length > 0){
if(extraParams.indexOf('&') > 0){
url += '&' + extraParams;
}
else {
url += extraParams;
}
}
return url;
}
// create and give the cache, if useCache option is true
var getCache = function(){
var cache = jQuery(document).data('hintbox_cache');
if (cache == undefined){
var cache = new Array();
cache.getItem = function(cKey){
return this[cKey];
}
cache.putItem = function(cKey, cValue){
this[cKey] = cValue;
}
cache.hasItem = function(cKey){
if (this[cKey] == undefined){
return false;
}
return true;
}
jQuery(document).data('hintbox_cache', cache);
}
return cache;
}
// jQuery.ajax success handler
var onAjaxCallSuccess = function(input, queryUrl, serverData){
input.removeClass(options.inputLoadingClass);
if(serverData.length > 0){
// create entries var
var entries = ( typeof serverData == "object" ? serverData : serverData.split(options.separator) );
// execute onListRetrieved
options.onListRetrieved(entries);
// check cache option and save data in cache
if(options.useCache){
var cache = getCache();
if(!cache.hasItem(queryUrl)){
cache.putItem(queryUrl, entries);
}
}
// create list and populate div container and ul pointers
createList(input, entries);
// backup old css li values
var cssBackup = {
backgroundColor: getUnsortedList(input).find('li').css('background-color'),
color: getUnsortedList(input).find('li').css('color')
}
jQuery.data(input, 'cssBackup', cssBackup);
// execute necessary operations
applyOptions(input);
fixIssues(input);
highlight(input);
rebindKeyboard(input);
selectHintElementByClick(input);
// execute onListLoaded()
options.onListLoaded(getUnsortedList(input));
}
}
// load list by ajax call
var loadList = function(input, queryString) {
if(options.immediateList || queryString.length >= options.minChars){
// create queryUrl
var queryUrl = buildUrl(queryString);
// add loading animation
input.addClass(options.inputLoadingClass);
// execute onBeforeListLoad()
options.onBeforeListLoad();
var entries = null;
if(options.useCache){
var cache = getCache();
if(cache.hasItem(queryUrl)){
entries = cache.getItem(queryUrl);
}
}
if(entries == null){
if(!options.json){
jQuery.ajax({
url: queryUrl,
//cache: false,
success: function(html){
onAjaxCallSuccess(input, queryUrl, jQuery.trim(html));
}
});
}
else {
jQuery.getJSON(queryUrl, function(data){
var str = "";
var list = jQuery(data.list);
var listSize = list.size();
var i = 1;
list.each(function(){
str += this;
if(i < listSize){
str += options.separator;
}
i++;
});
onAjaxCallSuccess(input, queryUrl, str);
});
}
}
else {
onAjaxCallSuccess(input, queryUrl, entries);
}
}
}
// positionate ListContainer correctly
var positionateHintListContainer = function(input){
var offset = input.offset();
var container = getHintListContainer(input);
var unsortedList = getUnsortedList(input);
container.css({
'display' : 'block',
'position' : 'absolute',
'top' : offset.top + input.outerHeight() - parseInt(input.css('border-bottom-width')),
'left' : offset.left - parseInt(unsortedList.css('border-left-width')) + parseInt(input.css('border-left-width'))
});
}
// sort entries, if sort option is true
var sortList = function(input, entries){
var inputVal = jQuery.trim(input.val());
var matrix = new Array();
var i = 0;
jQuery.each(entries, function(){
var distance = levenshtein(inputVal, jQuery.trim(this));
if(matrix[i] == undefined){
matrix[i] = new Array();
}
matrix[i] = new Array(distance, jQuery.trim(this));
i++;
});
// sort array ascending
var swap = function(i, j){
if (parseInt(matrix[j]) < parseInt(matrix[i])){
var temp = matrix[i];
matrix[i] = matrix[j]
matrix[j] = temp;
if(i > 0){
swap(i - 1, i);
}
}
}
for(var j = 0; j < matrix.length -1; j++){
swap(j, j + 1);
}
// get only values and not Levenshtein distance
entries = new Array();
for(var j = 0; j < matrix.length; j++){
var temp = matrix[j];
entries.push(temp[1]);
}
// return sorted entries
return entries;
}
// match hint, if matchHint option is true
var matchHint = function(input, entries){
var inputVal = jQuery.trim(input.val());
var matched = new Array();
if(options.matchRule == MATCHRULE.STARTS_WITH){
jQuery.each(entries, function(){
var curItem = jQuery.trim(this).toLowerCase();
var toMatch = inputVal.toLowerCase();
if(curItem.match("^" + toMatch) == toMatch){
matched.push(jQuery.trim(this));
}
});
}
else if(options.matchRule == MATCHRULE.ENDS_WITH){
jQuery.each(entries, function(){
var curItem = jQuery.trim(this).toLowerCase();
var toMatch = inputVal.toLowerCase();
if(curItem.match(toMatch + "$") == toMatch){
matched.push(jQuery.trim(this));
}
});
}
else if(options.matchRule == MATCHRULE.CONTAINS){
jQuery.each(entries, function(){
var curItem = jQuery.trim(this).toLowerCase();
var toMatch = inputVal.toLowerCase();
if(curItem.match("^" + toMatch) == toMatch){
matched.push(jQuery.trim(this));
}
});
jQuery.each(entries, function(){
var curItem = jQuery.trim(this).toLowerCase();
var toMatch = inputVal.toLowerCase();
if(curItem.match("^" + toMatch) != toMatch){
if(curItem.match(toMatch) == toMatch){
matched.push(jQuery.trim(this));
}
}
});
}
return matched;
}
// create div container for ul list
var createList = function(input, entries){
var divContainer = getHintListContainer(input);
if (divContainer.get() == ''){
divContainer = jQuery('<div></div>').addClass(options.hintboxContainerClass).css({
'margin': 0,
'padding': 0,
'display': 'none',
'z-index': options.zIndex
});
}
else {
divContainer.empty();
}
// create UL dom element
var ul = jQuery('<ul></ul>').css({'cursor': 'default'});
//var entries = jQuery.trim(html).split(options.separator);
// match hint
if(options.matchHint){
entries = matchHint(input, entries);
}
// sort by levenshtein distance
if(options.sort){
entries = sortList(input, entries);
}
// limit option
if(options.limit > 0){
entries = entries.slice(0, options.limit);
}
jQuery.each(entries, function(){
var txt = jQuery.trim(this)+"\n";
ul.append(jQuery('<li></li>').text(txt));
});
// append ul to div and show
divContainer.append(ul);
input.after(divContainer);
// positionate container
positionateHintListContainer(input);
// show container
divContainer.slideDown(options.slideDownTime);
}
// apply loaded options
var applyOptions = function(input){
var unsortedList = getUnsortedList(input);
if(unsortedList.find('li').length > 0){
var entries = unsortedList.find('li').text().split(options.separator);
var maxLength = 0;
for (i = 0; i <= entries.length-1; i++) {
if (maxLength < entries[i].length) {
maxLength = entries[i].length;
}
}
if (options.autoDimentions){
// ovverride options.width
var blw = parseInt(input.css('border-left-width'));
var brw = parseInt(input.css('border-right-width'));
var w = input.outerWidth();
options.width = maxLength * 6 +'px'; //(w - blw - brw + 50) + 'px';
// normalize li height
unsortedList.find('li').css({
'width': options.width,
'line-height': input.outerHeight() + 'px'
});
}
unsortedList.css({
'width': options.width,
'overflow-x': 'hidden'
});
}
else {
unsortedList.remove();
}
}
// close hit results for givel input
var closeHintResults = function(input){
unbindKeyboard();
var container = getHintListContainer(input);
container.slideUp(options.slideUpTime, function(){
jQuery(this).remove();
});
}
// highlight or not highlight, this is the question :-)
var highlight = function(input){
var unsotedList = getUnsortedList(input);
var cssBackup = jQuery.data(input, 'cssBackup');
unsotedList.find('li').hover(
function(){
deselectLi(unsotedList.find('.selected'), cssBackup);
selectLi(jQuery(this));
},
function(){
deselectLi(jQuery(this), cssBackup);
}
);
}
// hilight current selected li element
var selectLi = function(li){
li.css({
'background-color': options.backgroundColor,
'color': options.color
});
li.addClass('selected');
}
// deselect pevious selected li element
var deselectLi = function(li, cssBackup){
li.css({
'background-color': cssBackup.backgroundColor,
'color': cssBackup.color
});
li.removeClass('selected');
}
// end css behaviours
// fix browsers issues
var fixIssues = function(input){
// fix i.e. issues
if (!jQuery.support.boxModel){
getUnsortedList(input).css({
'width': (parseInt(options.width) + parseInt(input.css('border-left-width')) * 2) + 'px'
}).find('li').css({
'width': (parseInt(options.width) + parseInt(input.css('border-left-width')) * 2) + 'px'
});
}
}
// startup jquery.hintbox for each selected input
jQuery(inputs).each(function(){
var input = jQuery(this);
if (!input.hasClass(options.inputClass)){
input.addClass(options.inputClass);
}
// init main controls and behaviours
init(input);
input.click(function(){
rebindKeyboard(input);
});
input.focus(function(){
rebindKeyboard(input);
});
input.blur(function(){
rebindKeyboard(input);
getHintListContainer(input).slideUp(options.slideUpTime);
});
});
// returning selector
return inputs;
};
})(jQuery);
/* this is for controlling the search textbox UI */
// and hintbox suggestions dropdown list
//addEvent(window, 'load', initSearchBoxCorners);
function initSearchBoxCorners() {
var settings = {
tl: { radius: 4 },
tr: { radius: 4 },
bl: { radius: 4 },
br: { radius: 4 },
antiAlias: false
}
curvyCorners(settings, "#searchBox");
}
/* the following is to support mootools.js */
var selectionID = -1;
var selectionCieling = 10;
function changeActiveHoversTop(id) {
var lcv = 0;
selectionCieling = 10;
while (lcv < selectionCieling) {
var suggestionElement = document.getElementById('sugTop'+lcv);
if (suggestionElement != null) {
if(document.getElementById('sugTop'+lcv).className = 'activeTop') {
document.getElementById('sugTop'+lcv).className = 'nonActiveTop'
}
} else {
selectionCieling = lcv;
lcv += 1;
}
lcv += 1;
}
if(lcv>=9) {
selectionCieling = 10;
} else {
}
var suggestionElement = document.getElementById('sugTop'+id);
if (suggestionElement != null) {
document.getElementById('sugTop'+id).className = 'activeTop';
selectionID = id;
} else {
document.getElementById('sugTop0').className = 'activeTop';
selectionID = 0;
}
}
function noenter() {
// return !(window.event && window.event.keyCode == 13);
}
function validatedKeyword() {
if(document.getElementById('keyword').value == 'Keyword or Item #' || document.getElementById('keyword').value == '') {
return false;
}
return true;
}
function getkeywordsuggestionTopNav(keyword,oEvent,subFlag,contextPath) {
if(document.getElementById('keyword').value == 'Keyword or Item #' || document.getElementById('keyword').value == '') {
document.getElementById('keywordsuggestTopNavContainer').style.display = 'none';
selectionID = -1;
return false;
}
if(keyword.length >= 1) {
// This subflag will be triggered from ajax
if(subFlag == 1) {
document.getElementById('keywordsuggestTopNavContainer').style.display = 'none';
document.getElementById('keyword').value = keyword.replace(/<.*?>/g,'').replace(/\&amp;/g,"&");
document.getElementById('searchForm').submit();
return true;
}
else if(oEvent.keyCode == 13 || oEvent == 13) {
if(selectionID >= 0) {
document.getElementById('keyword').value = document.getElementById('suggestionVal'+selectionID).innerHTML.replace(/<.*?>/g,'').replace(/\&amp;/g,"&");
}
document.getElementById('searchForm').submit();
}
else if(oEvent.keyCode == 38) {
if (selectionID > 0) {
selectionID = selectionID - 1;
}
else {
selectionID = 0;
}
changeActiveHoversTop(selectionID);
}
else if(oEvent.keyCode == 40) {
if (selectionID < selectionCieling) {
selectionID = selectionID + 1;
}
changeActiveHoversTop(selectionID);
}
else if(oEvent.keyCode == 27) {
document.getElementById('keyword').value = '';
selectionID = -1;
document.getElementById('keywordsuggestTopNavContainer').style.display = 'none';
}
else {
varGlobal = 1;
var currentTime = new Date();
var pars = 'input=' + keyword;
var url = contextPath +"/includes/hintbox_suggestions.jsp?" + pars + "&t=" + currentTime.getSeconds();
new Ajax(url, {method:'get',
onComplete:function(txt, xml) {
var trimmed = txt.replace(/^\s+|\s+$/g, '') ;
if (trimmed == '') {
document.getElementById('keywordsuggestTopNavContainer').style.display = 'none';
}
else {
document.getElementById('keywordsuggestTopNavContainer').style.display = 'inline';
document.getElementById('keywordsuggestTopNav').innerHTML = txt;
}
varGlobal = 0;
}}).request();
}
}
else {
document.getElementById('keywordsuggestTopNavContainer').style.display = 'none';
// This subflag will be triggered from the form
if(subFlag == 1) {
document.getElementById('searchForm').action = document.getElementById('searchForm').action + document.getElementById('keyword').value;
if(selectionID >= 0) {
document.getElementById('keyword').value = document.getElementById('suggestionVal' + selectionID).innerHTML.replace(/\&amp;/g,"&");
} else {
return false;
}
document.getElementById('searchForm').submit();
return true;
}
if(subFlag == 0) {
selectionID = -1;
}
}
}
function headerAllBrandsShowMenu() {
document.getElementById("HeaderAllBrandsMenu").style.display = "block";
document.getElementById("HeaderAllBrandsMenu").style.visibility = "visible";
document.getElementById("HeaderAllBrandsMenu").style.zIndex = "505";
}
function headerAllBrandsHideMenu() {
document.getElementById("HeaderAllBrandsMenu").style.display = "none";
document.getElementById("HeaderAllBrandsMenu").style.visibility = "hidden";
}
/*
//MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006 Valerio Proietti, <http://mad4milk.net>, MIT Style License.*/
var MooTools={version:"1.12"};function $defined(a){return(a!=undefined)}function $type(b){if(!$defined(b)){return false}if(b.htmlElement){return"element"}var a=typeof b;if(a=="object"&&b.nodeName){switch(b.nodeType){case 1:return"element";case 3:return(/\S/).test(b.nodeValue)?"textnode":"whitespace"}}if(a=="object"||a=="function"){switch(b.constructor){case Array:return"array";case RegExp:return"regexp";case Class:return"class"}if(typeof b.length=="number"){if(b.item){return"collection"}if(b.callee){return"arguments"}}}return a}function $merge(){var c={};for(var b=0;b<arguments.length;b++){for(var f in arguments[b]){var a=arguments[b][f];var d=c[f];if(d&&$type(a)=="object"&&$type(d)=="object"){c[f]=$merge(d,a)}else{c[f]=a}}}return c}var $extend=function(){var a=arguments;if(!a[1]){a=[this,a[0]]}for(var b in a[1]){a[0][b]=a[1][b]}return a[0]};var $native=function(){for(var b=0,a=arguments.length;b<a;b++){arguments[b].extend=function(c){for(var d in c){if(!this.prototype[d]){this.prototype[d]=c[d]}if(!this[d]){this[d]=$native.generic(d)}}}}};$native.generic=function(a){return function(b){return this.prototype[a].apply(b,Array.prototype.slice.call(arguments,1))}};$native(Function,Array,String,Number);function $chk(a){return !!(a||a===0)}function $pick(b,a){return $defined(b)?b:a}function $random(b,a){return Math.floor(Math.random()*(a-b+1)+b)}function $time(){return new Date().getTime()}function $clear(a){clearTimeout(a);clearInterval(a);return null}var Abstract=function(a){a=a||{};a.extend=$extend;return a};var Window=new Abstract(window);var Document=new Abstract(document);document.head=document.getElementsByTagName("head")[0];window.xpath=!!(document.evaluate);if(window.ActiveXObject){window.ie=window[window.XMLHttpRequest?"ie7":"ie6"]=true}else{if(document.childNodes&&!document.all&&!navigator.taintEnabled){window.webkit=window[window.xpath?"webkit420":"webkit419"]=true}else{if(document.getBoxObjectFor!=null||window.mozInnerScreenX!=null){window.gecko=true}}}window.khtml=window.webkit;Object.extend=$extend;if(typeof HTMLElement=="undefined"){var HTMLElement=function(){};if(window.webkit){document.createElement("iframe")}HTMLElement.prototype=(window.webkit)?window["[[DOMElement.prototype]]"]:{}}HTMLElement.prototype.htmlElement=function(){};if(window.ie6){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}var Class=function(b){var a=function(){return(arguments[0]!==null&&this.initialize&&$type(this.initialize)=="function")?this.initialize.apply(this,arguments):this};$extend(a,this);a.prototype=b;a.constructor=Class;return a};Class.empty=function(){};Class.prototype={extend:function(b){var c=new this(null);for(var d in b){var a=c[d];c[d]=Class.Merge(a,b[d])}return new Class(c)},implement:function(){for(var b=0,a=arguments.length;b<a;b++){$extend(this.prototype,arguments[b])}}};Class.Merge=function(c,d){if(c&&c!=d){var b=$type(d);if(b!=$type(c)){return d}switch(b){case"function":var a=function(){this.parent=arguments.callee.parent;return d.apply(this,arguments)};a.parent=c;return a;case"object":return $merge(c,d)}}return d};var Chain=new Class({chain:function(a){this.chains=this.chains||[];this.chains.push(a);return this},callChain:function(){if(this.chains&&this.chains.length){this.chains.shift().delay(10,this)}},clearChain:function(){this.chains=[]}});var Events=new Class({addEvent:function(b,a){if(a!=Class.empty){this.$events=this.$events||{};this.$events[b]=this.$events[b]||[];this.$events[b].include(a)}return this},fireEvent:function(c,b,a){if(this.$events&&this.$events[c]){this.$events[c].each(function(d){d.create({bind:this,delay:a,"arguments":b})()},this)}return this},removeEvent:function(b,a){if(this.$events&&this.$events[b]){this.$events[b].remove(a)}return this}});var Options=new Class({setOptions:function(){this.options=$merge.apply(null,[this.options].extend(arguments));if(this.addEvent){for(var a in this.options){if($type(this.options[a]=="function")&&(/^on[A-Z]/).test(a)){this.addEvent(a,this.options[a])}}}return this}});Array.extend({forEach:function(c,d){for(var b=0,a=this.length;b<a;b++){c.call(d,this[b],b,this)}},filter:function(d,f){var c=[];for(var b=0,a=this.length;b<a;b++){if(d.call(f,this[b],b,this)){c.push(this[b])}}return c},map:function(d,f){var c=[];for(var b=0,a=this.length;b<a;b++){c[b]=d.call(f,this[b],b,this)}return c},every:function(c,d){for(var b=0,a=this.length;b<a;b++){if(!c.call(d,this[b],b,this)){return false}}return true},some:function(c,d){for(var b=0,a=this.length;b<a;b++){if(c.call(d,this[b],b,this)){return true}}return false},indexOf:function(c,d){var a=this.length;for(var b=(d<0)?Math.max(0,a+d):d||0;b<a;b++){if(this[b]===c){return b}}return -1},copy:function(d,c){d=d||0;if(d<0){d=this.length+d}c=c||(this.length-d);var a=[];for(var b=0;b<c;b++){a[b]=this[d++]}return a},remove:function(c){var b=0;var a=this.length;while(b<a){if(this[b]===c){this.splice(b,1);a--}else{b++}}return this},contains:function(a,b){return this.indexOf(a,b)!=-1},associate:function(c){var d={},b=Math.min(this.length,c.length);for(var a=0;a<b;a++){d[c[a]]=this[a]}return d},extend:function(c){for(var b=0,a=c.length;b<a;b++){this.push(c[b])}return this},merge:function(c){for(var b=0,a=c.length;b<a;b++){this.include(c[b])}return this},include:function(a){if(!this.contains(a)){this.push(a)}return this},getRandom:function(){return this[$random(0,this.length-1)]||null},getLast:function(){return this[this.length-1]||null}});Array.prototype.each=Array.prototype.forEach;Array.each=Array.forEach;function $A(a){return Array.copy(a)}function $each(c,b,d){if(c&&typeof c.length=="number"&&$type(c)!="object"){Array.forEach(c,b,d)}else{for(var a in c){b.call(d||c,c[a],a)}}}Array.prototype.test=Array.prototype.contains;String.extend({test:function(a,b){return(($type(a)=="string")?new RegExp(a,b):a).test(this)},toInt:function(){return parseInt(this,10)},toFloat:function(){return parseFloat(this)},camelCase:function(){return this.replace(/-\D/g,function(a){return a.charAt(1).toUpperCase()})},hyphenate:function(){return this.replace(/\w[A-Z]/g,function(a){return(a.charAt(0)+"-"+a.charAt(1).toLowerCase())})},capitalize:function(){return this.replace(/\b[a-z]/g,function(a){return a.toUpperCase()})},trim:function(){return this.replace(/^\s+|\s+$/g,"")},clean:function(){return this.replace(/\s{2,}/g," ").trim()},rgbToHex:function(b){var a=this.match(/\d{1,3}/g);return(a)?a.rgbToHex(b):false},hexToRgb:function(b){var a=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(a)?a.slice(1).hexToRgb(b):false},contains:function(a,b){return(b)?(b+this+b).indexOf(b+a+b)>-1:this.indexOf(a)>-1},escapeRegExp:function(){return this.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")}});Array.extend({rgbToHex:function(d){if(this.length<3){return false}if(this.length==4&&this[3]==0&&!d){return"transparent"}var b=[];for(var a=0;a<3;a++){var c=(this[a]-0).toString(16);b.push((c.length==1)?"0"+c:c)}return d?b:"#"+b.join("")},hexToRgb:function(c){if(this.length!=3){return false}var a=[];for(var b=0;b<3;b++){a.push(parseInt((this[b].length==1)?this[b]+this[b]:this[b],16))}return c?a:"rgb("+a.join(",")+")"}});Function.extend({create:function(a){var b=this;a=$merge({bind:b,event:false,"arguments":null,delay:false,periodical:false,attempt:false},a);if($chk(a.arguments)&&$type(a.arguments)!="array"){a.arguments=[a.arguments]}return function(f){var c;if(a.event){f=f||window.event;c=[(a.event===true)?f:new a.event(f)];if(a.arguments){c.extend(a.arguments)}}else{c=a.arguments||arguments}var g=function(){return b.apply($pick(a.bind,b),c)};if(a.delay){return setTimeout(g,a.delay)}if(a.periodical){return setInterval(g,a.periodical)}if(a.attempt){try{return g()}catch(d){return false}}return g()}},pass:function(a,b){return this.create({"arguments":a,bind:b})},attempt:function(a,b){return this.create({"arguments":a,bind:b,attempt:true})()},bind:function(b,a){return this.create({bind:b,"arguments":a})},bindAsEventListener:function(b,a){return this.create({bind:b,event:true,"arguments":a})},delay:function(b,c,a){return this.create({delay:b,bind:c,"arguments":a})()},periodical:function(a,c,b){return this.create({periodical:a,bind:c,"arguments":b})()}});Number.extend({toInt:function(){return parseInt(this)},toFloat:function(){return parseFloat(this)},limit:function(b,a){return Math.min(a,Math.max(b,this))},round:function(a){a=Math.pow(10,a||0);return Math.round(this*a)/a},times:function(b){for(var a=0;a<this;a++){b(a)}}});var Element=new Class({initialize:function(d,c){if($type(d)=="string"){if(window.ie&&c&&(c.name||c.type)){var a=(c.name)?' name="'+c.name+'"':"";var b=(c.type)?' type="'+c.type+'"':"";delete c.name;delete c.type;d="<"+d+a+b+">"}d=document.createElement(d)}d=$(d);return(!c||!d)?d:d.set(c)}});var Elements=new Class({initialize:function(a){return(a)?$extend(a,this):this}});Elements.extend=function(a){for(var b in a){this.prototype[b]=a[b];this[b]=$native.generic(b)}};function $(b){if(!b){return null}if(b.htmlElement){return Garbage.collect(b)}if([window,document].contains(b)){return b}var a=$type(b);if(a=="string"){b=document.getElementById(b);a=(b)?"element":false}if(a!="element"){return null}if(b.htmlElement){return Garbage.collect(b)}if(["object","embed"].contains(b.tagName.toLowerCase())){return b}$extend(b,Element.prototype);b.htmlElement=function(){};return Garbage.collect(b)}document.getElementsBySelector=document.getElementsByTagName;function $$(){var d=[];for(var c=0,b=arguments.length;c<b;c++){var a=arguments[c];switch($type(a)){case"element":d.push(a);case"boolean":break;case false:break;case"string":a=document.getElementsBySelector(a,true);default:d.extend(a)}}return $$.unique(d)}$$.unique=function(j){var f=[];for(var c=0,a=j.length;c<a;c++){if(j[c].$included){continue}var b=$(j[c]);if(b&&!b.$included){b.$included=true;f.push(b)}}for(var h=0,g=f.length;h<g;h++){f[h].$included=null}return new Elements(f)};Elements.Multi=function(a){return function(){var d=arguments;var b=[];var h=true;for(var f=0,c=this.length,g;f<c;f++){g=this[f][a].apply(this[f],d);if($type(g)!="element"){h=false}b.push(g)}return(h)?$$.unique(b):b}};Element.extend=function(a){for(var b in a){HTMLElement.prototype[b]=a[b];Element.prototype[b]=a[b];Element[b]=$native.generic(b);var c=(Array.prototype[b])?b+"Elements":b;Elements.prototype[c]=Elements.Multi(b)}};Element.extend({set:function(a){for(var c in a){var b=a[c];switch(c){case"styles":this.setStyles(b);break;case"events":if(this.addEvents){this.addEvents(b)}break;case"properties":this.setProperties(b);break;default:this.setProperty(c,b)}}return this},inject:function(c,a){c=$(c);switch(a){case"before":c.parentNode.insertBefore(this,c);break;case"after":var b=c.getNext();if(!b){c.parentNode.appendChild(this)}else{c.parentNode.insertBefore(this,b)}break;case"top":var d=c.firstChild;if(d){c.insertBefore(this,d);break}default:c.appendChild(this)}return this},injectBefore:function(a){return this.inject(a,"before")},injectAfter:function(a){return this.inject(a,"after")},injectInside:function(a){return this.inject(a,"bottom")},injectTop:function(a){return this.inject(a,"top")},adopt:function(){var a=[];$each(arguments,function(b){a=a.concat(b)});$$(a).inject(this);return this},remove:function(){return this.parentNode.removeChild(this)},clone:function(c){var b=$(this.cloneNode(c!==false));if(!b.$events){return b}b.$events={};for(var a in this.$events){b.$events[a]={keys:$A(this.$events[a].keys),values:$A(this.$events[a].values)}}return b.removeEvents()},replaceWith:function(a){a=$(a);this.parentNode.replaceChild(a,this);return a},appendText:function(a){this.appendChild(document.createTextNode(a));return this},hasClass:function(a){return this.className.contains(a," ")},addClass:function(a){if(!this.hasClass(a)){this.className=(this.className+" "+a).clean()}return this},removeClass:function(a){this.className=this.className.replace(new RegExp("(^|\\s)"+a+"(?:\\s|$)"),"$1").clean();return this},toggleClass:function(a){return this.hasClass(a)?this.removeClass(a):this.addClass(a)},setStyle:function(b,a){switch(b){case"opacity":return this.setOpacity(parseFloat(a));case"float":b=(window.ie)?"styleFloat":"cssFloat"}b=b.camelCase();switch($type(a)){case"number":if(!["zIndex","zoom"].contains(b)){a+="px"}break;case"array":a="rgb("+a.join(",")+")"}this.style[b]=a;return this},setStyles:function(a){switch($type(a)){case"object":Element.setMany(this,"setStyle",a);break;case"string":this.style.cssText=a}return this},setOpacity:function(a){if(a==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden"}}else{if(this.style.visibility!="visible"){this.style.visibility="visible"}}if(!this.currentStyle||!this.currentStyle.hasLayout){this.style.zoom=1}if(window.ie){this.style.filter=(a==1)?"":"alpha(opacity="+a*100+")"}this.style.opacity=this.$tmp.opacity=a;return this},getStyle:function(c){c=c.camelCase();var a=this.style[c];if(!$chk(a)){if(c=="opacity"){return this.$tmp.opacity}a=[];for(var b in Element.Styles){if(c==b){Element.Styles[b].each(function(g){var f=this.getStyle(g);a.push(parseInt(f)?f:"0px")},this);if(c=="border"){var d=a.every(function(f){return(f==a[0])});return(d)?a[0]:false}return a.join(" ")}}if(c.contains("border")){if(Element.Styles.border.contains(c)){return["Width","Style","Color"].map(function(f){return this.getStyle(c+f)},this).join(" ")}else{if(Element.borderShort.contains(c)){return["Top","Right","Bottom","Left"].map(function(f){return this.getStyle("border"+f+c.replace("border",""))},this).join(" ")}}}if(document.defaultView){a=document.defaultView.getComputedStyle(this,null).getPropertyValue(c.hyphenate())}else{if(this.currentStyle){a=this.currentStyle[c]}}}if(window.ie){a=Element.fixStyle(c,a,this)}if(a&&c.test(/color/i)&&a.contains("rgb")){return a.split("rgb").splice(1,4).map(function(f){return f.rgbToHex()}).join(" ")}return a},getStyles:function(){return Element.getMany(this,"getStyle",arguments)},walk:function(a,c){a+="Sibling";var b=(c)?this[c]:this[a];while(b&&$type(b)!="element"){b=b[a]}return $(b)},getPrevious:function(){return this.walk("previous")},getNext:function(){return this.walk("next")},getFirst:function(){return this.walk("next","firstChild")},getLast:function(){return this.walk("previous","lastChild")},getParent:function(){return $(this.parentNode)},getChildren:function(){return $$(this.childNodes)},hasChild:function(a){return !!$A(this.getElementsByTagName("*")).contains(a)},getProperty:function(d){var b=Element.Properties[d];if(b){return this[b]}var a=Element.PropertiesIFlag[d]||0;if(!window.ie||a){return this.getAttribute(d,a)}var c=this.attributes[d];return(c)?c.nodeValue:null},removeProperty:function(b){var a=Element.Properties[b];if(a){this[a]=""}else{this.removeAttribute(b)}return this},getProperties:function(){return Element.getMany(this,"getProperty",arguments)},setProperty:function(c,b){var a=Element.Properties[c];if(a){this[a]=b}else{this.setAttribute(c,b)}return this},setProperties:function(a){return Element.setMany(this,"setProperty",a)},setHTML:function(){this.innerHTML=$A(arguments).join("");return this},setText:function(b){var a=this.getTag();if(["style","script"].contains(a)){if(window.ie){if(a=="style"){this.styleSheet.cssText=b}else{if(a=="script"){this.setProperty("text",b)}}return this}else{this.removeChild(this.firstChild);return this.appendText(b)}}this[$defined(this.innerText)?"innerText":"textContent"]=b;return this},getText:function(){var a=this.getTag();if(["style","script"].contains(a)){if(window.ie){if(a=="style"){return this.styleSheet.cssText}else{if(a=="script"){return this.getProperty("text")}}}else{return this.innerHTML}}return($pick(this.innerText,this.textContent))},getTag:function(){return this.tagName.toLowerCase()},empty:function(){Garbage.trash(this.getElementsByTagName("*"));return this.setHTML("")}});Element.fixStyle=function(f,a,d){if($chk(parseInt(a))){return a}if(["height","width"].contains(f)){var b=(f=="width")?["left","right"]:["top","bottom"];var c=0;b.each(function(g){c+=d.getStyle("border-"+g+"-width").toInt()+d.getStyle("padding-"+g).toInt()});return d["offset"+f.capitalize()]-c+"px"}else{if(f.test(/border(.+)Width|margin|padding/)){return"0px"}}return a};Element.Styles={border:[],padding:[],margin:[]};["Top","Right","Bottom","Left"].each(function(b){for(var a in Element.Styles){Element.Styles[a].push(a+b)}});Element.borderShort=["borderWidth","borderStyle","borderColor"];Element.getMany=function(b,d,c){var a={};$each(c,function(f){a[f]=b[d](f)});return a};Element.setMany=function(b,d,c){for(var a in c){b[d](a,c[a])}return b};Element.Properties=new Abstract({"class":"className","for":"htmlFor",colspan:"colSpan",rowspan:"rowSpan",accesskey:"accessKey",tabindex:"tabIndex",maxlength:"maxLength",readonly:"readOnly",frameborder:"frameBorder",value:"value",disabled:"disabled",checked:"checked",multiple:"multiple",selected:"selected"});Element.PropertiesIFlag={href:2,src:2};Element.Methods={Listeners:{addListener:function(b,a){if(this.addEventListener){this.addEventListener(b,a,false)}else{this.attachEvent("on"+b,a)}return this},removeListener:function(b,a){if(this.removeEventListener){this.removeEventListener(b,a,false)}else{this.detachEvent("on"+b,a)}return this}}};window.extend(Element.Methods.Listeners);document.extend(Element.Methods.Listeners);Element.extend(Element.Methods.Listeners);var Garbage={elements:[],collect:function(a){if(!a.$tmp){Garbage.elements.push(a);a.$tmp={opacity:1}}return a},trash:function(f){for(var b=0,a=f.length,c;b<a;b++){if(!(c=f[b])||!c.$tmp){continue}if(c.$events){c.fireEvent("trash").removeEvents()}for(var g in c.$tmp){c.$tmp[g]=null}for(var h in Element.prototype){c[h]=null}Garbage.elements[Garbage.elements.indexOf(c)]=null;c.htmlElement=c.$tmp=c=null}Garbage.elements.remove(null)},empty:function(){Garbage.collect(window);Garbage.collect(document);Garbage.trash(Garbage.elements)}};window.addListener("beforeunload",function(){window.addListener("unload",Garbage.empty);if(window.ie){window.addListener("unload",CollectGarbage)}});var Event=new Class({initialize:function(c){if(c&&c.$extended){return c}this.$extended=true;c=c||window.event;this.event=c;this.type=c.type;this.target=c.target||c.srcElement;if(this.target.nodeType==3){this.target=this.target.parentNode}this.shift=c.shiftKey;this.control=c.ctrlKey;this.alt=c.altKey;this.meta=c.metaKey;if(["DOMMouseScroll","mousewheel"].contains(this.type)){this.wheel=(c.wheelDelta)?c.wheelDelta/120:-(c.detail||0)/3}else{if(this.type.contains("key")){this.code=c.which||c.keyCode;for(var b in Event.keys){if(Event.keys[b]==this.code){this.key=b;break}}if(this.type=="keydown"){var a=this.code-111;if(a>0&&a<13){this.key="f"+a}}this.key=this.key||String.fromCharCode(this.code).toLowerCase()}else{if(this.type.test(/(click|mouse|menu)/)){this.page={x:c.pageX||c.clientX+document.documentElement.scrollLeft,y:c.pageY||c.clientY+document.documentElement.scrollTop};this.client={x:c.pageX?c.pageX-window.pageXOffset:c.clientX,y:c.pageY?c.pageY-window.pageYOffset:c.clientY};this.rightClick=(c.which==3)||(c.button==2);switch(this.type){case"mouseover":this.relatedTarget=c.relatedTarget||c.fromElement;break;case"mouseout":this.relatedTarget=c.relatedTarget||c.toElement}this.fixRelatedTarget()}}}return this},stop:function(){return this.stopPropagation().preventDefault()},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation()}else{this.event.cancelBubble=true}return this},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault()}else{this.event.returnValue=false}return this}});Event.fix={relatedTarget:function(){if(this.relatedTarget&&this.relatedTarget.nodeType==3){this.relatedTarget=this.relatedTarget.parentNode}},relatedTargetGecko:function(){try{Event.fix.relatedTarget.call(this)}catch(a){this.relatedTarget=this.target}}};Event.prototype.fixRelatedTarget=(window.gecko)?Event.fix.relatedTargetGecko:Event.fix.relatedTarget;Event.keys=new Abstract({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});Element.Methods.Events={addEvent:function(c,b){this.$events=this.$events||{};this.$events[c]=this.$events[c]||{keys:[],values:[]};if(this.$events[c].keys.contains(b)){return this}this.$events[c].keys.push(b);var a=c;var d=Element.Events[c];if(d){if(d.add){d.add.call(this,b)}if(d.map){b=d.map}if(d.type){a=d.type}}if(!this.addEventListener){}this.$events[c].values.push(b);return(Element.NativeEvents.contains(a))?this.addListener(a,b):this},removeEvent:function(c,b){if(!this.$events||!this.$events[c]){return this}var g=this.$events[c].keys.indexOf(b);if(g==-1){return this}var a=this.$events[c].keys.splice(g,1)[0];var f=this.$events[c].values.splice(g,1)[0];var d=Element.Events[c];if(d){if(d.remove){d.remove.call(this,b)}if(d.type){c=d.type}}return(Element.NativeEvents.contains(c))?this.removeListener(c,f):this},addEvents:function(a){return Element.setMany(this,"addEvent",a)},removeEvents:function(a){if(!this.$events){return this}if(!a){for(var b in this.$events){this.removeEvents(b)}this.$events=null}else{if(this.$events[a]){this.$events[a].keys.each(function(c){this.removeEvent(a,c)},this);this.$events[a]=null}}return this},fireEvent:function(c,b,a){if(this.$events&&this.$events[c]){this.$events[c].keys.each(function(d){d.create({bind:this,delay:a,"arguments":b})()},this)}return this},cloneEvents:function(c,a){if(!c.$events){return this}if(!a){for(var b in c.$events){this.cloneEvents(c,b)}}else{if(c.$events[a]){c.$events[a].keys.each(function(d){this.addEvent(a,d)},this)}}return this}};window.extend(Element.Methods.Events);document.extend(Element.Methods.Events);Element.extend(Element.Methods.Events);Element.Events=new Abstract({mouseenter:{type:"mouseover",map:function(a){a=new Event(a);if(a.relatedTarget!=this&&!this.hasChild(a.relatedTarget)){this.fireEvent("mouseenter",a)}}},mouseleave:{type:"mouseout",map:function(a){a=new Event(a);if(a.relatedTarget!=this&&!this.hasChild(a.relatedTarget)){this.fireEvent("mouseleave",a)}}},mousewheel:{type:(window.gecko)?"DOMMouseScroll":"mousewheel"}});Element.NativeEvents=["click","dblclick","mouseup","mousedown","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","keydown","keypress","keyup","load","unload","beforeunload","resize","move","focus","blur","change","submit","reset","select","error","abort","contextmenu","scroll"];Function.extend({bindWithEvent:function(b,a){return this.create({bind:b,"arguments":a,event:Event})}});Elements.extend({filterByTag:function(a){return new Elements(this.filter(function(b){return(Element.getTag(b)==a)}))},filterByClass:function(a,c){var b=this.filter(function(d){return(d.className&&d.className.contains(a," "))});return(c)?b:new Elements(b)},filterById:function(c,b){var a=this.filter(function(d){return(d.id==c)});return(b)?a:new Elements(a)},filterByAttribute:function(b,a,d,f){var c=this.filter(function(g){var h=Element.getProperty(g,b);if(!h){return false}if(!a){return true}switch(a){case"=":return(h==d);case"*=":return(h.contains(d));case"^=":return(h.substr(0,d.length)==d);case"$=":return(h.substr(h.length-d.length)==d);case"!=":return(h!=d);case"~=":return h.contains(d," ")}return false});return(f)?c:new Elements(c)}});function $E(a,b){return($(b)||document).getElement(a)}function $ES(a,b){return($(b)||document).getElementsBySelector(a)}$$.shared={regexp:/^(\w*|\*)(?:#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)["']?([^"'\]]*)["']?)?])?$/,xpath:{getParam:function(b,d,f,c){var a=[d.namespaceURI?"xhtml:":"",f[1]];if(f[2]){a.push('[@id="',f[2],'"]')}if(f[3]){a.push('[contains(concat(" ", @class, " "), " ',f[3],' ")]')}if(f[4]){if(f[5]&&f[6]){switch(f[5]){case"*=":a.push("[contains(@",f[4],', "',f[6],'")]');break;case"^=":a.push("[starts-with(@",f[4],', "',f[6],'")]');break;case"$=":a.push("[substring(@",f[4],", string-length(@",f[4],") - ",f[6].length,' + 1) = "',f[6],'"]');break;case"=":a.push("[@",f[4],'="',f[6],'"]');break;case"!=":a.push("[@",f[4],'!="',f[6],'"]')}}else{a.push("[@",f[4],"]")}}b.push(a.join(""));return b},getItems:function(b,f,h){var g=[];var a=document.evaluate(".//"+b.join("//"),f,$$.shared.resolver,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(var d=0,c=a.snapshotLength;d<c;d++){g.push(a.snapshotItem(d))}return(h)?g:new Elements(g.map($))}},normal:{getParam:function(a,c,f,b){if(b==0){if(f[2]){var d=c.getElementById(f[2]);if(!d||((f[1]!="*")&&(Element.getTag(d)!=f[1]))){return false}a=[d]}else{a=$A(c.getElementsByTagName(f[1]))}}else{a=$$.shared.getElementsByTagName(a,f[1]);if(f[2]){a=Elements.filterById(a,f[2],true)}}if(f[3]){a=Elements.filterByClass(a,f[3],true)}if(f[4]){a=Elements.filterByAttribute(a,f[4],f[5],f[6],true)}return a},getItems:function(a,b,c){return(c)?a:$$.unique(a)}},resolver:function(a){return(a=="xhtml")?"http://www.w3.org/1999/xhtml":false},getElementsByTagName:function(d,c){var f=[];for(var b=0,a=d.length;b<a;b++){f.extend(d[b].getElementsByTagName(c))}return f}};$$.shared.method=(window.xpath)?"xpath":"normal";Element.Methods.Dom={getElements:function(a,k){var c=[];a=a.trim().split(" ");for(var f=0,d=a.length;f<d;f++){var g=a[f];var h=g.match($$.shared.regexp);if(!h){break}h[1]=h[1]||"*";var b=$$.shared[$$.shared.method].getParam(c,this,h,f);if(!b){break}c=b}return $$.shared[$$.shared.method].getItems(c,this,k)},getElement:function(a){return $(this.getElements(a,true)[0]||false)},getElementsBySelector:function(a,f){var d=[];a=a.split(",");for(var c=0,b=a.length;c<b;c++){d=d.concat(this.getElements(a[c],true))}return(f)?d:$$.unique(d)}};Element.extend({getElementById:function(c){var b=document.getElementById(c);if(!b){return false}for(var a=b.parentNode;a!=this;a=a.parentNode){if(!a){return false}}return b},getElementsByClassName:function(a){return this.getElements("."+a)}});document.extend(Element.Methods.Dom);Element.extend(Element.Methods.Dom);Element.extend({getValue:function(){switch(this.getTag()){case"select":var a=[];$each(this.options,function(b){if(b.selected){a.push($pick(b.value,b.text))}});return(this.multiple)?a:a[0];case"input":if(!(this.checked&&["checkbox","radio"].contains(this.type))&&!["hidden","text","password"].contains(this.type)){break}case"textarea":return this.value}return false},getFormElements:function(){return $$(this.getElementsByTagName("input"),this.getElementsByTagName("select"),this.getElementsByTagName("textarea"))},toQueryString:function(){var a=[];this.getFormElements().each(function(d){var c=d.name;var f=d.getValue();if(f===false||!c||d.disabled){return}var b=function(g){a.push(c+"="+encodeURIComponent(g))};if($type(f)=="array"){f.each(b)}else{b(f)}});return a.join("&")}});Element.extend({scrollTo:function(a,b){this.scrollLeft=a;this.scrollTop=b},getSize:function(){return{scroll:{x:this.scrollLeft,y:this.scrollTop},size:{x:this.offsetWidth,y:this.offsetHeight},scrollSize:{x:this.scrollWidth,y:this.scrollHeight}}},getPosition:function(a){a=a||[];var b=this,d=0,c=0;do{d+=b.offsetLeft||0;c+=b.offsetTop||0;b=b.offsetParent}while(b);a.each(function(f){d-=f.scrollLeft||0;c-=f.scrollTop||0});return{x:d,y:c}},getTop:function(a){return this.getPosition(a).y},getLeft:function(a){return this.getPosition(a).x},getCoordinates:function(b){var a=this.getPosition(b);var c={width:this.offsetWidth,height:this.offsetHeight,left:a.x,top:a.y};c.right=c.left+c.width;c.bottom=c.top+c.height;return c}});Element.Events.domready={add:function(b){if(window.loaded){b.call(this);return}var a=function(){if(window.loaded){return}window.loaded=true;window.timer=$clear(window.timer);this.fireEvent("domready")}.bind(this);if(document.readyState&&window.webkit){window.timer=function(){if(["loaded","complete"].contains(document.readyState)){a()}}.periodical(50)}else{if(document.readyState&&window.ie){if(!$("ie_ready")){var c=(window.location.protocol=="https:")?"://0":"javascript:void(0)";document.write('<script id="ie_ready" defer src="'+c+'"><\/script>');$("ie_ready").onreadystatechange=function(){if(this.readyState=="complete"){a()}}}}else{window.addListener("load",a);document.addListener("DOMContentLoaded",a)}}}};window.onDomReady=function(a){return this.addEvent("domready",a)};window.extend({getWidth:function(){if(this.webkit419){return this.innerWidth}if(this.opera){return document.body.clientWidth}return document.documentElement.clientWidth},getHeight:function(){if(this.webkit419){return this.innerHeight}if(this.opera){return document.body.clientHeight}return document.documentElement.clientHeight},getScrollWidth:function(){if(this.ie){return Math.max(document.documentElement.offsetWidth,document.documentElement.scrollWidth)}if(this.webkit){return document.body.scrollWidth}return document.documentElement.scrollWidth},getScrollHeight:function(){if(this.ie){return Math.max(document.documentElement.offsetHeight,document.documentElement.scrollHeight)}if(this.webkit){return document.body.scrollHeight}return document.documentElement.scrollHeight},getScrollLeft:function(){return this.pageXOffset||document.documentElement.scrollLeft},getScrollTop:function(){return this.pageYOffset||document.documentElement.scrollTop},getSize:function(){return{size:{x:this.getWidth(),y:this.getHeight()},scrollSize:{x:this.getScrollWidth(),y:this.getScrollHeight()},scroll:{x:this.getScrollLeft(),y:this.getScrollTop()}}},getPosition:function(){return{x:0,y:0}}});var Fx={};Fx.Base=new Class({options:{onStart:Class.empty,onComplete:Class.empty,onCancel:Class.empty,transition:function(a){return -(Math.cos(Math.PI*a)-1)/2},duration:500,unit:"px",wait:true,fps:50},initialize:function(a){this.element=this.element||null;this.setOptions(a);if(this.options.initialize){this.options.initialize.call(this)}},step:function(){var a=$time();if(a<this.time+this.options.duration){this.delta=this.options.transition((a-this.time)/this.options.duration);this.setNow();this.increase()}else{this.stop(true);this.set(this.to);this.fireEvent("onComplete",this.element,10);this.callChain()}},set:function(a){this.now=a;this.increase();return this},setNow:function(){this.now=this.compute(this.from,this.to)},compute:function(b,a){return(a-b)*this.delta+b},start:function(b,a){if(!this.options.wait){this.stop()}else{if(this.timer){return this}}this.from=b;this.to=a;this.change=this.to-this.from;this.time=$time();this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);this.fireEvent("onStart",this.element);return this},stop:function(a){if(!this.timer){return this}this.timer=$clear(this.timer);if(!a){this.fireEvent("onCancel",this.element)}return this},custom:function(b,a){return this.start(b,a)},clearTimer:function(a){return this.stop(a)}});Fx.Base.implement(new Chain,new Events,new Options);Fx.CSS={select:function(b,c){if(b.test(/color/i)){return this.Color}var a=$type(c);if((a=="array")||(a=="string"&&c.contains(" "))){return this.Multi}return this.Single},parse:function(c,d,a){if(!a.push){a=[a]}var g=a[0],f=a[1];if(!$chk(f)){f=g;g=c.getStyle(d)}var b=this.select(d,f);return{from:b.parse(g),to:b.parse(f),css:b}}};Fx.CSS.Single={parse:function(a){return parseFloat(a)},getNow:function(c,b,a){return a.compute(c,b)},getValue:function(c,a,b){if(a=="px"&&b!="opacity"){c=Math.round(c)}return c+a}};Fx.CSS.Multi={parse:function(a){return a.push?a:a.split(" ").map(function(b){return parseFloat(b)})},getNow:function(f,d,c){var a=[];for(var b=0;b<f.length;b++){a[b]=c.compute(f[b],d[b])}return a},getValue:function(c,a,b){if(a=="px"&&b!="opacity"){c=c.map(Math.round)}return c.join(a+" ")+a}};Fx.CSS.Color={parse:function(a){return a.push?a:a.hexToRgb(true)},getNow:function(f,d,c){var a=[];for(var b=0;b<f.length;b++){a[b]=Math.round(c.compute(f[b],d[b]))}return a},getValue:function(a){return"rgb("+a.join(",")+")"}};Fx.Style=Fx.Base.extend({initialize:function(b,c,a){this.element=$(b);this.property=c;this.parent(a)},hide:function(){return this.set(0)},setNow:function(){this.now=this.css.getNow(this.from,this.to,this)},set:function(a){this.css=Fx.CSS.select(this.property,a);return this.parent(this.css.parse(a))},start:function(c,b){if(this.timer&&this.options.wait){return this}var a=Fx.CSS.parse(this.element,this.property,[c,b]);this.css=a.css;return this.parent(a.from,a.to)},increase:function(){this.element.setStyle(this.property,this.css.getValue(this.now,this.options.unit,this.property))}});Element.extend({effect:function(b,a){return new Fx.Style(this,b,a)}});Fx.Styles=Fx.Base.extend({initialize:function(b,a){this.element=$(b);this.parent(a)},setNow:function(){for(var a in this.from){this.now[a]=this.css[a].getNow(this.from[a],this.to[a],this)}},set:function(c){var a={};this.css={};for(var b in c){this.css[b]=Fx.CSS.select(b,c[b]);a[b]=this.css[b].parse(c[b])}return this.parent(a)},start:function(c){if(this.timer&&this.options.wait){return this}this.now={};this.css={};var f={},d={};for(var b in c){var a=Fx.CSS.parse(this.element,b,c[b]);f[b]=a.from;d[b]=a.to;this.css[b]=a.css}return this.parent(f,d)},increase:function(){for(var a in this.now){this.element.setStyle(a,this.css[a].getValue(this.now[a],this.options.unit,a))}}});Element.extend({effects:function(a){return new Fx.Styles(this,a)}});Fx.Elements=Fx.Base.extend({initialize:function(b,a){this.elements=$$(b);this.parent(a)},setNow:function(){for(var c in this.from){var g=this.from[c],f=this.to[c],b=this.css[c],a=this.now[c]={};for(var d in g){a[d]=b[d].getNow(g[d],f[d],this)}}},set:function(h){var b={};this.css={};for(var d in h){var g=h[d],c=this.css[d]={},a=b[d]={};for(var f in g){c[f]=Fx.CSS.select(f,g[f]);a[f]=c[f].parse(g[f])}}return this.parent(b)},start:function(d){if(this.timer&&this.options.wait){return this}this.now={};this.css={};var k={},l={};for(var f in d){var h=d[f],a=k[f]={},j=l[f]={},c=this.css[f]={};for(var b in h){var g=Fx.CSS.parse(this.elements[f],b,h[b]);a[b]=g.from;j[b]=g.to;c[b]=g.css}}return this.parent(k,l)},increase:function(){for(var c in this.now){var a=this.now[c],b=this.css[c];for(var d in a){this.elements[c].setStyle(d,b[d].getValue(a[d],this.options.unit,d))}}}});Fx.Scroll=Fx.Base.extend({options:{overflown:[],offset:{x:0,y:0},wheelStops:true},initialize:function(b,a){this.now=[];this.element=$(b);this.bound={stop:this.stop.bind(this,false)};this.parent(a);if(this.options.wheelStops){this.addEvent("onStart",function(){document.addEvent("mousewheel",this.bound.stop)}.bind(this));this.addEvent("onComplete",function(){document.removeEvent("mousewheel",this.bound.stop)}.bind(this))}},setNow:function(){for(var a=0;a<2;a++){this.now[a]=this.compute(this.from[a],this.to[a])}},scrollTo:function(b,g){if(this.timer&&this.options.wait){return this}var d=this.element.getSize();var c={x:b,y:g};for(var f in d.size){var a=d.scrollSize[f]-d.size[f];if($chk(c[f])){c[f]=($type(c[f])=="number")?c[f].limit(0,a):a}else{c[f]=d.scroll[f]}c[f]+=this.options.offset[f]}return this.start([d.scroll.x,d.scroll.y],[c.x,c.y])},toTop:function(){return this.scrollTo(false,0)},toBottom:function(){return this.scrollTo(false,"full")},toLeft:function(){return this.scrollTo(0,false)},toRight:function(){return this.scrollTo("full",false)},toElement:function(b){var a=this.element.getPosition(this.options.overflown);var c=$(b).getPosition(this.options.overflown);return this.scrollTo(c.x-a.x,c.y-a.y)},increase:function(){this.element.scrollTo(this.now[0],this.now[1])}});Fx.Slide=Fx.Base.extend({options:{mode:"vertical"},initialize:function(b,a){this.element=$(b);this.wrapper=new Element("div",{styles:$extend(this.element.getStyles("margin"),{overflow:"hidden"})}).injectAfter(this.element).adopt(this.element);this.element.setStyle("margin",0);this.setOptions(a);this.now=[];this.parent(this.options);this.open=true;this.addEvent("onComplete",function(){this.open=(this.now[0]===0)});if(window.webkit419){this.addEvent("onComplete",function(){if(this.open){this.element.remove().inject(this.wrapper)}})}},setNow:function(){for(var a=0;a<2;a++){this.now[a]=this.compute(this.from[a],this.to[a])}},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight},horizontal:function(){this.margin="margin-left";this.layout="width";this.offset=this.element.offsetWidth},slideIn:function(a){this[a||this.options.mode]();return this.start([this.element.getStyle(this.margin).toInt(),this.wrapper.getStyle(this.layout).toInt()],[0,this.offset])},slideOut:function(a){this[a||this.options.mode]();return this.start([this.element.getStyle(this.margin).toInt(),this.wrapper.getStyle(this.layout).toInt()],[-this.offset,0])},hide:function(a){this[a||this.options.mode]();this.open=false;return this.set([-this.offset,0])},show:function(a){this[a||this.options.mode]();this.open=true;return this.set([0,this.offset])},toggle:function(a){if(this.wrapper.offsetHeight==0||this.wrapper.offsetWidth==0){return this.slideIn(a)}return this.slideOut(a)},increase:function(){this.element.setStyle(this.margin,this.now[0]+this.options.unit);this.wrapper.setStyle(this.layout,this.now[1]+this.options.unit)}});Fx.Transition=function(b,a){a=a||[];if($type(a)!="array"){a=[a]}return $extend(b,{easeIn:function(c){return b(c,a)},easeOut:function(c){return 1-b(1-c,a)},easeInOut:function(c){return(c<=0.5)?b(2*c,a)/2:(2-b(2*(1-c),a))/2}})};Fx.Transitions=new Abstract({linear:function(a){return a}});Fx.Transitions.extend=function(a){for(var b in a){Fx.Transitions[b]=new Fx.Transition(a[b]);Fx.Transitions.compat(b)}};Fx.Transitions.compat=function(a){["In","Out","InOut"].each(function(b){Fx.Transitions[a.toLowerCase()+b]=Fx.Transitions[a]["ease"+b]})};Fx.Transitions.extend({Pow:function(b,a){return Math.pow(b,a[0]||6)},Expo:function(a){return Math.pow(2,8*(a-1))},Circ:function(a){return 1-Math.sin(Math.acos(a))},Sine:function(a){return 1-Math.sin((1-a)*Math.PI/2)},Back:function(b,a){a=a[0]||1.618;return Math.pow(b,2)*((a+1)*b-a)},Bounce:function(g){var f;for(var d=0,c=1;1;d+=c,c/=2){if(g>=(7-4*d)/11){f=-Math.pow((11-6*d-11*g)/4,2)+c*c;break}}return f},Elastic:function(b,a){return Math.pow(2,10*--b)*Math.cos(20*b*Math.PI*(a[0]||1)/3)}});["Quad","Cubic","Quart","Quint"].each(function(b,a){Fx.Transitions[b]=new Fx.Transition(function(c){return Math.pow(c,[a+2])});Fx.Transitions.compat(b)});var Drag={};Drag.Base=new Class({options:{handle:false,unit:"px",onStart:Class.empty,onBeforeStart:Class.empty,onComplete:Class.empty,onSnap:Class.empty,onDrag:Class.empty,limit:false,modifiers:{x:"left",y:"top"},grid:false,snap:6},initialize:function(b,a){this.setOptions(a);this.element=$(b);this.handle=$(this.options.handle)||this.element;this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.bound={start:this.start.bindWithEvent(this),check:this.check.bindWithEvent(this),drag:this.drag.bindWithEvent(this),stop:this.stop.bind(this)};this.attach();if(this.options.initialize){this.options.initialize.call(this)}},attach:function(){this.handle.addEvent("mousedown",this.bound.start);return this},detach:function(){this.handle.removeEvent("mousedown",this.bound.start);return this},start:function(c){this.fireEvent("onBeforeStart",this.element);this.mouse.start=c.page;var a=this.options.limit;this.limit={x:[],y:[]};for(var d in this.options.modifiers){if(!this.options.modifiers[d]){continue}this.value.now[d]=this.element.getStyle(this.options.modifiers[d]).toInt();this.mouse.pos[d]=c.page[d]-this.value.now[d];if(a&&a[d]){for(var b=0;b<2;b++){if($chk(a[d][b])){this.limit[d][b]=($type(a[d][b])=="function")?a[d][b]():a[d][b]}}}}if($type(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid}}document.addListener("mousemove",this.bound.check);document.addListener("mouseup",this.bound.stop);this.fireEvent("onStart",this.element);c.stop()},check:function(a){var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));if(b>this.options.snap){document.removeListener("mousemove",this.bound.check);document.addListener("mousemove",this.bound.drag);this.drag(a);this.fireEvent("onSnap",this.element)}a.stop()},drag:function(a){this.out=false;this.mouse.now=a.page;for(var b in this.options.modifiers){if(!this.options.modifiers[b]){continue}this.value.now[b]=this.mouse.now[b]-this.mouse.pos[b];if(this.limit[b]){if($chk(this.limit[b][1])&&(this.value.now[b]>this.limit[b][1])){this.value.now[b]=this.limit[b][1];this.out=true}else{if($chk(this.limit[b][0])&&(this.value.now[b]<this.limit[b][0])){this.value.now[b]=this.limit[b][0];this.out=true}}}if(this.options.grid[b]){this.value.now[b]-=(this.value.now[b]%this.options.grid[b])}this.element.setStyle(this.options.modifiers[b],this.value.now[b]+this.options.unit)}this.fireEvent("onDrag",this.element);a.stop()},stop:function(){document.removeListener("mousemove",this.bound.check);document.removeListener("mousemove",this.bound.drag);document.removeListener("mouseup",this.bound.stop);this.fireEvent("onComplete",this.element)}});Drag.Base.implement(new Events,new Options);Element.extend({makeResizable:function(a){return new Drag.Base(this,$merge({modifiers:{x:"width",y:"height"}},a))}});Drag.Move=Drag.Base.extend({options:{droppables:[],container:false,overflown:[]},initialize:function(b,a){this.setOptions(a);this.element=$(b);this.droppables=$$(this.options.droppables);this.container=$(this.options.container);this.position={element:this.element.getStyle("position"),container:false};if(this.container){this.position.container=this.container.getStyle("position")}if(!["relative","absolute","fixed"].contains(this.position.element)){this.position.element="absolute"}var d=this.element.getStyle("top").toInt();var c=this.element.getStyle("left").toInt();if(this.position.element=="absolute"&&!["relative","absolute","fixed"].contains(this.position.container)){d=$chk(d)?d:this.element.getTop(this.options.overflown);c=$chk(c)?c:this.element.getLeft(this.options.overflown)}else{d=$chk(d)?d:0;c=$chk(c)?c:0}this.element.setStyles({top:d,left:c,position:this.position.element});this.parent(this.element)},start:function(c){this.overed=null;if(this.container){var a=this.container.getCoordinates();var b=this.element.getCoordinates();if(this.position.element=="absolute"&&!["relative","absolute","fixed"].contains(this.position.container)){this.options.limit={x:[a.left,a.right-b.width],y:[a.top,a.bottom-b.height]}}else{this.options.limit={y:[0,a.height-b.height],x:[0,a.width-b.width]}}}this.parent(c)},drag:function(a){this.parent(a);var b=this.out?false:this.droppables.filter(this.checkAgainst,this).getLast();if(this.overed!=b){if(this.overed){this.overed.fireEvent("leave",[this.element,this])}this.overed=b?b.fireEvent("over",[this.element,this]):null}return this},checkAgainst:function(b){b=b.getCoordinates(this.options.overflown);var a=this.mouse.now;return(a.x>b.left&&a.x<b.right&&a.y<b.bottom&&a.y>b.top)},stop:function(){if(this.overed&&!this.out){this.overed.fireEvent("drop",[this.element,this])}else{this.element.fireEvent("emptydrop",this)}this.parent();return this}});Element.extend({makeDraggable:function(a){return new Drag.Move(this,a)}});var XHR=new Class({options:{method:"post",async:true,onRequest:Class.empty,onSuccess:Class.empty,onFailure:Class.empty,urlEncoded:true,encoding:"utf-8",autoCancel:false,headers:{}},setTransport:function(){this.transport=(window.XMLHttpRequest)?new XMLHttpRequest():(window.ie?new ActiveXObject("Microsoft.XMLHTTP"):false);return this},initialize:function(a){this.setTransport().setOptions(a);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers={};if(this.options.urlEncoded&&this.options.method=="post"){var b=(this.options.encoding)?"; charset="+this.options.encoding:"";this.setHeader("Content-type","application/x-www-form-urlencoded"+b)}if(this.options.initialize){this.options.initialize.call(this)}},onStateChange:function(){if(this.transport.readyState!=4||!this.running){return}this.running=false;var a=0;try{a=this.transport.status}catch(b){}if(this.options.isSuccess.call(this,a)){this.onSuccess()}else{this.onFailure()}this.transport.onreadystatechange=Class.empty},isSuccess:function(a){return((a>=200)&&(a<300))},onSuccess:function(){this.response={text:this.transport.responseText,xml:this.transport.responseXML};this.fireEvent("onSuccess",[this.response.text,this.response.xml]);this.callChain()},onFailure:function(){this.fireEvent("onFailure",this.transport)},setHeader:function(a,b){this.headers[a]=b;return this},send:function(a,c){if(this.options.autoCancel){this.cancel()}else{if(this.running){return this}}this.running=true;if(c&&this.options.method=="get"){a=a+(a.contains("?")?"&":"?")+c;c=null}this.transport.open(this.options.method.toUpperCase(),a,this.options.async);this.transport.onreadystatechange=this.onStateChange.bind(this);if((this.options.method=="post")&&this.transport.overrideMimeType){this.setHeader("Connection","close")}$extend(this.headers,this.options.headers);for(var b in this.headers){try{this.transport.setRequestHeader(b,this.headers[b])}catch(d){}}this.fireEvent("onRequest");this.transport.send($pick(c,null));return this},cancel:function(){if(!this.running){return this}this.running=false;this.transport.abort();this.transport.onreadystatechange=Class.empty;this.setTransport();this.fireEvent("onCancel");return this}});XHR.implement(new Chain,new Events,new Options);var Ajax=XHR.extend({options:{data:null,update:null,onComplete:Class.empty,evalScripts:false,evalResponse:false},initialize:function(b,a){this.addEvent("onSuccess",this.onComplete);this.setOptions(a);this.options.data=this.options.data||this.options.postBody;if(!["post","get"].contains(this.options.method)){this._method="_method="+this.options.method;this.options.method="post"}this.parent();this.setHeader("X-Requested-With","XMLHttpRequest");this.setHeader("Accept","text/javascript, text/html, application/xml, text/xml, */*");this.url=b},onComplete:function(){if(this.options.update){$(this.options.update).empty().setHTML(this.response.text)}if(this.options.evalScripts||this.options.evalResponse){this.evalScripts()}this.fireEvent("onComplete",[this.response.text,this.response.xml],20)},request:function(a){a=a||this.options.data;switch($type(a)){case"element":a=$(a).toQueryString();break;case"object":a=Object.toQueryString(a)}if(this._method){a=(a)?[this._method,a].join("&"):this._method}return this.send(this.url,a)},evalScripts:function(){var b,a;if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){a=this.response.text}else{a=[];var c=/<script[^>]*>([\s\S]*?)<\/script>/gi;while((b=c.exec(this.response.text))){a.push(b[1])}a=a.join("\n")}if(a){(window.execScript)?window.execScript(a):window.setTimeout(a,0)}},getHeader:function(a){try{return this.transport.getResponseHeader(a)}catch(b){}return null}});Object.toQueryString=function(b){var c=[];for(var a in b){c.push(encodeURIComponent(a)+"="+encodeURIComponent(b[a]))}return c.join("&")};Element.extend({send:function(a){return new Ajax(this.getProperty("action"),$merge({data:this.toQueryString()},a,{method:"post"})).request()}});var Cookie=new Abstract({options:{domain:false,path:false,duration:false,secure:false},set:function(c,d,b){b=$merge(this.options,b);d=encodeURIComponent(d);if(b.domain){d+="; domain="+b.domain}if(b.path){d+="; path="+b.path}if(b.duration){var a=new Date();a.setTime(a.getTime()+b.duration*24*60*60*1000);d+="; expires="+a.toGMTString()}if(b.secure){d+="; secure"}document.cookie=c+"="+d;return $extend(b,{key:c,value:d})},get:function(a){var b=document.cookie.match("(?:^|;)\\s*"+a.escapeRegExp()+"=([^;]*)");return b?decodeURIComponent(b[1]):false},remove:function(b,a){if($type(b)=="object"){this.set(b.key,"",$merge(b,{duration:-1}))}else{this.set(b,"",$merge(a,{duration:-1}))}}});var Json={toString:function(c){switch($type(c)){case"string":return'"'+c.replace(/(["\\])/g,"\\$1")+'"';case"array":return"["+c.map(Json.toString).join(",")+"]";case"object":var a=[];for(var b in c){a.push(Json.toString(b)+":"+Json.toString(c[b]))}return"{"+a.join(",")+"}";case"number":if(isFinite(c)){break}case false:return"null"}return String(c)},evaluate:function(str,secure){return(($type(str)!="string")||(secure&&!str.test(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/)))?null:eval("("+str+")")}};Json.Remote=XHR.extend({initialize:function(b,a){this.url=b;this.addEvent("onSuccess",this.onComplete);this.parent(a);this.setHeader("X-Request","JSON")},send:function(a){return this.parent(this.url,"json="+Json.toString(a))},onComplete:function(){this.fireEvent("onComplete",[Json.evaluate(this.response.text,this.options.secure)])}});var Asset=new Abstract({javascript:function(c,b){b=$merge({onload:Class.empty},b);var a=new Element("script",{src:c}).addEvents({load:b.onload,readystatechange:function(){if(this.readyState=="complete"){this.fireEvent("load")}}});delete b.onload;return a.setProperties(b).inject(document.head)},css:function(b,a){return new Element("link",$merge({rel:"stylesheet",media:"screen",type:"text/css",href:b},a)).inject(document.head)},image:function(c,b){b=$merge({onload:Class.empty,onabort:Class.empty,onerror:Class.empty},b);var d=new Image();d.src=c;var a=new Element("img",{src:c});["load","abort","error"].each(function(f){var g=b["on"+f];delete b["on"+f];a.addEvent(f,function(){this.removeEvent(f,arguments.callee);g.call(this)})});if(d.width&&d.height){a.fireEvent("load",a,1)}return a.setProperties(b)},images:function(d,c){c=$merge({onComplete:Class.empty,onProgress:Class.empty},c);if(!d.push){d=[d]}var a=[];var b=0;d.each(function(g){var f=new Asset.image(g,{onload:function(){c.onProgress.call(this,b);b++;if(b==d.length){c.onComplete()}}});a.push(f)});return new Elements(a)}});var Hash=new Class({length:0,initialize:function(a){this.obj=a||{};this.setLength()},get:function(a){return(this.hasKey(a))?this.obj[a]:null},hasKey:function(a){return(a in this.obj)},set:function(a,b){if(!this.hasKey(a)){this.length++}this.obj[a]=b;return this},setLength:function(){this.length=0;for(var a in this.obj){this.length++}return this},remove:function(a){if(this.hasKey(a)){delete this.obj[a];this.length--}return this},each:function(a,b){$each(this.obj,a,b)},extend:function(a){$extend(this.obj,a);return this.setLength()},merge:function(){this.obj=$merge.apply(null,[this.obj].extend(arguments));return this.setLength()},empty:function(){this.obj={};this.length=0;return this},keys:function(){var a=[];for(var b in this.obj){a.push(b)}return a},values:function(){var a=[];for(var b in this.obj){a.push(this.obj[b])}return a}});function $H(a){return new Hash(a)}Hash.Cookie=Hash.extend({initialize:function(b,a){this.name=b;this.options=$extend({autoSave:true},a||{});this.load()},save:function(){if(this.length==0){Cookie.remove(this.name,this.options);return true}var a=Json.toString(this.obj);if(a.length>4096){return false}Cookie.set(this.name,a,this.options);return true},load:function(){this.obj=Json.evaluate(Cookie.get(this.name),true)||{};this.setLength()}});Hash.Cookie.Methods={};["extend","set","merge","empty","remove"].each(function(a){Hash.Cookie.Methods[a]=function(){Hash.prototype[a].apply(this,arguments);if(this.options.autoSave){this.save()}return this}});Hash.Cookie.implement(Hash.Cookie.Methods);var Color=new Class({initialize:function(b,d){d=d||(b.push?"rgb":"hex");var c,a;switch(d){case"rgb":c=b;a=c.rgbToHsb();break;case"hsb":c=b.hsbToRgb();a=b;break;default:c=b.hexToRgb(true);a=c.rgbToHsb()}c.hsb=a;c.hex=c.rgbToHex();return $extend(c,Color.prototype)},mix:function(){var a=$A(arguments);var c=($type(a[a.length-1])=="number")?a.pop():50;var b=this.copy();a.each(function(d){d=new Color(d);for(var f=0;f<3;f++){b[f]=Math.round((b[f]/100*(100-c))+(d[f]/100*c))}});return new Color(b,"rgb")},invert:function(){return new Color(this.map(function(a){return 255-a}))},setHue:function(a){return new Color([a,this.hsb[1],this.hsb[2]],"hsb")},setSaturation:function(a){return new Color([this.hsb[0],a,this.hsb[2]],"hsb")},setBrightness:function(a){return new Color([this.hsb[0],this.hsb[1],a],"hsb")}});function $RGB(d,c,a){return new Color([d,c,a],"rgb")}function $HSB(d,c,a){return new Color([d,c,a],"hsb")}Array.extend({rgbToHsb:function(){var b=this[0],c=this[1],k=this[2];var h,g,i;var j=Math.max(b,c,k),f=Math.min(b,c,k);var l=j-f;i=j/255;g=(j!=0)?l/j:0;if(g==0){h=0}else{var d=(j-b)/l;var a=(j-c)/l;var m=(j-k)/l;if(b==j){h=m-a}else{if(c==j){h=2+d-m}else{h=4+a-d}}h/=6;if(h<0){h++}}return[Math.round(h*360),Math.round(g*100),Math.round(i*100)]},hsbToRgb:function(){var c=Math.round(this[2]/100*255);if(this[1]==0){return[c,c,c]}else{var a=this[0]%360;var g=a%60;var h=Math.round((this[2]*(100-this[1]))/10000*255);var d=Math.round((this[2]*(6000-this[1]*g))/600000*255);var b=Math.round((this[2]*(6000-this[1]*(60-g)))/600000*255);switch(Math.floor(a/60)){case 0:return[c,b,h];case 1:return[d,c,h];case 2:return[h,c,b];case 3:return[h,d,c];case 4:return[b,h,c];case 5:return[c,h,d]}}return false}});var Scroller=new Class({options:{area:20,velocity:1,onChange:function(a,b){this.element.scrollTo(a,b)}},initialize:function(b,a){this.setOptions(a);this.element=$(b);this.mousemover=([window,document].contains(b))?$(document.body):this.element},start:function(){this.coord=this.getCoords.bindWithEvent(this);this.mousemover.addListener("mousemove",this.coord)},stop:function(){this.mousemover.removeListener("mousemove",this.coord);this.timer=$clear(this.timer)},getCoords:function(a){this.page=(this.element==window)?a.client:a.page;if(!this.timer){this.timer=this.scroll.periodical(50,this)}},scroll:function(){var a=this.element.getSize();var d=this.element.getPosition();var c={x:0,y:0};for(var b in this.page){if(this.page[b]<(this.options.area+d[b])&&a.scroll[b]!=0){c[b]=(this.page[b]-this.options.area-d[b])*this.options.velocity}else{if(this.page[b]+this.options.area>(a.size[b]+d[b])&&a.scroll[b]+a.size[b]!=a.scrollSize[b]){c[b]=(this.page[b]-a.size[b]+this.options.area-d[b])*this.options.velocity}}}if(c.y||c.x){this.fireEvent("onChange",[a.scroll.x+c.x,a.scroll.y+c.y])}}});Scroller.implement(new Events,new Options);var Slider=new Class({options:{onChange:Class.empty,onComplete:Class.empty,onTick:function(a){this.knob.setStyle(this.p,a)},mode:"horizontal",steps:100,offset:0},initialize:function(d,a,b){this.element=$(d);this.knob=$(a);this.setOptions(b);this.previousChange=-1;this.previousEnd=-1;this.step=-1;this.element.addEvent("mousedown",this.clickedElement.bindWithEvent(this));var c,g;switch(this.options.mode){case"horizontal":this.z="x";this.p="left";c={x:"left",y:false};g="offsetWidth";break;case"vertical":this.z="y";this.p="top";c={x:false,y:"top"};g="offsetHeight"}this.max=this.element[g]-this.knob[g]+(this.options.offset*2);this.half=this.knob[g]/2;this.getPos=this.element["get"+this.p.capitalize()].bind(this.element);this.knob.setStyle("position","relative").setStyle(this.p,-this.options.offset);var f={};f[this.z]=[-this.options.offset,this.max-this.options.offset];this.drag=new Drag.Base(this.knob,{limit:f,modifiers:c,snap:0,onStart:function(){this.draggedKnob()}.bind(this),onDrag:function(){this.draggedKnob()}.bind(this),onComplete:function(){this.draggedKnob();this.end()}.bind(this)});if(this.options.initialize){this.options.initialize.call(this)}},set:function(a){this.step=a.limit(0,this.options.steps);this.checkStep();this.end();this.fireEvent("onTick",this.toPosition(this.step));return this},clickedElement:function(b){var a=b.page[this.z]-this.getPos()-this.half;a=a.limit(-this.options.offset,this.max-this.options.offset);this.step=this.toStep(a);this.checkStep();this.end();this.fireEvent("onTick",a)},draggedKnob:function(){this.step=this.toStep(this.drag.value.now[this.z]);this.checkStep()},checkStep:function(){if(this.previousChange!=this.step){this.previousChange=this.step;this.fireEvent("onChange",this.step)}},end:function(){if(this.previousEnd!==this.step){this.previousEnd=this.step;this.fireEvent("onComplete",this.step+"")}},toStep:function(a){return Math.round((a+this.options.offset)/this.max*this.options.steps)},toPosition:function(a){return this.max*a/this.options.steps}});Slider.implement(new Events);Slider.implement(new Options);var SmoothScroll=Fx.Scroll.extend({initialize:function(b){this.parent(window,b);this.links=(this.options.links)?$$(this.options.links):$$(document.links);var a=window.location.href.match(/^[^#]*/)[0]+"#";this.links.each(function(d){if(d.href.indexOf(a)!=0){return}var c=d.href.substr(a.length);if(c&&$(c)){this.useLink(d,c)}},this);if(!window.webkit419){this.addEvent("onComplete",function(){window.location.hash=this.anchor})}},useLink:function(b,a){b.addEvent("click",function(c){this.anchor=a;this.toElement(a);c.stop()}.bindWithEvent(this))}});var Sortables=new Class({options:{handles:false,onStart:Class.empty,onComplete:Class.empty,ghost:true,snap:3,onDragStart:function(a,b){b.setStyle("opacity",0.7);a.setStyle("opacity",0.7)},onDragComplete:function(a,b){a.setStyle("opacity",1);b.remove();this.trash.remove()}},initialize:function(d,b){this.setOptions(b);this.list=$(d);this.elements=this.list.getChildren();this.handles=(this.options.handles)?$$(this.options.handles):this.elements;this.bound={start:[],moveGhost:this.moveGhost.bindWithEvent(this)};for(var c=0,a=this.handles.length;c<a;c++){this.bound.start[c]=this.start.bindWithEvent(this,this.elements[c])}this.attach();if(this.options.initialize){this.options.initialize.call(this)}this.bound.move=this.move.bindWithEvent(this);this.bound.end=this.end.bind(this)},attach:function(){this.handles.each(function(b,a){b.addEvent("mousedown",this.bound.start[a])},this)},detach:function(){this.handles.each(function(b,a){b.removeEvent("mousedown",this.bound.start[a])},this)},start:function(c,b){this.active=b;this.coordinates=this.list.getCoordinates();if(this.options.ghost){var a=b.getPosition();this.offset=c.page.y-a.y;this.trash=new Element("div").inject(document.body);this.ghost=b.clone().inject(this.trash).setStyles({position:"absolute",left:a.x,top:c.page.y-this.offset});document.addListener("mousemove",this.bound.moveGhost);this.fireEvent("onDragStart",[b,this.ghost])}document.addListener("mousemove",this.bound.move);document.addListener("mouseup",this.bound.end);this.fireEvent("onStart",b);c.stop()},moveGhost:function(a){var b=a.page.y-this.offset;b=b.limit(this.coordinates.top,this.coordinates.bottom-this.ghost.offsetHeight);this.ghost.setStyle("top",b);a.stop()},move:function(f){var b=f.page.y;this.previous=this.previous||b;var a=((this.previous-b)>0);var d=this.active.getPrevious();var c=this.active.getNext();if(d&&a&&b<d.getCoordinates().bottom){this.active.injectBefore(d)}if(c&&!a&&b>c.getCoordinates().top){this.active.injectAfter(c)}this.previous=b},serialize:function(a){return this.list.getChildren().map(a||function(b){return this.elements.indexOf(b)},this)},end:function(){this.previous=null;document.removeListener("mousemove",this.bound.move);document.removeListener("mouseup",this.bound.end);if(this.options.ghost){document.removeListener("mousemove",this.bound.moveGhost);this.fireEvent("onDragComplete",[this.active,this.ghost])}this.fireEvent("onComplete",this.active)}});Sortables.implement(new Events,new Options);var Tips=new Class({options:{onShow:function(a){a.setStyle("visibility","visible")},onHide:function(a){a.setStyle("visibility","hidden")},maxTitleChars:30,showDelay:100,hideDelay:100,className:"tool",offsets:{x:16,y:16},fixed:false},initialize:function(b,a){this.setOptions(a);this.toolTip=new Element("div",{"class":this.options.className+"-tip",styles:{position:"absolute",top:"0",left:"0",visibility:"hidden"}}).inject(document.body);this.wrapper=new Element("div").inject(this.toolTip);$$(b).each(this.build,this);if(this.options.initialize){this.options.initialize.call(this)}},build:function(b){b.$tmp.myTitle=(b.href&&b.getTag()=="a")?b.href.replace("http://",""):(b.rel||false);if(b.title){var c=b.title.split("::");if(c.length>1){b.$tmp.myTitle=c[0].trim();b.$tmp.myText=c[1].trim()}else{b.$tmp.myText=b.title}b.removeAttribute("title")}else{b.$tmp.myText=false}if(b.$tmp.myTitle&&b.$tmp.myTitle.length>this.options.maxTitleChars){b.$tmp.myTitle=b.$tmp.myTitle.substr(0,this.options.maxTitleChars-1)+"&hellip;"}b.addEvent("mouseenter",function(d){this.start(b);if(!this.options.fixed){this.locate(d)}else{this.position(b)}}.bind(this));if(!this.options.fixed){b.addEvent("mousemove",this.locate.bindWithEvent(this))}var a=this.end.bind(this);b.addEvent("mouseleave",a);b.addEvent("trash",a)},start:function(a){this.wrapper.empty();if(a.$tmp.myTitle){this.title=new Element("span").inject(new Element("div",{"class":this.options.className+"-title"}).inject(this.wrapper)).setHTML(a.$tmp.myTitle)}if(a.$tmp.myText){this.text=new Element("span").inject(new Element("div",{"class":this.options.className+"-text"}).inject(this.wrapper)).setHTML(a.$tmp.myText)}$clear(this.timer);this.timer=this.show.delay(this.options.showDelay,this)},end:function(a){$clear(this.timer);this.timer=this.hide.delay(this.options.hideDelay,this)},position:function(a){var b=a.getPosition();this.toolTip.setStyles({left:b.x+this.options.offsets.x,top:b.y+this.options.offsets.y})},locate:function(b){var d={x:window.getWidth(),y:window.getHeight()};var a={x:window.getScrollLeft(),y:window.getScrollTop()};var c={x:this.toolTip.offsetWidth,y:this.toolTip.offsetHeight};var h={x:"left",y:"top"};for(var f in h){var g=b.page[f]+this.options.offsets[f];if((g+c[f]-a[f])>d[f]){g=b.page[f]-this.options.offsets[f]-c[f]}this.toolTip.setStyle(h[f],g)}},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])}});Tips.implement(new Events,new Options);var Group=new Class({initialize:function(){this.instances=$A(arguments);this.events={};this.checker={}},addEvent:function(b,a){this.checker[b]=this.checker[b]||{};this.events[b]=this.events[b]||[];if(this.events[b].contains(a)){return false}else{this.events[b].push(a)}this.instances.each(function(c,d){c.addEvent(b,this.check.bind(this,[b,c,d]))},this);return this},check:function(c,a,b){this.checker[c][b]=true;var d=this.instances.every(function(g,f){return this.checker[c][f]||false},this);if(!d){return}this.checker[c]={};this.events[c].each(function(f){f.call(this,this.instances,a)},this)}});var Accordion=Fx.Elements.extend({options:{onActive:Class.empty,onBackground:Class.empty,display:0,show:false,height:true,width:false,opacity:true,fixedHeight:false,fixedWidth:false,wait:false,alwaysHide:false},initialize:function(){var c,f,g,b;$each(arguments,function(k,j){switch($type(k)){case"object":c=k;break;case"element":b=$(k);break;default:var h=$$(k);if(!f){f=h}else{g=h}}});this.togglers=f||[];this.elements=g||[];this.container=$(b);this.setOptions(c);this.previous=-1;if(this.options.alwaysHide){this.options.wait=true}if($chk(this.options.show)){this.options.display=false;this.previous=this.options.show}if(this.options.start){this.options.display=false;this.options.show=false}this.effects={};if(this.options.opacity){this.effects.opacity="fullOpacity"}if(this.options.width){this.effects.width=this.options.fixedWidth?"fullWidth":"offsetWidth"}if(this.options.height){this.effects.height=this.options.fixedHeight?"fullHeight":"scrollHeight"}for(var d=0,a=this.togglers.length;d<a;d++){this.addSection(this.togglers[d],this.elements[d])}this.elements.each(function(j,h){if(this.options.show===h){this.fireEvent("onActive",[this.togglers[h],j])}else{for(var k in this.effects){j.setStyle(k,0)}}},this);this.parent(this.elements);if($chk(this.options.display)){this.display(this.options.display)}},addSection:function(f,c,h){f=$(f);c=$(c);var g=this.togglers.contains(f);var b=this.togglers.length;this.togglers.include(f);this.elements.include(c);if(b&&(!g||h)){h=$pick(h,b-1);f.injectBefore(this.togglers[h]);c.injectAfter(f)}else{if(this.container&&!g){f.inject(this.container);c.inject(this.container)}}var a=this.togglers.indexOf(f);f.addEvent("click",this.display.bind(this,a));if(this.options.height){c.setStyles({"padding-top":0,"border-top":"none","padding-bottom":0,"border-bottom":"none"})}if(this.options.width){c.setStyles({"padding-left":0,"border-left":"none","padding-right":0,"border-right":"none"})}c.fullOpacity=1;if(this.options.fixedWidth){c.fullWidth=this.options.fixedWidth}if(this.options.fixedHeight){c.fullHeight=this.options.fixedHeight}c.setStyle("overflow","hidden");if(!g){for(var d in this.effects){c.setStyle(d,0)}}return this},display:function(a){a=($type(a)=="element")?this.elements.indexOf(a):a;if((this.timer&&this.options.wait)||(a===this.previous&&!this.options.alwaysHide)){return this}this.previous=a;var b={};this.elements.each(function(f,d){b[d]={};var c=(d!=a)||(this.options.alwaysHide&&(f.offsetHeight>0));this.fireEvent(c?"onBackground":"onActive",[this.togglers[d],f]);for(var g in this.effects){b[d][g]=c?0:f[this.effects[g]]}},this);return this.start(b)},showThisHideOpen:function(a){return this.display(a)}});Fx.Accordion=Accordion;
/*
intermediary functions to prevent errors before page loaded
when using html element event handler attributes
Provided for backwards compatibility with updated dw_scroll.js
*/
dw_scrollObj.loadLayer = function(wndoId, lyrId, horizId) {
if ( dw_scrollObj.col[wndoId] ) dw_scrollObj.col[wndoId].load(lyrId, horizId);
}
// Support for mouseover/down scrolling at any angle has been removed
dw_scrollObj.initScroll = function(wndoId, dir, speed) {
var deg = dir == 'up'? 90: dir == 'down'? 270: dir == 'left'? 180: dir == 'right'? 0: dir;
if ( deg != null && dw_scrollObj.col[wndoId] ) {
dw_scrollObj.col[wndoId].initScrollVals(deg, speed);
}
}
dw_scrollObj.stopScroll = function(wndoId) {
if ( dw_scrollObj.col[wndoId] ) dw_scrollObj.col[wndoId].ceaseScroll();
}
// increase speed onmousedown of scroll links (for mouseover scrolling)
dw_scrollObj.doubleSpeed = function(wndoId) {
if ( dw_scrollObj.col[wndoId] ) dw_scrollObj.col[wndoId].speed *= 2;
}
dw_scrollObj.resetSpeed = function(wndoId) {
if ( dw_scrollObj.col[wndoId] ) dw_scrollObj.col[wndoId].speed /= 2;
}
// for glide onclick scrolling
dw_scrollObj.scrollBy = function(wndoId, x, y, dur) {
if ( dw_scrollObj.col[wndoId] ) dw_scrollObj.col[wndoId].initScrollByVals(x, y, dur);
}
dw_scrollObj.scrollTo = function(wndoId, x, y, dur) {
if ( dw_scrollObj.col[wndoId] ) dw_scrollObj.col[wndoId].initScrollToVals(x, y, dur);
}
function coremetrics_process_response(a_product_ids,            // Array of recommended product IDs
zone,                  // Zone ID specified in the request (as entered on zone edit screen)
symbolic,              // Target type:
//      _SP_  Specified Product ID
//      _SC_  Specified Category ID
//      _RVP_ Most Recently Viewed Product
//      _RPP_ Most Recently Purchased Product
//      _NR_  No Recommendations
//      _LCP_ Last Carted Product
//      _MPC_ Visitor's Most Popular Category
//      _SS_  Specified Search Term
target_id,             // Target ID recommendations are based on
category,              // Category of Target ID - EPR Category ID if the Target ID is a product
rec_attributes,        // 2 dimensional array of attributes for each recommendation
target_attributes,     // Array of attribute for the target
target_header_txt,     // Header text (as entered on recommendation plan edit screen)
ab_test_id,            // String containing AB Test Name, a semicolon, AB test ID for the test element requested
//      Null if no AB Test
//
// The final 2 parameters are not standard parameters passed into zone population function
// They ared added via the function calls at bottom of this file
div_id,                //      div id - must match div id in cm_io_demo.html
b_display_target,      //     indicates whether target will be displayed
top_button_div,       // The div that is displayed if number of records is greater than 3
bottom_button_div)   // The div that is displayed if number of records is greater than 3
{
try{
if (symbolic !== '_NR_')
{
var number_of_records      = a_product_ids.length;
var number_of_valid_products = 0;
// Loop through the entire set of data to determine if the data is valid
var list_of_products = "";
for (var record_number=0; record_number < number_of_records; record_number++)
{
var product_name     = rec_attributes[record_number][0] ? rec_attributes[record_number][0] : ''; //attr_1
if (product_name.length == 0 ){
continue;
}
else{
number_of_valid_products++;
list_of_products += '&product_id=';
list_of_products += a_product_ids[record_number];
}
}
var display_scrolling = false;
if (number_of_valid_products > 3){
display_scrolling = true;
}
var rand_no = Math.random();
rand_no = rand_no * 10000000;
if (zone == 'pdpz1'){
var url = "/includes/product_list.jsp?RELATED_ITEM_TYPE=CROSSSELL"+list_of_products+'&t='+rand_no; // The server-side script
} else if (zone == 'cpz1'){
var url = "/includes/product_list.jsp?RELATED_ITEM_TYPE=UPSELL"+list_of_products+'&t='+rand_no; // The server-side script
}
new Ajax(url, {method:'get',
evalScripts: true,
onComplete:function(txt, xml) {
if (document.getElementById(div_id) != null ){
document.getElementById(div_id).innerHTML = txt;
document.getElementById(div_id).style.display = "block"; //to hide it
if (zone == 'pdpz1'){
dw_scrollObj.loadLayer('wnCrossSell',div_id);
if (number_of_valid_products < 3){
document.getElementById("wnCrossSell").style.height = 125 * number_of_valid_products + 'px';
}
}
else if (zone == 'cpz1'){
dw_scrollObj.loadLayer('wnUpSell',div_id);
if (number_of_valid_products < 3){
document.getElementById("wnUpSell").style.height = 125 * number_of_valid_products + 'px';
}
}
// Make the scroll bar visible
if (display_scrolling && scrolling_Enabled){
if (document.getElementById(top_button_div) != null){
document.getElementById(top_button_div).style.visibility = "visible";
}
if (document.getElementById(bottom_button_div) != null){
document.getElementById(bottom_button_div).style.visibility = "visible";
}
}
if (document.getElementById("RelatedProductsItemContainer") != null){
var container = document.getElementById("RelatedProductsItemContainer");
container.style.visibility = "visible";
addEvent(window, 'load', initCorners);
function initCorners() {
var setting = {
tl: { radius: 5 },
tr: { radius: 5 },
bl: { radius: 5 },
br: { radius: 5 },
antiAlias: true
};
curvyCorners(setting, "#RelatedProductsItemContainer");
}
}
}
}}).request();
}
} catch(err){
error_encountered = true;
}
}
function pdpz1_zp(a,b,c,d,e,f,g,h,i)
{
coremetrics_process_response(a,b,c,d,e,f,g,h,i,'lyrCrossSellCoremetrics7',true,'scrollLinksTopCrossSell','scrollLinksBottomCrossSell');
}
function cpz1_zp(a,b,c,d,e,f,g,h,i)
{
coremetrics_process_response(a,b,c,d,e,f,g,h,i,'lyrUpSellCoremetrics7',true,'scrollLinksTopUpSell','scrollLinksBottomUpSell');
}
function spz1_zp(a,b,c,d,e,f,g,h,i)
{
if (d == '_TS_'){
coremetrics_process_response_feature_search(a,b,c,d,e,f,g,h,i,'NoSearchResultsCoremetrics7',true,'NoSearchResultsTS');
} else {
coremetrics_process_response_feature_search(a,b,c,d,e,f,g,h,i,'SearchFeatureCoremetrics7',true,'SearchFeature');
}
}
function scpz1_zp(a,b,c,d,e,f,g,h,i)
{
coremetrics_process_response_feature_search(a,b,c,d,e,f,g,h,i,'SubcatFeatCoremetrics7',true,'SubcatFeat');
}
function coremetrics_process_response_feature_search(a_product_ids,            // Array of recommended product IDs
zone,                  // Zone ID specified in the request (as entered on zone edit screen)
symbolic,              // Target type:
//      _SP_  Specified Product ID
//      _SC_  Specified Category ID
//      _RVP_ Most Recently Viewed Product
//      _RPP_ Most Recently Purchased Product
//      _NR_  No Recommendations
//      _LCP_ Last Carted Product
//      _MPC_ Visitor's Most Popular Category
//      _SS_  Specified Search Term
target_id,             // Target ID recommendations are based on
category,              // Category of Target ID - EPR Category ID if the Target ID is a product
rec_attributes,        // 2 dimensional array of attributes for each recommendation
target_attributes,     // Array of attribute for the target
target_header_txt,     // Header text (as entered on recommendation plan edit screen)
ab_test_id,            // String containing AB Test Name, a semicolon, AB test ID for the test element requested
//      Null if no AB Test
//
// The final 2 parameters are not standard parameters passed into zone population function
// They ared added via the function calls at bottom of this file
div_id,                //      div id - must match div id in cm_io_demo.html
b_display_target,      //     indicates whether target will be displayed
default_div_id        // The div that is displayed if no records are displayed
)
{
try{
if (symbolic !== '_NR_')
{
var number_of_records      = a_product_ids.length;
var number_of_valid_products = 0;
// Loop through the entire set of data to determine if the data is valid
var list_of_products = "";
for (var record_number=0; record_number < number_of_records; record_number++)
{
var product_name     = rec_attributes[record_number][0] ? rec_attributes[record_number][0] : ''; //attr_1
if (product_name.length == 0 ){
continue;
}
else{
number_of_valid_products++;
list_of_products += '&product_id=';
list_of_products += a_product_ids[record_number];
}
}
var rand_no = Math.random();
rand_no = rand_no * 10000000;
if (zone == 'scpz1'){
var url = "/includes/product_list_thumbnail.jsp?t="+rand_no+list_of_products+"&subCategoryId="+target_id; // The server-side script
} else if (zone == 'spz1'){
if (target_id == '_TS_'){
var url = "/includes/product_list_search.jsp?t="+rand_no+list_of_products+"&thumbnailType=SEARCH_NO_RESULTS"; // The server-side script
} else {
var url = "/includes/product_list_search.jsp?t="+rand_no+list_of_products; // The server-side script
}
}
new Ajax(url, {method:'get',
evalScripts: true,
onComplete:function(txt, xml) {
if (document.getElementById(div_id) != null && document.getElementById(default_div_id) != null ){
document.getElementById(div_id).innerHTML = txt;
document.getElementById(default_div_id).style.display = "none"; //to hide it
if (zone == 'scpz1'){
cmCreateConversionEventTag("A Group","1","Browse Page","0");
} else if (zone == 'spz1'){
cmCreateConversionEventTag("A Group","1","Search","0");
}
}
}}).request();
}
} catch(err){
error_encountered = true;
}
}
function headerNavDisplayRecentlyViewedMenu() {
var recentlyViewedMenu = document.getElementById("RecentlyViewedMenu");
recentlyViewedMenu.style.visibility = "visible";
recentlyViewedMenu.style.zIndex = "505";
document.getElementById("HeaderNav1Line3").style.width="225px";
if (document.getElementById("wnHeaderRecentlyViewed") != null ){
document.getElementById("wnHeaderRecentlyViewed").style.width="180px";
}
}
function headerNavHideRecentlyViewedMenu() {
var recentlyViewedMenu = document.getElementById("RecentlyViewedMenu");
recentlyViewedMenu.style.visibility = "hidden";
recentlyViewedMenu.style.zIndex = "-1";
document.getElementById("HeaderNav1Line3").style.width="0px";
if (document.getElementById("wnHeaderRecentlyViewed") != null){
document.getElementById("wnHeaderRecentlyViewed").style.width="0px";
}
}
var isInMiniCart = false;
function headerNavDisplayMiniCartViewedMenu(hostURL,miniCartCookieName) {
isInMiniCart = true;
var itemCountElement = document.getElementsByName("orderItemCount");
var itemCountFromMiniCart = "0";
if (itemCountElement != null && itemCountElement.length > 0) {
itemCountFromMiniCart = itemCountElement[0].value;
}
var itemCountFromCookie = getCookie(miniCartCookieName);
if (parseInt(itemCountFromCookie) != parseInt(itemCountFromMiniCart)) {
var rand_no = Math.random();
rand_no = rand_no * 10000000;
var url = hostURL + '/includes/cart_viewed_items.jsp?t=' + rand_no;
new Ajax(url, {method:'get',
onComplete:function(txt, xml){
var cartViewedMenu = document.getElementById("CartViewedMenu");
if(cartViewedMenu != null){
cartViewedMenu.innerHTML = txt;
cartViewedMenu.style.visibility = "visible";
cartViewedMenu.style.zIndex = "505";
setTimeout("activateMiniCartScroller()", 500);
}
}}).request();
} else {
var cartViewedMenu = document.getElementById("CartViewedMenu");
if (cartViewedMenu != null) {
cartViewedMenu.style.visibility = "visible";
cartViewedMenu.style.zIndex = "505";
document.getElementById("HeaderNav1Line4").style.width="260px";
}
}
}
function activateMiniCartScroller() {
if (typeof init_dw_ScrollHeaderMiniCartViewed == 'function') {
init_dw_ScrollHeaderMiniCartViewed();
}
}
function headerNavHideMiniCartOnMouseOut(miniCartCookieNm) {
isInMiniCart = false;
var itemCountCookie = getCookie(miniCartCookieNm);
var itemCount = (itemCountCookie == null || itemCountCookie == '') ? "0" : itemCountCookie;
if (parseInt(itemCount) > 0) {
headerNavHideMiniCartViewedMenu();
}
else {
setTimeout("headerNavHideMiniCartViewedMenu()",300);
}
}
function headerNavHideMiniCartViewedMenu() {
var cartViewedMenu = document.getElementById("CartViewedMenu");
if (cartViewedMenu != null & !isInMiniCart) {
cartViewedMenu.style.visibility = "hidden";
cartViewedMenu.style.zIndex = "-1";
document.getElementById("HeaderNav1Line4").style.width="255px";
}
}
/*!
* jQuery UI 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI
*/
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.6",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
* jQuery UI Widget 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Widget
*/
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*
* jQuery UI Position 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Position
*/
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+parseInt(c.curCSS(this,"marginRight",true))||0,w=m+q+parseInt(c.curCSS(this,"marginBottom",true))||0,i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=m/2;
i.left=parseInt(i.left);i.top=parseInt(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=d>0?
b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
;/*
* jQuery UI Dialog 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Dialog
*
* Depends:
*	jquery.ui.core.js
*	jquery.ui.widget.js
*  jquery.ui.button.js
*	jquery.ui.draggable.js
*	jquery.ui.mouse.js
*	jquery.ui.position.js
*	jquery.ui.resizable.js
*/
(function(c,j){var k={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},l={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",of:window,collision:"fit",using:function(a){var b=c(this).css(a).offset().top;
b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||"&#160;",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",
-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role",
"button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=
b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");a.uiDialog.remove();a.originalTitle&&
a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==b.uiDialog[0])d=Math.max(d,c(this).css("z-index"))});
c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);
d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();
a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;f=c('<button type="button"></button>').attr(h,true).unbind("click").click(function(){h.click.apply(b.element[0],
arguments)}).appendTo(g);c.fn.button&&f.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,
h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,originalSize:f.originalSize,position:f.position,size:f.size}}a=a===j?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";
d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",
g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,
a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(a);e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);if(g in k)e=true;if(g in l)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);
break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");
g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||"&#160;"));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=this.options,b,d;this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,
height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.6",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});
c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()<c.ui.dialog.overlay.maxZ)return false})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&
d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){this.oldInstances.push(this.instances.splice(c.inArray(a,this.instances),1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");
a.remove();var b=0;c.each(this.instances,function(){b=Math.max(b,this.css("z-index"))});this.maxZ=b},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollWidth,
document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,function(){a=a.add(this)});a.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
;/*
* jQuery UI Effects 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Effects/
*/
jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:f.fx.speeds[b]||f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor",
"borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,
0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],
lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,d){if(f.isFunction(b)){d=
b;b=null}return this.each(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("className");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("className",v);e.animate(u(h,r),a,b,function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)})})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?
f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,
[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.6",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=
0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,
{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=
k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=
k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,
a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*
(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,
a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,
a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+
d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==
j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*
(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
;/*
* jQuery UI Effects Explode 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Effects/Explode
*
* Depends:
*	jquery.effects.core.js
*/
(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=
0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+
e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery);
;/*
* jQuery UI Effects Slide 1.8.6
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Effects/Slide
*
* Depends:
*	jquery.effects.core.js
*/
(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","left"],e=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(e=="show")a.css(f,b=="pos"?-g:g);var i={};i[f]=(e=="show"?b=="pos"?
"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
;var closedialog;
//offer has not been made or it has expired
$.fx.speeds._default = 1500;
$(function() {
$( "#dialog" ).dialog({
zIndex:1000,
width:395,
draggable:false,
resizable:false,
autoOpen: false,
title: 'Thompson Cigar: Special Offer',
modal: true,
open: function(){
closedialog = 1;$(document).bind('click', overlayclickclose);
},
focus: function(){
closedialog = 0;
},
close: function(event, ui) {
}
});
var sbvalue =getCookie('FLYOVER_DISPLAYED');
if (sbvalue == 'Y') {
} else {
$('#dialog').dialog('open');
setCookie('FLYOVER_DISPLAYED','Y');
}
$('#dialog').click(function() {
closedialog = 0;
});
});
function overlayclickclose() {
if (closedialog) {
$('#dialog').dialog('close');
}
//set to one because click on dialog box sets to zero
closedialog = 1;
}
function openFlyoverWindow(mypage2,myname2,w2,h2,scroll2,pos2){
var win2=null;
if (h2 == "none")
{
h2 = (screen.height * 90) / 100;
}
if (w2 == "none")
{
w2 = (screen.width * 90) / 100;
}
// default to popup in the center of the screen
var LeftPos = (screen.width-w2) / 2;
var TopPos = (screen.height-h2) / 2;
if (pos2 == 'bottom'){
LeftPos = screen.width - 1;
TopPos = screen.height - 1;
}
var settings2='width='+w2+',height='+h2+',top='+TopPos+',left='+LeftPos+',resizable=1,scrollbars='+scroll2;
win2=window.open(mypage2,myname2,settings2);
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
if (is_chrome) {
window.blur();
window.focus();
} else {
win2.blur();
window.focus();
}
}
function showFlyoverWindow(w2,h2){
var LeftPos = (screen.width-w2) / 2;
var TopPos = (screen.height-h2) / 2;
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
if (window.opener != null){
try{
if (window.opener.location.href != null){
window.close();
}
} catch (e) {
window.moveTo(LeftPos,TopPos);
window.resizeTo(w2,h2);
window.focus();
return true;
}
} else {
window.moveTo(LeftPos,TopPos);
window.resizeTo(w2,h2);
window.focus();
return true;
}
return false;
}
function validateZIP(field) {
var valid = "0123456789-";
var hyphencount = 0;
if (field.length!=5 && field.length!=10) {
alert("Please enter your 5 digit or 5 digit+4 zip code.");
return false;
}
for (var i=0; i < field.length; i++) {
temp = "" + field.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
alert("Invalid characters in your zip code.  Please try again.");
return false;
}
if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
return false;
}
}
return true;
}
function calculateShippingAndTaxes(is_editable,target_content_name,managed_content_name,selected_carrier_code){
var carrierCode = "";
var zipCode = "";
var recalculateOrder = true;
var isMobile = "N";
if (document.getElementById('carrierCode') != null){
carrierCode = document.getElementById('carrierCode').value;
}
if (document.getElementById('isMobile') != null){
isMobile = document.getElementById('isMobile').value;
}
if (document.getElementById('zipCode') != null &&
validateZIP(document.getElementById('zipCode').value)){
zipCode = document.getElementById('zipCode').value;
} else {
recalculateOrder = false;
if (selected_carrier_code.length != 0 ){
document.getElementById("carrierCode").value = selected_carrier_code;
}
}
var url = "/checkout/calculate_order_totals.cmd?IS_EDITABLE="+is_editable+"&zipCode="+zipCode+"&carrierCode="+carrierCode+"&TARGET_CONTENT_NAME="+target_content_name+"&MANAGED_CONTENT_NAME="+managed_content_name+"&isEditable="+is_editable;
if (recalculateOrder){
showContentArea('RecalculatingOrderTotals');
new Ajax(url, {
method:'get',
evalScripts: false,
onComplete:function(txt, xml) {
hideContentArea('RecalculatingOrderTotals');
document.getElementById('BasketTotals').innerHTML = txt;
}
}).request();
}
}
function updateShippingAddress(index,is_editable,target_content_name,managed_content_name) {
//disable all buttons
$("#PaymentShippingHandlingMethod").find("input, select, button, textarea").attr("disabled",true);
$("#ShippingAddressBookContainer").find("input, select, button, textarea").attr("disabled",true);
var url = "/checkout/update_shipping_address.cmd?selectedAddressIndex="
+ index;
new Ajax(url, {
method : 'get',
evalScripts : true,
onComplete : function(txt, xml) {
calculateShippingAndTaxes(is_editable,target_content_name,managed_content_name);
document.getElementById('PaymentShippingHandlingMethod').innerHTML = txt;
showGiftMessageArea();
$("#PaymentShippingHandlingMethod").find("input, select, button, textarea").removeAttr("disabled");
$("#ShippingAddressBookContainer").find("input, select, button, textarea").removeAttr("disabled");
}
}).request();
}
function showContentArea(elementId) {
tca = document.getElementById(elementId);
tca.style.visibility = "visible";
tca.style.display = "block";
tca.style.zIndex = "200";
}
function hideContentArea(elementId) {
tca = document.getElementById(elementId);
tca.style.visibility = "hidden";
tca.style.display = "none";
tca.style.zIndex = "-1";
}
function toggleContentArea(elementId,isShow) {
if (isShow){
showContentArea(elementId);
} else {
hideContentArea(elementId);
}
}
function populateShippingAddressWithBillingAddressMobile(){
if (document.getElementById("firstName") != null){
document.getElementById("firstNameShip").value=document.getElementById("firstName").value;
}
if (document.getElementById("lastName") != null){
document.getElementById("lastNameShip").value=document.getElementById("lastName").value;
}
if (document.getElementById("address1") != null){
document.getElementById("address1Ship").value=document.getElementById("address1").value;
}
if (document.getElementById("address2") != null){
document.getElementById("address2Ship").value=document.getElementById("address2").value;
}
if (document.getElementById("city") != null){
document.getElementById("cityShip").value=document.getElementById("city").value;
}
if (document.getElementById("zipCode") != null){
document.getElementById("zipCodeShip").value=document.getElementById("zipCode").value;
}
if (document.getElementById("phone") != null){
document.getElementById("phoneShip").value=document.getElementById("phone").value;
}
if (document.getElementById("state") != null){
document.getElementById("stateShip").value=document.getElementById("state").value;
}
}
function populateShippingAddressWithBillingAddress(){
if (document.getElementById("firstName") != null){
document.getElementById("firstNameShip").value=document.getElementById("firstName").value;
}
if (document.getElementById("lastName") != null){
document.getElementById("lastNameShip").value=document.getElementById("lastName").value;
}
if (document.getElementById("var_add1") != null){
document.getElementById("address1Ship").value=document.getElementById("var_add1").value;
}
if (document.getElementById("var_add2") != null){
document.getElementById("address2Ship").value=document.getElementById("var_add2").value;
}
if (document.getElementById("var_city") != null){
document.getElementById("cityShip").value=document.getElementById("var_city").value;
}
if (document.getElementById("var_zip") != null){
document.getElementById("zipCodeShip").value=document.getElementById("var_zip").value;
}
if (document.getElementById("phone") != null){
document.getElementById("phoneShip").value=document.getElementById("phone").value;
}
if (document.getElementById("var_state") != null){
document.getElementById("stateShip").value=document.getElementById("var_state").value;
}
}
function showGiftMessageArea()
{
var orderIndex = document.getElementById("orderIndexes").value;
if(document.getElementById("chkIsGift:"+orderIndex).checked == true){
document.getElementById("GiftMessageContentArea").style.display = "block";
document.getElementById("GiftMessagesHeaderRight").style.display = "block";
document.getElementById("GiftMessageInstructions").style.display = "block";
}
else {
document.getElementById("GiftMessageContentArea").style.display = "none";
document.getElementById("GiftMessagesHeaderRight").style.display = "none";
document.getElementById("GiftMessageInstructions").style.display = "none";
}
}
function checkPromotionCode() {
if (document.getElementById("promoCode") != null){
var str = document.getElementById("promoCode").value;
str = str.replace(/ /g,'');
if(str == "EnterPromoCode") {
document.getElementById("promoCode").value = "";
}
}
}
function checkGiftCard() {
if (document.getElementById("gcRedemptionCode") != null){
var str = document.getElementById("gcRedemptionCode").value;
str = str.replace(/ /g,'');
if(str == "EnterGiftCard") {
document.getElementById("gcRedemptionCode").value = "";
}
}
}
buildHeaderMenu = function(page_name) {
var queryUrl = '/header/header.json';
$.getJSON(queryUrl,function(data){
var sectionsList = data.menu.sections;
$.each(
sectionsList,
function( intIndex, objValue ){
if ( !jQuery.isEmptyObject(sectionsList[intIndex].section)){
if (intIndex != 0){
$("#NavBarTop").append('<li class="NavBarDivider"></li>');
}
$("#NavBarTop").append(buildSection(sectionsList[intIndex].section,page_name));
}
}
);
});
}
buildSection = function(individualSection,page_name) {
var html = '<li class="NavBarDrop">';
var category_name = individualSection.title;
html += buildHyperLink(individualSection,page_name,category_name);
html += '<div>';
html += '<ul>';
var categoryList = individualSection.categories;
if (categoryList instanceof  Array){
$.each(
categoryList,
function( intIndex, objValue ){
if ( !jQuery.isEmptyObject(categoryList[intIndex].category)){
html += '<li>';
html += buildHyperLink(categoryList[intIndex].category,page_name,category_name);
html += '</li>';
}
}
);
}
html += '</ul>';
html += '</div>';
html += '</li>';
return html;
}
buildHyperLink = function(object,page_name,category_name) {
var url = object.url;
var section_name=  object.name;
var icon_name = object.icon_attachment;
var html = '<a href="' + url + '" ';
html += 'title="' + section_name + '" ';
html += 'onclick="" ';
if (page_name != ""){
html += 'manual_cm_re="' + page_name + '-_-Global-Header-_-'+ category_name+'" ';
}
html +='>';
if (icon_name === undefined){
} else {
if (icon_name != ""){
html += ' <img src="' + icon_name + '"> ';
}
}
html += section_name;
if (icon_name === undefined){
} else {
if (icon_name != ""){
html += ' <img src="' + icon_name + '"> ';
}
}
html += '</a>';
return html;
}
buildCacheImage = function() {
$("#NavBarTop").append('<img src="/servlets/ContentDeliveryNetworkCacheServlet" width="0" height="0" border="0" alt="" />');
}

