Dotclear

Changeset 703:1a44cbb3ca1a


Ignore:
Timestamp:
09/05/11 21:22:12 (14 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
default
Message:

Restore non minified javascript files. Theses files will be minified at build time.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • admin/js/ie7/IE7.js

    r175 r703  
    1 /* IE7/IE8.js - copyright 2004-2008, Dean Edwards */ 
    2 (function(){IE7={toString:function(){return"IE7 version 2.0 (beta2)"}};var k=IE7.appVersion=navigator.appVersion.match(/MSIE (\d\.\d)/)[1];if(/ie7_off/.test(top.location.search)||k<5)return;var Q=bG();var C=document.compatMode!="CSS1Compat";var bm=document.documentElement,v,s;var bA="!";var G=":link{ie7-link:link}:visited{ie7-link:visited}";var cj=/^[\w\.]+[^:]*$/;function W(a,b){if(cj.test(a))a=(b||"")+a;return a};function bn(a,b){a=W(a,b);return a.slice(0,a.lastIndexOf("/")+1)};var bB=document.scripts[document.scripts.length-1];var ck=bn(bB.src);try{var H=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}var X={};function cl(a,b){try{a=W(a,b);if(!X[a]){H.open("GET",a,false);H.send();if(H.status==0||H.status==200){X[a]=H.responseText}}}catch(e){}finally{return X[a]||""}};if(k<5.5){undefined=Q();bA="HTML:!";var cm=/(g|gi)$/;var cn=String.prototype.replace;String.prototype.replace=function(a,b){if(typeof b=="function"){if(a&&a.constructor==RegExp){var c=a;var d=c.global;if(d==null)d=cm.test(c);if(d)c=new RegExp(c.source)}else{c=new RegExp(bb(a))}var f,g=this,h="";while(g&&(f=c.exec(g))){h+=g.slice(0,f.index)+b.apply(this,f);g=g.slice(f.index+f[0].length);if(!d)break}return h+g}return cn.apply(this,arguments)};Array.prototype.pop=function(){if(this.length){var a=this[this.length-1];this.length--;return a}return undefined};Array.prototype.push=function(){for(var a=0;a<arguments.length;a++){this[this.length]=arguments[a]}return this.length};var co=this;Function.prototype.apply=function(a,b){if(a===undefined)a=co;else if(a==null)a=window;else if(typeof a=="string")a=new String(a);else if(typeof a=="number")a=new Number(a);else if(typeof a=="boolean")a=new Boolean(a);if(arguments.length==1)b=[];else if(b[0]&&b[0].writeln)b[0]=b[0].documentElement.document||b[0];var c="#ie7_apply",d;a[c]=this;switch(b.length){case 0:d=a[c]();break;case 1:d=a[c](b[0]);break;case 2:d=a[c](b[0],b[1]);break;case 3:d=a[c](b[0],b[1],b[2]);break;case 4:d=a[c](b[0],b[1],b[2],b[3]);break;case 5:d=a[c](b[0],b[1],b[2],b[3],b[4]);break;default:var f=[],g=b.length-1;do f[g]="a["+g+"]";while(g--);eval("r=o[$]("+f+")")}if(typeof a.valueOf=="function"){delete a[c]}else{a[c]=undefined;if(d&&d.writeln)d=d.documentElement.document||d}return d};Function.prototype.call=function(a){return this.apply(a,bC.apply(arguments,[1]))};G+="address,blockquote,body,dd,div,dt,fieldset,form,"+"frame,frameset,h1,h2,h3,h4,h5,h6,iframe,noframes,object,p,"+"hr,applet,center,dir,menu,pre,dl,li,ol,ul{display:block}"}var bC=Array.prototype.slice;var cJ=/%([1-9])/g;var cp=/^\s\s*/;var cq=/\s\s*$/;var cr=/([\/()[\]{}|*+-.,^$?\\])/g;var bD=/\bbase\b/;var bE=["constructor","toString"];var Y;function z(){};z.extend=function(a,b){Y=true;var c=new this;ba(c,a);Y=false;var d=c.constructor;function f(){if(!Y)d.apply(this,arguments)};c.constructor=f;f.extend=arguments.callee;ba(f,b);f.prototype=c;return f};z.prototype.extend=function(a){return ba(this,a)};var bo="#";var Z="~";var cs=/\\./g;var ct=/\(\?[:=!]|\[[^\]]+\]/g;var cu=/\(/g;var D=z.extend({constructor:function(a){this[Z]=[];this.merge(a)},exec:function(g){var h=this,p=this[Z];return String(g).replace(new RegExp(this,this.ignoreCase?"gi":"g"),function(){var a,b=1,c=0;while((a=h[bo+p[c++]])){var d=b+a.length+1;if(arguments[b]){var f=a.replacement;switch(typeof f){case"function":return f.apply(h,bC.call(arguments,b,d));case"number":return arguments[b+f];default:return f}}b=d}})},add:function(a,b){if(a instanceof RegExp){a=a.source}if(!this[bo+a])this[Z].push(String(a));this[bo+a]=new D.Item(a,b)},merge:function(a){for(var b in a)this.add(b,a[b])},toString:function(){return"("+this[Z].join(")|(")+")"}},{IGNORE:"$0",Item:z.extend({constructor:function(a,b){a=a instanceof RegExp?a.source:String(a);if(typeof b=="number")b=String(b);else if(b==null)b="";if(typeof b=="string"&&/\$(\d+)/.test(b)){if(/^\$\d+$/.test(b)){b=parseInt(b.slice(1))}else{var c=/'/.test(b.replace(/\\./g,""))?'"':"'";b=b.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\$(\d+)/g,c+"+(arguments[$1]||"+c+c+")+"+c);b=new Function("return "+c+b.replace(/(['"])\1\+(.*)\+\1\1$/,"$1")+c)}}this.length=D.count(a);this.replacement=b;this.toString=bG(a)}}),count:function(a){a=String(a).replace(cs,"").replace(ct,"");return I(a,cu).length}});function ba(a,b){if(a&&b){var c=(typeof b=="function"?Function:Object).prototype;var d=bE.length,f;if(Y)while(f=bE[--d]){var g=b[f];if(g!=c[f]){if(bD.test(g)){bF(a,f,g)}else{a[f]=g}}}for(f in b)if(c[f]===undefined){var g=b[f];if(a[f]&&typeof g=="function"&&bD.test(g)){bF(a,f,g)}else{a[f]=g}}}return a};function bF(c,d,f){var g=c[d];c[d]=function(){var a=this.base;this.base=g;var b=f.apply(this,arguments);this.base=a;return b}};function cv(a,b){if(!b)b=a;var c={};for(var d in a)c[d]=b[d];return c};function i(c){var d=arguments;var f=new RegExp("%([1-"+arguments.length+"])","g");return String(c).replace(f,function(a,b){return b<d.length?d[b]:a})};function I(a,b){return String(a).match(b)||[]};function bb(a){return String(a).replace(cr,"\\$1")};function cK(a){return String(a).replace(cp,"").replace(cq,"")};function bG(a){return function(){return a}};var bH=D.extend({ignoreCase:true});var cw=/\x01(\d+)/g,cx=/'/g,cy=/^\x01/,cz=/\\([\da-fA-F]{1,4})/g;var bp=[];var cA=new bH({"<!\\-\\-|\\-\\->":"","\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/":"","@(namespace|import)[^;\\n]+[;\\n]":"","'(\\\\.|[^'\\\\])*'":bJ,'"(\\\\.|[^"\\\\])*"':bJ,"\\s+":" "});function cB(a){return cA.exec(a)};function bI(c){return c.replace(cw,function(a,b){return bp[b-1]})};function bJ(c){return"\x01"+bp.push(c.replace(cz,function(a,b){return eval("'\\u"+"0000".slice(b.length)+b+"'")}).slice(1,-1).replace(cx,"\\'"))};function cC(a){return cy.test(a)?bp[a.slice(1)-1]:a};var cD=new D({Width:"Height",width:"height",Left:"Top",left:"top",Right:"Bottom",right:"bottom",onX:"onY"});function A(a){return cD.exec(a)};var bK=[];function bq(a){cF(a);w(window,"onresize",a)};function w(a,b,c){a.attachEvent(b,c);bK.push(arguments)};function cE(a,b,c){try{a.detachEvent(b,c)}catch(ignore){}};w(window,"onunload",function(){var a;while(a=bK.pop()){cE(a[0],a[1],a[2])}});function R(a,b,c){if(!a.elements)a.elements={};if(c)a.elements[b.uniqueID]=b;else delete a.elements[b.uniqueID];return c};w(window,"onbeforeprint",function(){if(!IE7.CSS.print)new bw("print");IE7.CSS.print.recalc()});var bL=/^\d+(px)?$/i;var J=/^\d+%$/;var E=function(a,b){if(bL.test(b))return parseInt(b);var c=a.style.left;var d=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b||0;b=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return b};var br="ie7-";var bM=z.extend({constructor:function(){this.fixes=[];this.recalcs=[]},init:Q});var bs=[];function cF(a){bs.push(a)};IE7.recalc=function(){IE7.HTML.recalc();IE7.CSS.recalc();for(var a=0;a<bs.length;a++)bs[a]()};function bc(a){return a.currentStyle["ie7-position"]=="fixed"};function bt(a,b){return a.currentStyle[br+b]||a.currentStyle[b]};function K(a,b,c){if(a.currentStyle[br+b]==null){a.runtimeStyle[br+b]=a.currentStyle[b]}a.runtimeStyle[b]=c};function bN(a){var b=document.createElement(a||"object");b.style.cssText="position:absolute;padding:0;display:block;border:none;clip:rect(0 0 0 0);left:-9999";b.ie7_anon=true;return b};function B(a,b,c){if(!be[a]){F=[];var d="";var f=T.escape(a).split(",");for(var g=0;g<f.length;g++){o=m=x=0;S=f.length>1?2:0;var h=T.exec(f[g])||"if(0){";if(o){h+=i("if(e%1.nodeName!='!'){",m)}var p=S>1?bV:"";h+=i(p+bW,m);h+=Array(I(h,/\{/g).length+1).join("}");d+=h}eval(i(bX,F)+T.unescape(d)+"return s?null:r}");be[a]=_h}return be[a](b||document,c)};var bd=k<6;var bO=/^(href|src)$/;var bu={"class":"className","for":"htmlFor"};IE7._5=1;IE7._e=function(a,b){var c=a.all[b]||null;if(!c||c.id==b)return c;for(var d=0;d<c.length;d++){if(c[d].id==b)return c[d]}return null};IE7._f=function(a,b){if(b=="src"&&a.pngSrc)return a.pngSrc;var c=bd?(a.attributes[b]||a.attributes[bu[b.toLowerCase()]]):a.getAttributeNode(b);if(c&&(c.specified||b=="value")){if(bO.test(b)){return a.getAttribute(b,2)}else if(b=="class"){return a.className.replace(/\sie7_\w+/g,"")}else if(b=="style"){return a.style.cssText}else{return c.nodeValue}}return null};var bP="colSpan,rowSpan,vAlign,dateTime,accessKey,tabIndex,encType,maxLength,readOnly,longDesc";ba(bu,cv(bP.toLowerCase().split(","),bP.split(",")));IE7._a=function(a){while(a&&(a=a.nextSibling)&&(a.nodeType!=1||a.nodeName=="!"))continue;return a};IE7._b=function(a){while(a&&(a=a.previousSibling)&&(a.nodeType!=1||a.nodeName=="!"))continue;return a};var cG=/([\s>+~,]|[^(]\+|^)([#.:\[])/g,cH=/(^|,)([^\s>+~])/g,cI=/\s*([\s>+~(),]|^|$)\s*/g,bQ=/\s\*\s/g;var bR=D.extend({constructor:function(a){this.base(a);this.sorter=new D;this.sorter.add(/:not\([^)]*\)/,D.IGNORE);this.sorter.add(/([ >](\*|[\w-]+))([^: >+~]*)(:\w+-child(\([^)]+\))?)([^: >+~]*)/,"$1$3$6$4")},ignoreCase:true,escape:function(a){return this.optimise(this.format(a))},format:function(a){return a.replace(cI,"$1").replace(cH,"$1 $2").replace(cG,"$1*$2")},optimise:function(a){return this.sorter.exec(a.replace(bQ,">* "))},unescape:function(a){return bI(a)}});var bS={"":"%1!=null","=":"%1=='%2'","~=":/(^| )%1( |$)/,"|=":/^%1(-|$)/,"^=":/^%1/,"$=":/%1$/,"*=":/%1/};var bT={"first-child":"!IE7._b(e%1)","link":"e%1.currentStyle['ie7-link']=='link'","visited":"e%1.currentStyle['ie7-link']=='visited'"};var bv="var p%2=0,i%2,e%2,n%2=e%1.";var bU="e%1.sourceIndex";var bV="var g="+bU+";if(!p[g]){p[g]=1;";var bW="r[r.length]=e%1;if(s)return e%1;";var bX="var _h=function(e0,s){IE7._5++;var r=[],p={},reg=[%1],d=document;";var F;var m;var o;var x;var S;var be={};var T=new bR({" (\\*|[\\w-]+)#([\\w-]+)":function(a,b,c){o=false;var d="var e%2=IE7._e(d,'%4');if(e%2&&";if(b!="*")d+="e%2.nodeName=='%3'&&";d+="(e%1==d||e%1.contains(e%2))){";if(x)d+=i("i%1=n%1.length;",x);return i(d,m++,m,b.toUpperCase(),c)}," (\\*|[\\w-]+)":function(a,b){S++;o=b=="*";var c=bv;c+=(o&&bd)?"all":"getElementsByTagName('%3')";c+=";for(i%2=0;(e%2=n%2[i%2]);i%2++){";return i(c,m++,x=m,b.toUpperCase())},">(\\*|[\\w-]+)":function(a,b){var c=x;o=b=="*";var d=bv;d+=c?"children":"childNodes";if(!o&&c)d+=".tags('%3')";d+=";for(i%2=0;(e%2=n%2[i%2]);i%2++){";if(o){d+="if(e%2.nodeType==1){";o=bd}else{if(!c)d+="if(e%2.nodeName=='%3'){"}return i(d,m++,x=m,b.toUpperCase())},"\\+(\\*|[\\w-]+)":function(a,b){var c="";if(o)c+="if(e%1.nodeName!='!'){";o=false;c+="e%1=IE7._a(e%1);if(e%1";if(b!="*")c+="&&e%1.nodeName=='%2'";c+="){";return i(c,m,b.toUpperCase())},"~(\\*|[\\w-]+)":function(a,b){var c="";if(o)c+="if(e%1.nodeName!='!'){";o=false;S=2;c+="while(e%1=e%1.nextSibling){if(e%1.ie7_adjacent==IE7._5)break;if(";if(b=="*"){c+="e%1.nodeType==1";if(bd)c+="&&e%1.nodeName!='!'"}else c+="e%1.nodeName=='%2'";c+="){e%1.ie7_adjacent=IE7._5;";return i(c,m,b.toUpperCase())},"#([\\w-]+)":function(a,b){o=false;var c="if(e%1.id=='%2'){";if(x)c+=i("i%1=n%1.length;",x);return i(c,m,b)},"\\.([\\w-]+)":function(a,b){o=false;F.push(new RegExp("(^|\\s)"+bb(b)+"(\\s|$)"));return i("if(e%1.className&&reg[%2].test(e%1.className)){",m,F.length-1)},"\\[([\\w-]+)\\s*([^=]?=)?\\s*([^\\]]*)\\]":function(a,b,c,d){var f=bu[b]||b;if(c){var g="e%1.getAttribute('%2',2)";if(!bO.test(b)){g="e%1.%3||"+g}b=i("("+g+")",m,b,f)}else{b=i("IE7._f(e%1,'%2')",m,b)}var h=bS[c||""]||"0";if(h&&h.source){F.push(new RegExp(i(h.source,bb(T.unescape(d)))));h="reg[%2].test(%1)";d=F.length-1}return"if("+i(h,b,d)+"){"},":+([\\w-]+)(\\(([^)]+)\\))?":function(a,b,c,d){b=bT[b];return"if("+(b?i(b,m,d||""):"0")+"){"}});var bY=/a(#[\w-]+)?(\.[\w-]+)?:(hover|active)/i;var bZ=/\s*\{\s*/,ca=/\s*\}\s*/,cb=/\s*\,\s*/;var cc=/(.*)(:first-(line|letter))/;var y=document.styleSheets;IE7.CSS=new(bM.extend({parser:new bH,screen:"",print:"",styles:[],rules:[],pseudoClasses:k<7?"first\\-child":"",dynamicPseudoClasses:{toString:function(){var a=[];for(var b in this)a.push(b);return a.join("|")}},init:function(){var a="^\x01$";var b="\\[class=?[^\\]]*\\]";var c=[];if(this.pseudoClasses)c.push(this.pseudoClasses);var d=this.dynamicPseudoClasses.toString();if(d)c.push(d);c=c.join("|");var f=k<7?["[>+~[(]|([:.])\\w+\\1"]:[b];if(c)f.push(":("+c+")");this.UNKNOWN=new RegExp(f.join("|")||a,"i");var g=k<7?["\\[[^\\]]+\\]|[^\\s(\\[]+\\s*[+~]"]:[b];var h=g.concat();if(c)h.push(":("+c+")");n.COMPLEX=new RegExp(h.join("|")||a,"ig");if(this.pseudoClasses)g.push(":("+this.pseudoClasses+")");L.COMPLEX=new RegExp(g.join("|")||a,"i");L.MATCH=new RegExp(d?"(.*):("+d+")(.*)":a,"i");this.createStyleSheet();this.refresh()},addEventHandler:function(){w.apply(null,arguments)},addFix:function(a,b){this.parser.add(a,b)},addRecalc:function(c,d,f,g){d=new RegExp("([{;\\s])"+c+"\\s*:\\s*"+d+"[^;}]*");var h=this.recalcs.length;if(g)g=c+":"+g;this.addFix(d,function(a,b){return(g?b+g:a)+";ie7-"+a.slice(1)+";ie7_recalc"+h+":1"});this.recalcs.push(arguments);return h},apply:function(){this.getInlineStyles();new bw("screen");this.trash()},createStyleSheet:function(){this.styleSheet=document.createStyleSheet();this.styleSheet.ie7=true;this.styleSheet.owningElement.ie7=true;this.styleSheet.cssText=G},getInlineStyles:function(){var a=document.getElementsByTagName("style"),b;for(var c=a.length-1;(b=a[c]);c--){if(!b.disabled&&!b.ie7){this.styles.push(b.innerHTML)}}},getText:function(a,b){try{var c=a.cssText}catch(e){c=""}if(H)c=cl(a.href,b)||c;return c},recalc:function(){this.screen.recalc();var a=/ie7_recalc\d+/g;var b=G.match(/[{,]/g).length;var c=b+(this.screen.cssText.match(/\{/g)||"").length;var d=this.styleSheet.rules,f;var g,h,p,t,q,j,u,l;for(q=b;q<c;q++){f=d[q];var r=f.style.cssText;if(f&&(g=r.match(a))){p=B(f.selectorText);if(p.length)for(j=0;j<g.length;j++){l=g[j];h=IE7.CSS.recalcs[l.slice(10)][2];for(u=0;(t=p[u]);u++){if(t.currentStyle[l])h(t,r)}}}}},refresh:function(){this.styleSheet.cssText=G+this.screen+this.print},trash:function(){for(var a=0;a<y.length;a++){if(!y[a].ie7){try{var b=y[a].cssText}catch(e){b=""}if(b)y[a].cssText=""}}}}));var bw=z.extend({constructor:function(a){this.media=a;this.load();IE7.CSS[a]=this;IE7.CSS.refresh()},createRule:function(a,b){if(IE7.CSS.UNKNOWN.test(a)){var c;if(bf&&(c=a.match(bf.MATCH))){return new bf(c[1],c[2],b)}else if(c=a.match(L.MATCH)){if(!bY.test(c[0])||L.COMPLEX.test(c[0])){return new L(a,c[1],c[2],c[3],b)}}else return new n(a,b)}return a+" {"+b+"}"},getText:function(){var h=[].concat(IE7.CSS.styles);var p=/@media\s+([^{]*)\{([^@]+\})\s*\}/gi;var t=/\ball\b|^$/i,q=/\bscreen\b/i,j=/\bprint\b/i;function u(a,b){l.value=b;return a.replace(p,l)};function l(a,b,c){b=r(b);switch(b){case"screen":case"print":if(b!=l.value)return"";case"all":return c}return""};function r(a){if(t.test(a))return"all";else if(q.test(a))return(j.test(a))?"all":"screen";else if(j.test(a))return"print"};var N=this;function O(a,b,c,d){var f="";if(!d){c=r(a.media);d=0}if(c=="all"||c==N.media){if(d<3){for(var g=0;g<a.imports.length;g++){f+=O(a.imports[g],bn(a.href,b),c,d+1)}}f+=cB(a.href?cg(a,b):h.pop()||"");f=u(f,N.media)}return f};var bl={};function cg(a,b){var c=W(a.href,b);if(bl[c])return"";bl[c]=(a.disabled)?"":ci(IE7.CSS.getText(a,b),bn(a.href,b));return bl[c]};var ch=/(url\s*\(\s*['"]?)([\w\.]+[^:\)]*['"]?\))/gi;function ci(a,b){return a.replace(ch,"$1"+b.slice(0,b.lastIndexOf("/")+1)+"$2")};for(var P=0;P<y.length;P++){if(!y[P].disabled&&!y[P].ie7){this.cssText+=O(y[P])}}},load:function(){this.cssText="";this.getText();this.parse();this.cssText=bI(this.cssText);X={}},parse:function(){this.cssText=IE7.CSS.parser.exec(this.cssText);var a=IE7.CSS.rules.length;var b=this.cssText.split(ca),c;var d,f,g,h;for(g=0;g<b.length;g++){c=b[g].split(bZ);d=c[0].split(cb);f=c[1];for(h=0;h<d.length;h++){d[h]=f?this.createRule(d[h],f):""}b[g]=d.join("\n")}this.cssText=b.join("\n");this.rules=IE7.CSS.rules.slice(a)},recalc:function(){var a,b;for(b=0;(a=this.rules[b]);b++)a.recalc()},toString:function(){return"@media "+this.media+"{"+this.cssText+"}"}});var bf;var n=IE7.Rule=z.extend({constructor:function(a,b){this.id=IE7.CSS.rules.length;this.className=n.PREFIX+this.id;a=a.match(cc)||a||"*";this.selector=a[1]||a;this.selectorText=this.parse(this.selector)+(a[2]||"");this.cssText=b;this.MATCH=new RegExp("\\s"+this.className+"(\\s|$)","g");IE7.CSS.rules.push(this);this.init()},init:Q,add:function(a){a.className+=" "+this.className},recalc:function(){var a=B(this.selector);for(var b=0;b<a.length;b++)this.add(a[b])},parse:function(a){var b=a.replace(n.CHILD," ").replace(n.COMPLEX,"");if(k<7)b=b.replace(n.MULTI,"");var c=I(b,n.TAGS).length-I(a,n.TAGS).length;var d=I(b,n.CLASSES).length-I(a,n.CLASSES).length+1;while(d>0&&n.CLASS.test(b)){b=b.replace(n.CLASS,"");d--}while(c>0&&n.TAG.test(b)){b=b.replace(n.TAG,"$1*");c--}b+="."+this.className;d=Math.min(d,2);c=Math.min(c,2);var f=-10*d-c;if(f>0){b=b+","+n.MAP[f]+" "+b}return b},remove:function(a){a.className=a.className.replace(this.MATCH,"$1")},toString:function(){return i("%1 {%2}",this.selectorText,this.cssText)}},{CHILD:/>/g,CLASS:/\.[\w-]+/,CLASSES:/[.:\[]/g,MULTI:/(\.[\w-]+)+/g,PREFIX:"ie7_class",TAG:/^\w+|([\s>+~])\w+/,TAGS:/^\w|[\s>+~]\w/g,MAP:{1:"html",2:"html body",10:".ie7_html",11:"html.ie7_html",12:"html.ie7_html body",20:".ie7_html .ie7_body",21:"html.ie7_html .ie7_body",22:"html.ie7_html body.ie7_body"}});var L=n.extend({constructor:function(a,b,c,d,f){this.attach=b||"*";this.dynamicPseudoClass=IE7.CSS.dynamicPseudoClasses[c];this.target=d;this.base(a,f)},recalc:function(){var a=B(this.attach),b;for(var c=0;b=a[c];c++){var d=this.target?B(this.target,b):[b];if(d.length)this.dynamicPseudoClass.apply(b,d,this)}}});var cd=z.extend({constructor:function(a,b){this.name=a;this.apply=b;this.instances={};IE7.CSS.dynamicPseudoClasses[a]=this},register:function(a){var b=a[2];a.id=b.id+a[0].uniqueID;if(!this.instances[a.id]){var c=a[1],d;for(d=0;d<c.length;d++)b.add(c[d]);this.instances[a.id]=a}},unregister:function(a){if(this.instances[a.id]){var b=a[2];var c=a[1],d;for(d=0;d<c.length;d++)b.remove(c[d]);delete this.instances[a.id]}}});if(k<7){var U=new cd("hover",function(a){var b=arguments;IE7.CSS.addEventHandler(a,k<5.5?"onmouseover":"onmouseenter",function(){U.register(b)});IE7.CSS.addEventHandler(a,k<5.5?"onmouseout":"onmouseleave",function(){U.unregister(b)})});w(document,"onmouseup",function(){var a=U.instances;for(var b in a)if(!a[b][0].contains(event.srcElement))U.unregister(a[b])})}IE7.CSS.addRecalc("[\\w-]+","inherit",function(c,d){var f=d.match(/[\w-]+\s*:\s*inherit/g);for(var g=0;g<f.length;g++){var h=f[g].replace(/ie7\-|\s*:\s*inherit/g,"").replace(/\-([a-z])/g,function(a,b){return b.toUpperCase()});c.runtimeStyle[h]=c.parentElement.currentStyle[h]}});IE7.HTML=new(bM.extend({fixed:{},init:Q,addFix:function(){this.fixes.push(arguments)},apply:function(){for(var a=0;a<this.fixes.length;a++){var b=B(this.fixes[a][0]);var c=this.fixes[a][1];for(var d=0;d<b.length;d++)c(b[d])}},addRecalc:function(){this.recalcs.push(arguments)},recalc:function(){for(var a=0;a<this.recalcs.length;a++){var b=B(this.recalcs[a][0]);var c=this.recalcs[a][1],d;var f=Math.pow(2,a);for(var g=0;(d=b[g]);g++){var h=d.uniqueID;if((this.fixed[h]&f)==0){d=c(d)||d;this.fixed[h]|=f}}}}}));if(k<7){document.createElement("abbr");IE7.HTML.addRecalc("label",function(a){if(!a.htmlFor){var b=B("input,textarea",a,true);if(b){w(a,"onclick",function(){b.click()})}}})}var V="[.\\d]";new function(_){var layout=IE7.Layout=this;G+="*{boxSizing:content-box}";IE7.hasLayout=k<5.5?function(a){return a.clientWidth}:function(a){return a.currentStyle.hasLayout};layout.boxSizing=function(a){if(!IE7.hasLayout(a)){a.style.height="0cm";if(a.currentStyle.verticalAlign=="auto")a.runtimeStyle.verticalAlign="top";collapseMargins(a)}};function collapseMargins(a){if(a!=s&&a.currentStyle.position!="absolute"){collapseMargin(a,"marginTop");collapseMargin(a,"marginBottom")}};function collapseMargin(a,b){if(!a.runtimeStyle[b]){var c=a.parentElement;if(c&&IE7.hasLayout(c)&&!IE7[b=="marginTop"?"_b":"_a"](a))return;var d=B(">*:"+(b=="marginTop"?"first":"last")+"-child",a,true);if(d&&d.currentStyle.styleFloat=="none"&&IE7.hasLayout(d)){collapseMargin(d,b);margin=_9(a,a.currentStyle[b]);childMargin=_9(d,d.currentStyle[b]);if(margin<0||childMargin<0){a.runtimeStyle[b]=margin+childMargin}else{a.runtimeStyle[b]=Math.max(childMargin,margin)}d.runtimeStyle[b]="0px"}}};function _9(a,b){return b=="auto"?0:E(a,b)};var UNIT=/^[.\d][\w%]*$/,AUTO=/^(auto|0cm)$/;var applyWidth,applyHeight;IE7.Layout.borderBox=function(a){applyWidth(a);applyHeight(a)};var fixWidth=function(g){applyWidth=function(a){if(!J.test(a.currentStyle.width))h(a);collapseMargins(a)};function h(a,b){if(!a.runtimeStyle.fixedWidth){if(!b)b=a.currentStyle.width;a.runtimeStyle.fixedWidth=(UNIT.test(b))?Math.max(0,q(a,b)):b;K(a,"width",a.runtimeStyle.fixedWidth)}};function p(a){if(!bc(a)){var b=a.offsetParent;while(b&&!IE7.hasLayout(b))b=b.offsetParent}return(b||s).clientWidth};function t(a,b){if(J.test(b))return parseInt(parseFloat(b)/100*p(a));return E(a,b)};var q=function(a,b){var c=a.currentStyle["box-sizing"]=="border-box";var d=0;if(C&&!c)d+=j(a)+u(a,"padding");else if(!C&&c)d-=j(a)+u(a,"padding");return t(a,b)+d};function j(a){return a.offsetWidth-a.clientWidth};function u(a,b){return t(a,a.currentStyle[b+"Left"])+t(a,a.currentStyle[b+"Right"])};G+="*{minWidth:none;maxWidth:none;min-width:none;max-width:none}";layout.minWidth=function(a){if(a.currentStyle["min-width"]!=null){a.style.minWidth=a.currentStyle["min-width"]}if(R(arguments.callee,a,a.currentStyle.minWidth!="none")){layout.boxSizing(a);h(a);l(a)}};eval("IE7.Layout.maxWidth="+String(layout.minWidth).replace(/min/g,"max"));function l(a){var b=a.getBoundingClientRect();var c=b.right-b.left;if(a.currentStyle.minWidth!="none"&&c<=q(a,a.currentStyle.minWidth)){a.runtimeStyle.width=a.currentStyle.minWidth}else if(a.currentStyle.maxWidth!="none"&&c>=q(a,a.currentStyle.maxWidth)){a.runtimeStyle.width=a.currentStyle.maxWidth}else{a.runtimeStyle.width=a.runtimeStyle.fixedWidth}};function r(a){if(R(r,a,/^(fixed|absolute)$/.test(a.currentStyle.position)&&bt(a,"left")!="auto"&&bt(a,"right")!="auto"&&AUTO.test(bt(a,"width")))){N(a);IE7.Layout.boxSizing(a)}};IE7.Layout.fixRight=r;function N(a){var b=t(a,a.runtimeStyle._c||a.currentStyle.left);var c=p(a)-t(a,a.currentStyle.right)-b-u(a,"margin");if(parseInt(a.runtimeStyle.width)==c)return;a.runtimeStyle.width="";if(bc(a)||g||a.offsetWidth<c){if(!C)c-=j(a)+u(a,"padding");if(c<0)c=0;a.runtimeStyle.fixedWidth=c;K(a,"width",c)}};var O=0;bq(function(){if(!s)return;var a,b=(O<s.clientWidth);O=s.clientWidth;var c=layout.minWidth.elements;for(a in c){var d=c[a];var f=(parseInt(d.runtimeStyle.width)==q(d,d.currentStyle.minWidth));if(b&&f)d.runtimeStyle.width="";if(b==f)l(d)}var c=layout.maxWidth.elements;for(a in c){var d=c[a];var f=(parseInt(d.runtimeStyle.width)==q(d,d.currentStyle.maxWidth));if(!b&&f)d.runtimeStyle.width="";if(b!=f)l(d)}for(a in r.elements)N(r.elements[a])});if(C){IE7.CSS.addRecalc("width",V,applyWidth)}if(k<7){IE7.CSS.addRecalc("min-width",V,layout.minWidth);IE7.CSS.addRecalc("max-width",V,layout.maxWidth);IE7.CSS.addRecalc("right",V,r)}};eval("var fixHeight="+A(fixWidth));fixWidth();fixHeight(true)};var bg=W("blank.gif",ck);var bh="DXImageTransform.Microsoft.AlphaImageLoader";var bx="progid:"+bh+"(src='%1',sizingMethod='%2')";var bi;var M=[];function by(a){if(bi.test(a.src)){var b=new Image(a.width,a.height);b.onload=function(){a.width=b.width;a.height=b.height;b=null};b.src=a.src;a.pngSrc=a.src;bz(a)}};if(k>=5.5&&k<7){IE7.CSS.addFix(/background(-image)?\s*:\s*([^};]*)?url\(([^\)]+)\)([^;}]*)?/,function(a,b,c,d,f){d=cC(d);return bi.test(d)?"filter:"+i(bx,d,"crop")+";zoom:1;background"+(b||"")+":"+(c||"")+"none"+(f||""):a});IE7.HTML.addRecalc("img,input",function(a){if(a.tagName=="INPUT"&&a.type!="image")return;by(a);w(a,"onpropertychange",function(){if(!bj&&event.propertyName=="src"&&a.src.indexOf(bg)==-1)by(a)})});var bj=false;w(window,"onbeforeprint",function(){bj=true;for(var a=0;a<M.length;a++)ce(M[a])});w(window,"onafterprint",function(){for(var a=0;a<M.length;a++)bz(M[a]);bj=false})}function bz(a,b){var c=a.filters[bh];if(c){c.src=a.src;c.enabled=true}else{a.runtimeStyle.filter=i(bx,a.src,b||"scale");M.push(a)}a.src=bg};function ce(a){a.src=a.pngSrc;a.filters[bh].enabled=false};new function(_){if(k>=7)return;IE7.CSS.addRecalc("position","fixed",_6,"absolute");IE7.CSS.addRecalc("background(-attachment)?","[^};]*fixed",_2);var $viewport=C?"body":"documentElement";function _3(){if(v.currentStyle.backgroundAttachment!="fixed"){if(v.currentStyle.backgroundImage=="none"){v.runtimeStyle.backgroundRepeat="no-repeat";v.runtimeStyle.backgroundImage="url("+bg+")"}v.runtimeStyle.backgroundAttachment="fixed"}_3=Q};var _0=bN("img");function _1(a){return a?bc(a)||_1(a.parentElement):false};function _d(a,b,c){setTimeout("document.all."+a.uniqueID+".runtimeStyle.setExpression('"+b+"','"+c+"')",0)};function _2(a){if(R(_2,a,a.currentStyle.backgroundAttachment=="fixed"&&!a.contains(v))){_3();bgLeft(a);bgTop(a);_8(a)}};function _8(a){_0.src=a.currentStyle.backgroundImage.slice(5,-2);var b=a.canHaveChildren?a:a.parentElement;b.appendChild(_0);setOffsetLeft(a);setOffsetTop(a);b.removeChild(_0)};function bgLeft(a){a.style.backgroundPositionX=a.currentStyle.backgroundPositionX;if(!_1(a)){_d(a,"backgroundPositionX","(parseInt(runtimeStyle.offsetLeft)+document."+$viewport+".scrollLeft)||0")}};eval(A(bgLeft));function setOffsetLeft(a){var b=_1(a)?"backgroundPositionX":"offsetLeft";a.runtimeStyle[b]=getOffsetLeft(a,a.style.backgroundPositionX)-a.getBoundingClientRect().left-a.clientLeft+2};eval(A(setOffsetLeft));function getOffsetLeft(a,b){switch(b){case"left":case"top":return 0;case"right":case"bottom":return s.clientWidth-_0.offsetWidth;case"center":return(s.clientWidth-_0.offsetWidth)/2;default:if(J.test(b)){return parseInt((s.clientWidth-_0.offsetWidth)*parseFloat(b)/100)}_0.style.left=b;return _0.offsetLeft}};eval(A(getOffsetLeft));function _6(a){if(R(_6,a,bc(a))){K(a,"position","absolute");K(a,"left",a.currentStyle.left);K(a,"top",a.currentStyle.top);_3();IE7.Layout.fixRight(a);_4(a)}};function _4(a,b){positionTop(a,b);positionLeft(a,b,true);if(!a.runtimeStyle.autoLeft&&a.currentStyle.marginLeft=="auto"&&a.currentStyle.right!="auto"){var c=s.clientWidth-getPixelWidth(a,a.currentStyle.right)-getPixelWidth(a,a.runtimeStyle._c)-a.clientWidth;if(a.currentStyle.marginRight=="auto")c=parseInt(c/2);if(_1(a.offsetParent))a.runtimeStyle.pixelLeft+=c;else a.runtimeStyle.shiftLeft=c}clipWidth(a);clipHeight(a)};function clipWidth(a){var b=a.runtimeStyle.fixWidth;a.runtimeStyle.borderRightWidth="";a.runtimeStyle.width=b?getPixelWidth(a,b):"";if(a.currentStyle.width!="auto"){var c=a.getBoundingClientRect();var d=a.offsetWidth-s.clientWidth+c.left-2;if(d>=0){a.runtimeStyle.borderRightWidth="0px";d=Math.max(E(a,a.currentStyle.width)-d,0);K(a,"width",d);return d}}};eval(A(clipWidth));function positionLeft(a,b){if(!b&&J.test(a.currentStyle.width)){a.runtimeStyle.fixWidth=a.currentStyle.width}if(a.runtimeStyle.fixWidth){a.runtimeStyle.width=getPixelWidth(a,a.runtimeStyle.fixWidth)}a.runtimeStyle.shiftLeft=0;a.runtimeStyle._c=a.currentStyle.left;a.runtimeStyle.autoLeft=a.currentStyle.right!="auto"&&a.currentStyle.left=="auto";a.runtimeStyle.left="";a.runtimeStyle.screenLeft=getScreenLeft(a);a.runtimeStyle.pixelLeft=a.runtimeStyle.screenLeft;if(!b&&!_1(a.offsetParent)){_d(a,"pixelLeft","runtimeStyle.screenLeft+runtimeStyle.shiftLeft+document."+$viewport+".scrollLeft")}};eval(A(positionLeft));function getScreenLeft(a){var b=a.offsetLeft,c=1;if(a.runtimeStyle.autoLeft){b=s.clientWidth-a.offsetWidth-getPixelWidth(a,a.currentStyle.right)}if(a.currentStyle.marginLeft!="auto"){b-=getPixelWidth(a,a.currentStyle.marginLeft)}while(a=a.offsetParent){if(a.currentStyle.position!="static")c=-1;b+=a.offsetLeft*c}return b};eval(A(getScreenLeft));function getPixelWidth(a,b){return J.test(b)?parseInt(parseFloat(b)/100*s.clientWidth):E(a,b)};eval(A(getPixelWidth));function _g(){var a=_2.elements;for(var b in a)_8(a[b]);a=_6.elements;for(b in a){_4(a[b],true);_4(a[b],true)}_7=0};var _7;bq(function(){if(!_7)_7=setTimeout(_g,0)})};var bk={backgroundColor:"transparent",backgroundImage:"none",backgroundPositionX:null,backgroundPositionY:null,backgroundRepeat:null,borderTopWidth:0,borderRightWidth:0,borderBottomWidth:0,borderLeftStyle:"none",borderTopStyle:"none",borderRightStyle:"none",borderBottomStyle:"none",borderLeftWidth:0,height:null,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,width:"100%"};IE7.CSS.addRecalc("overflow","visible",function(a){if(a.parentNode.ie7_wrapped)return;if(IE7.Layout&&a.currentStyle["max-height"]!="auto"){IE7.Layout.maxHeight(a)}if(a.currentStyle.marginLeft=="auto")a.style.marginLeft=0;if(a.currentStyle.marginRight=="auto")a.style.marginRight=0;var b=document.createElement(bA);b.ie7_wrapped=a;for(var c in bk){b.style[c]=a.currentStyle[c];if(bk[c]!=null){a.runtimeStyle[c]=bk[c]}}b.style.display="block";b.style.position="relative";a.runtimeStyle.position="absolute";a.parentNode.insertBefore(b,a);b.appendChild(a)});function cf(){var f="xx-small,x-small,small,medium,large,x-large,xx-large".split(",");for(var g=0;g<f.length;g++){f[f[g]]=f[g-1]||"0.67em"}IE7.CSS.addFix(/(font(-size)?\s*:\s*)([\w.-]+)/,function(a,b,c,d){return b+(f[d]||d)});if(k<6){var h=/^\-/,p=/(em|ex)$/i;var t=/em$/i,q=/ex$/i;E=function(a,b){if(bL.test(b))return parseInt(b)||0;var c=h.test(b)?-1:1;if(p.test(b))c*=u(a);j.style.width=(c<0)?b.slice(1):b;v.appendChild(j);b=c*j.offsetWidth;j.removeNode();return parseInt(b)};var j=bN();function u(a){var b=1;j.style.fontFamily=a.currentStyle.fontFamily;j.style.lineHeight=a.currentStyle.lineHeight;while(a!=v){var c=a.currentStyle["ie7-font-size"];if(c){if(t.test(c))b*=parseFloat(c);else if(J.test(c))b*=(parseFloat(c)/100);else if(q.test(c))b*=(parseFloat(c)/2);else{j.style.fontSize=c;return 1}}a=a.parentElement}return b};IE7.CSS.addFix(/cursor\s*:\s*pointer/,"cursor:hand");IE7.CSS.addFix(/display\s*:\s*list-item/,"display:block")}function l(a){if(k<5.5)IE7.Layout.boxSizing(a.parentElement);var b=a.parentElement;var c=b.offsetWidth-a.offsetWidth-r(b);var d=(a.currentStyle["ie7-margin"]&&a.currentStyle.marginRight=="auto")||a.currentStyle["ie7-margin-right"]=="auto";switch(b.currentStyle.textAlign){case"right":c=d?parseInt(c/2):0;a.runtimeStyle.marginRight=c+"px";break;case"center":if(d)c=0;default:if(d)c/=2;a.runtimeStyle.marginLeft=parseInt(c)+"px"}};function r(a){return E(a,a.currentStyle.paddingLeft)+E(a,a.currentStyle.paddingRight)};IE7.CSS.addRecalc("margin(-left|-right)?","[^};]*auto",function(a){if(R(l,a,a.parentElement&&a.currentStyle.display=="block"&&a.currentStyle.marginLeft=="auto"&&a.currentStyle.position!="absolute")){l(a)}});bq(function(){for(var a in l.elements){var b=l.elements[a];b.runtimeStyle.marginLeft=b.runtimeStyle.marginRight="";l(b)}})};IE7.loaded=true;(function(){try{bm.doScroll("left")}catch(e){setTimeout(arguments.callee,1);return}try{eval(bB.innerHTML)}catch(e){}bi=new RegExp(bb(typeof IE7_PNG_SUFFIX=="string"?IE7_PNG_SUFFIX:"-trans.png")+"$","i");v=document.body;s=C?v:bm;v.className+=" ie7_body";bm.className+=" ie7_html";if(C)cf();IE7.CSS.init();IE7.HTML.init();IE7.HTML.apply();IE7.CSS.apply();IE7.recalc()})()})(); 
     1// timestamp: Sun, 03 Feb 2008 19:26:22 
     2/* 
     3  IE7/IE8.js - copyright 2004-2008, Dean Edwards 
     4  http://dean.edwards.name/IE7/ 
     5  http://www.opensource.org/licenses/mit-license.php 
     6*/ 
     7 
     8/* W3C compliance for Microsoft Internet Explorer */ 
     9 
     10/* credits/thanks: 
     11  Shaggy, Martijn Wargers, Jimmy Cerra, Mark D Anderson, 
     12  Lars Dieckow, Erik Arvidsson, Gellért Gyuris, James Denny, 
     13  Unknown W Brackets, Benjamin Westfarer, Rob Eberhardt, 
     14  Bill Edney, Kevin Newman, James Crompton, Matthew Mastracci, 
     15  Doug Wright, Richard York, Kenneth Kolano, MegaZone, 
     16  Thomas Verelst, Mark 'Tarquin' Wilton-Jones, Rainer Åhlfors, 
     17  David Zulaica, Ken Kolano, Kevin Newman 
     18*/ 
     19 
     20// ======================================================================= 
     21// TO DO 
     22// ======================================================================= 
     23 
     24// PNG - unclickable content 
     25 
     26// ======================================================================= 
     27// TEST/BUGGY 
     28// ======================================================================= 
     29 
     30// hr{margin:1em auto} (doesn't look right in IE5) 
     31 
     32(function() { 
     33 
     34IE7 = { 
     35  toString: function(){return "IE7 version 2.0 (beta2)"} 
     36}; 
     37var appVersion = IE7.appVersion = navigator.appVersion.match(/MSIE (\d\.\d)/)[1]; 
     38 
     39if (/ie7_off/.test(top.location.search) || appVersion < 5) return; 
     40 
     41var Undefined = K(); 
     42var quirksMode = document.compatMode != "CSS1Compat"; 
     43var documentElement = document.documentElement, body, viewport; 
     44var ANON = "!"; 
     45var HEADER = ":link{ie7-link:link}:visited{ie7-link:visited}"; 
     46 
     47// ----------------------------------------------------------------------- 
     48// external 
     49// ----------------------------------------------------------------------- 
     50 
     51var RELATIVE = /^[\w\.]+[^:]*$/; 
     52function makePath(href, path) { 
     53  if (RELATIVE.test(href)) href = (path || "") + href; 
     54  return href; 
     55}; 
     56 
     57function getPath(href, path) { 
     58  href = makePath(href, path); 
     59  return href.slice(0, href.lastIndexOf("/") + 1); 
     60}; 
     61 
     62// get the path to this script 
     63var script = document.scripts[document.scripts.length - 1]; 
     64var path = getPath(script.src); 
     65 
     66// we'll use microsoft's http request object to load external files 
     67try { 
     68  var httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); 
     69} catch (e) { 
     70  // ActiveX disabled 
     71} 
     72 
     73var fileCache = {}; 
     74function loadFile(href, path) { 
     75try { 
     76  href = makePath(href, path); 
     77  if (!fileCache[href]) { 
     78    // easy to load a file huh? 
     79    httpRequest.open("GET", href, false); 
     80    httpRequest.send(); 
     81    if (httpRequest.status == 0 || httpRequest.status == 200) { 
     82      fileCache[href] = httpRequest.responseText; 
     83    } 
     84  } 
     85} catch (e) { 
     86  // ignore errors 
     87} finally { 
     88  return fileCache[href] || ""; 
     89}}; 
     90 
     91// ----------------------------------------------------------------------- 
     92// IE5.0 compatibility 
     93// ----------------------------------------------------------------------- 
     94 
     95 
     96if (appVersion < 5.5) { 
     97  undefined = Undefined(); 
     98 
     99  ANON = "HTML:!"; // for anonymous content 
     100   
     101  // Fix String.replace (Safari1.x/IE5.0). 
     102  var GLOBAL = /(g|gi)$/; 
     103  var _String_replace = String.prototype.replace;  
     104  String.prototype.replace = function(expression, replacement) { 
     105    if (typeof replacement == "function") { // Safari doesn't like functions 
     106      if (expression && expression.constructor == RegExp) { 
     107        var regexp = expression; 
     108        var global = regexp.global; 
     109        if (global == null) global = GLOBAL.test(regexp); 
     110        // we have to convert global RexpExps for exec() to work consistently 
     111        if (global) regexp = new RegExp(regexp.source); // non-global 
     112      } else { 
     113        regexp = new RegExp(rescape(expression)); 
     114      } 
     115      var match, string = this, result = ""; 
     116      while (string && (match = regexp.exec(string))) { 
     117        result += string.slice(0, match.index) + replacement.apply(this, match); 
     118        string = string.slice(match.index + match[0].length); 
     119        if (!global) break; 
     120      } 
     121      return result + string; 
     122    } 
     123    return _String_replace.apply(this, arguments); 
     124  }; 
     125   
     126  Array.prototype.pop = function() { 
     127    if (this.length) { 
     128      var i = this[this.length - 1]; 
     129      this.length--; 
     130      return i; 
     131    } 
     132    return undefined; 
     133  }; 
     134   
     135  Array.prototype.push = function() { 
     136    for (var i = 0; i < arguments.length; i++) { 
     137      this[this.length] = arguments[i]; 
     138    } 
     139    return this.length; 
     140  }; 
     141   
     142  var ns = this; 
     143  Function.prototype.apply = function(o, a) { 
     144    if (o === undefined) o = ns; 
     145    else if (o == null) o = window; 
     146    else if (typeof o == "string") o = new String(o); 
     147    else if (typeof o == "number") o = new Number(o); 
     148    else if (typeof o == "boolean") o = new Boolean(o); 
     149    if (arguments.length == 1) a = []; 
     150    else if (a[0] && a[0].writeln) a[0] = a[0].documentElement.document || a[0]; 
     151    var $ = "#ie7_apply", r; 
     152    o[$] = this; 
     153    switch (a.length) { // unroll for speed 
     154      case 0: r = o[$](); break; 
     155      case 1: r = o[$](a[0]); break; 
     156      case 2: r = o[$](a[0],a[1]); break; 
     157      case 3: r = o[$](a[0],a[1],a[2]); break; 
     158      case 4: r = o[$](a[0],a[1],a[2],a[3]); break; 
     159      case 5: r = o[$](a[0],a[1],a[2],a[3],a[4]); break; 
     160      default: 
     161        var b = [], i = a.length - 1; 
     162        do b[i] = "a[" + i + "]"; while (i--); 
     163        eval("r=o[$](" + b + ")"); 
     164    } 
     165    if (typeof o.valueOf == "function") { // not a COM object 
     166      delete o[$]; 
     167    } else { 
     168      o[$] = undefined; 
     169      if (r && r.writeln) r = r.documentElement.document || r; 
     170    } 
     171    return r; 
     172  }; 
     173   
     174  Function.prototype.call = function(o) { 
     175    return this.apply(o, _slice.apply(arguments, [1])); 
     176  }; 
     177 
     178  // block elements are "inline" according to IE5.0 so we'll fix it 
     179  HEADER += "address,blockquote,body,dd,div,dt,fieldset,form,"+ 
     180    "frame,frameset,h1,h2,h3,h4,h5,h6,iframe,noframes,object,p,"+ 
     181    "hr,applet,center,dir,menu,pre,dl,li,ol,ul{display:block}"; 
     182} 
     183 
     184// ----------------------------------------------------------------------- 
     185// OO support 
     186// ----------------------------------------------------------------------- 
     187 
     188 
     189// This is a cut-down version of base2 (http://code.google.com/p/base2/) 
     190 
     191var _slice = Array.prototype.slice; 
     192 
     193// private 
     194var _FORMAT = /%([1-9])/g; 
     195var _LTRIM = /^\s\s*/; 
     196var _RTRIM = /\s\s*$/; 
     197var _RESCAPE = /([\/()[\]{}|*+-.,^$?\\])/g;           // safe regular expressions 
     198var _BASE = /\bbase\b/; 
     199var _HIDDEN = ["constructor", "toString"];            // only override these when prototyping 
     200 
     201var prototyping; 
     202 
     203function Base(){}; 
     204Base.extend = function(_instance, _static) { 
     205  // Build the prototype. 
     206  prototyping = true; 
     207  var _prototype = new this; 
     208  extend(_prototype, _instance); 
     209  prototyping = false; 
     210 
     211  // Create the wrapper for the constructor function. 
     212  var _constructor = _prototype.constructor; 
     213  function klass() { 
     214    // Don't call the constructor function when prototyping. 
     215    if (!prototyping) _constructor.apply(this, arguments); 
     216  }; 
     217  _prototype.constructor = klass; 
     218 
     219  // Build the static interface. 
     220  klass.extend = arguments.callee; 
     221  extend(klass, _static); 
     222  klass.prototype = _prototype; 
     223  return klass; 
     224}; 
     225Base.prototype.extend = function(source) { 
     226  return extend(this, source); 
     227}; 
     228 
     229// A collection of regular expressions and their associated replacement values. 
     230// A Base class for creating parsers. 
     231 
     232var _HASH   = "#"; 
     233var _KEYS   = "~"; 
     234 
     235var _RG_ESCAPE_CHARS    = /\\./g; 
     236var _RG_ESCAPE_BRACKETS = /\(\?[:=!]|\[[^\]]+\]/g; 
     237var _RG_BRACKETS        = /\(/g; 
     238 
     239var RegGrp = Base.extend({ 
     240  constructor: function(values) { 
     241    this[_KEYS] = []; 
     242    this.merge(values); 
     243  }, 
     244 
     245  exec: function(string) { 
     246    var items = this, keys = this[_KEYS];     
     247    return String(string).replace(new RegExp(this, this.ignoreCase ? "gi" : "g"), function() { 
     248      var item, offset = 1, i = 0; 
     249      // Loop through the RegGrp items. 
     250      while ((item = items[_HASH + keys[i++]])) { 
     251        var next = offset + item.length + 1; 
     252        if (arguments[offset]) { // do we have a result? 
     253          var replacement = item.replacement; 
     254          switch (typeof replacement) { 
     255            case "function": 
     256              return replacement.apply(items, _slice.call(arguments, offset, next)); 
     257            case "number": 
     258              return arguments[offset + replacement]; 
     259            default: 
     260              return replacement; 
     261          } 
     262        } 
     263        offset = next; 
     264      } 
     265    }); 
     266  }, 
     267 
     268  add: function(expression, replacement) { 
     269    if (expression instanceof RegExp) { 
     270      expression = expression.source; 
     271    } 
     272    if (!this[_HASH + expression]) this[_KEYS].push(String(expression)); 
     273    this[_HASH + expression] = new RegGrp.Item(expression, replacement); 
     274  }, 
     275 
     276  merge: function(values) { 
     277    for (var i in values) this.add(i, values[i]); 
     278  }, 
     279 
     280  toString: function() { 
     281    // back references not supported in simple RegGrp 
     282    return "(" + this[_KEYS].join(")|(") + ")"; 
     283  } 
     284}, { 
     285  IGNORE: "$0", 
     286 
     287  Item: Base.extend({ 
     288    constructor: function(expression, replacement) { 
     289      expression = expression instanceof RegExp ? expression.source : String(expression); 
     290 
     291      if (typeof replacement == "number") replacement = String(replacement); 
     292      else if (replacement == null) replacement = ""; 
     293 
     294      // does the pattern use sub-expressions? 
     295      if (typeof replacement == "string" && /\$(\d+)/.test(replacement)) { 
     296        // a simple lookup? (e.g. "$2") 
     297        if (/^\$\d+$/.test(replacement)) { 
     298          // store the index (used for fast retrieval of matched strings) 
     299          replacement = parseInt(replacement.slice(1)); 
     300        } else { // a complicated lookup (e.g. "Hello $2 $1") 
     301          // build a function to do the lookup 
     302          var Q = /'/.test(replacement.replace(/\\./g, "")) ? '"' : "'"; 
     303          replacement = replacement.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\$(\d+)/g, Q + 
     304            "+(arguments[$1]||" + Q+Q + ")+" + Q); 
     305          replacement = new Function("return " + Q + replacement.replace(/(['"])\1\+(.*)\+\1\1$/, "$1") + Q); 
     306        } 
     307      } 
     308 
     309      this.length = RegGrp.count(expression); 
     310      this.replacement = replacement; 
     311      this.toString = K(expression); 
     312    } 
     313  }), 
     314 
     315  count: function(expression) { 
     316    // Count the number of sub-expressions in a RegExp/RegGrp.Item. 
     317    expression = String(expression).replace(_RG_ESCAPE_CHARS, "").replace(_RG_ESCAPE_BRACKETS, ""); 
     318    return match(expression, _RG_BRACKETS).length; 
     319  } 
     320}); 
     321 
     322// ========================================================================= 
     323// lang/extend.js 
     324// ========================================================================= 
     325 
     326function extend(object, source) { // or extend(object, key, value) 
     327  if (object && source) { 
     328    var proto = (typeof source == "function" ? Function : Object).prototype; 
     329    // Add constructor, toString etc 
     330    var i = _HIDDEN.length, key; 
     331    if (prototyping) while (key = _HIDDEN[--i]) { 
     332      var value = source[key]; 
     333      if (value != proto[key]) { 
     334        if (_BASE.test(value)) { 
     335          _override(object, key, value) 
     336        } else { 
     337          object[key] = value; 
     338        } 
     339      } 
     340    } 
     341    // Copy each of the source object's properties to the target object. 
     342    for (key in source) if (proto[key] === undefined) { 
     343      var value = source[key]; 
     344      // Check for method overriding. 
     345      if (object[key] && typeof value == "function" && _BASE.test(value)) { 
     346        _override(object, key, value); 
     347      } else { 
     348        object[key] = value; 
     349      } 
     350    } 
     351  } 
     352  return object; 
     353}; 
     354 
     355function _override(object, name, method) { 
     356  // Override an existing method. 
     357  var ancestor = object[name]; 
     358  object[name] = function() { 
     359    var previous = this.base; 
     360    this.base = ancestor; 
     361    var returnValue = method.apply(this, arguments); 
     362    this.base = previous; 
     363    return returnValue; 
     364  }; 
     365}; 
     366 
     367function combine(keys, values) { 
     368  // Combine two arrays to make a hash. 
     369  if (!values) values = keys; 
     370  var hash = {}; 
     371  for (var i in keys) hash[i] = values[i]; 
     372  return hash; 
     373}; 
     374 
     375function format(string) { 
     376  // Replace %n with arguments[n]. 
     377  // e.g. format("%1 %2%3 %2a %1%3", "she", "se", "lls"); 
     378  // ==> "she sells sea shells" 
     379  // Only %1 - %9 supported. 
     380  var args = arguments; 
     381  var _FORMAT = new RegExp("%([1-" + arguments.length + "])", "g"); 
     382  return String(string).replace(_FORMAT, function(match, index) { 
     383    return index < args.length ? args[index] : match; 
     384  }); 
     385}; 
     386 
     387function match(string, expression) { 
     388  // Same as String.match() except that this function will return an empty 
     389  // array if there is no match. 
     390  return String(string).match(expression) || []; 
     391}; 
     392 
     393function rescape(string) { 
     394  // Make a string safe for creating a RegExp. 
     395  return String(string).replace(_RESCAPE, "\\$1"); 
     396}; 
     397 
     398// http://blog.stevenlevithan.com/archives/faster-trim-javascript 
     399function trim(string) { 
     400  return String(string).replace(_LTRIM, "").replace(_RTRIM, ""); 
     401}; 
     402 
     403function K(k) { 
     404  return function() { 
     405    return k; 
     406  }; 
     407}; 
     408 
     409// ----------------------------------------------------------------------- 
     410// parsing 
     411// ----------------------------------------------------------------------- 
     412 
     413var Parser = RegGrp.extend({ignoreCase: true}); 
     414 
     415var ENCODED = /\x01(\d+)/g, 
     416    QUOTES  = /'/g,  
     417    STRING = /^\x01/, 
     418    UNICODE = /\\([\da-fA-F]{1,4})/g; 
     419 
     420var _strings = []; 
     421 
     422var encoder = new Parser({ 
     423  // comments 
     424  "<!\\-\\-|\\-\\->": "", 
     425  "\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/": "", 
     426  // get rid 
     427  "@(namespace|import)[^;\\n]+[;\\n]": "", 
     428  // strings 
     429  "'(\\\\.|[^'\\\\])*'": encodeString, 
     430  '"(\\\\.|[^"\\\\])*"': encodeString, 
     431  // white space 
     432  "\\s+": " " 
     433}); 
     434 
     435function encode(cssText) { 
     436  return encoder.exec(cssText); 
     437}; 
     438 
     439function decode(cssText) { 
     440  return cssText.replace(ENCODED, function(match, index) { 
     441    return _strings[index - 1]; 
     442  }); 
     443}; 
     444 
     445function encodeString(string) { 
     446  return "\x01" + _strings.push(string.replace(UNICODE, function(match, chr) { 
     447    return eval("'\\u" + "0000".slice(chr.length) + chr + "'"); 
     448  }).slice(1, -1).replace(QUOTES, "\\'")); 
     449}; 
     450 
     451function getString(value) { 
     452  return STRING.test(value) ? _strings[value.slice(1) - 1] : value; 
     453}; 
     454 
     455// clone a "width" function to create a "height" function 
     456var rotater = new RegGrp({ 
     457  Width: "Height", 
     458  width: "height", 
     459  Left:  "Top", 
     460  left:  "top", 
     461  Right: "Bottom", 
     462  right: "bottom", 
     463  onX:   "onY" 
     464}); 
     465 
     466function rotate(fn) { 
     467  return rotater.exec(fn); 
     468}; 
     469 
     470// ----------------------------------------------------------------------- 
     471// event handling 
     472// ----------------------------------------------------------------------- 
     473 
     474var eventHandlers = []; 
     475 
     476function addResize(handler) { 
     477  addRecalc(handler); 
     478  addEventHandler(window, "onresize", handler); 
     479}; 
     480 
     481// add an event handler (function) to an element 
     482function addEventHandler(element, type, handler) { 
     483  element.attachEvent(type, handler); 
     484  // store the handler so it can be detached later 
     485  eventHandlers.push(arguments); 
     486}; 
     487 
     488// remove an event handler assigned to an element by IE7 
     489function removeEventHandler(element, type, handler) { 
     490try { 
     491  element.detachEvent(type, handler); 
     492} catch (ignore) { 
     493  // write a letter of complaint to microsoft.. 
     494}}; 
     495 
     496// remove event handlers (they eat memory) 
     497addEventHandler(window, "onunload", function() { 
     498  var handler; 
     499  while (handler = eventHandlers.pop()) { 
     500    removeEventHandler(handler[0], handler[1], handler[2]); 
     501  } 
     502}); 
     503 
     504function register(handler, element, condition) { // -@DRE 
     505  //var set = handler[element.uniqueID]; 
     506  if (!handler.elements) handler.elements = {}; 
     507  if (condition) handler.elements[element.uniqueID] = element; 
     508  else delete handler.elements[element.uniqueID]; 
     509  //return !set && condition; 
     510  return condition; 
     511}; 
     512 
     513addEventHandler(window, "onbeforeprint", function() { 
     514  if (!IE7.CSS.print) new StyleSheet("print"); 
     515  IE7.CSS.print.recalc(); 
     516}); 
     517 
     518// ----------------------------------------------------------------------- 
     519// pixel conversion 
     520// ----------------------------------------------------------------------- 
     521 
     522// this is handy because it means that web developers can mix and match 
     523//  measurement units in their style sheets. it is not uncommon to 
     524//  express something like padding in "em" units whilst border thickness 
     525//  is most often expressed in pixels. 
     526 
     527var PIXEL = /^\d+(px)?$/i; 
     528var PERCENT = /^\d+%$/; 
     529var getPixelValue = function(element, value) { 
     530  if (PIXEL.test(value)) return parseInt(value); 
     531  var style = element.style.left; 
     532  var runtimeStyle = element.runtimeStyle.left; 
     533  element.runtimeStyle.left = element.currentStyle.left; 
     534  element.style.left = value || 0; 
     535  value = element.style.pixelLeft; 
     536  element.style.left = style; 
     537  element.runtimeStyle.left = runtimeStyle; 
     538  return value; 
     539}; 
     540 
     541// ----------------------------------------------------------------------- 
     542// generic 
     543// ----------------------------------------------------------------------- 
     544 
     545var $IE7 = "ie7-"; 
     546 
     547var Fix = Base.extend({ 
     548  constructor: function() { 
     549    this.fixes = []; 
     550    this.recalcs = []; 
     551  }, 
     552  init: Undefined 
     553}); 
     554 
     555// a store for functions that will be called when refreshing IE7 
     556var recalcs = []; 
     557function addRecalc(recalc) { 
     558  recalcs.push(recalc); 
     559}; 
     560 
     561IE7.recalc = function() { 
     562  IE7.HTML.recalc(); 
     563  // re-apply style sheet rules (re-calculate ie7 classes) 
     564  IE7.CSS.recalc(); 
     565  // apply global fixes to the document 
     566  for (var i = 0; i < recalcs.length; i++) recalcs[i](); 
     567}; 
     568 
     569function isFixed(element) { 
     570  return element.currentStyle["ie7-position"] == "fixed"; 
     571}; 
     572 
     573// original style 
     574function getDefinedStyle(element, propertyName) { 
     575  return element.currentStyle[$IE7 + propertyName] || element.currentStyle[propertyName]; 
     576}; 
     577 
     578function setOverrideStyle(element, propertyName, value) { 
     579  if (element.currentStyle[$IE7 + propertyName] == null) { 
     580    element.runtimeStyle[$IE7 + propertyName] = element.currentStyle[propertyName]; 
     581  } 
     582  element.runtimeStyle[propertyName] = value; 
     583}; 
     584 
     585// create a temporary element which is used to inherit styles 
     586//  from the target element. the temporary element can be resized 
     587//  to determine pixel widths/heights 
     588function createTempElement(tagName) { 
     589  var element = document.createElement(tagName || "object"); 
     590  element.style.cssText = "position:absolute;padding:0;display:block;border:none;clip:rect(0 0 0 0);left:-9999"; 
     591  element.ie7_anon = true; 
     592  return element; 
     593}; 
     594 
     595 
     596// ========================================================================= 
     597// ie7-cssQuery.js 
     598// ========================================================================= 
     599 
     600function cssQuery(selector, context, single) { 
     601  if (!_cache[selector]) { 
     602    reg = []; // store for RegExp objects 
     603    var fn = ""; 
     604    var selectors = cssParser.escape(selector).split(","); 
     605    for (var i = 0; i < selectors.length; i++) { 
     606      _wild = _index = _list = 0; // reset 
     607      _duplicate = selectors.length > 1 ? 2 : 0; // reset 
     608      var block = cssParser.exec(selectors[i]) || "if(0){"; 
     609      if (_wild) { // IE's pesky comment nodes 
     610        block += format("if(e%1.nodeName!='!'){", _index); 
     611      } 
     612      // check for duplicates before storing results 
     613      var store = _duplicate > 1 ? _TEST : ""; 
     614      block += format(store + _STORE, _index); 
     615      // add closing braces 
     616      block += Array(match(block, /\{/g).length + 1).join("}"); 
     617      fn += block; 
     618    } 
     619    eval(format(_FN, reg) + cssParser.unescape(fn) + "return s?null:r}"); 
     620    _cache[selector] = _selectorFunction; 
     621  } 
     622  return _cache[selector](context || document, single); 
     623}; 
     624 
     625var _MSIE5 = appVersion < 6; 
     626 
     627var _EVALUATED = /^(href|src)$/; 
     628var _ATTRIBUTES = { 
     629  "class": "className", 
     630  "for": "htmlFor" 
     631}; 
     632 
     633IE7._indexed = 1; 
     634 
     635IE7._byId = function(document, id) { 
     636  var result = document.all[id] || null; 
     637  // returns a single element or a collection 
     638  if (!result || result.id == id) return result; 
     639  // document.all has returned a collection of elements with name/id 
     640  for (var i = 0; i < result.length; i++) { 
     641    if (result[i].id == id) return result[i]; 
     642  } 
     643  return null; 
     644}; 
     645 
     646IE7._getAttribute = function(element, name) { 
     647  if (name == "src" && element.pngSrc) return element.pngSrc; 
     648   
     649  var attribute = _MSIE5 ? (element.attributes[name] || element.attributes[_ATTRIBUTES[name.toLowerCase()]]) : element.getAttributeNode(name); 
     650  if (attribute && (attribute.specified || name == "value")) { 
     651    if (_EVALUATED.test(name)) { 
     652      return element.getAttribute(name, 2); 
     653    } else if (name == "class") { 
     654     return element.className.replace(/\sie7_\w+/g, ""); 
     655    } else if (name == "style") { 
     656     return element.style.cssText; 
     657    } else { 
     658     return attribute.nodeValue; 
     659    } 
     660  } 
     661  return null; 
     662}; 
     663 
     664var names = "colSpan,rowSpan,vAlign,dateTime,accessKey,tabIndex,encType,maxLength,readOnly,longDesc"; 
     665// Convert the list of strings to a hash, mapping the lowercase name to the camelCase name. 
     666extend(_ATTRIBUTES, combine(names.toLowerCase().split(","), names.split(","))); 
     667 
     668IE7._getNextElementSibling = function(node) { 
     669  // return the next element to the supplied element 
     670  //  nextSibling is not good enough as it might return a text or comment node 
     671  while (node && (node = node.nextSibling) && (node.nodeType != 1 || node.nodeName == "!")) continue; 
     672  return node; 
     673}; 
     674 
     675IE7._getPreviousElementSibling = function(node) { 
     676  // return the previous element to the supplied element 
     677  while (node && (node = node.previousSibling) && (node.nodeType != 1 || node.nodeName == "!")) continue; 
     678  return node; 
     679}; 
     680 
     681// ========================================================================= 
     682// CSSParser 
     683// ========================================================================= 
     684 
     685var IMPLIED_ASTERISK = /([\s>+~,]|[^(]\+|^)([#.:\[])/g, 
     686    IMPLIED_SPACE =    /(^|,)([^\s>+~])/g, 
     687    WHITESPACE =       /\s*([\s>+~(),]|^|$)\s*/g, 
     688    WILD_CARD =        /\s\*\s/g;; 
     689 
     690var CSSParser = RegGrp.extend({ 
     691  constructor: function(items) { 
     692    this.base(items); 
     693    this.sorter = new RegGrp; 
     694    this.sorter.add(/:not\([^)]*\)/, RegGrp.IGNORE); 
     695    this.sorter.add(/([ >](\*|[\w-]+))([^: >+~]*)(:\w+-child(\([^)]+\))?)([^: >+~]*)/, "$1$3$6$4"); 
     696  }, 
     697   
     698  ignoreCase: true, 
     699 
     700  escape: function(selector) { 
     701    return this.optimise(this.format(selector)); 
     702  }, 
     703 
     704  format: function(selector) { 
     705    return selector 
     706      .replace(WHITESPACE, "$1") 
     707      .replace(IMPLIED_SPACE, "$1 $2") 
     708      .replace(IMPLIED_ASTERISK, "$1*$2"); 
     709  }, 
     710 
     711  optimise: function(selector) { 
     712    // optimise wild card descendant selectors 
     713    return this.sorter.exec(selector.replace(WILD_CARD, ">* ")); 
     714  }, 
     715 
     716  unescape: function(selector) { 
     717    return decode(selector); 
     718  } 
     719}); 
     720 
     721// some constants 
     722var _OPERATORS = { 
     723  "":   "%1!=null", 
     724  "=":  "%1=='%2'", 
     725  "~=": /(^| )%1( |$)/, 
     726  "|=": /^%1(-|$)/, 
     727  "^=": /^%1/, 
     728  "$=": /%1$/, 
     729  "*=": /%1/ 
     730}; 
     731 
     732var _PSEUDO_CLASSES = { 
     733  "first-child": "!IE7._getPreviousElementSibling(e%1)", 
     734  "link":        "e%1.currentStyle['ie7-link']=='link'", 
     735  "visited":     "e%1.currentStyle['ie7-link']=='visited'" 
     736}; 
     737 
     738var _VAR = "var p%2=0,i%2,e%2,n%2=e%1."; 
     739var _ID = "e%1.sourceIndex"; 
     740var _TEST = "var g=" + _ID + ";if(!p[g]){p[g]=1;"; 
     741var _STORE = "r[r.length]=e%1;if(s)return e%1;"; 
     742var _FN = "var _selectorFunction=function(e0,s){IE7._indexed++;var r=[],p={},reg=[%1],d=document;"; 
     743var reg; // a store for RexExp objects 
     744var _index; 
     745var _wild; // need to flag certain _wild card selectors as MSIE includes comment nodes 
     746var _list; // are we processing a node _list? 
     747var _duplicate; // possible duplicates? 
     748var _cache = {}; // store parsed selectors 
     749 
     750// a hideous parser 
     751var cssParser = new CSSParser({ 
     752  " (\\*|[\\w-]+)#([\\w-]+)": function(match, tagName, id) { // descendant selector followed by ID 
     753    _wild = false; 
     754    var replacement = "var e%2=IE7._byId(d,'%4');if(e%2&&"; 
     755    if (tagName != "*") replacement += "e%2.nodeName=='%3'&&"; 
     756    replacement += "(e%1==d||e%1.contains(e%2))){"; 
     757    if (_list) replacement += format("i%1=n%1.length;", _list); 
     758    return format(replacement, _index++, _index, tagName.toUpperCase(), id); 
     759  }, 
     760   
     761  " (\\*|[\\w-]+)": function(match, tagName) { // descendant selector 
     762    _duplicate++; // this selector may produce duplicates 
     763    _wild = tagName == "*"; 
     764    var replacement = _VAR; 
     765    // IE5.x does not support getElementsByTagName("*"); 
     766    replacement += (_wild && _MSIE5) ? "all" : "getElementsByTagName('%3')"; 
     767    replacement += ";for(i%2=0;(e%2=n%2[i%2]);i%2++){"; 
     768    return format(replacement, _index++, _list = _index, tagName.toUpperCase()); 
     769  }, 
     770   
     771  ">(\\*|[\\w-]+)": function(match, tagName) { // child selector 
     772    var children = _list; 
     773    _wild = tagName == "*"; 
     774    var replacement = _VAR; 
     775    // use the children property for MSIE as it does not contain text nodes 
     776    //  (but the children collection still includes comments). 
     777    // the document object does not have a children collection 
     778    replacement += children ? "children": "childNodes"; 
     779    if (!_wild && children) replacement += ".tags('%3')"; 
     780    replacement += ";for(i%2=0;(e%2=n%2[i%2]);i%2++){"; 
     781    if (_wild) { 
     782      replacement += "if(e%2.nodeType==1){"; 
     783      _wild = _MSIE5; 
     784    } else { 
     785      if (!children) replacement += "if(e%2.nodeName=='%3'){"; 
     786    } 
     787    return format(replacement, _index++, _list = _index, tagName.toUpperCase()); 
     788  }, 
     789   
     790  "\\+(\\*|[\\w-]+)": function(match, tagName) { // direct adjacent selector 
     791    var replacement = ""; 
     792    if (_wild) replacement += "if(e%1.nodeName!='!'){"; 
     793    _wild = false; 
     794    replacement += "e%1=IE7._getNextElementSibling(e%1);if(e%1"; 
     795    if (tagName != "*") replacement += "&&e%1.nodeName=='%2'"; 
     796    replacement += "){"; 
     797    return format(replacement, _index, tagName.toUpperCase()); 
     798  }, 
     799   
     800  "~(\\*|[\\w-]+)": function(match, tagName) { // indirect adjacent selector 
     801    var replacement = ""; 
     802    if (_wild) replacement += "if(e%1.nodeName!='!'){"; 
     803    _wild = false; 
     804    _duplicate = 2; // this selector may produce duplicates 
     805    replacement += "while(e%1=e%1.nextSibling){if(e%1.ie7_adjacent==IE7._indexed)break;if("; 
     806    if (tagName == "*") { 
     807      replacement += "e%1.nodeType==1"; 
     808      if (_MSIE5) replacement += "&&e%1.nodeName!='!'"; 
     809    } else replacement += "e%1.nodeName=='%2'"; 
     810    replacement += "){e%1.ie7_adjacent=IE7._indexed;"; 
     811    return format(replacement, _index, tagName.toUpperCase()); 
     812  }, 
     813   
     814  "#([\\w-]+)": function(match, id) { // ID selector 
     815    _wild = false; 
     816    var replacement = "if(e%1.id=='%2'){"; 
     817    if (_list) replacement += format("i%1=n%1.length;", _list); 
     818    return format(replacement, _index, id); 
     819  }, 
     820   
     821  "\\.([\\w-]+)": function(match, className) { // class selector 
     822    _wild = false; 
     823    // store RegExp objects - slightly faster on IE 
     824    reg.push(new RegExp("(^|\\s)" + rescape(className) + "(\\s|$)")); 
     825    return format("if(e%1.className&&reg[%2].test(e%1.className)){", _index, reg.length - 1); 
     826  }, 
     827   
     828  "\\[([\\w-]+)\\s*([^=]?=)?\\s*([^\\]]*)\\]": function(match, attr, operator, value) { // attribute selectors 
     829    var alias = _ATTRIBUTES[attr] || attr; 
     830    if (operator) { 
     831      var getAttribute = "e%1.getAttribute('%2',2)"; 
     832      if (!_EVALUATED.test(attr)) { 
     833        getAttribute = "e%1.%3||" + getAttribute; 
     834      } 
     835      attr = format("(" + getAttribute + ")", _index, attr, alias); 
     836    } else { 
     837      attr = format("IE7._getAttribute(e%1,'%2')", _index, attr); 
     838    } 
     839    var replacement = _OPERATORS[operator || ""] || "0"; 
     840    if (replacement && replacement.source) { 
     841      reg.push(new RegExp(format(replacement.source, rescape(cssParser.unescape(value))))); 
     842      replacement = "reg[%2].test(%1)"; 
     843      value = reg.length - 1; 
     844    } 
     845    return "if(" + format(replacement, attr, value) + "){"; 
     846  }, 
     847   
     848  ":+([\\w-]+)(\\(([^)]+)\\))?": function(match, pseudoClass, $2, args) { // pseudo class selectors 
     849    pseudoClass = _PSEUDO_CLASSES[pseudoClass]; 
     850    return "if(" + (pseudoClass ? format(pseudoClass, _index, args || "")  : "0") + "){"; 
     851  } 
     852}); 
     853 
     854// ========================================================================= 
     855// ie7-css.js 
     856// ========================================================================= 
     857 
     858var HYPERLINK = /a(#[\w-]+)?(\.[\w-]+)?:(hover|active)/i; 
     859var BRACE1 = /\s*\{\s*/, BRACE2 = /\s*\}\s*/, COMMA = /\s*\,\s*/; 
     860var FIRST_LINE_LETTER = /(.*)(:first-(line|letter))/; 
     861 
     862//var UNKNOWN = /UNKNOWN|([:.])\w+\1/i; 
     863 
     864var styleSheets = document.styleSheets; 
     865 
     866IE7.CSS = new (Fix.extend({ // single instance 
     867  parser: new Parser, 
     868  screen: "", 
     869  print: "", 
     870  styles: [], 
     871  rules: [], 
     872  pseudoClasses: appVersion < 7 ? "first\\-child" : "", 
     873  dynamicPseudoClasses: { 
     874    toString: function() { 
     875      var strings = []; 
     876      for (var pseudoClass in this) strings.push(pseudoClass); 
     877      return strings.join("|"); 
     878    } 
     879  }, 
     880   
     881  init: function() { 
     882    var NONE = "^\x01$"; 
     883    var CLASS = "\\[class=?[^\\]]*\\]"; 
     884    var pseudoClasses = []; 
     885    if (this.pseudoClasses) pseudoClasses.push(this.pseudoClasses); 
     886    var dynamicPseudoClasses = this.dynamicPseudoClasses.toString();  
     887    if (dynamicPseudoClasses) pseudoClasses.push(dynamicPseudoClasses); 
     888    pseudoClasses = pseudoClasses.join("|"); 
     889    var unknown = appVersion < 7 ? ["[>+~[(]|([:.])\\w+\\1"] : [CLASS]; 
     890    if (pseudoClasses) unknown.push(":(" + pseudoClasses + ")"); 
     891    this.UNKNOWN = new RegExp(unknown.join("|") || NONE, "i"); 
     892    var complex = appVersion < 7 ? ["\\[[^\\]]+\\]|[^\\s(\\[]+\\s*[+~]"] : [CLASS]; 
     893    var complexRule = complex.concat(); 
     894    if (pseudoClasses) complexRule.push(":(" + pseudoClasses + ")"); 
     895    Rule.COMPLEX = new RegExp(complexRule.join("|") || NONE, "ig"); 
     896    if (this.pseudoClasses) complex.push(":(" + this.pseudoClasses + ")"); 
     897    DynamicRule.COMPLEX = new RegExp(complex.join("|") || NONE, "i"); 
     898    DynamicRule.MATCH = new RegExp(dynamicPseudoClasses ? "(.*):(" + dynamicPseudoClasses + ")(.*)" : NONE, "i"); 
     899     
     900    this.createStyleSheet(); 
     901    this.refresh(); 
     902  }, 
     903   
     904     addEventHandler: function() { 
     905          addEventHandler.apply(null, arguments); 
     906     }, 
     907   
     908  addFix: function(expression, replacement) { 
     909    this.parser.add(expression, replacement); 
     910  }, 
     911   
     912  addRecalc: function(propertyName, test, handler, replacement) { 
     913    // recalcs occur whenever the document is refreshed using document.recalc() 
     914    test = new RegExp("([{;\\s])" + propertyName + "\\s*:\\s*" + test + "[^;}]*"); 
     915    var id = this.recalcs.length; 
     916    if (replacement) replacement = propertyName + ":" + replacement; 
     917    this.addFix(test, function(match, $1) { 
     918      return (replacement ? $1 + replacement : match) + ";ie7-" + match.slice(1) + ";ie7_recalc" + id + ":1"; 
     919    }); 
     920    this.recalcs.push(arguments); 
     921    return id; 
     922  }, 
     923   
     924  apply: function() { 
     925    this.getInlineStyles(); 
     926    new StyleSheet("screen"); 
     927    this.trash(); 
     928  }, 
     929   
     930  createStyleSheet: function() { 
     931    // create the IE7 style sheet 
     932    this.styleSheet = document.createStyleSheet(); 
     933    // flag it so we can ignore it during parsing 
     934    this.styleSheet.ie7 = true; 
     935    this.styleSheet.owningElement.ie7 = true; 
     936    this.styleSheet.cssText = HEADER; 
     937  }, 
     938   
     939  getInlineStyles: function() { 
     940    // load inline styles 
     941    var styleSheets = document.getElementsByTagName("style"), styleSheet; 
     942    for (var i = styleSheets.length - 1; (styleSheet = styleSheets[i]); i--) { 
     943      if (!styleSheet.disabled && !styleSheet.ie7) { 
     944        this.styles.push(styleSheet.innerHTML); 
     945      } 
     946    } 
     947  }, 
     948   
     949  getText: function(styleSheet, path) { 
     950    // explorer will trash unknown selectors (it converts them to "UNKNOWN"). 
     951    // so we must reload external style sheets (internal style sheets can have their text 
     952    //  extracted through the innerHTML property). 
     953      // load the style sheet text from an external file 
     954    try { 
     955      var cssText = styleSheet.cssText; 
     956    } catch (e) { 
     957      cssText = ""; 
     958    } 
     959    if (httpRequest) cssText = loadFile(styleSheet.href, path) || cssText; 
     960    return cssText; 
     961  }, 
     962   
     963  recalc: function() { 
     964    this.screen.recalc(); 
     965    // we're going to read through all style rules. 
     966    //  certain rules have had ie7 properties added to them. 
     967    //   e.g. p{top:0; ie7_recalc2:1; left:0} 
     968    //  this flags a property in the rule as needing a fix. 
     969    //  the selector text is then used to query the document. 
     970    //  we can then loop through the results of the query 
     971    //  and fix the elements. 
     972    // we ignore the IE7 rules - so count them in the header 
     973    var RECALCS = /ie7_recalc\d+/g; 
     974    var start = HEADER.match(/[{,]/g).length; 
     975    // only calculate screen fixes. print fixes don't show up anyway 
     976    var stop = start + (this.screen.cssText.match(/\{/g)||"").length; 
     977    var rules = this.styleSheet.rules, rule; 
     978    var calcs, calc, elements, element, i, j, k, id; 
     979    // loop through all rules 
     980    for (i = start; i < stop; i++) { 
     981      rule = rules[i]; 
     982      var cssText = rule.style.cssText; 
     983      // search for the "ie7_recalc" flag (there may be more than one) 
     984      if (rule && (calcs = cssText.match(RECALCS))) { 
     985        // use the selector text to query the document 
     986        elements = cssQuery(rule.selectorText); 
     987        // if there are matching elements then loop 
     988        //  through the recalc functions and apply them 
     989        //  to each element 
     990        if (elements.length) for (j = 0; j < calcs.length; j++) { 
     991          // get the matching flag (e.g. ie7_recalc3) 
     992          id = calcs[j]; 
     993          // extract the numeric id from the end of the flag 
     994          //  and use it to index the collection of recalc 
     995          //  functions 
     996          calc = IE7.CSS.recalcs[id.slice(10)][2]; 
     997          for (k = 0; (element = elements[k]); k++) { 
     998            // apply the fix 
     999            if (element.currentStyle[id]) calc(element, cssText); 
     1000          } 
     1001        } 
     1002      } 
     1003    } 
     1004  }, 
     1005   
     1006  refresh: function() { 
     1007    this.styleSheet.cssText = HEADER + this.screen + this.print; 
     1008  }, 
     1009   
     1010  trash: function() { 
     1011    // trash the old style sheets 
     1012    for (var i = 0; i < styleSheets.length; i++) { 
     1013      if (!styleSheets[i].ie7) { 
     1014        try { 
     1015          var cssText = styleSheets[i].cssText; 
     1016        } catch (e) { 
     1017          cssText = ""; 
     1018        } 
     1019        if (cssText) styleSheets[i].cssText = ""; 
     1020      } 
     1021    } 
     1022  } 
     1023})); 
     1024 
     1025// ----------------------------------------------------------------------- 
     1026//  IE7 StyleSheet class 
     1027// ----------------------------------------------------------------------- 
     1028 
     1029var StyleSheet = Base.extend({ 
     1030  constructor: function(media) { 
     1031    this.media = media; 
     1032    this.load(); 
     1033    IE7.CSS[media] = this; 
     1034    IE7.CSS.refresh(); 
     1035  }, 
     1036   
     1037  createRule: function(selector, cssText) { 
     1038    if (IE7.CSS.UNKNOWN.test(selector)) { 
     1039      var match; 
     1040      if (PseudoElement && (match = selector.match(PseudoElement.MATCH))) { 
     1041        return new PseudoElement(match[1], match[2], cssText); 
     1042      } else if (match = selector.match(DynamicRule.MATCH)) { 
     1043        if (!HYPERLINK.test(match[0]) || DynamicRule.COMPLEX.test(match[0])) { 
     1044          return new DynamicRule(selector, match[1], match[2], match[3], cssText); 
     1045        } 
     1046      } else return new Rule(selector, cssText); 
     1047    } 
     1048    return selector + " {" + cssText + "}"; 
     1049  }, 
     1050   
     1051  getText: function() { 
     1052    // store for style sheet text 
     1053    var _inlineStyles = [].concat(IE7.CSS.styles); 
     1054    // parse media decalarations 
     1055    var MEDIA = /@media\s+([^{]*)\{([^@]+\})\s*\}/gi; 
     1056    var ALL = /\ball\b|^$/i, SCREEN = /\bscreen\b/i, PRINT = /\bprint\b/i; 
     1057    function _parseMedia(cssText, media) { 
     1058      _filterMedia.value = media; 
     1059      return cssText.replace(MEDIA, _filterMedia); 
     1060    }; 
     1061    function _filterMedia(match, media, cssText) { 
     1062      media = _simpleMedia(media); 
     1063      switch (media) { 
     1064        case "screen": 
     1065        case "print": 
     1066          if (media != _filterMedia.value) return ""; 
     1067        case "all": 
     1068          return cssText; 
     1069      } 
     1070      return ""; 
     1071    }; 
     1072    function _simpleMedia(media) { 
     1073      if (ALL.test(media)) return "all"; 
     1074      else if (SCREEN.test(media)) return (PRINT.test(media)) ? "all" : "screen"; 
     1075      else if (PRINT.test(media)) return "print"; 
     1076    }; 
     1077    var self = this; 
     1078    function _getCSSText(styleSheet, path, media, level) { 
     1079      var cssText = ""; 
     1080      if (!level) { 
     1081        media = _simpleMedia(styleSheet.media); 
     1082        level = 0; 
     1083      } 
     1084      if (media == "all" || media == self.media) { 
     1085        // IE only allows importing style sheets three levels deep. 
     1086        // it will crash if you try to access a level below this 
     1087        if (level < 3) { 
     1088          // loop through imported style sheets 
     1089          for (var i = 0; i < styleSheet.imports.length; i++) { 
     1090            // call this function recursively to get all imported style sheets 
     1091            cssText += _getCSSText(styleSheet.imports[i], getPath(styleSheet.href, path), media, level + 1); 
     1092          } 
     1093        } 
     1094        // retrieve inline style or load an external style sheet 
     1095        cssText += encode(styleSheet.href ? _loadStyleSheet(styleSheet, path) : _inlineStyles.pop() || ""); 
     1096        cssText = _parseMedia(cssText, self.media); 
     1097      } 
     1098      return cssText; 
     1099    }; 
     1100    // store loaded cssText URLs 
     1101    var fileCache = {}; 
     1102    // load an external style sheet 
     1103    function _loadStyleSheet(styleSheet, path) { 
     1104      var url = makePath(styleSheet.href, path); 
     1105      // if the style sheet has already loaded then don't duplicate it 
     1106      if (fileCache[url]) return ""; 
     1107      // load from source 
     1108      fileCache[url] = (styleSheet.disabled) ? "" : 
     1109        _fixUrls(IE7.CSS.getText(styleSheet, path), getPath(styleSheet.href, path)); 
     1110      return fileCache[url]; 
     1111    }; 
     1112    // fix css paths 
     1113    // we're lumping all css text into one big style sheet so relative 
     1114    //  paths have to be fixed. this is necessary anyway because of other 
     1115    //  explorer bugs. 
     1116    var URL = /(url\s*\(\s*['"]?)([\w\.]+[^:\)]*['"]?\))/gi; 
     1117    function _fixUrls(cssText, pathname) { 
     1118      // hack & slash 
     1119      return cssText.replace(URL, "$1" + pathname.slice(0, pathname.lastIndexOf("/") + 1) + "$2"); 
     1120    }; 
     1121 
     1122    // load all style sheets in the document 
     1123    for (var i = 0; i < styleSheets.length; i++) { 
     1124      if (!styleSheets[i].disabled && !styleSheets[i].ie7) { 
     1125        this.cssText += _getCSSText(styleSheets[i]); 
     1126      } 
     1127    } 
     1128  }, 
     1129   
     1130  load: function() { 
     1131    this.cssText = ""; 
     1132    this.getText(); 
     1133    this.parse(); 
     1134    this.cssText = decode(this.cssText); 
     1135    fileCache = {}; 
     1136  }, 
     1137   
     1138  parse: function() { 
     1139    this.cssText = IE7.CSS.parser.exec(this.cssText); 
     1140     
     1141    // parse the style sheet 
     1142    var offset = IE7.CSS.rules.length; 
     1143    var rules = this.cssText.split(BRACE2), rule; 
     1144    var selectors, cssText, i, j; 
     1145    for (i = 0; i < rules.length; i++) { 
     1146      rule = rules[i].split(BRACE1); 
     1147      selectors = rule[0].split(COMMA); 
     1148      cssText = rule[1]; 
     1149      for (j = 0; j < selectors.length; j++) { 
     1150        selectors[j] = cssText ? this.createRule(selectors[j], cssText) : ""; 
     1151      } 
     1152      rules[i] = selectors.join("\n"); 
     1153    } 
     1154    this.cssText = rules.join("\n"); 
     1155    this.rules = IE7.CSS.rules.slice(offset); 
     1156  }, 
     1157   
     1158  recalc: function() { 
     1159    var rule, i; 
     1160    for (i = 0; (rule = this.rules[i]); i++) rule.recalc(); 
     1161  }, 
     1162   
     1163  toString: function() { 
     1164    return "@media " + this.media + "{" + this.cssText + "}"; 
     1165  } 
     1166}); 
     1167 
     1168var PseudoElement; 
     1169 
     1170// ----------------------------------------------------------------------- 
     1171// IE7 style rules 
     1172// ----------------------------------------------------------------------- 
     1173 
     1174var Rule = IE7.Rule = Base.extend({ 
     1175  // properties 
     1176  constructor: function(selector, cssText) { 
     1177    this.id = IE7.CSS.rules.length; 
     1178    this.className = Rule.PREFIX + this.id; 
     1179    selector = selector.match(FIRST_LINE_LETTER) || selector || "*"; 
     1180    this.selector = selector[1] || selector; 
     1181    this.selectorText = this.parse(this.selector) + (selector[2] || ""); 
     1182    this.cssText = cssText; 
     1183    this.MATCH = new RegExp("\\s" + this.className + "(\\s|$)", "g"); 
     1184    IE7.CSS.rules.push(this); 
     1185    this.init(); 
     1186  }, 
     1187   
     1188  init: Undefined, 
     1189   
     1190  add: function(element) { 
     1191    // allocate this class 
     1192    element.className += " " + this.className; 
     1193  }, 
     1194   
     1195  recalc: function() { 
     1196    // execute the underlying css query for this class 
     1197    var match = cssQuery(this.selector); 
     1198    // add the class name for all matching elements 
     1199    for (var i = 0; i < match.length; i++) this.add(match[i]); 
     1200  }, 
     1201 
     1202  parse: function(selector) { 
     1203    // attempt to preserve specificity for "loose" parsing by 
     1204    //  removing unknown tokens from a css selector but keep as 
     1205    //  much as we can.. 
     1206    var simple = selector.replace(Rule.CHILD, " ").replace(Rule.COMPLEX, ""); 
     1207    if (appVersion < 7) simple = simple.replace(Rule.MULTI, ""); 
     1208    var tags = match(simple, Rule.TAGS).length - match(selector, Rule.TAGS).length; 
     1209    var classes = match(simple, Rule.CLASSES).length - match(selector, Rule.CLASSES).length + 1; 
     1210    while (classes > 0 && Rule.CLASS.test(simple)) { 
     1211      simple = simple.replace(Rule.CLASS, ""); 
     1212      classes--; 
     1213    } 
     1214    while (tags > 0 && Rule.TAG.test(simple)) { 
     1215      simple = simple.replace(Rule.TAG, "$1*"); 
     1216      tags--; 
     1217    } 
     1218    simple += "." + this.className; 
     1219    classes = Math.min(classes, 2); 
     1220    tags = Math.min(tags, 2); 
     1221    var score = -10 * classes - tags; 
     1222    if (score > 0) { 
     1223      simple = simple + "," + Rule.MAP[score] + " " + simple; 
     1224    } 
     1225    return simple; 
     1226  }, 
     1227   
     1228  remove: function(element) { 
     1229    // deallocate this class 
     1230    element.className = element.className.replace(this.MATCH, "$1"); 
     1231  }, 
     1232   
     1233  toString: function() { 
     1234    return format("%1 {%2}", this.selectorText, this.cssText); 
     1235  } 
     1236}, { 
     1237  CHILD: />/g, 
     1238  CLASS: /\.[\w-]+/, 
     1239  CLASSES: /[.:\[]/g, 
     1240  MULTI: /(\.[\w-]+)+/g, 
     1241  PREFIX: "ie7_class", 
     1242  TAG: /^\w+|([\s>+~])\w+/, 
     1243  TAGS: /^\w|[\s>+~]\w/g, 
     1244  MAP: { 
     1245    1:  "html", 
     1246    2:  "html body", 
     1247    10: ".ie7_html", 
     1248    11: "html.ie7_html", 
     1249    12: "html.ie7_html body", 
     1250    20: ".ie7_html .ie7_body", 
     1251    21: "html.ie7_html .ie7_body", 
     1252    22: "html.ie7_html body.ie7_body" 
     1253  } 
     1254}); 
     1255 
     1256// ----------------------------------------------------------------------- 
     1257// IE7 dynamic style 
     1258// ----------------------------------------------------------------------- 
     1259 
     1260// object properties: 
     1261// attach: the element that an event handler will be attached to 
     1262// target: the element that will have the IE7 class applied 
     1263 
     1264var DynamicRule = Rule.extend({ 
     1265  // properties 
     1266  constructor: function(selector, attach, dynamicPseudoClass, target, cssText) { 
     1267    // initialise object properties 
     1268    this.attach = attach || "*"; 
     1269    this.dynamicPseudoClass = IE7.CSS.dynamicPseudoClasses[dynamicPseudoClass]; 
     1270    this.target = target; 
     1271    this.base(selector, cssText); 
     1272  }, 
     1273   
     1274  recalc: function() { 
     1275    // execute the underlying css query for this class 
     1276    var attaches = cssQuery(this.attach), attach; 
     1277    // process results 
     1278    for (var i = 0; attach = attaches[i]; i++) { 
     1279      // retrieve the event handler's target element(s) 
     1280      var target = this.target ? cssQuery(this.target, attach) : [attach]; 
     1281      // attach event handlers for dynamic pseudo-classes 
     1282      if (target.length) this.dynamicPseudoClass.apply(attach, target, this); 
     1283    } 
     1284  } 
     1285}); 
     1286 
     1287// ----------------------------------------------------------------------- 
     1288//  IE7 dynamic pseudo-classes 
     1289// ----------------------------------------------------------------------- 
     1290 
     1291var DynamicPseudoClass = Base.extend({ 
     1292  constructor: function(name, apply) { 
     1293    this.name = name; 
     1294    this.apply = apply; 
     1295    this.instances = {}; 
     1296    IE7.CSS.dynamicPseudoClasses[name] = this; 
     1297  }, 
     1298   
     1299  register: function(instance) { 
     1300    // an "instance" is actually an Arguments object 
     1301    var _class = instance[2]; 
     1302    instance.id = _class.id + instance[0].uniqueID; 
     1303    if (!this.instances[instance.id]) { 
     1304      var target = instance[1], j; 
     1305      for (j = 0; j < target.length; j++) _class.add(target[j]); 
     1306      this.instances[instance.id] = instance; 
     1307    } 
     1308  }, 
     1309   
     1310  unregister: function(instance) { 
     1311    if (this.instances[instance.id]) { 
     1312      var _class = instance[2]; 
     1313      var target = instance[1], j; 
     1314      for (j = 0; j < target.length; j++) _class.remove(target[j]); 
     1315      delete this.instances[instance.id]; 
     1316    } 
     1317  } 
     1318}); 
     1319   
     1320// ----------------------------------------------------------------------- 
     1321// dynamic pseudo-classes 
     1322// ----------------------------------------------------------------------- 
     1323 
     1324if (appVersion < 7) { 
     1325  var Hover = new DynamicPseudoClass("hover", function(element) { 
     1326    var instance = arguments; 
     1327    IE7.CSS.addEventHandler(element, appVersion < 5.5 ? "onmouseover" : "onmouseenter", function() { 
     1328      Hover.register(instance); 
     1329    }); 
     1330    IE7.CSS.addEventHandler(element, appVersion < 5.5 ? "onmouseout" : "onmouseleave", function() { 
     1331      Hover.unregister(instance); 
     1332    }); 
     1333  }); 
     1334   
     1335  // globally trap the mouseup event (thanks Martijn!) 
     1336  addEventHandler(document, "onmouseup", function() { 
     1337    var instances = Hover.instances; 
     1338    for (var i in instances) 
     1339      if (!instances[i][0].contains(event.srcElement)) 
     1340        Hover.unregister(instances[i]); 
     1341  }); 
     1342} 
     1343 
     1344// ----------------------------------------------------------------------- 
     1345// propertyName: inherit; 
     1346// ----------------------------------------------------------------------- 
     1347 
     1348IE7.CSS.addRecalc("[\\w-]+", "inherit", function(element, cssText) { 
     1349  var inherited = cssText.match(/[\w-]+\s*:\s*inherit/g); 
     1350  for (var i = 0; i < inherited.length; i++) { 
     1351    var propertyName = inherited[i].replace(/ie7\-|\s*:\s*inherit/g, "").replace(/\-([a-z])/g, function(match, chr) { 
     1352      return chr.toUpperCase() 
     1353    }); 
     1354    element.runtimeStyle[propertyName] = element.parentElement.currentStyle[propertyName]; 
     1355  } 
     1356}); 
     1357 
     1358// ========================================================================= 
     1359// ie7-html.js 
     1360// ========================================================================= 
     1361 
     1362// default font-sizes 
     1363//HEADER += "h1{font-size:2em}h2{font-size:1.5em;}h3{font-size:1.17em;}h4{font-size:1em}h5{font-size:.83em}h6{font-size:.67em}"; 
     1364 
     1365IE7.HTML = new (Fix.extend({ // single instance   
     1366  fixed: {}, 
     1367   
     1368  init: Undefined, 
     1369   
     1370  addFix: function() { 
     1371    // fixes are a one-off, they are applied when the document is loaded 
     1372    this.fixes.push(arguments); 
     1373  }, 
     1374   
     1375  apply: function() { 
     1376    for (var i = 0; i < this.fixes.length; i++) { 
     1377      var match = cssQuery(this.fixes[i][0]); 
     1378      var fix = this.fixes[i][1]; 
     1379      for (var j = 0; j < match.length; j++) fix(match[j]); 
     1380    } 
     1381  }, 
     1382   
     1383  addRecalc: function() { 
     1384    // recalcs occur whenever the document is refreshed using document.recalc() 
     1385    this.recalcs.push(arguments); 
     1386  }, 
     1387   
     1388  recalc: function() { 
     1389    // loop through the fixes 
     1390    for (var i = 0; i < this.recalcs.length; i++) { 
     1391      var match = cssQuery(this.recalcs[i][0]); 
     1392      var recalc = this.recalcs[i][1], element; 
     1393      var key = Math.pow(2, i); 
     1394      for (var j = 0; (element = match[j]); j++) { 
     1395        var uniqueID = element.uniqueID; 
     1396        if ((this.fixed[uniqueID] & key) == 0) { 
     1397          element = recalc(element) || element; 
     1398          this.fixed[uniqueID] |= key; 
     1399        } 
     1400      } 
     1401    } 
     1402  } 
     1403})); 
     1404 
     1405if (appVersion < 7) {   
     1406  // provide support for the <abbr> tag. 
     1407  //  this is a proper fix, it preserves the DOM structure and 
     1408  //  <abbr> elements report the correct tagName & namespace prefix 
     1409  document.createElement("abbr"); 
     1410   
     1411  // bind to the first child control 
     1412  IE7.HTML.addRecalc("label", function(label) { 
     1413    if (!label.htmlFor) { 
     1414      var firstChildControl = cssQuery("input,textarea", label, true); 
     1415      if (firstChildControl) { 
     1416        addEventHandler(label, "onclick", function() { 
     1417          firstChildControl.click(); 
     1418        }); 
     1419      } 
     1420    } 
     1421  }); 
     1422} 
     1423 
     1424// ========================================================================= 
     1425// ie7-layout.js 
     1426// ========================================================================= 
     1427 
     1428var NUMERIC = "[.\\d]"; 
     1429 
     1430new function(_) { 
     1431var layout = IE7.Layout = this; 
     1432 
     1433  // big, ugly box-model hack + min/max stuff 
     1434   
     1435  // #tantek > #erik > #dean { voice-family: hacker; } 
     1436   
     1437  // ----------------------------------------------------------------------- 
     1438  // "layout" 
     1439  // ----------------------------------------------------------------------- 
     1440   
     1441  HEADER += "*{boxSizing:content-box}"; 
     1442   
     1443  // does an element have "layout" ? 
     1444  IE7.hasLayout = appVersion < 5.5 ? function(element) { 
     1445    // element.currentStyle.hasLayout doesn't work for IE5.0 
     1446    return element.clientWidth; 
     1447  } : function(element) { 
     1448    return element.currentStyle.hasLayout; 
     1449  }; 
     1450   
     1451  // give an element "layout" 
     1452  layout.boxSizing = function(element) { 
     1453    if (!IE7.hasLayout(element)) { 
     1454    //#  element.runtimeStyle.fixedHeight = 
     1455      element.style.height = "0cm"; 
     1456      if (element.currentStyle.verticalAlign == "auto") 
     1457        element.runtimeStyle.verticalAlign = "top"; 
     1458      // when an element acquires "layout", margins no longer collapse correctly 
     1459      collapseMargins(element); 
     1460    } 
     1461  }; 
     1462   
     1463  // ----------------------------------------------------------------------- 
     1464  // Margin Collapse 
     1465  // ----------------------------------------------------------------------- 
     1466   
     1467  function collapseMargins(element) { 
     1468    if (element != viewport && element.currentStyle.position != "absolute") { 
     1469      collapseMargin(element, "marginTop"); 
     1470      collapseMargin(element, "marginBottom"); 
     1471    } 
     1472  }; 
     1473   
     1474  function collapseMargin(element, type) { 
     1475    if (!element.runtimeStyle[type]) { 
     1476      var parentElement = element.parentElement; 
     1477      if (parentElement && IE7.hasLayout(parentElement) && !IE7[type == "marginTop" ? "_getPreviousElementSibling" : "_getNextElementSibling"](element)) return; 
     1478      var child = cssQuery(">*:" + (type == "marginTop" ? "first" : "last") + "-child", element, true); 
     1479      if (child && child.currentStyle.styleFloat == "none" && IE7.hasLayout(child)) { 
     1480        collapseMargin(child, type); 
     1481        margin = _getMargin(element, element.currentStyle[type]); 
     1482        childMargin = _getMargin(child, child.currentStyle[type]); 
     1483        if (margin < 0 || childMargin < 0) { 
     1484          element.runtimeStyle[type] = margin + childMargin; 
     1485        } else { 
     1486          element.runtimeStyle[type] = Math.max(childMargin, margin); 
     1487        } 
     1488        child.runtimeStyle[type] = "0px"; 
     1489      } 
     1490    } 
     1491  }; 
     1492   
     1493  function _getMargin(element, value) { 
     1494    return value == "auto" ? 0 : getPixelValue(element, value); 
     1495  }; 
     1496   
     1497  // ----------------------------------------------------------------------- 
     1498  // box-model 
     1499  // ----------------------------------------------------------------------- 
     1500   
     1501  // constants 
     1502  var UNIT = /^[.\d][\w%]*$/, AUTO = /^(auto|0cm)$/; 
     1503   
     1504  var applyWidth, applyHeight; 
     1505  IE7.Layout.borderBox = function(element){ 
     1506    applyWidth(element); 
     1507    applyHeight(element); 
     1508  }; 
     1509   
     1510  var fixWidth = function(HEIGHT) { 
     1511    applyWidth = function(element) { 
     1512      if (!PERCENT.test(element.currentStyle.width)) fixWidth(element); 
     1513      collapseMargins(element); 
     1514    }; 
     1515   
     1516    function fixWidth(element, value) { 
     1517      if (!element.runtimeStyle.fixedWidth) { 
     1518        if (!value) value = element.currentStyle.width; 
     1519        element.runtimeStyle.fixedWidth = (UNIT.test(value)) ? Math.max(0, getFixedWidth(element, value)) : value; 
     1520        setOverrideStyle(element, "width", element.runtimeStyle.fixedWidth); 
     1521      } 
     1522    }; 
     1523   
     1524    function layoutWidth(element) { 
     1525      if (!isFixed(element)) { 
     1526        var layoutParent = element.offsetParent; 
     1527        while (layoutParent && !IE7.hasLayout(layoutParent)) layoutParent = layoutParent.offsetParent; 
     1528      } 
     1529      return (layoutParent || viewport).clientWidth; 
     1530    }; 
     1531   
     1532    function getPixelWidth(element, value) { 
     1533      if (PERCENT.test(value)) return parseInt(parseFloat(value) / 100 * layoutWidth(element)); 
     1534      return getPixelValue(element, value); 
     1535    }; 
     1536   
     1537    var getFixedWidth = function(element, value) { 
     1538      var borderBox = element.currentStyle["box-sizing"] == "border-box"; 
     1539      var adjustment = 0; 
     1540      if (quirksMode && !borderBox) 
     1541        adjustment += getBorderWidth(element) + getWidth(element, "padding"); 
     1542      else if (!quirksMode && borderBox) 
     1543        adjustment -= getBorderWidth(element) + getWidth(element, "padding"); 
     1544      return getPixelWidth(element, value) + adjustment; 
     1545    }; 
     1546   
     1547    // easy way to get border thickness for elements with "layout" 
     1548    function getBorderWidth(element) { 
     1549      return element.offsetWidth - element.clientWidth; 
     1550    }; 
     1551   
     1552    // have to do some pixel conversion to get padding/margin thickness :-( 
     1553    function getWidth(element, type) { 
     1554      return getPixelWidth(element, element.currentStyle[type + "Left"]) + getPixelWidth(element, element.currentStyle[type + "Right"]); 
     1555    }; 
     1556   
     1557    // ----------------------------------------------------------------------- 
     1558    // min/max 
     1559    // ----------------------------------------------------------------------- 
     1560   
     1561    HEADER += "*{minWidth:none;maxWidth:none;min-width:none;max-width:none}"; 
     1562   
     1563    // handle min-width property 
     1564    layout.minWidth = function(element) { 
     1565      // IE6 supports min-height so we frig it here 
     1566      //#if (element.currentStyle.minHeight == "auto") element.runtimeStyle.minHeight = 0; 
     1567      if (element.currentStyle["min-width"] != null) { 
     1568        element.style.minWidth = element.currentStyle["min-width"]; 
     1569      } 
     1570      if (register(arguments.callee, element, element.currentStyle.minWidth != "none")) { 
     1571        layout.boxSizing(element); 
     1572        fixWidth(element); 
     1573        resizeWidth(element); 
     1574      } 
     1575    }; 
     1576     
     1577    // clone the minWidth function to make a maxWidth function 
     1578    eval("IE7.Layout.maxWidth=" + String(layout.minWidth).replace(/min/g, "max")); 
     1579     
     1580    // apply min/max restrictions 
     1581    function resizeWidth(element) { 
     1582      // check boundaries 
     1583      var rect = element.getBoundingClientRect(); 
     1584      var width = rect.right - rect.left; 
     1585   
     1586      if (element.currentStyle.minWidth != "none" && width <= getFixedWidth(element, element.currentStyle.minWidth)) { 
     1587        element.runtimeStyle.width = element.currentStyle.minWidth; 
     1588      } else if (element.currentStyle.maxWidth != "none" && width >= getFixedWidth(element, element.currentStyle.maxWidth)) { 
     1589        element.runtimeStyle.width = element.currentStyle.maxWidth; 
     1590      } else { 
     1591        element.runtimeStyle.width = element.runtimeStyle.fixedWidth; // || "auto"; 
     1592      } 
     1593    }; 
     1594   
     1595    // ----------------------------------------------------------------------- 
     1596    // right/bottom 
     1597    // ----------------------------------------------------------------------- 
     1598   
     1599    function fixRight(element) { 
     1600      if (register(fixRight, element, /^(fixed|absolute)$/.test(element.currentStyle.position) && 
     1601        getDefinedStyle(element, "left") != "auto" && 
     1602        getDefinedStyle(element, "right") != "auto" && 
     1603        AUTO.test(getDefinedStyle(element, "width")))) { 
     1604          resizeRight(element); 
     1605          IE7.Layout.boxSizing(element); 
     1606      } 
     1607    }; 
     1608    IE7.Layout.fixRight = fixRight; 
     1609   
     1610    function resizeRight(element) { 
     1611      var left = getPixelWidth(element, element.runtimeStyle._left || element.currentStyle.left); 
     1612      var width = layoutWidth(element) - getPixelWidth(element, element.currentStyle.right) -  left - getWidth(element, "margin"); 
     1613      if (parseInt(element.runtimeStyle.width) == width) return; 
     1614      element.runtimeStyle.width = ""; 
     1615      if (isFixed(element) || HEIGHT || element.offsetWidth < width) { 
     1616        if (!quirksMode) width -= getBorderWidth(element) + getWidth(element, "padding"); 
     1617        if (width < 0) width = 0; 
     1618        element.runtimeStyle.fixedWidth = width; 
     1619        setOverrideStyle(element, "width", width); 
     1620      } 
     1621    }; 
     1622   
     1623  // ----------------------------------------------------------------------- 
     1624  // window.onresize 
     1625  // ----------------------------------------------------------------------- 
     1626   
     1627    // handle window resize 
     1628    var clientWidth = 0; 
     1629    addResize(function() { 
     1630      if (!viewport) return; 
     1631      var i, wider = (clientWidth < viewport.clientWidth); 
     1632      clientWidth = viewport.clientWidth; 
     1633      // resize elements with "min-width" set 
     1634      var elements = layout.minWidth.elements; 
     1635      for (i in elements) { 
     1636        var element = elements[i]; 
     1637        var fixedWidth = (parseInt(element.runtimeStyle.width) == getFixedWidth(element, element.currentStyle.minWidth)); 
     1638        if (wider && fixedWidth) element.runtimeStyle.width = ""; 
     1639        if (wider == fixedWidth) resizeWidth(element); 
     1640      } 
     1641      // resize elements with "max-width" set 
     1642      var elements = layout.maxWidth.elements; 
     1643      for (i in elements) { 
     1644        var element = elements[i]; 
     1645        var fixedWidth = (parseInt(element.runtimeStyle.width) == getFixedWidth(element, element.currentStyle.maxWidth)); 
     1646        if (!wider && fixedWidth) element.runtimeStyle.width = ""; 
     1647        if (wider != fixedWidth) resizeWidth(element); 
     1648      } 
     1649      // resize elements with "right" set 
     1650      for (i in fixRight.elements) resizeRight(fixRight.elements[i]); 
     1651    }); 
     1652   
     1653  // ----------------------------------------------------------------------- 
     1654  // fix CSS 
     1655  // ----------------------------------------------------------------------- 
     1656    if (quirksMode) { 
     1657      IE7.CSS.addRecalc("width", NUMERIC, applyWidth); 
     1658    } 
     1659    if (appVersion < 7) { 
     1660      IE7.CSS.addRecalc("min-width", NUMERIC, layout.minWidth); 
     1661      IE7.CSS.addRecalc("max-width", NUMERIC, layout.maxWidth); 
     1662      IE7.CSS.addRecalc("right", NUMERIC, fixRight); 
     1663    } 
     1664  }; 
     1665   
     1666  eval("var fixHeight=" + rotate(fixWidth)); 
     1667   
     1668  // apply box-model + min/max fixes 
     1669  fixWidth(); 
     1670  fixHeight(true); 
     1671}; 
     1672 
     1673// ========================================================================= 
     1674// ie7-graphics.js 
     1675// ========================================================================= 
     1676 
     1677// a small transparent image used as a placeholder 
     1678var BLANK_GIF = makePath("blank.gif", path); 
     1679 
     1680var ALPHA_IMAGE_LOADER = "DXImageTransform.Microsoft.AlphaImageLoader"; 
     1681var PNG_FILTER = "progid:" + ALPHA_IMAGE_LOADER + "(src='%1',sizingMethod='%2')"; 
     1682   
     1683// regular expression version of the above 
     1684var PNG; 
     1685 
     1686var filtered = []; 
     1687 
     1688function fixImage(element) { 
     1689  if (PNG.test(element.src)) { 
     1690    // we have to preserve width and height 
     1691    var image = new Image(element.width, element.height); 
     1692    image.onload = function() { 
     1693      element.width = image.width; 
     1694      element.height = image.height; 
     1695      image = null; 
     1696    }; 
     1697    image.src = element.src; 
     1698    // store the original url (we'll put it back when it's printed) 
     1699    element.pngSrc = element.src; 
     1700    // add the AlphaImageLoader thingy 
     1701    addFilter(element); 
     1702  } 
     1703}; 
     1704 
     1705if (appVersion >= 5.5 && appVersion < 7) { 
     1706  // ** IE7 VARIABLE 
     1707  // e.g. only apply the hack to files ending in ".png" 
     1708  // IE7_PNG_SUFFIX = ".png"; 
     1709 
     1710  // replace background(-image): url(..) ..  with background(-image): .. ;filter: ..; 
     1711  IE7.CSS.addFix(/background(-image)?\s*:\s*([^};]*)?url\(([^\)]+)\)([^;}]*)?/, function(match, $1, $2, url, $4) { 
     1712    url = getString(url); 
     1713    return PNG.test(url) ? "filter:" + format(PNG_FILTER, url, "crop") + 
     1714      ";zoom:1;background" + ($1||"") + ":" + ($2||"") + "none" + ($4||"") : match; 
     1715  }); 
     1716   
     1717  // ----------------------------------------------------------------------- 
     1718  //  fix PNG transparency (HTML images) 
     1719  // ----------------------------------------------------------------------- 
     1720 
     1721  IE7.HTML.addRecalc("img,input", function(element) { 
     1722    if (element.tagName == "INPUT" && element.type != "image") return; 
     1723    fixImage(element); 
     1724    addEventHandler(element, "onpropertychange", function() { 
     1725      if (!printing && event.propertyName == "src" && 
     1726        element.src.indexOf(BLANK_GIF) == -1) fixImage(element); 
     1727    }); 
     1728  }); 
     1729 
     1730  // assume that background images should not be printed 
     1731  //  (if they are not transparent then they'll just obscure content) 
     1732  // but we'll put foreground images back... 
     1733  var printing = false; 
     1734  addEventHandler(window, "onbeforeprint", function() { 
     1735    printing = true; 
     1736    for (var i = 0; i < filtered.length; i++) removeFilter(filtered[i]); 
     1737  }); 
     1738  addEventHandler(window, "onafterprint", function() { 
     1739    for (var i = 0; i < filtered.length; i++) addFilter(filtered[i]); 
     1740    printing = false; 
     1741  }); 
     1742} 
     1743 
     1744// apply a filter 
     1745function addFilter(element, sizingMethod) { 
     1746  var filter = element.filters[ALPHA_IMAGE_LOADER]; 
     1747  if (filter) { 
     1748    filter.src = element.src; 
     1749    filter.enabled = true; 
     1750  } else { 
     1751    element.runtimeStyle.filter = format(PNG_FILTER, element.src, sizingMethod || "scale"); 
     1752    filtered.push(element); 
     1753  } 
     1754  // remove the real image 
     1755  element.src = BLANK_GIF; 
     1756}; 
     1757 
     1758function removeFilter(element) { 
     1759  element.src = element.pngSrc; 
     1760  element.filters[ALPHA_IMAGE_LOADER].enabled = false; 
     1761}; 
     1762 
     1763// ========================================================================= 
     1764// ie7-fixed.js 
     1765// ========================================================================= 
     1766 
     1767new function(_) { 
     1768  if (appVersion >= 7) return; 
     1769   
     1770  // some things to consider for this hack. 
     1771  // the document body requires a fixed background. even if 
     1772  //  it is just a blank image. 
     1773  // you have to use setExpression instead of onscroll, this 
     1774  //  together with a fixed body background helps avoid the 
     1775  //  annoying screen flicker of other solutions. 
     1776   
     1777  IE7.CSS.addRecalc("position", "fixed", _positionFixed, "absolute"); 
     1778  IE7.CSS.addRecalc("background(-attachment)?", "[^};]*fixed", _backgroundFixed); 
     1779   
     1780  // scrolling is relative to the documentElement (HTML tag) when in 
     1781  //  standards mode, otherwise it's relative to the document body 
     1782  var $viewport = quirksMode ? "body" : "documentElement"; 
     1783   
     1784  function _fixBackground() { 
     1785    // this is required by both position:fixed and background-attachment:fixed. 
     1786    // it is necessary for the document to also have a fixed background image. 
     1787    // we can fake this with a blank image if necessary 
     1788    if (body.currentStyle.backgroundAttachment != "fixed") { 
     1789      if (body.currentStyle.backgroundImage == "none") { 
     1790        body.runtimeStyle.backgroundRepeat = "no-repeat"; 
     1791        body.runtimeStyle.backgroundImage = "url(" + BLANK_GIF + ")"; // dummy 
     1792      } 
     1793      body.runtimeStyle.backgroundAttachment = "fixed"; 
     1794    } 
     1795    _fixBackground = Undefined; 
     1796  }; 
     1797   
     1798  var _tmp = createTempElement("img"); 
     1799   
     1800  function _isFixed(element) { 
     1801    return element ? isFixed(element) || _isFixed(element.parentElement) : false; 
     1802  }; 
     1803   
     1804  function _setExpression(element, propertyName, expression) { 
     1805    setTimeout("document.all." + element.uniqueID + ".runtimeStyle.setExpression('" + propertyName + "','" + expression + "')", 0); 
     1806  }; 
     1807   
     1808  // ----------------------------------------------------------------------- 
     1809  //  backgroundAttachment: fixed 
     1810  // ----------------------------------------------------------------------- 
     1811   
     1812  function _backgroundFixed(element) { 
     1813    if (register(_backgroundFixed, element, element.currentStyle.backgroundAttachment == "fixed" && !element.contains(body))) { 
     1814      _fixBackground(); 
     1815      bgLeft(element); 
     1816      bgTop(element); 
     1817      _backgroundPosition(element); 
     1818    } 
     1819  }; 
     1820   
     1821  function _backgroundPosition(element) { 
     1822    _tmp.src = element.currentStyle.backgroundImage.slice(5, -2); 
     1823    var parentElement = element.canHaveChildren ? element : element.parentElement; 
     1824    parentElement.appendChild(_tmp); 
     1825    setOffsetLeft(element); 
     1826    setOffsetTop(element); 
     1827    parentElement.removeChild(_tmp); 
     1828  }; 
     1829   
     1830  function bgLeft(element) { 
     1831    element.style.backgroundPositionX = element.currentStyle.backgroundPositionX; 
     1832    if (!_isFixed(element)) { 
     1833      _setExpression(element, "backgroundPositionX", "(parseInt(runtimeStyle.offsetLeft)+document." + $viewport + ".scrollLeft)||0"); 
     1834    } 
     1835  }; 
     1836  eval(rotate(bgLeft)); 
     1837   
     1838  function setOffsetLeft(element) { 
     1839    var propertyName = _isFixed(element) ? "backgroundPositionX" : "offsetLeft"; 
     1840    element.runtimeStyle[propertyName] = 
     1841      getOffsetLeft(element, element.style.backgroundPositionX) - 
     1842      element.getBoundingClientRect().left - element.clientLeft + 2; 
     1843  }; 
     1844  eval(rotate(setOffsetLeft)); 
     1845   
     1846  function getOffsetLeft(element, position) { 
     1847    switch (position) { 
     1848      case "left": 
     1849      case "top": 
     1850        return 0; 
     1851      case "right": 
     1852      case "bottom": 
     1853        return viewport.clientWidth - _tmp.offsetWidth; 
     1854      case "center": 
     1855        return (viewport.clientWidth - _tmp.offsetWidth) / 2; 
     1856      default: 
     1857        if (PERCENT.test(position)) { 
     1858          return parseInt((viewport.clientWidth - _tmp.offsetWidth) * parseFloat(position) / 100); 
     1859        } 
     1860        _tmp.style.left = position; 
     1861        return _tmp.offsetLeft; 
     1862    } 
     1863  }; 
     1864  eval(rotate(getOffsetLeft)); 
     1865   
     1866  // ----------------------------------------------------------------------- 
     1867  //  position: fixed 
     1868  // ----------------------------------------------------------------------- 
     1869   
     1870  function _positionFixed(element) { 
     1871    if (register(_positionFixed, element, isFixed(element))) { 
     1872      setOverrideStyle(element, "position",  "absolute"); 
     1873      setOverrideStyle(element, "left",  element.currentStyle.left); 
     1874      setOverrideStyle(element, "top",  element.currentStyle.top); 
     1875      _fixBackground(); 
     1876      IE7.Layout.fixRight(element); 
     1877      _foregroundPosition(element); 
     1878    } 
     1879  }; 
     1880   
     1881  function _foregroundPosition(element, recalc) { 
     1882    positionTop(element, recalc); 
     1883    positionLeft(element, recalc, true); 
     1884    if (!element.runtimeStyle.autoLeft && element.currentStyle.marginLeft == "auto" && 
     1885      element.currentStyle.right != "auto") { 
     1886      var left = viewport.clientWidth - getPixelWidth(element, element.currentStyle.right) - 
     1887        getPixelWidth(element, element.runtimeStyle._left) - element.clientWidth; 
     1888      if (element.currentStyle.marginRight == "auto") left = parseInt(left / 2); 
     1889      if (_isFixed(element.offsetParent)) element.runtimeStyle.pixelLeft += left; 
     1890      else element.runtimeStyle.shiftLeft = left; 
     1891    } 
     1892    clipWidth(element); 
     1893    clipHeight(element); 
     1894  }; 
     1895 
     1896  function clipWidth(element) { 
     1897    var fixWidth = element.runtimeStyle.fixWidth; 
     1898    element.runtimeStyle.borderRightWidth = ""; 
     1899    element.runtimeStyle.width = fixWidth ? getPixelWidth(element, fixWidth) : ""; 
     1900    if (element.currentStyle.width != "auto") { 
     1901      var rect = element.getBoundingClientRect(); 
     1902      var width = element.offsetWidth - viewport.clientWidth + rect.left - 2; 
     1903      if (width >= 0) { 
     1904        element.runtimeStyle.borderRightWidth = "0px"; 
     1905        width = Math.max(getPixelValue(element, element.currentStyle.width) - width, 0); 
     1906        setOverrideStyle(element, "width",  width); 
     1907        return width; 
     1908      } 
     1909    } 
     1910  }; 
     1911  eval(rotate(clipWidth)); 
     1912   
     1913  function positionLeft(element, recalc) { 
     1914    // if the element's width is in % units then it must be recalculated 
     1915    //  with respect to the viewport 
     1916    if (!recalc && PERCENT.test(element.currentStyle.width)) { 
     1917      element.runtimeStyle.fixWidth = element.currentStyle.width; 
     1918    } 
     1919    if (element.runtimeStyle.fixWidth) { 
     1920      element.runtimeStyle.width = getPixelWidth(element, element.runtimeStyle.fixWidth); 
     1921    } 
     1922    //if (recalc) { 
     1923    //  // if the element is fixed on the right then no need to recalculate 
     1924    //  if (!element.runtimeStyle.autoLeft) return; 
     1925    //} else { 
     1926      element.runtimeStyle.shiftLeft = 0; 
     1927      element.runtimeStyle._left = element.currentStyle.left; 
     1928      // is the element fixed on the right? 
     1929      element.runtimeStyle.autoLeft = element.currentStyle.right != "auto" && 
     1930        element.currentStyle.left == "auto"; 
     1931    //} 
     1932    // reset the element's "left" value and get it's natural position 
     1933    element.runtimeStyle.left = ""; 
     1934    element.runtimeStyle.screenLeft = getScreenLeft(element); 
     1935    element.runtimeStyle.pixelLeft = element.runtimeStyle.screenLeft; 
     1936    // if the element is contained by another fixed element then there is no need to 
     1937    //  continually recalculate it's left position 
     1938    if (!recalc && !_isFixed(element.offsetParent)) { 
     1939      // onsrcoll produces jerky movement, so we use an expression 
     1940      _setExpression(element, "pixelLeft", "runtimeStyle.screenLeft+runtimeStyle.shiftLeft+document." + $viewport + ".scrollLeft"); 
     1941    } 
     1942  }; 
     1943  // clone this function so we can do "top" 
     1944  eval(rotate(positionLeft)); 
     1945   
     1946  // I've forgotten how this works... 
     1947  function getScreenLeft(element) { // thanks to kevin newman (captainn) 
     1948    var screenLeft = element.offsetLeft, nested = 1; 
     1949    if (element.runtimeStyle.autoLeft) { 
     1950      screenLeft = viewport.clientWidth - element.offsetWidth - getPixelWidth(element, element.currentStyle.right); 
     1951    } 
     1952    // accommodate margins 
     1953    if (element.currentStyle.marginLeft != "auto") { 
     1954      screenLeft -= getPixelWidth(element, element.currentStyle.marginLeft); 
     1955    } 
     1956    while (element = element.offsetParent) { 
     1957      if (element.currentStyle.position != "static") nested = -1; 
     1958      screenLeft += element.offsetLeft * nested; 
     1959    } 
     1960    return screenLeft; 
     1961  }; 
     1962  eval(rotate(getScreenLeft)); 
     1963   
     1964  function getPixelWidth(element, value) { 
     1965    return PERCENT.test(value) ? parseInt(parseFloat(value) / 100 * viewport.clientWidth) : getPixelValue(element, value); 
     1966  }; 
     1967  eval(rotate(getPixelWidth)); 
     1968   
     1969  // ----------------------------------------------------------------------- 
     1970  //  capture window resize 
     1971  // ----------------------------------------------------------------------- 
     1972   
     1973  function _resize() { 
     1974    // if the window has been resized then some positions need to be 
     1975    //  recalculated (especially those aligned to "right" or "top" 
     1976    var elements = _backgroundFixed.elements; 
     1977    for (var i in elements) _backgroundPosition(elements[i]); 
     1978    elements = _positionFixed.elements; 
     1979    for (i in elements) { 
     1980      _foregroundPosition(elements[i], true); 
     1981      // do this twice to be sure - hackish, I know :-) 
     1982      _foregroundPosition(elements[i], true); 
     1983    } 
     1984    _timer = 0; 
     1985  }; 
     1986   
     1987  // use a timer for some reason. 
     1988  //  (sometimes this is a good way to prevent resize loops) 
     1989  var _timer; 
     1990  addResize(function() { 
     1991    if (!_timer) _timer = setTimeout(_resize, 0); 
     1992  }); 
     1993}; 
     1994 
     1995// ========================================================================= 
     1996// ie7-oveflow.js 
     1997// ========================================================================= 
     1998 
     1999/* --------------------------------------------------------------------- 
     2000 
     2001  This module alters the structure of the document. 
     2002  It may adversely affect other CSS rules. Be warned. 
     2003 
     2004--------------------------------------------------------------------- */ 
     2005 
     2006var WRAPPER_STYLE = { 
     2007  backgroundColor: "transparent", 
     2008  backgroundImage: "none", 
     2009  backgroundPositionX: null, 
     2010  backgroundPositionY: null, 
     2011  backgroundRepeat: null, 
     2012  borderTopWidth: 0, 
     2013  borderRightWidth: 0, 
     2014  borderBottomWidth: 0, 
     2015  borderLeftStyle: "none", 
     2016  borderTopStyle: "none", 
     2017  borderRightStyle: "none", 
     2018  borderBottomStyle: "none", 
     2019  borderLeftWidth: 0, 
     2020  height: null, 
     2021  marginTop: 0, 
     2022  marginBottom: 0, 
     2023  marginRight: 0, 
     2024  marginLeft: 0, 
     2025  width: "100%" 
     2026}; 
     2027 
     2028IE7.CSS.addRecalc("overflow", "visible", function(element) { 
     2029  // don't do this again 
     2030  if (element.parentNode.ie7_wrapped) return; 
     2031 
     2032  // if max-height is applied, makes sure it gets applied first 
     2033  if (IE7.Layout && element.currentStyle["max-height"] != "auto") { 
     2034    IE7.Layout.maxHeight(element); 
     2035  } 
     2036 
     2037  if (element.currentStyle.marginLeft == "auto") element.style.marginLeft = 0; 
     2038  if (element.currentStyle.marginRight == "auto") element.style.marginRight = 0; 
     2039 
     2040  var wrapper = document.createElement(ANON); 
     2041  wrapper.ie7_wrapped = element; 
     2042  for (var propertyName in WRAPPER_STYLE) { 
     2043    wrapper.style[propertyName] = element.currentStyle[propertyName]; 
     2044    if (WRAPPER_STYLE[propertyName] != null) { 
     2045      element.runtimeStyle[propertyName] = WRAPPER_STYLE[propertyName]; 
     2046    } 
     2047  } 
     2048  wrapper.style.display = "block"; 
     2049  wrapper.style.position = "relative"; 
     2050  element.runtimeStyle.position = "absolute"; 
     2051  element.parentNode.insertBefore(wrapper, element); 
     2052  wrapper.appendChild(element); 
     2053}); 
     2054 
     2055// ========================================================================= 
     2056// ie7-quirks.js 
     2057// ========================================================================= 
     2058 
     2059function ie7Quirks() { 
     2060  var FONT_SIZES = "xx-small,x-small,small,medium,large,x-large,xx-large".split(","); 
     2061  for (var i = 0; i < FONT_SIZES.length; i++) { 
     2062    FONT_SIZES[FONT_SIZES[i]] = FONT_SIZES[i - 1] || "0.67em"; 
     2063  } 
     2064   
     2065  IE7.CSS.addFix(/(font(-size)?\s*:\s*)([\w.-]+)/, function(match, label, size, value) { 
     2066    return label + (FONT_SIZES[value] || value); 
     2067  }); 
     2068   
     2069  if (appVersion < 6) { 
     2070    var NEGATIVE = /^\-/, LENGTH = /(em|ex)$/i; 
     2071    var EM = /em$/i, EX = /ex$/i; 
     2072   
     2073    getPixelValue = function(element, value) { 
     2074      if (PIXEL.test(value)) return parseInt(value)||0; 
     2075      var scale = NEGATIVE.test(value)? -1 : 1; 
     2076      if (LENGTH.test(value)) scale *= getFontScale(element); 
     2077      temp.style.width = (scale < 0) ? value.slice(1) : value; 
     2078      body.appendChild(temp); 
     2079      // retrieve pixel width 
     2080      value = scale * temp.offsetWidth; 
     2081      // remove the temporary element 
     2082      temp.removeNode(); 
     2083      return parseInt(value); 
     2084    }; 
     2085 
     2086    var temp = createTempElement(); 
     2087    function getFontScale(element) { 
     2088      var scale = 1; 
     2089      temp.style.fontFamily = element.currentStyle.fontFamily; 
     2090      temp.style.lineHeight = element.currentStyle.lineHeight; 
     2091      //temp.style.fontSize = ""; 
     2092      while (element != body) { 
     2093        var fontSize = element.currentStyle["ie7-font-size"]; 
     2094        if (fontSize) { 
     2095          if (EM.test(fontSize)) scale *= parseFloat(fontSize); 
     2096          else if (PERCENT.test(fontSize)) scale *= (parseFloat(fontSize) / 100); 
     2097          else if (EX.test(fontSize)) scale *= (parseFloat(fontSize) / 2); 
     2098          else { 
     2099            temp.style.fontSize = fontSize; 
     2100            return 1; 
     2101          } 
     2102        } 
     2103        element = element.parentElement; 
     2104      } 
     2105      return scale; 
     2106    }; 
     2107 
     2108    // cursor:pointer (IE5.x) 
     2109    IE7.CSS.addFix(/cursor\s*:\s*pointer/, "cursor:hand"); 
     2110    // display:list-item (IE5.x) 
     2111    IE7.CSS.addFix(/display\s*:\s*list-item/, "display:block"); 
     2112  } 
     2113   
     2114  // ----------------------------------------------------------------------- 
     2115  //  margin:auto 
     2116  // ----------------------------------------------------------------------- 
     2117   
     2118  function fixMargin(element) { 
     2119    if (appVersion < 5.5) IE7.Layout.boxSizing(element.parentElement); 
     2120    var parent = element.parentElement; 
     2121    var margin = parent.offsetWidth - element.offsetWidth - getPaddingWidth(parent); 
     2122    var autoRight = (element.currentStyle["ie7-margin"] && element.currentStyle.marginRight == "auto") || 
     2123      element.currentStyle["ie7-margin-right"] == "auto"; 
     2124    switch (parent.currentStyle.textAlign) { 
     2125      case "right": 
     2126        margin = autoRight ? parseInt(margin / 2) : 0; 
     2127        element.runtimeStyle.marginRight = margin + "px"; 
     2128        break; 
     2129      case "center": 
     2130        if (autoRight) margin = 0; 
     2131      default: 
     2132        if (autoRight) margin /= 2; 
     2133        element.runtimeStyle.marginLeft = parseInt(margin) + "px"; 
     2134    } 
     2135  }; 
     2136 
     2137  function getPaddingWidth(element) { 
     2138    return getPixelValue(element, element.currentStyle.paddingLeft) + 
     2139      getPixelValue(element, element.currentStyle.paddingRight); 
     2140  }; 
     2141   
     2142  IE7.CSS.addRecalc("margin(-left|-right)?", "[^};]*auto", function(element) { 
     2143    if (register(fixMargin, element, 
     2144      element.parentElement && 
     2145      element.currentStyle.display == "block" && 
     2146      element.currentStyle.marginLeft == "auto" && 
     2147      element.currentStyle.position != "absolute")) { 
     2148        fixMargin(element); 
     2149    } 
     2150  }); 
     2151   
     2152  addResize(function() { 
     2153    for (var i in fixMargin.elements) { 
     2154      var element = fixMargin.elements[i]; 
     2155      element.runtimeStyle.marginLeft = 
     2156      element.runtimeStyle.marginRight = ""; 
     2157      fixMargin(element); 
     2158    } 
     2159  }); 
     2160}; 
     2161 
     2162 
     2163// ----------------------------------------------------------------------- 
     2164// initialisation 
     2165// ----------------------------------------------------------------------- 
     2166 
     2167IE7.loaded = true; 
     2168 
     2169(function() { 
     2170  try { 
     2171    // http://javascript.nwbox.com/IEContentLoaded/ 
     2172    documentElement.doScroll("left"); 
     2173  } catch (e) { 
     2174    setTimeout(arguments.callee, 1); 
     2175    return; 
     2176  } 
     2177  // execute the inner text of the IE7 script 
     2178  try { 
     2179    eval(script.innerHTML); 
     2180  } catch (e) { 
     2181    // ignore errors 
     2182  } 
     2183  PNG = new RegExp(rescape(typeof IE7_PNG_SUFFIX == "string" ? IE7_PNG_SUFFIX : "-trans.png") + "$", "i"); 
     2184 
     2185  // frequently used references 
     2186  body = document.body; 
     2187  viewport = quirksMode ? body : documentElement; 
     2188 
     2189  // classes 
     2190  body.className += " ie7_body"; 
     2191  documentElement.className += " ie7_html"; 
     2192 
     2193  if (quirksMode) ie7Quirks(); 
     2194 
     2195  IE7.CSS.init(); 
     2196  IE7.HTML.init(); 
     2197 
     2198  IE7.HTML.apply(); 
     2199  IE7.CSS.apply(); 
     2200 
     2201  IE7.recalc(); 
     2202})(); 
     2203 
     2204 
     2205})(); 
  • admin/js/ie7/IE8.js

    r175 r703  
    1 /* IE7/IE8.js - copyright 2004-2008, Dean Edwards */ 
    2 (function(){IE7={toString:function(){return"IE7 version 2.0 (beta2)"}};var m=IE7.appVersion=navigator.appVersion.match(/MSIE (\d\.\d)/)[1];if(/ie7_off/.test(top.location.search)||m<5)return;var U=bT();var G=document.compatMode!="CSS1Compat";var bx=document.documentElement,w,t;var bN="!";var J=":link{ie7-link:link}:visited{ie7-link:visited}";var cB=/^[\w\.]+[^:]*$/;function bc(a,b){if(cB.test(a))a=(b||"")+a;return a};function by(a,b){a=bc(a,b);return a.slice(0,a.lastIndexOf("/")+1)};var bO=document.scripts[document.scripts.length-1];var cC=by(bO.src);try{var K=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}var bd={};function cD(a,b){try{a=bc(a,b);if(!bd[a]){K.open("GET",a,false);K.send();if(K.status==0||K.status==200){bd[a]=K.responseText}}}catch(e){}finally{return bd[a]||""}};if(m<5.5){undefined=U();bN="HTML:!";var cE=/(g|gi)$/;var cF=String.prototype.replace;String.prototype.replace=function(a,b){if(typeof b=="function"){if(a&&a.constructor==RegExp){var c=a;var d=c.global;if(d==null)d=cE.test(c);if(d)c=new RegExp(c.source)}else{c=new RegExp(W(a))}var f,g=this,h="";while(g&&(f=c.exec(g))){h+=g.slice(0,f.index)+b.apply(this,f);g=g.slice(f.index+f[0].length);if(!d)break}return h+g}return cF.apply(this,arguments)};Array.prototype.pop=function(){if(this.length){var a=this[this.length-1];this.length--;return a}return undefined};Array.prototype.push=function(){for(var a=0;a<arguments.length;a++){this[this.length]=arguments[a]}return this.length};var cG=this;Function.prototype.apply=function(a,b){if(a===undefined)a=cG;else if(a==null)a=window;else if(typeof a=="string")a=new String(a);else if(typeof a=="number")a=new Number(a);else if(typeof a=="boolean")a=new Boolean(a);if(arguments.length==1)b=[];else if(b[0]&&b[0].writeln)b[0]=b[0].documentElement.document||b[0];var c="#ie7_apply",d;a[c]=this;switch(b.length){case 0:d=a[c]();break;case 1:d=a[c](b[0]);break;case 2:d=a[c](b[0],b[1]);break;case 3:d=a[c](b[0],b[1],b[2]);break;case 4:d=a[c](b[0],b[1],b[2],b[3]);break;case 5:d=a[c](b[0],b[1],b[2],b[3],b[4]);break;default:var f=[],g=b.length-1;do f[g]="a["+g+"]";while(g--);eval("r=o[$]("+f+")")}if(typeof a.valueOf=="function"){delete a[c]}else{a[c]=undefined;if(d&&d.writeln)d=d.documentElement.document||d}return d};Function.prototype.call=function(a){return this.apply(a,bP.apply(arguments,[1]))};J+="address,blockquote,body,dd,div,dt,fieldset,form,"+"frame,frameset,h1,h2,h3,h4,h5,h6,iframe,noframes,object,p,"+"hr,applet,center,dir,menu,pre,dl,li,ol,ul{display:block}"}var bP=Array.prototype.slice;var cZ=/%([1-9])/g;var cH=/^\s\s*/;var cI=/\s\s*$/;var cJ=/([\/()[\]{}|*+-.,^$?\\])/g;var bQ=/\bbase\b/;var bR=["constructor","toString"];var be;function B(){};B.extend=function(a,b){be=true;var c=new this;bf(c,a);be=false;var d=c.constructor;function f(){if(!be)d.apply(this,arguments)};c.constructor=f;f.extend=arguments.callee;bf(f,b);f.prototype=c;return f};B.prototype.extend=function(a){return bf(this,a)};var bz="#";var V="~";var cK=/\\./g;var cL=/\(\?[:=!]|\[[^\]]+\]/g;var cM=/\(/g;var H=B.extend({constructor:function(a){this[V]=[];this.merge(a)},exec:function(g){var h=this,j=this[V];return String(g).replace(new RegExp(this,this.ignoreCase?"gi":"g"),function(){var a,b=1,c=0;while((a=h[bz+j[c++]])){var d=b+a.length+1;if(arguments[b]){var f=a.replacement;switch(typeof f){case"function":return f.apply(h,bP.call(arguments,b,d));case"number":return arguments[b+f];default:return f}}b=d}})},add:function(a,b){if(a instanceof RegExp){a=a.source}if(!this[bz+a])this[V].push(String(a));this[bz+a]=new H.Item(a,b)},merge:function(a){for(var b in a)this.add(b,a[b])},toString:function(){return"("+this[V].join(")|(")+")"}},{IGNORE:"$0",Item:B.extend({constructor:function(a,b){a=a instanceof RegExp?a.source:String(a);if(typeof b=="number")b=String(b);else if(b==null)b="";if(typeof b=="string"&&/\$(\d+)/.test(b)){if(/^\$\d+$/.test(b)){b=parseInt(b.slice(1))}else{var c=/'/.test(b.replace(/\\./g,""))?'"':"'";b=b.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\$(\d+)/g,c+"+(arguments[$1]||"+c+c+")+"+c);b=new Function("return "+c+b.replace(/(['"])\1\+(.*)\+\1\1$/,"$1")+c)}}this.length=H.count(a);this.replacement=b;this.toString=bT(a)}}),count:function(a){a=String(a).replace(cK,"").replace(cL,"");return L(a,cM).length}});function bf(a,b){if(a&&b){var c=(typeof b=="function"?Function:Object).prototype;var d=bR.length,f;if(be)while(f=bR[--d]){var g=b[f];if(g!=c[f]){if(bQ.test(g)){bS(a,f,g)}else{a[f]=g}}}for(f in b)if(c[f]===undefined){var g=b[f];if(a[f]&&typeof g=="function"&&bQ.test(g)){bS(a,f,g)}else{a[f]=g}}}return a};function bS(c,d,f){var g=c[d];c[d]=function(){var a=this.base;this.base=g;var b=f.apply(this,arguments);this.base=a;return b}};function cN(a,b){if(!b)b=a;var c={};for(var d in a)c[d]=b[d];return c};function i(c){var d=arguments;var f=new RegExp("%([1-"+arguments.length+"])","g");return String(c).replace(f,function(a,b){return b<d.length?d[b]:a})};function L(a,b){return String(a).match(b)||[]};function W(a){return String(a).replace(cJ,"\\$1")};function da(a){return String(a).replace(cH,"").replace(cI,"")};function bT(a){return function(){return a}};var bU=H.extend({ignoreCase:true});var cO=/\x01(\d+)/g,cP=/'/g,cQ=/^\x01/,cR=/\\([\da-fA-F]{1,4})/g;var bA=[];var bV=new bU({"<!\\-\\-|\\-\\->":"","\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/":"","@(namespace|import)[^;\\n]+[;\\n]":"","'(\\\\.|[^'\\\\])*'":bW,'"(\\\\.|[^"\\\\])*"':bW,"\\s+":" "});function cS(a){return bV.exec(a)};function bg(c){return c.replace(cO,function(a,b){return bA[b-1]})};function bW(c){return"\x01"+bA.push(c.replace(cR,function(a,b){return eval("'\\u"+"0000".slice(b.length)+b+"'")}).slice(1,-1).replace(cP,"\\'"))};function bB(a){return cQ.test(a)?bA[a.slice(1)-1]:a};var cT=new H({Width:"Height",width:"height",Left:"Top",left:"top",Right:"Bottom",right:"bottom",onX:"onY"});function C(a){return cT.exec(a)};var bX=[];function bC(a){cV(a);v(window,"onresize",a)};function v(a,b,c){a.attachEvent(b,c);bX.push(arguments)};function cU(a,b,c){try{a.detachEvent(b,c)}catch(ignore){}};v(window,"onunload",function(){var a;while(a=bX.pop()){cU(a[0],a[1],a[2])}});function X(a,b,c){if(!a.elements)a.elements={};if(c)a.elements[b.uniqueID]=b;else delete a.elements[b.uniqueID];return c};v(window,"onbeforeprint",function(){if(!IE7.CSS.print)new bJ("print");IE7.CSS.print.recalc()});var bY=/^\d+(px)?$/i;var M=/^\d+%$/;var D=function(a,b){if(bY.test(b))return parseInt(b);var c=a.style.left;var d=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b||0;b=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return b};var bD="ie7-";var bZ=B.extend({constructor:function(){this.fixes=[];this.recalcs=[]},init:U});var bE=[];function cV(a){bE.push(a)};IE7.recalc=function(){IE7.HTML.recalc();IE7.CSS.recalc();for(var a=0;a<bE.length;a++)bE[a]()};function bh(a){return a.currentStyle["ie7-position"]=="fixed"};function bF(a,b){return a.currentStyle[bD+b]||a.currentStyle[b]};function N(a,b,c){if(a.currentStyle[bD+b]==null){a.runtimeStyle[bD+b]=a.currentStyle[b]}a.runtimeStyle[b]=c};function ca(a){var b=document.createElement(a||"object");b.style.cssText="position:absolute;padding:0;display:block;border:none;clip:rect(0 0 0 0);left:-9999";b.ie7_anon=true;return b};function x(a,b,c){if(!bj[a]){I=[];var d="";var f=E.escape(a).split(",");for(var g=0;g<f.length;g++){p=l=y=0;Y=f.length>1?2:0;var h=E.exec(f[g])||"if(0){";if(p){h+=i("if(e%1.nodeName!='!'){",l)}var j=Y>1?ch:"";h+=i(j+ci,l);h+=Array(L(h,/\{/g).length+1).join("}");d+=h}eval(i(cj,I)+E.unescape(d)+"return s?null:r}");bj[a]=_k}return bj[a](b||document,c)};var bi=m<6;var cb=/^(href|src)$/;var bG={"class":"className","for":"htmlFor"};IE7._1=1;IE7._e=function(a,b){var c=a.all[b]||null;if(!c||c.id==b)return c;for(var d=0;d<c.length;d++){if(c[d].id==b)return c[d]}return null};IE7._f=function(a,b){if(b=="src"&&a.pngSrc)return a.pngSrc;var c=bi?(a.attributes[b]||a.attributes[bG[b.toLowerCase()]]):a.getAttributeNode(b);if(c&&(c.specified||b=="value")){if(cb.test(b)){return a.getAttribute(b,2)}else if(b=="class"){return a.className.replace(/\sie7_\w+/g,"")}else if(b=="style"){return a.style.cssText}else{return c.nodeValue}}return null};var cc="colSpan,rowSpan,vAlign,dateTime,accessKey,tabIndex,encType,maxLength,readOnly,longDesc";bf(bG,cN(cc.toLowerCase().split(","),cc.split(",")));IE7._3=function(a){while(a&&(a=a.nextSibling)&&(a.nodeType!=1||a.nodeName=="!"))continue;return a};IE7._4=function(a){while(a&&(a=a.previousSibling)&&(a.nodeType!=1||a.nodeName=="!"))continue;return a};var cW=/([\s>+~,]|[^(]\+|^)([#.:\[])/g,cX=/(^|,)([^\s>+~])/g,cY=/\s*([\s>+~(),]|^|$)\s*/g,cd=/\s\*\s/g;var ce=H.extend({constructor:function(a){this.base(a);this.sorter=new H;this.sorter.add(/:not\([^)]*\)/,H.IGNORE);this.sorter.add(/([ >](\*|[\w-]+))([^: >+~]*)(:\w+-child(\([^)]+\))?)([^: >+~]*)/,"$1$3$6$4")},ignoreCase:true,escape:function(a){return this.optimise(this.format(a))},format:function(a){return a.replace(cY,"$1").replace(cX,"$1 $2").replace(cW,"$1*$2")},optimise:function(a){return this.sorter.exec(a.replace(cd,">* "))},unescape:function(a){return bg(a)}});var cf={"":"%1!=null","=":"%1=='%2'","~=":/(^| )%1( |$)/,"|=":/^%1(-|$)/,"^=":/^%1/,"$=":/%1$/,"*=":/%1/};var bH={"first-child":"!IE7._4(e%1)","link":"e%1.currentStyle['ie7-link']=='link'","visited":"e%1.currentStyle['ie7-link']=='visited'"};var bI="var p%2=0,i%2,e%2,n%2=e%1.";var cg="e%1.sourceIndex";var ch="var g="+cg+";if(!p[g]){p[g]=1;";var ci="r[r.length]=e%1;if(s)return e%1;";var cj="var _k=function(e0,s){IE7._1++;var r=[],p={},reg=[%1],d=document;";var I;var l;var p;var y;var Y;var bj={};var E=new ce({" (\\*|[\\w-]+)#([\\w-]+)":function(a,b,c){p=false;var d="var e%2=IE7._e(d,'%4');if(e%2&&";if(b!="*")d+="e%2.nodeName=='%3'&&";d+="(e%1==d||e%1.contains(e%2))){";if(y)d+=i("i%1=n%1.length;",y);return i(d,l++,l,b.toUpperCase(),c)}," (\\*|[\\w-]+)":function(a,b){Y++;p=b=="*";var c=bI;c+=(p&&bi)?"all":"getElementsByTagName('%3')";c+=";for(i%2=0;(e%2=n%2[i%2]);i%2++){";return i(c,l++,y=l,b.toUpperCase())},">(\\*|[\\w-]+)":function(a,b){var c=y;p=b=="*";var d=bI;d+=c?"children":"childNodes";if(!p&&c)d+=".tags('%3')";d+=";for(i%2=0;(e%2=n%2[i%2]);i%2++){";if(p){d+="if(e%2.nodeType==1){";p=bi}else{if(!c)d+="if(e%2.nodeName=='%3'){"}return i(d,l++,y=l,b.toUpperCase())},"\\+(\\*|[\\w-]+)":function(a,b){var c="";if(p)c+="if(e%1.nodeName!='!'){";p=false;c+="e%1=IE7._3(e%1);if(e%1";if(b!="*")c+="&&e%1.nodeName=='%2'";c+="){";return i(c,l,b.toUpperCase())},"~(\\*|[\\w-]+)":function(a,b){var c="";if(p)c+="if(e%1.nodeName!='!'){";p=false;Y=2;c+="while(e%1=e%1.nextSibling){if(e%1.ie7_adjacent==IE7._1)break;if(";if(b=="*"){c+="e%1.nodeType==1";if(bi)c+="&&e%1.nodeName!='!'"}else c+="e%1.nodeName=='%2'";c+="){e%1.ie7_adjacent=IE7._1;";return i(c,l,b.toUpperCase())},"#([\\w-]+)":function(a,b){p=false;var c="if(e%1.id=='%2'){";if(y)c+=i("i%1=n%1.length;",y);return i(c,l,b)},"\\.([\\w-]+)":function(a,b){p=false;I.push(new RegExp("(^|\\s)"+W(b)+"(\\s|$)"));return i("if(e%1.className&&reg[%2].test(e%1.className)){",l,I.length-1)},"\\[([\\w-]+)\\s*([^=]?=)?\\s*([^\\]]*)\\]":function(a,b,c,d){var f=bG[b]||b;if(c){var g="e%1.getAttribute('%2',2)";if(!cb.test(b)){g="e%1.%3||"+g}b=i("("+g+")",l,b,f)}else{b=i("IE7._f(e%1,'%2')",l,b)}var h=cf[c||""]||"0";if(h&&h.source){I.push(new RegExp(i(h.source,W(E.unescape(d)))));h="reg[%2].test(%1)";d=I.length-1}return"if("+i(h,b,d)+"){"},":+([\\w-]+)(\\(([^)]+)\\))?":function(a,b,c,d){b=bH[b];return"if("+(b?i(b,l,d||""):"0")+"){"}});var ck=/a(#[\w-]+)?(\.[\w-]+)?:(hover|active)/i;var cl=/\s*\{\s*/,cm=/\s*\}\s*/,cn=/\s*\,\s*/;var co=/(.*)(:first-(line|letter))/;var z=document.styleSheets;IE7.CSS=new(bZ.extend({parser:new bU,screen:"",print:"",styles:[],rules:[],pseudoClasses:m<7?"first\\-child":"",dynamicPseudoClasses:{toString:function(){var a=[];for(var b in this)a.push(b);return a.join("|")}},init:function(){var a="^\x01$";var b="\\[class=?[^\\]]*\\]";var c=[];if(this.pseudoClasses)c.push(this.pseudoClasses);var d=this.dynamicPseudoClasses.toString();if(d)c.push(d);c=c.join("|");var f=m<7?["[>+~[(]|([:.])\\w+\\1"]:[b];if(c)f.push(":("+c+")");this.UNKNOWN=new RegExp(f.join("|")||a,"i");var g=m<7?["\\[[^\\]]+\\]|[^\\s(\\[]+\\s*[+~]"]:[b];var h=g.concat();if(c)h.push(":("+c+")");o.COMPLEX=new RegExp(h.join("|")||a,"ig");if(this.pseudoClasses)g.push(":("+this.pseudoClasses+")");O.COMPLEX=new RegExp(g.join("|")||a,"i");O.MATCH=new RegExp(d?"(.*):("+d+")(.*)":a,"i");this.createStyleSheet();this.refresh()},addEventHandler:function(){v.apply(null,arguments)},addFix:function(a,b){this.parser.add(a,b)},addRecalc:function(c,d,f,g){d=new RegExp("([{;\\s])"+c+"\\s*:\\s*"+d+"[^;}]*");var h=this.recalcs.length;if(g)g=c+":"+g;this.addFix(d,function(a,b){return(g?b+g:a)+";ie7-"+a.slice(1)+";ie7_recalc"+h+":1"});this.recalcs.push(arguments);return h},apply:function(){this.getInlineStyles();new bJ("screen");this.trash()},createStyleSheet:function(){this.styleSheet=document.createStyleSheet();this.styleSheet.ie7=true;this.styleSheet.owningElement.ie7=true;this.styleSheet.cssText=J},getInlineStyles:function(){var a=document.getElementsByTagName("style"),b;for(var c=a.length-1;(b=a[c]);c--){if(!b.disabled&&!b.ie7){this.styles.push(b.innerHTML)}}},getText:function(a,b){try{var c=a.cssText}catch(e){c=""}if(K)c=cD(a.href,b)||c;return c},recalc:function(){this.screen.recalc();var a=/ie7_recalc\d+/g;var b=J.match(/[{,]/g).length;var c=b+(this.screen.cssText.match(/\{/g)||"").length;var d=this.styleSheet.rules,f;var g,h,j,q,r,k,u,n;for(r=b;r<c;r++){f=d[r];var s=f.style.cssText;if(f&&(g=s.match(a))){j=x(f.selectorText);if(j.length)for(k=0;k<g.length;k++){n=g[k];h=IE7.CSS.recalcs[n.slice(10)][2];for(u=0;(q=j[u]);u++){if(q.currentStyle[n])h(q,s)}}}}},refresh:function(){this.styleSheet.cssText=J+this.screen+this.print},trash:function(){for(var a=0;a<z.length;a++){if(!z[a].ie7){try{var b=z[a].cssText}catch(e){b=""}if(b)z[a].cssText=""}}}}));var bJ=B.extend({constructor:function(a){this.media=a;this.load();IE7.CSS[a]=this;IE7.CSS.refresh()},createRule:function(a,b){if(IE7.CSS.UNKNOWN.test(a)){var c;if(F&&(c=a.match(F.MATCH))){return new F(c[1],c[2],b)}else if(c=a.match(O.MATCH)){if(!ck.test(c[0])||O.COMPLEX.test(c[0])){return new O(a,c[1],c[2],c[3],b)}}else return new o(a,b)}return a+" {"+b+"}"},getText:function(){var h=[].concat(IE7.CSS.styles);var j=/@media\s+([^{]*)\{([^@]+\})\s*\}/gi;var q=/\ball\b|^$/i,r=/\bscreen\b/i,k=/\bprint\b/i;function u(a,b){n.value=b;return a.replace(j,n)};function n(a,b,c){b=s(b);switch(b){case"screen":case"print":if(b!=n.value)return"";case"all":return c}return""};function s(a){if(q.test(a))return"all";else if(r.test(a))return(k.test(a))?"all":"screen";else if(k.test(a))return"print"};var R=this;function S(a,b,c,d){var f="";if(!d){c=s(a.media);d=0}if(c=="all"||c==R.media){if(d<3){for(var g=0;g<a.imports.length;g++){f+=S(a.imports[g],by(a.href,b),c,d+1)}}f+=cS(a.href?cy(a,b):h.pop()||"");f=u(f,R.media)}return f};var bw={};function cy(a,b){var c=bc(a.href,b);if(bw[c])return"";bw[c]=(a.disabled)?"":cA(IE7.CSS.getText(a,b),by(a.href,b));return bw[c]};var cz=/(url\s*\(\s*['"]?)([\w\.]+[^:\)]*['"]?\))/gi;function cA(a,b){return a.replace(cz,"$1"+b.slice(0,b.lastIndexOf("/")+1)+"$2")};for(var T=0;T<z.length;T++){if(!z[T].disabled&&!z[T].ie7){this.cssText+=S(z[T])}}},load:function(){this.cssText="";this.getText();this.parse();this.cssText=bg(this.cssText);bd={}},parse:function(){this.cssText=IE7.CSS.parser.exec(this.cssText);var a=IE7.CSS.rules.length;var b=this.cssText.split(cm),c;var d,f,g,h;for(g=0;g<b.length;g++){c=b[g].split(cl);d=c[0].split(cn);f=c[1];for(h=0;h<d.length;h++){d[h]=f?this.createRule(d[h],f):""}b[g]=d.join("\n")}this.cssText=b.join("\n");this.rules=IE7.CSS.rules.slice(a)},recalc:function(){var a,b;for(b=0;(a=this.rules[b]);b++)a.recalc()},toString:function(){return"@media "+this.media+"{"+this.cssText+"}"}});var F;var o=IE7.Rule=B.extend({constructor:function(a,b){this.id=IE7.CSS.rules.length;this.className=o.PREFIX+this.id;a=a.match(co)||a||"*";this.selector=a[1]||a;this.selectorText=this.parse(this.selector)+(a[2]||"");this.cssText=b;this.MATCH=new RegExp("\\s"+this.className+"(\\s|$)","g");IE7.CSS.rules.push(this);this.init()},init:U,add:function(a){a.className+=" "+this.className},recalc:function(){var a=x(this.selector);for(var b=0;b<a.length;b++)this.add(a[b])},parse:function(a){var b=a.replace(o.CHILD," ").replace(o.COMPLEX,"");if(m<7)b=b.replace(o.MULTI,"");var c=L(b,o.TAGS).length-L(a,o.TAGS).length;var d=L(b,o.CLASSES).length-L(a,o.CLASSES).length+1;while(d>0&&o.CLASS.test(b)){b=b.replace(o.CLASS,"");d--}while(c>0&&o.TAG.test(b)){b=b.replace(o.TAG,"$1*");c--}b+="."+this.className;d=Math.min(d,2);c=Math.min(c,2);var f=-10*d-c;if(f>0){b=b+","+o.MAP[f]+" "+b}return b},remove:function(a){a.className=a.className.replace(this.MATCH,"$1")},toString:function(){return i("%1 {%2}",this.selectorText,this.cssText)}},{CHILD:/>/g,CLASS:/\.[\w-]+/,CLASSES:/[.:\[]/g,MULTI:/(\.[\w-]+)+/g,PREFIX:"ie7_class",TAG:/^\w+|([\s>+~])\w+/,TAGS:/^\w|[\s>+~]\w/g,MAP:{1:"html",2:"html body",10:".ie7_html",11:"html.ie7_html",12:"html.ie7_html body",20:".ie7_html .ie7_body",21:"html.ie7_html .ie7_body",22:"html.ie7_html body.ie7_body"}});var O=o.extend({constructor:function(a,b,c,d,f){this.attach=b||"*";this.dynamicPseudoClass=IE7.CSS.dynamicPseudoClasses[c];this.target=d;this.base(a,f)},recalc:function(){var a=x(this.attach),b;for(var c=0;b=a[c];c++){var d=this.target?x(this.target,b):[b];if(d.length)this.dynamicPseudoClass.apply(b,d,this)}}});var A=B.extend({constructor:function(a,b){this.name=a;this.apply=b;this.instances={};IE7.CSS.dynamicPseudoClasses[a]=this},register:function(a){var b=a[2];a.id=b.id+a[0].uniqueID;if(!this.instances[a.id]){var c=a[1],d;for(d=0;d<c.length;d++)b.add(c[d]);this.instances[a.id]=a}},unregister:function(a){if(this.instances[a.id]){var b=a[2];var c=a[1],d;for(d=0;d<c.length;d++)b.remove(c[d]);delete this.instances[a.id]}}});if(m<7){var Z=new A("hover",function(a){var b=arguments;IE7.CSS.addEventHandler(a,m<5.5?"onmouseover":"onmouseenter",function(){Z.register(b)});IE7.CSS.addEventHandler(a,m<5.5?"onmouseout":"onmouseleave",function(){Z.unregister(b)})});v(document,"onmouseup",function(){var a=Z.instances;for(var b in a)if(!a[b][0].contains(event.srcElement))Z.unregister(a[b])})}IE7.CSS.addRecalc("[\\w-]+","inherit",function(c,d){var f=d.match(/[\w-]+\s*:\s*inherit/g);for(var g=0;g<f.length;g++){var h=f[g].replace(/ie7\-|\s*:\s*inherit/g,"").replace(/\-([a-z])/g,function(a,b){return b.toUpperCase()});c.runtimeStyle[h]=c.parentElement.currentStyle[h]}});IE7.HTML=new(bZ.extend({fixed:{},init:U,addFix:function(){this.fixes.push(arguments)},apply:function(){for(var a=0;a<this.fixes.length;a++){var b=x(this.fixes[a][0]);var c=this.fixes[a][1];for(var d=0;d<b.length;d++)c(b[d])}},addRecalc:function(){this.recalcs.push(arguments)},recalc:function(){for(var a=0;a<this.recalcs.length;a++){var b=x(this.recalcs[a][0]);var c=this.recalcs[a][1],d;var f=Math.pow(2,a);for(var g=0;(d=b[g]);g++){var h=d.uniqueID;if((this.fixed[h]&f)==0){d=c(d)||d;this.fixed[h]|=f}}}}}));if(m<7){document.createElement("abbr");IE7.HTML.addRecalc("label",function(a){if(!a.htmlFor){var b=x("input,textarea",a,true);if(b){v(a,"onclick",function(){b.click()})}}})}var P="[.\\d]";new function(_){var layout=IE7.Layout=this;J+="*{boxSizing:content-box}";IE7.hasLayout=m<5.5?function(a){return a.clientWidth}:function(a){return a.currentStyle.hasLayout};layout.boxSizing=function(a){if(!IE7.hasLayout(a)){a.style.height="0cm";if(a.currentStyle.verticalAlign=="auto")a.runtimeStyle.verticalAlign="top";collapseMargins(a)}};function collapseMargins(a){if(a!=t&&a.currentStyle.position!="absolute"){collapseMargin(a,"marginTop");collapseMargin(a,"marginBottom")}};function collapseMargin(a,b){if(!a.runtimeStyle[b]){var c=a.parentElement;if(c&&IE7.hasLayout(c)&&!IE7[b=="marginTop"?"_4":"_3"](a))return;var d=x(">*:"+(b=="marginTop"?"first":"last")+"-child",a,true);if(d&&d.currentStyle.styleFloat=="none"&&IE7.hasLayout(d)){collapseMargin(d,b);margin=_b(a,a.currentStyle[b]);childMargin=_b(d,d.currentStyle[b]);if(margin<0||childMargin<0){a.runtimeStyle[b]=margin+childMargin}else{a.runtimeStyle[b]=Math.max(childMargin,margin)}d.runtimeStyle[b]="0px"}}};function _b(a,b){return b=="auto"?0:D(a,b)};var UNIT=/^[.\d][\w%]*$/,AUTO=/^(auto|0cm)$/;var applyWidth,applyHeight;IE7.Layout.borderBox=function(a){applyWidth(a);applyHeight(a)};var fixWidth=function(g){applyWidth=function(a){if(!M.test(a.currentStyle.width))h(a);collapseMargins(a)};function h(a,b){if(!a.runtimeStyle.fixedWidth){if(!b)b=a.currentStyle.width;a.runtimeStyle.fixedWidth=(UNIT.test(b))?Math.max(0,r(a,b)):b;N(a,"width",a.runtimeStyle.fixedWidth)}};function j(a){if(!bh(a)){var b=a.offsetParent;while(b&&!IE7.hasLayout(b))b=b.offsetParent}return(b||t).clientWidth};function q(a,b){if(M.test(b))return parseInt(parseFloat(b)/100*j(a));return D(a,b)};var r=function(a,b){var c=a.currentStyle["box-sizing"]=="border-box";var d=0;if(G&&!c)d+=k(a)+u(a,"padding");else if(!G&&c)d-=k(a)+u(a,"padding");return q(a,b)+d};function k(a){return a.offsetWidth-a.clientWidth};function u(a,b){return q(a,a.currentStyle[b+"Left"])+q(a,a.currentStyle[b+"Right"])};J+="*{minWidth:none;maxWidth:none;min-width:none;max-width:none}";layout.minWidth=function(a){if(a.currentStyle["min-width"]!=null){a.style.minWidth=a.currentStyle["min-width"]}if(X(arguments.callee,a,a.currentStyle.minWidth!="none")){layout.boxSizing(a);h(a);n(a)}};eval("IE7.Layout.maxWidth="+String(layout.minWidth).replace(/min/g,"max"));function n(a){var b=a.getBoundingClientRect();var c=b.right-b.left;if(a.currentStyle.minWidth!="none"&&c<=r(a,a.currentStyle.minWidth)){a.runtimeStyle.width=a.currentStyle.minWidth}else if(a.currentStyle.maxWidth!="none"&&c>=r(a,a.currentStyle.maxWidth)){a.runtimeStyle.width=a.currentStyle.maxWidth}else{a.runtimeStyle.width=a.runtimeStyle.fixedWidth}};function s(a){if(X(s,a,/^(fixed|absolute)$/.test(a.currentStyle.position)&&bF(a,"left")!="auto"&&bF(a,"right")!="auto"&&AUTO.test(bF(a,"width")))){R(a);IE7.Layout.boxSizing(a)}};IE7.Layout.fixRight=s;function R(a){var b=q(a,a.runtimeStyle._c||a.currentStyle.left);var c=j(a)-q(a,a.currentStyle.right)-b-u(a,"margin");if(parseInt(a.runtimeStyle.width)==c)return;a.runtimeStyle.width="";if(bh(a)||g||a.offsetWidth<c){if(!G)c-=k(a)+u(a,"padding");if(c<0)c=0;a.runtimeStyle.fixedWidth=c;N(a,"width",c)}};var S=0;bC(function(){if(!t)return;var a,b=(S<t.clientWidth);S=t.clientWidth;var c=layout.minWidth.elements;for(a in c){var d=c[a];var f=(parseInt(d.runtimeStyle.width)==r(d,d.currentStyle.minWidth));if(b&&f)d.runtimeStyle.width="";if(b==f)n(d)}var c=layout.maxWidth.elements;for(a in c){var d=c[a];var f=(parseInt(d.runtimeStyle.width)==r(d,d.currentStyle.maxWidth));if(!b&&f)d.runtimeStyle.width="";if(b!=f)n(d)}for(a in s.elements)R(s.elements[a])});if(G){IE7.CSS.addRecalc("width",P,applyWidth)}if(m<7){IE7.CSS.addRecalc("min-width",P,layout.minWidth);IE7.CSS.addRecalc("max-width",P,layout.maxWidth);IE7.CSS.addRecalc("right",P,s)}};eval("var fixHeight="+C(fixWidth));fixWidth();fixHeight(true)};var bk=bc("blank.gif",cC);var bl="DXImageTransform.Microsoft.AlphaImageLoader";var bK="progid:"+bl+"(src='%1',sizingMethod='%2')";var bm;var Q=[];function bL(a){if(bm.test(a.src)){var b=new Image(a.width,a.height);b.onload=function(){a.width=b.width;a.height=b.height;b=null};b.src=a.src;a.pngSrc=a.src;bo(a)}};if(m>=5.5&&m<7){IE7.CSS.addFix(/background(-image)?\s*:\s*([^};]*)?url\(([^\)]+)\)([^;}]*)?/,function(a,b,c,d,f){d=bB(d);return bm.test(d)?"filter:"+i(bK,d,"crop")+";zoom:1;background"+(b||"")+":"+(c||"")+"none"+(f||""):a});IE7.HTML.addRecalc("img,input",function(a){if(a.tagName=="INPUT"&&a.type!="image")return;bL(a);v(a,"onpropertychange",function(){if(!bn&&event.propertyName=="src"&&a.src.indexOf(bk)==-1)bL(a)})});var bn=false;v(window,"onbeforeprint",function(){bn=true;for(var a=0;a<Q.length;a++)cp(Q[a])});v(window,"onafterprint",function(){for(var a=0;a<Q.length;a++)bo(Q[a]);bn=false})}function bo(a,b){var c=a.filters[bl];if(c){c.src=a.src;c.enabled=true}else{a.runtimeStyle.filter=i(bK,a.src,b||"scale");Q.push(a)}a.src=bk};function cp(a){a.src=a.pngSrc;a.filters[bl].enabled=false};new function(_){if(m>=7)return;IE7.CSS.addRecalc("position","fixed",_8,"absolute");IE7.CSS.addRecalc("background(-attachment)?","[^};]*fixed",_5);var $viewport=G?"body":"documentElement";function _6(){if(w.currentStyle.backgroundAttachment!="fixed"){if(w.currentStyle.backgroundImage=="none"){w.runtimeStyle.backgroundRepeat="no-repeat";w.runtimeStyle.backgroundImage="url("+bk+")"}w.runtimeStyle.backgroundAttachment="fixed"}_6=U};var _0=ca("img");function _2(a){return a?bh(a)||_2(a.parentElement):false};function _d(a,b,c){setTimeout("document.all."+a.uniqueID+".runtimeStyle.setExpression('"+b+"','"+c+"')",0)};function _5(a){if(X(_5,a,a.currentStyle.backgroundAttachment=="fixed"&&!a.contains(w))){_6();bgLeft(a);bgTop(a);_a(a)}};function _a(a){_0.src=a.currentStyle.backgroundImage.slice(5,-2);var b=a.canHaveChildren?a:a.parentElement;b.appendChild(_0);setOffsetLeft(a);setOffsetTop(a);b.removeChild(_0)};function bgLeft(a){a.style.backgroundPositionX=a.currentStyle.backgroundPositionX;if(!_2(a)){_d(a,"backgroundPositionX","(parseInt(runtimeStyle.offsetLeft)+document."+$viewport+".scrollLeft)||0")}};eval(C(bgLeft));function setOffsetLeft(a){var b=_2(a)?"backgroundPositionX":"offsetLeft";a.runtimeStyle[b]=getOffsetLeft(a,a.style.backgroundPositionX)-a.getBoundingClientRect().left-a.clientLeft+2};eval(C(setOffsetLeft));function getOffsetLeft(a,b){switch(b){case"left":case"top":return 0;case"right":case"bottom":return t.clientWidth-_0.offsetWidth;case"center":return(t.clientWidth-_0.offsetWidth)/2;default:if(M.test(b)){return parseInt((t.clientWidth-_0.offsetWidth)*parseFloat(b)/100)}_0.style.left=b;return _0.offsetLeft}};eval(C(getOffsetLeft));function _8(a){if(X(_8,a,bh(a))){N(a,"position","absolute");N(a,"left",a.currentStyle.left);N(a,"top",a.currentStyle.top);_6();IE7.Layout.fixRight(a);_7(a)}};function _7(a,b){positionTop(a,b);positionLeft(a,b,true);if(!a.runtimeStyle.autoLeft&&a.currentStyle.marginLeft=="auto"&&a.currentStyle.right!="auto"){var c=t.clientWidth-getPixelWidth(a,a.currentStyle.right)-getPixelWidth(a,a.runtimeStyle._c)-a.clientWidth;if(a.currentStyle.marginRight=="auto")c=parseInt(c/2);if(_2(a.offsetParent))a.runtimeStyle.pixelLeft+=c;else a.runtimeStyle.shiftLeft=c}clipWidth(a);clipHeight(a)};function clipWidth(a){var b=a.runtimeStyle.fixWidth;a.runtimeStyle.borderRightWidth="";a.runtimeStyle.width=b?getPixelWidth(a,b):"";if(a.currentStyle.width!="auto"){var c=a.getBoundingClientRect();var d=a.offsetWidth-t.clientWidth+c.left-2;if(d>=0){a.runtimeStyle.borderRightWidth="0px";d=Math.max(D(a,a.currentStyle.width)-d,0);N(a,"width",d);return d}}};eval(C(clipWidth));function positionLeft(a,b){if(!b&&M.test(a.currentStyle.width)){a.runtimeStyle.fixWidth=a.currentStyle.width}if(a.runtimeStyle.fixWidth){a.runtimeStyle.width=getPixelWidth(a,a.runtimeStyle.fixWidth)}a.runtimeStyle.shiftLeft=0;a.runtimeStyle._c=a.currentStyle.left;a.runtimeStyle.autoLeft=a.currentStyle.right!="auto"&&a.currentStyle.left=="auto";a.runtimeStyle.left="";a.runtimeStyle.screenLeft=getScreenLeft(a);a.runtimeStyle.pixelLeft=a.runtimeStyle.screenLeft;if(!b&&!_2(a.offsetParent)){_d(a,"pixelLeft","runtimeStyle.screenLeft+runtimeStyle.shiftLeft+document."+$viewport+".scrollLeft")}};eval(C(positionLeft));function getScreenLeft(a){var b=a.offsetLeft,c=1;if(a.runtimeStyle.autoLeft){b=t.clientWidth-a.offsetWidth-getPixelWidth(a,a.currentStyle.right)}if(a.currentStyle.marginLeft!="auto"){b-=getPixelWidth(a,a.currentStyle.marginLeft)}while(a=a.offsetParent){if(a.currentStyle.position!="static")c=-1;b+=a.offsetLeft*c}return b};eval(C(getScreenLeft));function getPixelWidth(a,b){return M.test(b)?parseInt(parseFloat(b)/100*t.clientWidth):D(a,b)};eval(C(getPixelWidth));function _j(){var a=_5.elements;for(var b in a)_a(a[b]);a=_8.elements;for(b in a){_7(a[b],true);_7(a[b],true)}_9=0};var _9;bC(function(){if(!_9)_9=setTimeout(_j,0)})};var bp={backgroundColor:"transparent",backgroundImage:"none",backgroundPositionX:null,backgroundPositionY:null,backgroundRepeat:null,borderTopWidth:0,borderRightWidth:0,borderBottomWidth:0,borderLeftStyle:"none",borderTopStyle:"none",borderRightStyle:"none",borderBottomStyle:"none",borderLeftWidth:0,height:null,marginTop:0,marginBottom:0,marginRight:0,marginLeft:0,width:"100%"};IE7.CSS.addRecalc("overflow","visible",function(a){if(a.parentNode.ie7_wrapped)return;if(IE7.Layout&&a.currentStyle["max-height"]!="auto"){IE7.Layout.maxHeight(a)}if(a.currentStyle.marginLeft=="auto")a.style.marginLeft=0;if(a.currentStyle.marginRight=="auto")a.style.marginRight=0;var b=document.createElement(bN);b.ie7_wrapped=a;for(var c in bp){b.style[c]=a.currentStyle[c];if(bp[c]!=null){a.runtimeStyle[c]=bp[c]}}b.style.display="block";b.style.position="relative";a.runtimeStyle.position="absolute";a.parentNode.insertBefore(b,a);b.appendChild(a)});function cq(){var f="xx-small,x-small,small,medium,large,x-large,xx-large".split(",");for(var g=0;g<f.length;g++){f[f[g]]=f[g-1]||"0.67em"}IE7.CSS.addFix(/(font(-size)?\s*:\s*)([\w.-]+)/,function(a,b,c,d){return b+(f[d]||d)});if(m<6){var h=/^\-/,j=/(em|ex)$/i;var q=/em$/i,r=/ex$/i;D=function(a,b){if(bY.test(b))return parseInt(b)||0;var c=h.test(b)?-1:1;if(j.test(b))c*=u(a);k.style.width=(c<0)?b.slice(1):b;w.appendChild(k);b=c*k.offsetWidth;k.removeNode();return parseInt(b)};var k=ca();function u(a){var b=1;k.style.fontFamily=a.currentStyle.fontFamily;k.style.lineHeight=a.currentStyle.lineHeight;while(a!=w){var c=a.currentStyle["ie7-font-size"];if(c){if(q.test(c))b*=parseFloat(c);else if(M.test(c))b*=(parseFloat(c)/100);else if(r.test(c))b*=(parseFloat(c)/2);else{k.style.fontSize=c;return 1}}a=a.parentElement}return b};IE7.CSS.addFix(/cursor\s*:\s*pointer/,"cursor:hand");IE7.CSS.addFix(/display\s*:\s*list-item/,"display:block")}function n(a){if(m<5.5)IE7.Layout.boxSizing(a.parentElement);var b=a.parentElement;var c=b.offsetWidth-a.offsetWidth-s(b);var d=(a.currentStyle["ie7-margin"]&&a.currentStyle.marginRight=="auto")||a.currentStyle["ie7-margin-right"]=="auto";switch(b.currentStyle.textAlign){case"right":c=d?parseInt(c/2):0;a.runtimeStyle.marginRight=c+"px";break;case"center":if(d)c=0;default:if(d)c/=2;a.runtimeStyle.marginLeft=parseInt(c)+"px"}};function s(a){return D(a,a.currentStyle.paddingLeft)+D(a,a.currentStyle.paddingRight)};IE7.CSS.addRecalc("margin(-left|-right)?","[^};]*auto",function(a){if(X(n,a,a.parentElement&&a.currentStyle.display=="block"&&a.currentStyle.marginLeft=="auto"&&a.currentStyle.position!="absolute")){n(a)}});bC(function(){for(var a in n.elements){var b=n.elements[a];b.runtimeStyle.marginLeft=b.runtimeStyle.marginRight="";n(b)}})};IE7._g=function(a){a=a.firstChild;while(a){if(a.nodeType==3||(a.nodeType==1&&a.nodeName!="!"))return false;a=a.nextSibling}return true};IE7._h=function(a,b){while(a&&!a.getAttribute("lang"))a=a.parentNode;return a&&new RegExp("^"+W(b),"i").test(a.getAttribute("lang"))};function cr(a,b,c,d){d=/last/i.test(a)?d+"+1-":"";if(!isNaN(b))b="0n+"+b;else if(b=="even")b="2n";else if(b=="odd")b="2n+1";b=b.split("n");var f=b[0]?(b[0]=="-")?-1:parseInt(b[0]):1;var g=parseInt(b[1])||0;var h=f<0;if(h){f=-f;if(f==1)g++}var j=i(f==0?"%3%7"+(d+g):"(%4%3-%2)%6%1%70%5%4%3>=%2",f,g,c,d,"&&","%","==");if(h)j="!("+j+")";return j};bH={"link":"e%1.currentStyle['ie7-link']=='link'","visited":"e%1.currentStyle['ie7-link']=='visited'","checked":"e%1.checked","contains":"e%1.innerText.indexOf('%2')!=-1","disabled":"e%1.isDisabled","empty":"IE7._g(e%1)","enabled":"e%1.disabled===false","first-child":"!IE7._4(e%1)","lang":"IE7._h(e%1,'%2')","last-child":"!IE7._3(e%1)","only-child":"!IE7._4(e%1)&&!IE7._3(e%1)","target":"e%1.id==location.hash.slice(1)","indeterminate":"e%1.indeterminate"};IE7._i=function(a){if(a.rows){a.ie7_length=a.rows.length;a.ie7_lookup="rowIndex"}else if(a.cells){a.ie7_length=a.cells.length;a.ie7_lookup="cellIndex"}else if(a.ie7_indexed!=IE7._1){var b=0;var c=a.firstChild;while(c){if(c.nodeType==1&&c.nodeName!="!"){c.ie7_index=++b}c=c.nextSibling}a.ie7_length=b;a.ie7_lookup="ie7_index"}a.ie7_indexed=IE7._1;return a};var ba=E[V];var cs=ba[ba.length-1];ba.length--;E.merge({":not\\((\\*|[\\w-]+)?([^)]*)\\)":function(a,b,c){var d=(b&&b!="*")?i("if(e%1.nodeName=='%2'){",l,b.toUpperCase()):"";d+=E.exec(c);return"if(!"+d.slice(2,-1).replace(/\)\{if\(/g,"&&")+"){"},":nth(-last)?-child\\(([^)]+)\\)":function(a,b,c){p=false;b=i("e%1.parentNode.ie7_length",l);var d="if(p%1!==e%1.parentNode)p%1=IE7._i(e%1.parentNode);";d+="var i=e%1[p%1.ie7_lookup];if(p%1.ie7_lookup!='ie7_index')i++;if(";return i(d,l)+cr(a,c,"i",b)+"){"}});ba.push(cs);var bM="\\([^)]*\\)";if(IE7.CSS.pseudoClasses)IE7.CSS.pseudoClasses+="|";IE7.CSS.pseudoClasses+="before|after|last\\-child|only\\-child|empty|root|"+"not|nth\\-child|nth\\-last\\-child|contains|lang".split("|").join(bM+"|")+bM;bV.add(/::/,":");var bb=new A("focus",function(a){var b=arguments;IE7.CSS.addEventHandler(a,"onfocus",function(){bb.unregister(b);bb.register(b)});IE7.CSS.addEventHandler(a,"onblur",function(){bb.unregister(b)});if(a==document.activeElement){bb.register(b)}});var bq=new A("active",function(a){var b=arguments;IE7.CSS.addEventHandler(a,"onmousedown",function(){bq.register(b)})});v(document,"onmouseup",function(){var a=bq.instances;for(var b in a)bq.unregister(a[b])});var br=new A("checked",function(a){if(typeof a.checked!="boolean")return;var b=arguments;IE7.CSS.addEventHandler(a,"onpropertychange",function(){if(event.propertyName=="checked"){if(a.checked)br.register(b);else br.unregister(b)}});if(a.checked)br.register(b)});var bs=new A("enabled",function(a){if(typeof a.disabled!="boolean")return;var b=arguments;IE7.CSS.addEventHandler(a,"onpropertychange",function(){if(event.propertyName=="disabled"){if(!a.isDisabled)bs.register(b);else bs.unregister(b)}});if(!a.isDisabled)bs.register(b)});var bt=new A("disabled",function(a){if(typeof a.disabled!="boolean")return;var b=arguments;IE7.CSS.addEventHandler(a,"onpropertychange",function(){if(event.propertyName=="disabled"){if(a.isDisabled)bt.register(b);else bt.unregister(b)}});if(a.isDisabled)bt.register(b)});var bu=new A("indeterminate",function(a){if(typeof a.indeterminate!="boolean")return;var b=arguments;IE7.CSS.addEventHandler(a,"onpropertychange",function(){if(event.propertyName=="indeterminate"){if(a.indeterminate)bu.register(b);else bu.unregister(b)}});IE7.CSS.addEventHandler(a,"onclick",function(){bu.unregister(b)})});var bv=new A("target",function(a){var b=arguments;if(!a.tabIndex)a.tabIndex=0;IE7.CSS.addEventHandler(document,"onpropertychange",function(){if(event.propertyName=="activeElement"){if(a.id&&a.id==location.hash.slice(1))bv.register(b);else bv.unregister(b)}});if(a.id&&a.id==location.hash.slice(1))bv.register(b)});var ct=/^attr/;var cu=/^url\s*\(\s*([^)]*)\)$/;var cv={before0:"beforeBegin",before1:"afterBegin",after0:"afterEnd",after1:"beforeEnd"};var F=IE7.PseudoElement=o.extend({constructor:function(a,b,c){this.position=b;var d=c.match(F.CONTENT),f,g;if(d){d=d[1];f=d.split(/\s+/);for(var h=0;(g=f[h]);h++){f[h]=ct.test(g)?{attr:g.slice(5,-1)}:(g.charAt(0)=="'")?bB(g):bg(g)}d=f}this.content=d;this.base(a,bg(c))},init:function(){this.match=x(this.selector);for(var a=0;a<this.match.length;a++){var b=this.match[a].runtimeStyle;if(!b[this.position])b[this.position]={cssText:""};b[this.position].cssText+=";"+this.cssText;if(this.content!=null)b[this.position].content=this.content}},create:function(a){var b=a.runtimeStyle[this.position];if(b){var c=[].concat(b.content||"");for(var d=0;d<c.length;d++){if(typeof c[d]=="object"){c[d]=a.getAttribute(c[d].attr)}}c=c.join("");var f=c.match(cu);var g="overflow:hidden;"+b.cssText.replace(/'/g,'"');if(a.currentStyle.styleFloat!="none"){}var h=cv[this.position+Number(a.canHaveChildren)];var j='ie7_pseudo'+F.count++;a.insertAdjacentHTML(h,i(F.ANON,this.className,j,g,f?"":c));if(f){var q=document.getElementById(j);q.src=bB(f[1]);bo(q,"crop")}a.runtimeStyle[this.position]=null}},recalc:function(){if(this.content==null)return;for(var a=0;a<this.match.length;a++){this.create(this.match[a])}},toString:function(){return"."+this.className+"{display:inline}"}},{CONTENT:/content\s*:\s*([^;]*)(;|$)/,ANON:"<ie7:! class='ie7_anon %1' id=%2 style='%3'>%4</ie7:!>",MATCH:/(.*):(before|after).*/,count:0});var cw=/^(submit|reset|button)$/;IE7.HTML.addRecalc("button,input",function(a){if(a.tagName=="BUTTON"){var b=a.outerHTML.match(/ value="([^"]*)"/i);a.runtimeStyle.value=(b)?b[1]:""}if(a.type=="submit"){v(a,"onclick",function(){a.runtimeStyle.clicked=true;setTimeout("document.all."+a.uniqueID+".runtimeStyle.clicked=false",1)})}});IE7.HTML.addRecalc("form",function(c){v(c,"onsubmit",function(){for(var a,b=0;a=c[b];b++){if(cw.test(a.type)&&!a.disabled&&!a.runtimeStyle.clicked){a.disabled=true;setTimeout("document.all."+a.uniqueID+".disabled=false",1)}else if(a.tagName=="BUTTON"&&a.type=="submit"){setTimeout("document.all."+a.uniqueID+".value='"+a.value+"'",1);a.value=a.runtimeStyle.value}}})});IE7.HTML.addRecalc("img",function(a){if(a.alt&&!a.title)a.title=""});IE7.CSS.addRecalc("border-spacing",P,function(a){if(a.currentStyle.borderCollapse!="collapse"){a.cellSpacing=D(a,a.currentStyle["border-spacing"])}});IE7.CSS.addRecalc("box-sizing","content-box",IE7.Layout.boxSizing);IE7.CSS.addRecalc("box-sizing","border-box",IE7.Layout.borderBox);IE7.CSS.addFix(/opacity\s*:\s*([\d.]+)/,function(a,b){return"zoom:1;filter:Alpha(opacity="+((b*100)||1)+")"});var cx=/^image/i;IE7.HTML.addRecalc("object",function(a){if(cx.test(a.type)){a.body.style.cssText="margin:0;padding:0;border:none;overflow:hidden";return a}});IE7.loaded=true;(function(){try{bx.doScroll("left")}catch(e){setTimeout(arguments.callee,1);return}try{eval(bO.innerHTML)}catch(e){}bm=new RegExp(W(typeof IE7_PNG_SUFFIX=="string"?IE7_PNG_SUFFIX:"-trans.png")+"$","i");w=document.body;t=G?w:bx;w.className+=" ie7_body";bx.className+=" ie7_html";if(G)cq();IE7.CSS.init();IE7.HTML.init();IE7.HTML.apply();IE7.CSS.apply();IE7.recalc()})()})(); 
     1// timestamp: Sun, 03 Feb 2008 19:26:22 
     2/* 
     3  IE7/IE8.js - copyright 2004-2008, Dean Edwards 
     4  http://dean.edwards.name/IE7/ 
     5  http://www.opensource.org/licenses/mit-license.php 
     6*/ 
     7 
     8/* W3C compliance for Microsoft Internet Explorer */ 
     9 
     10/* credits/thanks: 
     11  Shaggy, Martijn Wargers, Jimmy Cerra, Mark D Anderson, 
     12  Lars Dieckow, Erik Arvidsson, Gellért Gyuris, James Denny, 
     13  Unknown W Brackets, Benjamin Westfarer, Rob Eberhardt, 
     14  Bill Edney, Kevin Newman, James Crompton, Matthew Mastracci, 
     15  Doug Wright, Richard York, Kenneth Kolano, MegaZone, 
     16  Thomas Verelst, Mark 'Tarquin' Wilton-Jones, Rainer Åhlfors, 
     17  David Zulaica, Ken Kolano, Kevin Newman 
     18*/ 
     19 
     20// ======================================================================= 
     21// TO DO 
     22// ======================================================================= 
     23 
     24// PNG - unclickable content 
     25 
     26// ======================================================================= 
     27// TEST/BUGGY 
     28// ======================================================================= 
     29 
     30// hr{margin:1em auto} (doesn't look right in IE5) 
     31 
     32(function() { 
     33 
     34IE7 = { 
     35  toString: function(){return "IE7 version 2.0 (beta2)"} 
     36}; 
     37var appVersion = IE7.appVersion = navigator.appVersion.match(/MSIE (\d\.\d)/)[1]; 
     38 
     39if (/ie7_off/.test(top.location.search) || appVersion < 5) return; 
     40 
     41var Undefined = K(); 
     42var quirksMode = document.compatMode != "CSS1Compat"; 
     43var documentElement = document.documentElement, body, viewport; 
     44var ANON = "!"; 
     45var HEADER = ":link{ie7-link:link}:visited{ie7-link:visited}"; 
     46 
     47// ----------------------------------------------------------------------- 
     48// external 
     49// ----------------------------------------------------------------------- 
     50 
     51var RELATIVE = /^[\w\.]+[^:]*$/; 
     52function makePath(href, path) { 
     53  if (RELATIVE.test(href)) href = (path || "") + href; 
     54  return href; 
     55}; 
     56 
     57function getPath(href, path) { 
     58  href = makePath(href, path); 
     59  return href.slice(0, href.lastIndexOf("/") + 1); 
     60}; 
     61 
     62// get the path to this script 
     63var script = document.scripts[document.scripts.length - 1]; 
     64var path = getPath(script.src); 
     65 
     66// we'll use microsoft's http request object to load external files 
     67try { 
     68  var httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); 
     69} catch (e) { 
     70  // ActiveX disabled 
     71} 
     72 
     73var fileCache = {}; 
     74function loadFile(href, path) { 
     75try { 
     76  href = makePath(href, path); 
     77  if (!fileCache[href]) { 
     78    // easy to load a file huh? 
     79    httpRequest.open("GET", href, false); 
     80    httpRequest.send(); 
     81    if (httpRequest.status == 0 || httpRequest.status == 200) { 
     82      fileCache[href] = httpRequest.responseText; 
     83    } 
     84  } 
     85} catch (e) { 
     86  // ignore errors 
     87} finally { 
     88  return fileCache[href] || ""; 
     89}}; 
     90 
     91// ----------------------------------------------------------------------- 
     92// IE5.0 compatibility 
     93// ----------------------------------------------------------------------- 
     94 
     95 
     96if (appVersion < 5.5) { 
     97  undefined = Undefined(); 
     98 
     99  ANON = "HTML:!"; // for anonymous content 
     100   
     101  // Fix String.replace (Safari1.x/IE5.0). 
     102  var GLOBAL = /(g|gi)$/; 
     103  var _String_replace = String.prototype.replace;  
     104  String.prototype.replace = function(expression, replacement) { 
     105    if (typeof replacement == "function") { // Safari doesn't like functions 
     106      if (expression && expression.constructor == RegExp) { 
     107        var regexp = expression; 
     108        var global = regexp.global; 
     109        if (global == null) global = GLOBAL.test(regexp); 
     110        // we have to convert global RexpExps for exec() to work consistently 
     111        if (global) regexp = new RegExp(regexp.source); // non-global 
     112      } else { 
     113        regexp = new RegExp(rescape(expression)); 
     114      } 
     115      var match, string = this, result = ""; 
     116      while (string && (match = regexp.exec(string))) { 
     117        result += string.slice(0, match.index) + replacement.apply(this, match); 
     118        string = string.slice(match.index + match[0].length); 
     119        if (!global) break; 
     120      } 
     121      return result + string; 
     122    } 
     123    return _String_replace.apply(this, arguments); 
     124  }; 
     125   
     126  Array.prototype.pop = function() { 
     127    if (this.length) { 
     128      var i = this[this.length - 1]; 
     129      this.length--; 
     130      return i; 
     131    } 
     132    return undefined; 
     133  }; 
     134   
     135  Array.prototype.push = function() { 
     136    for (var i = 0; i < arguments.length; i++) { 
     137      this[this.length] = arguments[i]; 
     138    } 
     139    return this.length; 
     140  }; 
     141   
     142  var ns = this; 
     143  Function.prototype.apply = function(o, a) { 
     144    if (o === undefined) o = ns; 
     145    else if (o == null) o = window; 
     146    else if (typeof o == "string") o = new String(o); 
     147    else if (typeof o == "number") o = new Number(o); 
     148    else if (typeof o == "boolean") o = new Boolean(o); 
     149    if (arguments.length == 1) a = []; 
     150    else if (a[0] && a[0].writeln) a[0] = a[0].documentElement.document || a[0]; 
     151    var $ = "#ie7_apply", r; 
     152    o[$] = this; 
     153    switch (a.length) { // unroll for speed 
     154      case 0: r = o[$](); break; 
     155      case 1: r = o[$](a[0]); break; 
     156      case 2: r = o[$](a[0],a[1]); break; 
     157      case 3: r = o[$](a[0],a[1],a[2]); break; 
     158      case 4: r = o[$](a[0],a[1],a[2],a[3]); break; 
     159      case 5: r = o[$](a[0],a[1],a[2],a[3],a[4]); break; 
     160      default: 
     161        var b = [], i = a.length - 1; 
     162        do b[i] = "a[" + i + "]"; while (i--); 
     163        eval("r=o[$](" + b + ")"); 
     164    } 
     165    if (typeof o.valueOf == "function") { // not a COM object 
     166      delete o[$]; 
     167    } else { 
     168      o[$] = undefined; 
     169      if (r && r.writeln) r = r.documentElement.document || r; 
     170    } 
     171    return r; 
     172  }; 
     173   
     174  Function.prototype.call = function(o) { 
     175    return this.apply(o, _slice.apply(arguments, [1])); 
     176  }; 
     177 
     178  // block elements are "inline" according to IE5.0 so we'll fix it 
     179  HEADER += "address,blockquote,body,dd,div,dt,fieldset,form,"+ 
     180    "frame,frameset,h1,h2,h3,h4,h5,h6,iframe,noframes,object,p,"+ 
     181    "hr,applet,center,dir,menu,pre,dl,li,ol,ul{display:block}"; 
     182} 
     183 
     184// ----------------------------------------------------------------------- 
     185// OO support 
     186// ----------------------------------------------------------------------- 
     187 
     188 
     189// This is a cut-down version of base2 (http://code.google.com/p/base2/) 
     190 
     191var _slice = Array.prototype.slice; 
     192 
     193// private 
     194var _FORMAT = /%([1-9])/g; 
     195var _LTRIM = /^\s\s*/; 
     196var _RTRIM = /\s\s*$/; 
     197var _RESCAPE = /([\/()[\]{}|*+-.,^$?\\])/g;           // safe regular expressions 
     198var _BASE = /\bbase\b/; 
     199var _HIDDEN = ["constructor", "toString"];            // only override these when prototyping 
     200 
     201var prototyping; 
     202 
     203function Base(){}; 
     204Base.extend = function(_instance, _static) { 
     205  // Build the prototype. 
     206  prototyping = true; 
     207  var _prototype = new this; 
     208  extend(_prototype, _instance); 
     209  prototyping = false; 
     210 
     211  // Create the wrapper for the constructor function. 
     212  var _constructor = _prototype.constructor; 
     213  function klass() { 
     214    // Don't call the constructor function when prototyping. 
     215    if (!prototyping) _constructor.apply(this, arguments); 
     216  }; 
     217  _prototype.constructor = klass; 
     218 
     219  // Build the static interface. 
     220  klass.extend = arguments.callee; 
     221  extend(klass, _static); 
     222  klass.prototype = _prototype; 
     223  return klass; 
     224}; 
     225Base.prototype.extend = function(source) { 
     226  return extend(this, source); 
     227}; 
     228 
     229// A collection of regular expressions and their associated replacement values. 
     230// A Base class for creating parsers. 
     231 
     232var _HASH   = "#"; 
     233var _KEYS   = "~"; 
     234 
     235var _RG_ESCAPE_CHARS    = /\\./g; 
     236var _RG_ESCAPE_BRACKETS = /\(\?[:=!]|\[[^\]]+\]/g; 
     237var _RG_BRACKETS        = /\(/g; 
     238 
     239var RegGrp = Base.extend({ 
     240  constructor: function(values) { 
     241    this[_KEYS] = []; 
     242    this.merge(values); 
     243  }, 
     244 
     245  exec: function(string) { 
     246    var items = this, keys = this[_KEYS];     
     247    return String(string).replace(new RegExp(this, this.ignoreCase ? "gi" : "g"), function() { 
     248      var item, offset = 1, i = 0; 
     249      // Loop through the RegGrp items. 
     250      while ((item = items[_HASH + keys[i++]])) { 
     251        var next = offset + item.length + 1; 
     252        if (arguments[offset]) { // do we have a result? 
     253          var replacement = item.replacement; 
     254          switch (typeof replacement) { 
     255            case "function": 
     256              return replacement.apply(items, _slice.call(arguments, offset, next)); 
     257            case "number": 
     258              return arguments[offset + replacement]; 
     259            default: 
     260              return replacement; 
     261          } 
     262        } 
     263        offset = next; 
     264      } 
     265    }); 
     266  }, 
     267 
     268  add: function(expression, replacement) { 
     269    if (expression instanceof RegExp) { 
     270      expression = expression.source; 
     271    } 
     272    if (!this[_HASH + expression]) this[_KEYS].push(String(expression)); 
     273    this[_HASH + expression] = new RegGrp.Item(expression, replacement); 
     274  }, 
     275 
     276  merge: function(values) { 
     277    for (var i in values) this.add(i, values[i]); 
     278  }, 
     279 
     280  toString: function() { 
     281    // back references not supported in simple RegGrp 
     282    return "(" + this[_KEYS].join(")|(") + ")"; 
     283  } 
     284}, { 
     285  IGNORE: "$0", 
     286 
     287  Item: Base.extend({ 
     288    constructor: function(expression, replacement) { 
     289      expression = expression instanceof RegExp ? expression.source : String(expression); 
     290 
     291      if (typeof replacement == "number") replacement = String(replacement); 
     292      else if (replacement == null) replacement = ""; 
     293 
     294      // does the pattern use sub-expressions? 
     295      if (typeof replacement == "string" && /\$(\d+)/.test(replacement)) { 
     296        // a simple lookup? (e.g. "$2") 
     297        if (/^\$\d+$/.test(replacement)) { 
     298          // store the index (used for fast retrieval of matched strings) 
     299          replacement = parseInt(replacement.slice(1)); 
     300        } else { // a complicated lookup (e.g. "Hello $2 $1") 
     301          // build a function to do the lookup 
     302          var Q = /'/.test(replacement.replace(/\\./g, "")) ? '"' : "'"; 
     303          replacement = replacement.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\$(\d+)/g, Q + 
     304            "+(arguments[$1]||" + Q+Q + ")+" + Q); 
     305          replacement = new Function("return " + Q + replacement.replace(/(['"])\1\+(.*)\+\1\1$/, "$1") + Q); 
     306        } 
     307      } 
     308 
     309      this.length = RegGrp.count(expression); 
     310      this.replacement = replacement; 
     311      this.toString = K(expression); 
     312    } 
     313  }), 
     314 
     315  count: function(expression) { 
     316    // Count the number of sub-expressions in a RegExp/RegGrp.Item. 
     317    expression = String(expression).replace(_RG_ESCAPE_CHARS, "").replace(_RG_ESCAPE_BRACKETS, ""); 
     318    return match(expression, _RG_BRACKETS).length; 
     319  } 
     320}); 
     321 
     322// ========================================================================= 
     323// lang/extend.js 
     324// ========================================================================= 
     325 
     326function extend(object, source) { // or extend(object, key, value) 
     327  if (object && source) { 
     328    var proto = (typeof source == "function" ? Function : Object).prototype; 
     329    // Add constructor, toString etc 
     330    var i = _HIDDEN.length, key; 
     331    if (prototyping) while (key = _HIDDEN[--i]) { 
     332      var value = source[key]; 
     333      if (value != proto[key]) { 
     334        if (_BASE.test(value)) { 
     335          _override(object, key, value) 
     336        } else { 
     337          object[key] = value; 
     338        } 
     339      } 
     340    } 
     341    // Copy each of the source object's properties to the target object. 
     342    for (key in source) if (proto[key] === undefined) { 
     343      var value = source[key]; 
     344      // Check for method overriding. 
     345      if (object[key] && typeof value == "function" && _BASE.test(value)) { 
     346        _override(object, key, value); 
     347      } else { 
     348        object[key] = value; 
     349      } 
     350    } 
     351  } 
     352  return object; 
     353}; 
     354 
     355function _override(object, name, method) { 
     356  // Override an existing method. 
     357  var ancestor = object[name]; 
     358  object[name] = function() { 
     359    var previous = this.base; 
     360    this.base = ancestor; 
     361    var returnValue = method.apply(this, arguments); 
     362    this.base = previous; 
     363    return returnValue; 
     364  }; 
     365}; 
     366 
     367function combine(keys, values) { 
     368  // Combine two arrays to make a hash. 
     369  if (!values) values = keys; 
     370  var hash = {}; 
     371  for (var i in keys) hash[i] = values[i]; 
     372  return hash; 
     373}; 
     374 
     375function format(string) { 
     376  // Replace %n with arguments[n]. 
     377  // e.g. format("%1 %2%3 %2a %1%3", "she", "se", "lls"); 
     378  // ==> "she sells sea shells" 
     379  // Only %1 - %9 supported. 
     380  var args = arguments; 
     381  var _FORMAT = new RegExp("%([1-" + arguments.length + "])", "g"); 
     382  return String(string).replace(_FORMAT, function(match, index) { 
     383    return index < args.length ? args[index] : match; 
     384  }); 
     385}; 
     386 
     387function match(string, expression) { 
     388  // Same as String.match() except that this function will return an empty 
     389  // array if there is no match. 
     390  return String(string).match(expression) || []; 
     391}; 
     392 
     393function rescape(string) { 
     394  // Make a string safe for creating a RegExp. 
     395  return String(string).replace(_RESCAPE, "\\$1"); 
     396}; 
     397 
     398// http://blog.stevenlevithan.com/archives/faster-trim-javascript 
     399function trim(string) { 
     400  return String(string).replace(_LTRIM, "").replace(_RTRIM, ""); 
     401}; 
     402 
     403function K(k) { 
     404  return function() { 
     405    return k; 
     406  }; 
     407}; 
     408 
     409// ----------------------------------------------------------------------- 
     410// parsing 
     411// ----------------------------------------------------------------------- 
     412 
     413var Parser = RegGrp.extend({ignoreCase: true}); 
     414 
     415var ENCODED = /\x01(\d+)/g, 
     416    QUOTES  = /'/g,  
     417    STRING = /^\x01/, 
     418    UNICODE = /\\([\da-fA-F]{1,4})/g; 
     419 
     420var _strings = []; 
     421 
     422var encoder = new Parser({ 
     423  // comments 
     424  "<!\\-\\-|\\-\\->": "", 
     425  "\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\/": "", 
     426  // get rid 
     427  "@(namespace|import)[^;\\n]+[;\\n]": "", 
     428  // strings 
     429  "'(\\\\.|[^'\\\\])*'": encodeString, 
     430  '"(\\\\.|[^"\\\\])*"': encodeString, 
     431  // white space 
     432  "\\s+": " " 
     433}); 
     434 
     435function encode(cssText) { 
     436  return encoder.exec(cssText); 
     437}; 
     438 
     439function decode(cssText) { 
     440  return cssText.replace(ENCODED, function(match, index) { 
     441    return _strings[index - 1]; 
     442  }); 
     443}; 
     444 
     445function encodeString(string) { 
     446  return "\x01" + _strings.push(string.replace(UNICODE, function(match, chr) { 
     447    return eval("'\\u" + "0000".slice(chr.length) + chr + "'"); 
     448  }).slice(1, -1).replace(QUOTES, "\\'")); 
     449}; 
     450 
     451function getString(value) { 
     452  return STRING.test(value) ? _strings[value.slice(1) - 1] : value; 
     453}; 
     454 
     455// clone a "width" function to create a "height" function 
     456var rotater = new RegGrp({ 
     457  Width: "Height", 
     458  width: "height", 
     459  Left:  "Top", 
     460  left:  "top", 
     461  Right: "Bottom", 
     462  right: "bottom", 
     463  onX:   "onY" 
     464}); 
     465 
     466function rotate(fn) { 
     467  return rotater.exec(fn); 
     468}; 
     469 
     470// ----------------------------------------------------------------------- 
     471// event handling 
     472// ----------------------------------------------------------------------- 
     473 
     474var eventHandlers = []; 
     475 
     476function addResize(handler) { 
     477  addRecalc(handler); 
     478  addEventHandler(window, "onresize", handler); 
     479}; 
     480 
     481// add an event handler (function) to an element 
     482function addEventHandler(element, type, handler) { 
     483  element.attachEvent(type, handler); 
     484  // store the handler so it can be detached later 
     485  eventHandlers.push(arguments); 
     486}; 
     487 
     488// remove an event handler assigned to an element by IE7 
     489function removeEventHandler(element, type, handler) { 
     490try { 
     491  element.detachEvent(type, handler); 
     492} catch (ignore) { 
     493  // write a letter of complaint to microsoft.. 
     494}}; 
     495 
     496// remove event handlers (they eat memory) 
     497addEventHandler(window, "onunload", function() { 
     498  var handler; 
     499  while (handler = eventHandlers.pop()) { 
     500    removeEventHandler(handler[0], handler[1], handler[2]); 
     501  } 
     502}); 
     503 
     504function register(handler, element, condition) { // -@DRE 
     505  //var set = handler[element.uniqueID]; 
     506  if (!handler.elements) handler.elements = {}; 
     507  if (condition) handler.elements[element.uniqueID] = element; 
     508  else delete handler.elements[element.uniqueID]; 
     509  //return !set && condition; 
     510  return condition; 
     511}; 
     512 
     513addEventHandler(window, "onbeforeprint", function() { 
     514  if (!IE7.CSS.print) new StyleSheet("print"); 
     515  IE7.CSS.print.recalc(); 
     516}); 
     517 
     518// ----------------------------------------------------------------------- 
     519// pixel conversion 
     520// ----------------------------------------------------------------------- 
     521 
     522// this is handy because it means that web developers can mix and match 
     523//  measurement units in their style sheets. it is not uncommon to 
     524//  express something like padding in "em" units whilst border thickness 
     525//  is most often expressed in pixels. 
     526 
     527var PIXEL = /^\d+(px)?$/i; 
     528var PERCENT = /^\d+%$/; 
     529var getPixelValue = function(element, value) { 
     530  if (PIXEL.test(value)) return parseInt(value); 
     531  var style = element.style.left; 
     532  var runtimeStyle = element.runtimeStyle.left; 
     533  element.runtimeStyle.left = element.currentStyle.left; 
     534  element.style.left = value || 0; 
     535  value = element.style.pixelLeft; 
     536  element.style.left = style; 
     537  element.runtimeStyle.left = runtimeStyle; 
     538  return value; 
     539}; 
     540 
     541// ----------------------------------------------------------------------- 
     542// generic 
     543// ----------------------------------------------------------------------- 
     544 
     545var $IE7 = "ie7-"; 
     546 
     547var Fix = Base.extend({ 
     548  constructor: function() { 
     549    this.fixes = []; 
     550    this.recalcs = []; 
     551  }, 
     552  init: Undefined 
     553}); 
     554 
     555// a store for functions that will be called when refreshing IE7 
     556var recalcs = []; 
     557function addRecalc(recalc) { 
     558  recalcs.push(recalc); 
     559}; 
     560 
     561IE7.recalc = function() { 
     562  IE7.HTML.recalc(); 
     563  // re-apply style sheet rules (re-calculate ie7 classes) 
     564  IE7.CSS.recalc(); 
     565  // apply global fixes to the document 
     566  for (var i = 0; i < recalcs.length; i++) recalcs[i](); 
     567}; 
     568 
     569function isFixed(element) { 
     570  return element.currentStyle["ie7-position"] == "fixed"; 
     571}; 
     572 
     573// original style 
     574function getDefinedStyle(element, propertyName) { 
     575  return element.currentStyle[$IE7 + propertyName] || element.currentStyle[propertyName]; 
     576}; 
     577 
     578function setOverrideStyle(element, propertyName, value) { 
     579  if (element.currentStyle[$IE7 + propertyName] == null) { 
     580    element.runtimeStyle[$IE7 + propertyName] = element.currentStyle[propertyName]; 
     581  } 
     582  element.runtimeStyle[propertyName] = value; 
     583}; 
     584 
     585// create a temporary element which is used to inherit styles 
     586//  from the target element. the temporary element can be resized 
     587//  to determine pixel widths/heights 
     588function createTempElement(tagName) { 
     589  var element = document.createElement(tagName || "object"); 
     590  element.style.cssText = "position:absolute;padding:0;display:block;border:none;clip:rect(0 0 0 0);left:-9999"; 
     591  element.ie7_anon = true; 
     592  return element; 
     593}; 
     594 
     595 
     596// ========================================================================= 
     597// ie7-cssQuery.js 
     598// ========================================================================= 
     599 
     600function cssQuery(selector, context, single) { 
     601  if (!_cache[selector]) { 
     602    reg = []; // store for RegExp objects 
     603    var fn = ""; 
     604    var selectors = cssParser.escape(selector).split(","); 
     605    for (var i = 0; i < selectors.length; i++) { 
     606      _wild = _index = _list = 0; // reset 
     607      _duplicate = selectors.length > 1 ? 2 : 0; // reset 
     608      var block = cssParser.exec(selectors[i]) || "if(0){"; 
     609      if (_wild) { // IE's pesky comment nodes 
     610        block += format("if(e%1.nodeName!='!'){", _index); 
     611      } 
     612      // check for duplicates before storing results 
     613      var store = _duplicate > 1 ? _TEST : ""; 
     614      block += format(store + _STORE, _index); 
     615      // add closing braces 
     616      block += Array(match(block, /\{/g).length + 1).join("}"); 
     617      fn += block; 
     618    } 
     619    eval(format(_FN, reg) + cssParser.unescape(fn) + "return s?null:r}"); 
     620    _cache[selector] = _selectorFunction; 
     621  } 
     622  return _cache[selector](context || document, single); 
     623}; 
     624 
     625var _MSIE5 = appVersion < 6; 
     626 
     627var _EVALUATED = /^(href|src)$/; 
     628var _ATTRIBUTES = { 
     629  "class": "className", 
     630  "for": "htmlFor" 
     631}; 
     632 
     633IE7._indexed = 1; 
     634 
     635IE7._byId = function(document, id) { 
     636  var result = document.all[id] || null; 
     637  // returns a single element or a collection 
     638  if (!result || result.id == id) return result; 
     639  // document.all has returned a collection of elements with name/id 
     640  for (var i = 0; i < result.length; i++) { 
     641    if (result[i].id == id) return result[i]; 
     642  } 
     643  return null; 
     644}; 
     645 
     646IE7._getAttribute = function(element, name) { 
     647  if (name == "src" && element.pngSrc) return element.pngSrc; 
     648   
     649  var attribute = _MSIE5 ? (element.attributes[name] || element.attributes[_ATTRIBUTES[name.toLowerCase()]]) : element.getAttributeNode(name); 
     650  if (attribute && (attribute.specified || name == "value")) { 
     651    if (_EVALUATED.test(name)) { 
     652      return element.getAttribute(name, 2); 
     653    } else if (name == "class") { 
     654     return element.className.replace(/\sie7_\w+/g, ""); 
     655    } else if (name == "style") { 
     656     return element.style.cssText; 
     657    } else { 
     658     return attribute.nodeValue; 
     659    } 
     660  } 
     661  return null; 
     662}; 
     663 
     664var names = "colSpan,rowSpan,vAlign,dateTime,accessKey,tabIndex,encType,maxLength,readOnly,longDesc"; 
     665// Convert the list of strings to a hash, mapping the lowercase name to the camelCase name. 
     666extend(_ATTRIBUTES, combine(names.toLowerCase().split(","), names.split(","))); 
     667 
     668IE7._getNextElementSibling = function(node) { 
     669  // return the next element to the supplied element 
     670  //  nextSibling is not good enough as it might return a text or comment node 
     671  while (node && (node = node.nextSibling) && (node.nodeType != 1 || node.nodeName == "!")) continue; 
     672  return node; 
     673}; 
     674 
     675IE7._getPreviousElementSibling = function(node) { 
     676  // return the previous element to the supplied element 
     677  while (node && (node = node.previousSibling) && (node.nodeType != 1 || node.nodeName == "!")) continue; 
     678  return node; 
     679}; 
     680 
     681// ========================================================================= 
     682// CSSParser 
     683// ========================================================================= 
     684 
     685var IMPLIED_ASTERISK = /([\s>+~,]|[^(]\+|^)([#.:\[])/g, 
     686    IMPLIED_SPACE =    /(^|,)([^\s>+~])/g, 
     687    WHITESPACE =       /\s*([\s>+~(),]|^|$)\s*/g, 
     688    WILD_CARD =        /\s\*\s/g;; 
     689 
     690var CSSParser = RegGrp.extend({ 
     691  constructor: function(items) { 
     692    this.base(items); 
     693    this.sorter = new RegGrp; 
     694    this.sorter.add(/:not\([^)]*\)/, RegGrp.IGNORE); 
     695    this.sorter.add(/([ >](\*|[\w-]+))([^: >+~]*)(:\w+-child(\([^)]+\))?)([^: >+~]*)/, "$1$3$6$4"); 
     696  }, 
     697   
     698  ignoreCase: true, 
     699 
     700  escape: function(selector) { 
     701    return this.optimise(this.format(selector)); 
     702  }, 
     703 
     704  format: function(selector) { 
     705    return selector 
     706      .replace(WHITESPACE, "$1") 
     707      .replace(IMPLIED_SPACE, "$1 $2") 
     708      .replace(IMPLIED_ASTERISK, "$1*$2"); 
     709  }, 
     710 
     711  optimise: function(selector) { 
     712    // optimise wild card descendant selectors 
     713    return this.sorter.exec(selector.replace(WILD_CARD, ">* ")); 
     714  }, 
     715 
     716  unescape: function(selector) { 
     717    return decode(selector); 
     718  } 
     719}); 
     720 
     721// some constants 
     722var _OPERATORS = { 
     723  "":   "%1!=null", 
     724  "=":  "%1=='%2'", 
     725  "~=": /(^| )%1( |$)/, 
     726  "|=": /^%1(-|$)/, 
     727  "^=": /^%1/, 
     728  "$=": /%1$/, 
     729  "*=": /%1/ 
     730}; 
     731 
     732var _PSEUDO_CLASSES = { 
     733  "first-child": "!IE7._getPreviousElementSibling(e%1)", 
     734  "link":        "e%1.currentStyle['ie7-link']=='link'", 
     735  "visited":     "e%1.currentStyle['ie7-link']=='visited'" 
     736}; 
     737 
     738var _VAR = "var p%2=0,i%2,e%2,n%2=e%1."; 
     739var _ID = "e%1.sourceIndex"; 
     740var _TEST = "var g=" + _ID + ";if(!p[g]){p[g]=1;"; 
     741var _STORE = "r[r.length]=e%1;if(s)return e%1;"; 
     742var _FN = "var _selectorFunction=function(e0,s){IE7._indexed++;var r=[],p={},reg=[%1],d=document;"; 
     743var reg; // a store for RexExp objects 
     744var _index; 
     745var _wild; // need to flag certain _wild card selectors as MSIE includes comment nodes 
     746var _list; // are we processing a node _list? 
     747var _duplicate; // possible duplicates? 
     748var _cache = {}; // store parsed selectors 
     749 
     750// a hideous parser 
     751var cssParser = new CSSParser({ 
     752  " (\\*|[\\w-]+)#([\\w-]+)": function(match, tagName, id) { // descendant selector followed by ID 
     753    _wild = false; 
     754    var replacement = "var e%2=IE7._byId(d,'%4');if(e%2&&"; 
     755    if (tagName != "*") replacement += "e%2.nodeName=='%3'&&"; 
     756    replacement += "(e%1==d||e%1.contains(e%2))){"; 
     757    if (_list) replacement += format("i%1=n%1.length;", _list); 
     758    return format(replacement, _index++, _index, tagName.toUpperCase(), id); 
     759  }, 
     760   
     761  " (\\*|[\\w-]+)": function(match, tagName) { // descendant selector 
     762    _duplicate++; // this selector may produce duplicates 
     763    _wild = tagName == "*"; 
     764    var replacement = _VAR; 
     765    // IE5.x does not support getElementsByTagName("*"); 
     766    replacement += (_wild && _MSIE5) ? "all" : "getElementsByTagName('%3')"; 
     767    replacement += ";for(i%2=0;(e%2=n%2[i%2]);i%2++){"; 
     768    return format(replacement, _index++, _list = _index, tagName.toUpperCase()); 
     769  }, 
     770   
     771  ">(\\*|[\\w-]+)": function(match, tagName) { // child selector 
     772    var children = _list; 
     773    _wild = tagName == "*"; 
     774    var replacement = _VAR; 
     775    // use the children property for MSIE as it does not contain text nodes 
     776    //  (but the children collection still includes comments). 
     777    // the document object does not have a children collection 
     778    replacement += children ? "children": "childNodes"; 
     779    if (!_wild && children) replacement += ".tags('%3')"; 
     780    replacement += ";for(i%2=0;(e%2=n%2[i%2]);i%2++){"; 
     781    if (_wild) { 
     782      replacement += "if(e%2.nodeType==1){"; 
     783      _wild = _MSIE5; 
     784    } else { 
     785      if (!children) replacement += "if(e%2.nodeName=='%3'){"; 
     786    } 
     787    return format(replacement, _index++, _list = _index, tagName.toUpperCase()); 
     788  }, 
     789   
     790  "\\+(\\*|[\\w-]+)": function(match, tagName) { // direct adjacent selector 
     791    var replacement = ""; 
     792    if (_wild) replacement += "if(e%1.nodeName!='!'){"; 
     793    _wild = false; 
     794    replacement += "e%1=IE7._getNextElementSibling(e%1);if(e%1"; 
     795    if (tagName != "*") replacement += "&&e%1.nodeName=='%2'"; 
     796    replacement += "){"; 
     797    return format(replacement, _index, tagName.toUpperCase()); 
     798  }, 
     799   
     800  "~(\\*|[\\w-]+)": function(match, tagName) { // indirect adjacent selector 
     801    var replacement = ""; 
     802    if (_wild) replacement += "if(e%1.nodeName!='!'){"; 
     803    _wild = false; 
     804    _duplicate = 2; // this selector may produce duplicates 
     805    replacement += "while(e%1=e%1.nextSibling){if(e%1.ie7_adjacent==IE7._indexed)break;if("; 
     806    if (tagName == "*") { 
     807      replacement += "e%1.nodeType==1"; 
     808      if (_MSIE5) replacement += "&&e%1.nodeName!='!'"; 
     809    } else replacement += "e%1.nodeName=='%2'"; 
     810    replacement += "){e%1.ie7_adjacent=IE7._indexed;"; 
     811    return format(replacement, _index, tagName.toUpperCase()); 
     812  }, 
     813   
     814  "#([\\w-]+)": function(match, id) { // ID selector 
     815    _wild = false; 
     816    var replacement = "if(e%1.id=='%2'){"; 
     817    if (_list) replacement += format("i%1=n%1.length;", _list); 
     818    return format(replacement, _index, id); 
     819  }, 
     820   
     821  "\\.([\\w-]+)": function(match, className) { // class selector 
     822    _wild = false; 
     823    // store RegExp objects - slightly faster on IE 
     824    reg.push(new RegExp("(^|\\s)" + rescape(className) + "(\\s|$)")); 
     825    return format("if(e%1.className&&reg[%2].test(e%1.className)){", _index, reg.length - 1); 
     826  }, 
     827   
     828  "\\[([\\w-]+)\\s*([^=]?=)?\\s*([^\\]]*)\\]": function(match, attr, operator, value) { // attribute selectors 
     829    var alias = _ATTRIBUTES[attr] || attr; 
     830    if (operator) { 
     831      var getAttribute = "e%1.getAttribute('%2',2)"; 
     832      if (!_EVALUATED.test(attr)) { 
     833        getAttribute = "e%1.%3||" + getAttribute; 
     834      } 
     835      attr = format("(" + getAttribute + ")", _index, attr, alias); 
     836    } else { 
     837      attr = format("IE7._getAttribute(e%1,'%2')", _index, attr); 
     838    } 
     839    var replacement = _OPERATORS[operator || ""] || "0"; 
     840    if (replacement && replacement.source) { 
     841      reg.push(new RegExp(format(replacement.source, rescape(cssParser.unescape(value))))); 
     842      replacement = "reg[%2].test(%1)"; 
     843      value = reg.length - 1; 
     844    } 
     845    return "if(" + format(replacement, attr, value) + "){"; 
     846  }, 
     847   
     848  ":+([\\w-]+)(\\(([^)]+)\\))?": function(match, pseudoClass, $2, args) { // pseudo class selectors 
     849    pseudoClass = _PSEUDO_CLASSES[pseudoClass]; 
     850    return "if(" + (pseudoClass ? format(pseudoClass, _index, args || "")  : "0") + "){"; 
     851  } 
     852}); 
     853 
     854// ========================================================================= 
     855// ie7-css.js 
     856// ========================================================================= 
     857 
     858var HYPERLINK = /a(#[\w-]+)?(\.[\w-]+)?:(hover|active)/i; 
     859var BRACE1 = /\s*\{\s*/, BRACE2 = /\s*\}\s*/, COMMA = /\s*\,\s*/; 
     860var FIRST_LINE_LETTER = /(.*)(:first-(line|letter))/; 
     861 
     862//var UNKNOWN = /UNKNOWN|([:.])\w+\1/i; 
     863 
     864var styleSheets = document.styleSheets; 
     865 
     866IE7.CSS = new (Fix.extend({ // single instance 
     867  parser: new Parser, 
     868  screen: "", 
     869  print: "", 
     870  styles: [], 
     871  rules: [], 
     872  pseudoClasses: appVersion < 7 ? "first\\-child" : "", 
     873  dynamicPseudoClasses: { 
     874    toString: function() { 
     875      var strings = []; 
     876      for (var pseudoClass in this) strings.push(pseudoClass); 
     877      return strings.join("|"); 
     878    } 
     879  }, 
     880   
     881  init: function() { 
     882    var NONE = "^\x01$"; 
     883    var CLASS = "\\[class=?[^\\]]*\\]"; 
     884    var pseudoClasses = []; 
     885    if (this.pseudoClasses) pseudoClasses.push(this.pseudoClasses); 
     886    var dynamicPseudoClasses = this.dynamicPseudoClasses.toString();  
     887    if (dynamicPseudoClasses) pseudoClasses.push(dynamicPseudoClasses); 
     888    pseudoClasses = pseudoClasses.join("|"); 
     889    var unknown = appVersion < 7 ? ["[>+~[(]|([:.])\\w+\\1"] : [CLASS]; 
     890    if (pseudoClasses) unknown.push(":(" + pseudoClasses + ")"); 
     891    this.UNKNOWN = new RegExp(unknown.join("|") || NONE, "i"); 
     892    var complex = appVersion < 7 ? ["\\[[^\\]]+\\]|[^\\s(\\[]+\\s*[+~]"] : [CLASS]; 
     893    var complexRule = complex.concat(); 
     894    if (pseudoClasses) complexRule.push(":(" + pseudoClasses + ")"); 
     895    Rule.COMPLEX = new RegExp(complexRule.join("|") || NONE, "ig"); 
     896    if (this.pseudoClasses) complex.push(":(" + this.pseudoClasses + ")"); 
     897    DynamicRule.COMPLEX = new RegExp(complex.join("|") || NONE, "i"); 
     898    DynamicRule.MATCH = new RegExp(dynamicPseudoClasses ? "(.*):(" + dynamicPseudoClasses + ")(.*)" : NONE, "i"); 
     899     
     900    this.createStyleSheet(); 
     901    this.refresh(); 
     902  }, 
     903   
     904     addEventHandler: function() { 
     905          addEventHandler.apply(null, arguments); 
     906     }, 
     907   
     908  addFix: function(expression, replacement) { 
     909    this.parser.add(expression, replacement); 
     910  }, 
     911   
     912  addRecalc: function(propertyName, test, handler, replacement) { 
     913    // recalcs occur whenever the document is refreshed using document.recalc() 
     914    test = new RegExp("([{;\\s])" + propertyName + "\\s*:\\s*" + test + "[^;}]*"); 
     915    var id = this.recalcs.length; 
     916    if (replacement) replacement = propertyName + ":" + replacement; 
     917    this.addFix(test, function(match, $1) { 
     918      return (replacement ? $1 + replacement : match) + ";ie7-" + match.slice(1) + ";ie7_recalc" + id + ":1"; 
     919    }); 
     920    this.recalcs.push(arguments); 
     921    return id; 
     922  }, 
     923   
     924  apply: function() { 
     925    this.getInlineStyles(); 
     926    new StyleSheet("screen"); 
     927    this.trash(); 
     928  }, 
     929   
     930  createStyleSheet: function() { 
     931    // create the IE7 style sheet 
     932    this.styleSheet = document.createStyleSheet(); 
     933    // flag it so we can ignore it during parsing 
     934    this.styleSheet.ie7 = true; 
     935    this.styleSheet.owningElement.ie7 = true; 
     936    this.styleSheet.cssText = HEADER; 
     937  }, 
     938   
     939  getInlineStyles: function() { 
     940    // load inline styles 
     941    var styleSheets = document.getElementsByTagName("style"), styleSheet; 
     942    for (var i = styleSheets.length - 1; (styleSheet = styleSheets[i]); i--) { 
     943      if (!styleSheet.disabled && !styleSheet.ie7) { 
     944        this.styles.push(styleSheet.innerHTML); 
     945      } 
     946    } 
     947  }, 
     948   
     949  getText: function(styleSheet, path) { 
     950    // explorer will trash unknown selectors (it converts them to "UNKNOWN"). 
     951    // so we must reload external style sheets (internal style sheets can have their text 
     952    //  extracted through the innerHTML property). 
     953      // load the style sheet text from an external file 
     954    try { 
     955      var cssText = styleSheet.cssText; 
     956    } catch (e) { 
     957      cssText = ""; 
     958    } 
     959    if (httpRequest) cssText = loadFile(styleSheet.href, path) || cssText; 
     960    return cssText; 
     961  }, 
     962   
     963  recalc: function() { 
     964    this.screen.recalc(); 
     965    // we're going to read through all style rules. 
     966    //  certain rules have had ie7 properties added to them. 
     967    //   e.g. p{top:0; ie7_recalc2:1; left:0} 
     968    //  this flags a property in the rule as needing a fix. 
     969    //  the selector text is then used to query the document. 
     970    //  we can then loop through the results of the query 
     971    //  and fix the elements. 
     972    // we ignore the IE7 rules - so count them in the header 
     973    var RECALCS = /ie7_recalc\d+/g; 
     974    var start = HEADER.match(/[{,]/g).length; 
     975    // only calculate screen fixes. print fixes don't show up anyway 
     976    var stop = start + (this.screen.cssText.match(/\{/g)||"").length; 
     977    var rules = this.styleSheet.rules, rule; 
     978    var calcs, calc, elements, element, i, j, k, id; 
     979    // loop through all rules 
     980    for (i = start; i < stop; i++) { 
     981      rule = rules[i]; 
     982      var cssText = rule.style.cssText; 
     983      // search for the "ie7_recalc" flag (there may be more than one) 
     984      if (rule && (calcs = cssText.match(RECALCS))) { 
     985        // use the selector text to query the document 
     986        elements = cssQuery(rule.selectorText); 
     987        // if there are matching elements then loop 
     988        //  through the recalc functions and apply them 
     989        //  to each element 
     990        if (elements.length) for (j = 0; j < calcs.length; j++) { 
     991          // get the matching flag (e.g. ie7_recalc3) 
     992          id = calcs[j]; 
     993          // extract the numeric id from the end of the flag 
     994          //  and use it to index the collection of recalc 
     995          //  functions 
     996          calc = IE7.CSS.recalcs[id.slice(10)][2]; 
     997          for (k = 0; (element = elements[k]); k++) { 
     998            // apply the fix 
     999            if (element.currentStyle[id]) calc(element, cssText); 
     1000          } 
     1001        } 
     1002      } 
     1003    } 
     1004  }, 
     1005   
     1006  refresh: function() { 
     1007    this.styleSheet.cssText = HEADER + this.screen + this.print; 
     1008  }, 
     1009   
     1010  trash: function() { 
     1011    // trash the old style sheets 
     1012    for (var i = 0; i < styleSheets.length; i++) { 
     1013      if (!styleSheets[i].ie7) { 
     1014        try { 
     1015          var cssText = styleSheets[i].cssText; 
     1016        } catch (e) { 
     1017          cssText = ""; 
     1018        } 
     1019        if (cssText) styleSheets[i].cssText = ""; 
     1020      } 
     1021    } 
     1022  } 
     1023})); 
     1024 
     1025// ----------------------------------------------------------------------- 
     1026//  IE7 StyleSheet class 
     1027// ----------------------------------------------------------------------- 
     1028 
     1029var StyleSheet = Base.extend({ 
     1030  constructor: function(media) { 
     1031    this.media = media; 
     1032    this.load(); 
     1033    IE7.CSS[media] = this; 
     1034    IE7.CSS.refresh(); 
     1035  }, 
     1036   
     1037  createRule: function(selector, cssText) { 
     1038    if (IE7.CSS.UNKNOWN.test(selector)) { 
     1039      var match; 
     1040      if (PseudoElement && (match = selector.match(PseudoElement.MATCH))) { 
     1041        return new PseudoElement(match[1], match[2], cssText); 
     1042      } else if (match = selector.match(DynamicRule.MATCH)) { 
     1043        if (!HYPERLINK.test(match[0]) || DynamicRule.COMPLEX.test(match[0])) { 
     1044          return new DynamicRule(selector, match[1], match[2], match[3], cssText); 
     1045        } 
     1046      } else return new Rule(selector, cssText); 
     1047    } 
     1048    return selector + " {" + cssText + "}"; 
     1049  }, 
     1050   
     1051  getText: function() { 
     1052    // store for style sheet text 
     1053    var _inlineStyles = [].concat(IE7.CSS.styles); 
     1054    // parse media decalarations 
     1055    var MEDIA = /@media\s+([^{]*)\{([^@]+\})\s*\}/gi; 
     1056    var ALL = /\ball\b|^$/i, SCREEN = /\bscreen\b/i, PRINT = /\bprint\b/i; 
     1057    function _parseMedia(cssText, media) { 
     1058      _filterMedia.value = media; 
     1059      return cssText.replace(MEDIA, _filterMedia); 
     1060    }; 
     1061    function _filterMedia(match, media, cssText) { 
     1062      media = _simpleMedia(media); 
     1063      switch (media) { 
     1064        case "screen": 
     1065        case "print": 
     1066          if (media != _filterMedia.value) return ""; 
     1067        case "all": 
     1068          return cssText; 
     1069      } 
     1070      return ""; 
     1071    }; 
     1072    function _simpleMedia(media) { 
     1073      if (ALL.test(media)) return "all"; 
     1074      else if (SCREEN.test(media)) return (PRINT.test(media)) ? "all" : "screen"; 
     1075      else if (PRINT.test(media)) return "print"; 
     1076    }; 
     1077    var self = this; 
     1078    function _getCSSText(styleSheet, path, media, level) { 
     1079      var cssText = ""; 
     1080      if (!level) { 
     1081        media = _simpleMedia(styleSheet.media); 
     1082        level = 0; 
     1083      } 
     1084      if (media == "all" || media == self.media) { 
     1085        // IE only allows importing style sheets three levels deep. 
     1086        // it will crash if you try to access a level below this 
     1087        if (level < 3) { 
     1088          // loop through imported style sheets 
     1089          for (var i = 0; i < styleSheet.imports.length; i++) { 
     1090            // call this function recursively to get all imported style sheets 
     1091            cssText += _getCSSText(styleSheet.imports[i], getPath(styleSheet.href, path), media, level + 1); 
     1092          } 
     1093        } 
     1094        // retrieve inline style or load an external style sheet 
     1095        cssText += encode(styleSheet.href ? _loadStyleSheet(styleSheet, path) : _inlineStyles.pop() || ""); 
     1096        cssText = _parseMedia(cssText, self.media); 
     1097      } 
     1098      return cssText; 
     1099    }; 
     1100    // store loaded cssText URLs 
     1101    var fileCache = {}; 
     1102    // load an external style sheet 
     1103    function _loadStyleSheet(styleSheet, path) { 
     1104      var url = makePath(styleSheet.href, path); 
     1105      // if the style sheet has already loaded then don't duplicate it 
     1106      if (fileCache[url]) return ""; 
     1107      // load from source 
     1108      fileCache[url] = (styleSheet.disabled) ? "" : 
     1109        _fixUrls(IE7.CSS.getText(styleSheet, path), getPath(styleSheet.href, path)); 
     1110      return fileCache[url]; 
     1111    }; 
     1112    // fix css paths 
     1113    // we're lumping all css text into one big style sheet so relative 
     1114    //  paths have to be fixed. this is necessary anyway because of other 
     1115    //  explorer bugs. 
     1116    var URL = /(url\s*\(\s*['"]?)([\w\.]+[^:\)]*['"]?\))/gi; 
     1117    function _fixUrls(cssText, pathname) { 
     1118      // hack & slash 
     1119      return cssText.replace(URL, "$1" + pathname.slice(0, pathname.lastIndexOf("/") + 1) + "$2"); 
     1120    }; 
     1121 
     1122    // load all style sheets in the document 
     1123    for (var i = 0; i < styleSheets.length; i++) { 
     1124      if (!styleSheets[i].disabled && !styleSheets[i].ie7) { 
     1125        this.cssText += _getCSSText(styleSheets[i]); 
     1126      } 
     1127    } 
     1128  }, 
     1129   
     1130  load: function() { 
     1131    this.cssText = ""; 
     1132    this.getText(); 
     1133    this.parse(); 
     1134    this.cssText = decode(this.cssText); 
     1135    fileCache = {}; 
     1136  }, 
     1137   
     1138  parse: function() { 
     1139    this.cssText = IE7.CSS.parser.exec(this.cssText); 
     1140     
     1141    // parse the style sheet 
     1142    var offset = IE7.CSS.rules.length; 
     1143    var rules = this.cssText.split(BRACE2), rule; 
     1144    var selectors, cssText, i, j; 
     1145    for (i = 0; i < rules.length; i++) { 
     1146      rule = rules[i].split(BRACE1); 
     1147      selectors = rule[0].split(COMMA); 
     1148      cssText = rule[1]; 
     1149      for (j = 0; j < selectors.length; j++) { 
     1150        selectors[j] = cssText ? this.createRule(selectors[j], cssText) : ""; 
     1151      } 
     1152      rules[i] = selectors.join("\n"); 
     1153    } 
     1154    this.cssText = rules.join("\n"); 
     1155    this.rules = IE7.CSS.rules.slice(offset); 
     1156  }, 
     1157   
     1158  recalc: function() { 
     1159    var rule, i; 
     1160    for (i = 0; (rule = this.rules[i]); i++) rule.recalc(); 
     1161  }, 
     1162   
     1163  toString: function() { 
     1164    return "@media " + this.media + "{" + this.cssText + "}"; 
     1165  } 
     1166}); 
     1167 
     1168var PseudoElement; 
     1169 
     1170// ----------------------------------------------------------------------- 
     1171// IE7 style rules 
     1172// ----------------------------------------------------------------------- 
     1173 
     1174var Rule = IE7.Rule = Base.extend({ 
     1175  // properties 
     1176  constructor: function(selector, cssText) { 
     1177    this.id = IE7.CSS.rules.length; 
     1178    this.className = Rule.PREFIX + this.id; 
     1179    selector = selector.match(FIRST_LINE_LETTER) || selector || "*"; 
     1180    this.selector = selector[1] || selector; 
     1181    this.selectorText = this.parse(this.selector) + (selector[2] || ""); 
     1182    this.cssText = cssText; 
     1183    this.MATCH = new RegExp("\\s" + this.className + "(\\s|$)", "g"); 
     1184    IE7.CSS.rules.push(this); 
     1185    this.init(); 
     1186  }, 
     1187   
     1188  init: Undefined, 
     1189   
     1190  add: function(element) { 
     1191    // allocate this class 
     1192    element.className += " " + this.className; 
     1193  }, 
     1194   
     1195  recalc: function() { 
     1196    // execute the underlying css query for this class 
     1197    var match = cssQuery(this.selector); 
     1198    // add the class name for all matching elements 
     1199    for (var i = 0; i < match.length; i++) this.add(match[i]); 
     1200  }, 
     1201 
     1202  parse: function(selector) { 
     1203    // attempt to preserve specificity for "loose" parsing by 
     1204    //  removing unknown tokens from a css selector but keep as 
     1205    //  much as we can.. 
     1206    var simple = selector.replace(Rule.CHILD, " ").replace(Rule.COMPLEX, ""); 
     1207    if (appVersion < 7) simple = simple.replace(Rule.MULTI, ""); 
     1208    var tags = match(simple, Rule.TAGS).length - match(selector, Rule.TAGS).length; 
     1209    var classes = match(simple, Rule.CLASSES).length - match(selector, Rule.CLASSES).length + 1; 
     1210    while (classes > 0 && Rule.CLASS.test(simple)) { 
     1211      simple = simple.replace(Rule.CLASS, ""); 
     1212      classes--; 
     1213    } 
     1214    while (tags > 0 && Rule.TAG.test(simple)) { 
     1215      simple = simple.replace(Rule.TAG, "$1*"); 
     1216      tags--; 
     1217    } 
     1218    simple += "." + this.className; 
     1219    classes = Math.min(classes, 2); 
     1220    tags = Math.min(tags, 2); 
     1221    var score = -10 * classes - tags; 
     1222    if (score > 0) { 
     1223      simple = simple + "," + Rule.MAP[score] + " " + simple; 
     1224    } 
     1225    return simple; 
     1226  }, 
     1227   
     1228  remove: function(element) { 
     1229    // deallocate this class 
     1230    element.className = element.className.replace(this.MATCH, "$1"); 
     1231  }, 
     1232   
     1233  toString: function() { 
     1234    return format("%1 {%2}", this.selectorText, this.cssText); 
     1235  } 
     1236}, { 
     1237  CHILD: />/g, 
     1238  CLASS: /\.[\w-]+/, 
     1239  CLASSES: /[.:\[]/g, 
     1240  MULTI: /(\.[\w-]+)+/g, 
     1241  PREFIX: "ie7_class", 
     1242  TAG: /^\w+|([\s>+~])\w+/, 
     1243  TAGS: /^\w|[\s>+~]\w/g, 
     1244  MAP: { 
     1245    1:  "html", 
     1246    2:  "html body", 
     1247    10: ".ie7_html", 
     1248    11: "html.ie7_html", 
     1249    12: "html.ie7_html body", 
     1250    20: ".ie7_html .ie7_body", 
     1251    21: "html.ie7_html .ie7_body", 
     1252    22: "html.ie7_html body.ie7_body" 
     1253  } 
     1254}); 
     1255 
     1256// ----------------------------------------------------------------------- 
     1257// IE7 dynamic style 
     1258// ----------------------------------------------------------------------- 
     1259 
     1260// object properties: 
     1261// attach: the element that an event handler will be attached to 
     1262// target: the element that will have the IE7 class applied 
     1263 
     1264var DynamicRule = Rule.extend({ 
     1265  // properties 
     1266  constructor: function(selector, attach, dynamicPseudoClass, target, cssText) { 
     1267    // initialise object properties 
     1268    this.attach = attach || "*"; 
     1269    this.dynamicPseudoClass = IE7.CSS.dynamicPseudoClasses[dynamicPseudoClass]; 
     1270    this.target = target; 
     1271    this.base(selector, cssText); 
     1272  }, 
     1273   
     1274  recalc: function() { 
     1275    // execute the underlying css query for this class 
     1276    var attaches = cssQuery(this.attach), attach; 
     1277    // process results 
     1278    for (var i = 0; attach = attaches[i]; i++) { 
     1279      // retrieve the event handler's target element(s) 
     1280      var target = this.target ? cssQuery(this.target, attach) : [attach]; 
     1281      // attach event handlers for dynamic pseudo-classes 
     1282      if (target.length) this.dynamicPseudoClass.apply(attach, target, this); 
     1283    } 
     1284  } 
     1285}); 
     1286 
     1287// ----------------------------------------------------------------------- 
     1288//  IE7 dynamic pseudo-classes 
     1289// ----------------------------------------------------------------------- 
     1290 
     1291var DynamicPseudoClass = Base.extend({ 
     1292  constructor: function(name, apply) { 
     1293    this.name = name; 
     1294    this.apply = apply; 
     1295    this.instances = {}; 
     1296    IE7.CSS.dynamicPseudoClasses[name] = this; 
     1297  }, 
     1298   
     1299  register: function(instance) { 
     1300    // an "instance" is actually an Arguments object 
     1301    var _class = instance[2]; 
     1302    instance.id = _class.id + instance[0].uniqueID; 
     1303    if (!this.instances[instance.id]) { 
     1304      var target = instance[1], j; 
     1305      for (j = 0; j < target.length; j++) _class.add(target[j]); 
     1306      this.instances[instance.id] = instance; 
     1307    } 
     1308  }, 
     1309   
     1310  unregister: function(instance) { 
     1311    if (this.instances[instance.id]) { 
     1312      var _class = instance[2]; 
     1313      var target = instance[1], j; 
     1314      for (j = 0; j < target.length; j++) _class.remove(target[j]); 
     1315      delete this.instances[instance.id]; 
     1316    } 
     1317  } 
     1318}); 
     1319   
     1320// ----------------------------------------------------------------------- 
     1321// dynamic pseudo-classes 
     1322// ----------------------------------------------------------------------- 
     1323 
     1324if (appVersion < 7) { 
     1325  var Hover = new DynamicPseudoClass("hover", function(element) { 
     1326    var instance = arguments; 
     1327    IE7.CSS.addEventHandler(element, appVersion < 5.5 ? "onmouseover" : "onmouseenter", function() { 
     1328      Hover.register(instance); 
     1329    }); 
     1330    IE7.CSS.addEventHandler(element, appVersion < 5.5 ? "onmouseout" : "onmouseleave", function() { 
     1331      Hover.unregister(instance); 
     1332    }); 
     1333  }); 
     1334   
     1335  // globally trap the mouseup event (thanks Martijn!) 
     1336  addEventHandler(document, "onmouseup", function() { 
     1337    var instances = Hover.instances; 
     1338    for (var i in instances) 
     1339      if (!instances[i][0].contains(event.srcElement)) 
     1340        Hover.unregister(instances[i]); 
     1341  }); 
     1342} 
     1343 
     1344// ----------------------------------------------------------------------- 
     1345// propertyName: inherit; 
     1346// ----------------------------------------------------------------------- 
     1347 
     1348IE7.CSS.addRecalc("[\\w-]+", "inherit", function(element, cssText) { 
     1349  var inherited = cssText.match(/[\w-]+\s*:\s*inherit/g); 
     1350  for (var i = 0; i < inherited.length; i++) { 
     1351    var propertyName = inherited[i].replace(/ie7\-|\s*:\s*inherit/g, "").replace(/\-([a-z])/g, function(match, chr) { 
     1352      return chr.toUpperCase() 
     1353    }); 
     1354    element.runtimeStyle[propertyName] = element.parentElement.currentStyle[propertyName]; 
     1355  } 
     1356}); 
     1357 
     1358// ========================================================================= 
     1359// ie7-html.js 
     1360// ========================================================================= 
     1361 
     1362// default font-sizes 
     1363//HEADER += "h1{font-size:2em}h2{font-size:1.5em;}h3{font-size:1.17em;}h4{font-size:1em}h5{font-size:.83em}h6{font-size:.67em}"; 
     1364 
     1365IE7.HTML = new (Fix.extend({ // single instance   
     1366  fixed: {}, 
     1367   
     1368  init: Undefined, 
     1369   
     1370  addFix: function() { 
     1371    // fixes are a one-off, they are applied when the document is loaded 
     1372    this.fixes.push(arguments); 
     1373  }, 
     1374   
     1375  apply: function() { 
     1376    for (var i = 0; i < this.fixes.length; i++) { 
     1377      var match = cssQuery(this.fixes[i][0]); 
     1378      var fix = this.fixes[i][1]; 
     1379      for (var j = 0; j < match.length; j++) fix(match[j]); 
     1380    } 
     1381  }, 
     1382   
     1383  addRecalc: function() { 
     1384    // recalcs occur whenever the document is refreshed using document.recalc() 
     1385    this.recalcs.push(arguments); 
     1386  }, 
     1387   
     1388  recalc: function() { 
     1389    // loop through the fixes 
     1390    for (var i = 0; i < this.recalcs.length; i++) { 
     1391      var match = cssQuery(this.recalcs[i][0]); 
     1392      var recalc = this.recalcs[i][1], element; 
     1393      var key = Math.pow(2, i); 
     1394      for (var j = 0; (element = match[j]); j++) { 
     1395        var uniqueID = element.uniqueID; 
     1396        if ((this.fixed[uniqueID] & key) == 0) { 
     1397          element = recalc(element) || element; 
     1398          this.fixed[uniqueID] |= key; 
     1399        } 
     1400      } 
     1401    } 
     1402  } 
     1403})); 
     1404 
     1405if (appVersion < 7) {   
     1406  // provide support for the <abbr> tag. 
     1407  //  this is a proper fix, it preserves the DOM structure and 
     1408  //  <abbr> elements report the correct tagName & namespace prefix 
     1409  document.createElement("abbr"); 
     1410   
     1411  // bind to the first child control 
     1412  IE7.HTML.addRecalc("label", function(label) { 
     1413    if (!label.htmlFor) { 
     1414      var firstChildControl = cssQuery("input,textarea", label, true); 
     1415      if (firstChildControl) { 
     1416        addEventHandler(label, "onclick", function() { 
     1417          firstChildControl.click(); 
     1418        }); 
     1419      } 
     1420    } 
     1421  }); 
     1422} 
     1423 
     1424// ========================================================================= 
     1425// ie7-layout.js 
     1426// ========================================================================= 
     1427 
     1428var NUMERIC = "[.\\d]"; 
     1429 
     1430new function(_) { 
     1431var layout = IE7.Layout = this; 
     1432 
     1433  // big, ugly box-model hack + min/max stuff 
     1434   
     1435  // #tantek > #erik > #dean { voice-family: hacker; } 
     1436   
     1437  // ----------------------------------------------------------------------- 
     1438  // "layout" 
     1439  // ----------------------------------------------------------------------- 
     1440   
     1441  HEADER += "*{boxSizing:content-box}"; 
     1442   
     1443  // does an element have "layout" ? 
     1444  IE7.hasLayout = appVersion < 5.5 ? function(element) { 
     1445    // element.currentStyle.hasLayout doesn't work for IE5.0 
     1446    return element.clientWidth; 
     1447  } : function(element) { 
     1448    return element.currentStyle.hasLayout; 
     1449  }; 
     1450   
     1451  // give an element "layout" 
     1452  layout.boxSizing = function(element) { 
     1453    if (!IE7.hasLayout(element)) { 
     1454    //#  element.runtimeStyle.fixedHeight = 
     1455      element.style.height = "0cm"; 
     1456      if (element.currentStyle.verticalAlign == "auto") 
     1457        element.runtimeStyle.verticalAlign = "top"; 
     1458      // when an element acquires "layout", margins no longer collapse correctly 
     1459      collapseMargins(element); 
     1460    } 
     1461  }; 
     1462   
     1463  // ----------------------------------------------------------------------- 
     1464  // Margin Collapse 
     1465  // ----------------------------------------------------------------------- 
     1466   
     1467  function collapseMargins(element) { 
     1468    if (element != viewport && element.currentStyle.position != "absolute") { 
     1469      collapseMargin(element, "marginTop"); 
     1470      collapseMargin(element, "marginBottom"); 
     1471    } 
     1472  }; 
     1473   
     1474  function collapseMargin(element, type) { 
     1475    if (!element.runtimeStyle[type]) { 
     1476      var parentElement = element.parentElement; 
     1477      if (parentElement && IE7.hasLayout(parentElement) && !IE7[type == "marginTop" ? "_getPreviousElementSibling" : "_getNextElementSibling"](element)) return; 
     1478      var child = cssQuery(">*:" + (type == "marginTop" ? "first" : "last") + "-child", element, true); 
     1479      if (child && child.currentStyle.styleFloat == "none" && IE7.hasLayout(child)) { 
     1480        collapseMargin(child, type); 
     1481        margin = _getMargin(element, element.currentStyle[type]); 
     1482        childMargin = _getMargin(child, child.currentStyle[type]); 
     1483        if (margin < 0 || childMargin < 0) { 
     1484          element.runtimeStyle[type] = margin + childMargin; 
     1485        } else { 
     1486          element.runtimeStyle[type] = Math.max(childMargin, margin); 
     1487        } 
     1488        child.runtimeStyle[type] = "0px"; 
     1489      } 
     1490    } 
     1491  }; 
     1492   
     1493  function _getMargin(element, value) { 
     1494    return value == "auto" ? 0 : getPixelValue(element, value); 
     1495  }; 
     1496   
     1497  // ----------------------------------------------------------------------- 
     1498  // box-model 
     1499  // ----------------------------------------------------------------------- 
     1500   
     1501  // constants 
     1502  var UNIT = /^[.\d][\w%]*$/, AUTO = /^(auto|0cm)$/; 
     1503   
     1504  var applyWidth, applyHeight; 
     1505  IE7.Layout.borderBox = function(element){ 
     1506    applyWidth(element); 
     1507    applyHeight(element); 
     1508  }; 
     1509   
     1510  var fixWidth = function(HEIGHT) { 
     1511    applyWidth = function(element) { 
     1512      if (!PERCENT.test(element.currentStyle.width)) fixWidth(element); 
     1513      collapseMargins(element); 
     1514    }; 
     1515   
     1516    function fixWidth(element, value) { 
     1517      if (!element.runtimeStyle.fixedWidth) { 
     1518        if (!value) value = element.currentStyle.width; 
     1519        element.runtimeStyle.fixedWidth = (UNIT.test(value)) ? Math.max(0, getFixedWidth(element, value)) : value; 
     1520        setOverrideStyle(element, "width", element.runtimeStyle.fixedWidth); 
     1521      } 
     1522    }; 
     1523   
     1524    function layoutWidth(element) { 
     1525      if (!isFixed(element)) { 
     1526        var layoutParent = element.offsetParent; 
     1527        while (layoutParent && !IE7.hasLayout(layoutParent)) layoutParent = layoutParent.offsetParent; 
     1528      } 
     1529      return (layoutParent || viewport).clientWidth; 
     1530    }; 
     1531   
     1532    function getPixelWidth(element, value) { 
     1533      if (PERCENT.test(value)) return parseInt(parseFloat(value) / 100 * layoutWidth(element)); 
     1534      return getPixelValue(element, value); 
     1535    }; 
     1536   
     1537    var getFixedWidth = function(element, value) { 
     1538      var borderBox = element.currentStyle["box-sizing"] == "border-box"; 
     1539      var adjustment = 0; 
     1540      if (quirksMode && !borderBox) 
     1541        adjustment += getBorderWidth(element) + getWidth(element, "padding"); 
     1542      else if (!quirksMode && borderBox) 
     1543        adjustment -= getBorderWidth(element) + getWidth(element, "padding"); 
     1544      return getPixelWidth(element, value) + adjustment; 
     1545    }; 
     1546   
     1547    // easy way to get border thickness for elements with "layout" 
     1548    function getBorderWidth(element) { 
     1549      return element.offsetWidth - element.clientWidth; 
     1550    }; 
     1551   
     1552    // have to do some pixel conversion to get padding/margin thickness :-( 
     1553    function getWidth(element, type) { 
     1554      return getPixelWidth(element, element.currentStyle[type + "Left"]) + getPixelWidth(element, element.currentStyle[type + "Right"]); 
     1555    }; 
     1556   
     1557    // ----------------------------------------------------------------------- 
     1558    // min/max 
     1559    // ----------------------------------------------------------------------- 
     1560   
     1561    HEADER += "*{minWidth:none;maxWidth:none;min-width:none;max-width:none}"; 
     1562   
     1563    // handle min-width property 
     1564    layout.minWidth = function(element) { 
     1565      // IE6 supports min-height so we frig it here 
     1566      //#if (element.currentStyle.minHeight == "auto") element.runtimeStyle.minHeight = 0; 
     1567      if (element.currentStyle["min-width"] != null) { 
     1568        element.style.minWidth = element.currentStyle["min-width"]; 
     1569      } 
     1570      if (register(arguments.callee, element, element.currentStyle.minWidth != "none")) { 
     1571        layout.boxSizing(element); 
     1572        fixWidth(element); 
     1573        resizeWidth(element); 
     1574      } 
     1575    }; 
     1576     
     1577    // clone the minWidth function to make a maxWidth function 
     1578    eval("IE7.Layout.maxWidth=" + String(layout.minWidth).replace(/min/g, "max")); 
     1579     
     1580    // apply min/max restrictions 
     1581    function resizeWidth(element) { 
     1582      // check boundaries 
     1583      var rect = element.getBoundingClientRect(); 
     1584      var width = rect.right - rect.left; 
     1585   
     1586      if (element.currentStyle.minWidth != "none" && width <= getFixedWidth(element, element.currentStyle.minWidth)) { 
     1587        element.runtimeStyle.width = element.currentStyle.minWidth; 
     1588      } else if (element.currentStyle.maxWidth != "none" && width >= getFixedWidth(element, element.currentStyle.maxWidth)) { 
     1589        element.runtimeStyle.width = element.currentStyle.maxWidth; 
     1590      } else { 
     1591        element.runtimeStyle.width = element.runtimeStyle.fixedWidth; // || "auto"; 
     1592      } 
     1593    }; 
     1594   
     1595    // ----------------------------------------------------------------------- 
     1596    // right/bottom 
     1597    // ----------------------------------------------------------------------- 
     1598   
     1599    function fixRight(element) { 
     1600      if (register(fixRight, element, /^(fixed|absolute)$/.test(element.currentStyle.position) && 
     1601        getDefinedStyle(element, "left") != "auto" && 
     1602        getDefinedStyle(element, "right") != "auto" && 
     1603        AUTO.test(getDefinedStyle(element, "width")))) { 
     1604          resizeRight(element); 
     1605          IE7.Layout.boxSizing(element); 
     1606      } 
     1607    }; 
     1608    IE7.Layout.fixRight = fixRight; 
     1609   
     1610    function resizeRight(element) { 
     1611      var left = getPixelWidth(element, element.runtimeStyle._left || element.currentStyle.left); 
     1612      var width = layoutWidth(element) - getPixelWidth(element, element.currentStyle.right) -  left - getWidth(element, "margin"); 
     1613      if (parseInt(element.runtimeStyle.width) == width) return; 
     1614      element.runtimeStyle.width = ""; 
     1615      if (isFixed(element) || HEIGHT || element.offsetWidth < width) { 
     1616        if (!quirksMode) width -= getBorderWidth(element) + getWidth(element, "padding"); 
     1617        if (width < 0) width = 0; 
     1618        element.runtimeStyle.fixedWidth = width; 
     1619        setOverrideStyle(element, "width", width); 
     1620      } 
     1621    }; 
     1622   
     1623  // ----------------------------------------------------------------------- 
     1624  // window.onresize 
     1625  // ----------------------------------------------------------------------- 
     1626   
     1627    // handle window resize 
     1628    var clientWidth = 0; 
     1629    addResize(function() { 
     1630      if (!viewport) return; 
     1631      var i, wider = (clientWidth < viewport.clientWidth); 
     1632      clientWidth = viewport.clientWidth; 
     1633      // resize elements with "min-width" set 
     1634      var elements = layout.minWidth.elements; 
     1635      for (i in elements) { 
     1636        var element = elements[i]; 
     1637        var fixedWidth = (parseInt(element.runtimeStyle.width) == getFixedWidth(element, element.currentStyle.minWidth)); 
     1638        if (wider && fixedWidth) element.runtimeStyle.width = ""; 
     1639        if (wider == fixedWidth) resizeWidth(element); 
     1640      } 
     1641      // resize elements with "max-width" set 
     1642      var elements = layout.maxWidth.elements; 
     1643      for (i in elements) { 
     1644        var element = elements[i]; 
     1645        var fixedWidth = (parseInt(element.runtimeStyle.width) == getFixedWidth(element, element.currentStyle.maxWidth)); 
     1646        if (!wider && fixedWidth) element.runtimeStyle.width = ""; 
     1647        if (wider != fixedWidth) resizeWidth(element); 
     1648      } 
     1649      // resize elements with "right" set 
     1650      for (i in fixRight.elements) resizeRight(fixRight.elements[i]); 
     1651    }); 
     1652   
     1653  // ----------------------------------------------------------------------- 
     1654  // fix CSS 
     1655  // ----------------------------------------------------------------------- 
     1656    if (quirksMode) { 
     1657      IE7.CSS.addRecalc("width", NUMERIC, applyWidth); 
     1658    } 
     1659    if (appVersion < 7) { 
     1660      IE7.CSS.addRecalc("min-width", NUMERIC, layout.minWidth); 
     1661      IE7.CSS.addRecalc("max-width", NUMERIC, layout.maxWidth); 
     1662      IE7.CSS.addRecalc("right", NUMERIC, fixRight); 
     1663    } 
     1664  }; 
     1665   
     1666  eval("var fixHeight=" + rotate(fixWidth)); 
     1667   
     1668  // apply box-model + min/max fixes 
     1669  fixWidth(); 
     1670  fixHeight(true); 
     1671}; 
     1672 
     1673// ========================================================================= 
     1674// ie7-graphics.js 
     1675// ========================================================================= 
     1676 
     1677// a small transparent image used as a placeholder 
     1678var BLANK_GIF = makePath("blank.gif", path); 
     1679 
     1680var ALPHA_IMAGE_LOADER = "DXImageTransform.Microsoft.AlphaImageLoader"; 
     1681var PNG_FILTER = "progid:" + ALPHA_IMAGE_LOADER + "(src='%1',sizingMethod='%2')"; 
     1682   
     1683// regular expression version of the above 
     1684var PNG; 
     1685 
     1686var filtered = []; 
     1687 
     1688function fixImage(element) { 
     1689  if (PNG.test(element.src)) { 
     1690    // we have to preserve width and height 
     1691    var image = new Image(element.width, element.height); 
     1692    image.onload = function() { 
     1693      element.width = image.width; 
     1694      element.height = image.height; 
     1695      image = null; 
     1696    }; 
     1697    image.src = element.src; 
     1698    // store the original url (we'll put it back when it's printed) 
     1699    element.pngSrc = element.src; 
     1700    // add the AlphaImageLoader thingy 
     1701    addFilter(element); 
     1702  } 
     1703}; 
     1704 
     1705if (appVersion >= 5.5 && appVersion < 7) { 
     1706  // ** IE7 VARIABLE 
     1707  // e.g. only apply the hack to files ending in ".png" 
     1708  // IE7_PNG_SUFFIX = ".png"; 
     1709 
     1710  // replace background(-image): url(..) ..  with background(-image): .. ;filter: ..; 
     1711  IE7.CSS.addFix(/background(-image)?\s*:\s*([^};]*)?url\(([^\)]+)\)([^;}]*)?/, function(match, $1, $2, url, $4) { 
     1712    url = getString(url); 
     1713    return PNG.test(url) ? "filter:" + format(PNG_FILTER, url, "crop") + 
     1714      ";zoom:1;background" + ($1||"") + ":" + ($2||"") + "none" + ($4||"") : match; 
     1715  }); 
     1716   
     1717  // ----------------------------------------------------------------------- 
     1718  //  fix PNG transparency (HTML images) 
     1719  // ----------------------------------------------------------------------- 
     1720 
     1721  IE7.HTML.addRecalc("img,input", function(element) { 
     1722    if (element.tagName == "INPUT" && element.type != "image") return; 
     1723    fixImage(element); 
     1724    addEventHandler(element, "onpropertychange", function() { 
     1725      if (!printing && event.propertyName == "src" && 
     1726        element.src.indexOf(BLANK_GIF) == -1) fixImage(element); 
     1727    }); 
     1728  }); 
     1729 
     1730  // assume that background images should not be printed 
     1731  //  (if they are not transparent then they'll just obscure content) 
     1732  // but we'll put foreground images back... 
     1733  var printing = false; 
     1734  addEventHandler(window, "onbeforeprint", function() { 
     1735    printing = true; 
     1736    for (var i = 0; i < filtered.length; i++) removeFilter(filtered[i]); 
     1737  }); 
     1738  addEventHandler(window, "onafterprint", function() { 
     1739    for (var i = 0; i < filtered.length; i++) addFilter(filtered[i]); 
     1740    printing = false; 
     1741  }); 
     1742} 
     1743 
     1744// apply a filter 
     1745function addFilter(element, sizingMethod) { 
     1746  var filter = element.filters[ALPHA_IMAGE_LOADER]; 
     1747  if (filter) { 
     1748    filter.src = element.src; 
     1749    filter.enabled = true; 
     1750  } else { 
     1751    element.runtimeStyle.filter = format(PNG_FILTER, element.src, sizingMethod || "scale"); 
     1752    filtered.push(element); 
     1753  } 
     1754  // remove the real image 
     1755  element.src = BLANK_GIF; 
     1756}; 
     1757 
     1758function removeFilter(element) { 
     1759  element.src = element.pngSrc; 
     1760  element.filters[ALPHA_IMAGE_LOADER].enabled = false; 
     1761}; 
     1762 
     1763// ========================================================================= 
     1764// ie7-fixed.js 
     1765// ========================================================================= 
     1766 
     1767new function(_) { 
     1768  if (appVersion >= 7) return; 
     1769   
     1770  // some things to consider for this hack. 
     1771  // the document body requires a fixed background. even if 
     1772  //  it is just a blank image. 
     1773  // you have to use setExpression instead of onscroll, this 
     1774  //  together with a fixed body background helps avoid the 
     1775  //  annoying screen flicker of other solutions. 
     1776   
     1777  IE7.CSS.addRecalc("position", "fixed", _positionFixed, "absolute"); 
     1778  IE7.CSS.addRecalc("background(-attachment)?", "[^};]*fixed", _backgroundFixed); 
     1779   
     1780  // scrolling is relative to the documentElement (HTML tag) when in 
     1781  //  standards mode, otherwise it's relative to the document body 
     1782  var $viewport = quirksMode ? "body" : "documentElement"; 
     1783   
     1784  function _fixBackground() { 
     1785    // this is required by both position:fixed and background-attachment:fixed. 
     1786    // it is necessary for the document to also have a fixed background image. 
     1787    // we can fake this with a blank image if necessary 
     1788    if (body.currentStyle.backgroundAttachment != "fixed") { 
     1789      if (body.currentStyle.backgroundImage == "none") { 
     1790        body.runtimeStyle.backgroundRepeat = "no-repeat"; 
     1791        body.runtimeStyle.backgroundImage = "url(" + BLANK_GIF + ")"; // dummy 
     1792      } 
     1793      body.runtimeStyle.backgroundAttachment = "fixed"; 
     1794    } 
     1795    _fixBackground = Undefined; 
     1796  }; 
     1797   
     1798  var _tmp = createTempElement("img"); 
     1799   
     1800  function _isFixed(element) { 
     1801    return element ? isFixed(element) || _isFixed(element.parentElement) : false; 
     1802  }; 
     1803   
     1804  function _setExpression(element, propertyName, expression) { 
     1805    setTimeout("document.all." + element.uniqueID + ".runtimeStyle.setExpression('" + propertyName + "','" + expression + "')", 0); 
     1806  }; 
     1807   
     1808  // ----------------------------------------------------------------------- 
     1809  //  backgroundAttachment: fixed 
     1810  // ----------------------------------------------------------------------- 
     1811   
     1812  function _backgroundFixed(element) { 
     1813    if (register(_backgroundFixed, element, element.currentStyle.backgroundAttachment == "fixed" && !element.contains(body))) { 
     1814      _fixBackground(); 
     1815      bgLeft(element); 
     1816      bgTop(element); 
     1817      _backgroundPosition(element); 
     1818    } 
     1819  }; 
     1820   
     1821  function _backgroundPosition(element) { 
     1822    _tmp.src = element.currentStyle.backgroundImage.slice(5, -2); 
     1823    var parentElement = element.canHaveChildren ? element : element.parentElement; 
     1824    parentElement.appendChild(_tmp); 
     1825    setOffsetLeft(element); 
     1826    setOffsetTop(element); 
     1827    parentElement.removeChild(_tmp); 
     1828  }; 
     1829   
     1830  function bgLeft(element) { 
     1831    element.style.backgroundPositionX = element.currentStyle.backgroundPositionX; 
     1832    if (!_isFixed(element)) { 
     1833      _setExpression(element, "backgroundPositionX", "(parseInt(runtimeStyle.offsetLeft)+document." + $viewport + ".scrollLeft)||0"); 
     1834    } 
     1835  }; 
     1836  eval(rotate(bgLeft)); 
     1837   
     1838  function setOffsetLeft(element) { 
     1839    var propertyName = _isFixed(element) ? "backgroundPositionX" : "offsetLeft"; 
     1840    element.runtimeStyle[propertyName] = 
     1841      getOffsetLeft(element, element.style.backgroundPositionX) - 
     1842      element.getBoundingClientRect().left - element.clientLeft + 2; 
     1843  }; 
     1844  eval(rotate(setOffsetLeft)); 
     1845   
     1846  function getOffsetLeft(element, position) { 
     1847    switch (position) { 
     1848      case "left": 
     1849      case "top": 
     1850        return 0; 
     1851      case "right": 
     1852      case "bottom": 
     1853        return viewport.clientWidth - _tmp.offsetWidth; 
     1854      case "center": 
     1855        return (viewport.clientWidth - _tmp.offsetWidth) / 2; 
     1856      default: 
     1857        if (PERCENT.test(position)) { 
     1858          return parseInt((viewport.clientWidth - _tmp.offsetWidth) * parseFloat(position) / 100); 
     1859        } 
     1860        _tmp.style.left = position; 
     1861        return _tmp.offsetLeft; 
     1862    } 
     1863  }; 
     1864  eval(rotate(getOffsetLeft)); 
     1865   
     1866  // ----------------------------------------------------------------------- 
     1867  //  position: fixed 
     1868  // ----------------------------------------------------------------------- 
     1869   
     1870  function _positionFixed(element) { 
     1871    if (register(_positionFixed, element, isFixed(element))) { 
     1872      setOverrideStyle(element, "position",  "absolute"); 
     1873      setOverrideStyle(element, "left",  element.currentStyle.left); 
     1874      setOverrideStyle(element, "top",  element.currentStyle.top); 
     1875      _fixBackground(); 
     1876      IE7.Layout.fixRight(element); 
     1877      _foregroundPosition(element); 
     1878    } 
     1879  }; 
     1880   
     1881  function _foregroundPosition(element, recalc) { 
     1882    positionTop(element, recalc); 
     1883    positionLeft(element, recalc, true); 
     1884    if (!element.runtimeStyle.autoLeft && element.currentStyle.marginLeft == "auto" && 
     1885      element.currentStyle.right != "auto") { 
     1886      var left = viewport.clientWidth - getPixelWidth(element, element.currentStyle.right) - 
     1887        getPixelWidth(element, element.runtimeStyle._left) - element.clientWidth; 
     1888      if (element.currentStyle.marginRight == "auto") left = parseInt(left / 2); 
     1889      if (_isFixed(element.offsetParent)) element.runtimeStyle.pixelLeft += left; 
     1890      else element.runtimeStyle.shiftLeft = left; 
     1891    } 
     1892    clipWidth(element); 
     1893    clipHeight(element); 
     1894  }; 
     1895 
     1896  function clipWidth(element) { 
     1897    var fixWidth = element.runtimeStyle.fixWidth; 
     1898    element.runtimeStyle.borderRightWidth = ""; 
     1899    element.runtimeStyle.width = fixWidth ? getPixelWidth(element, fixWidth) : ""; 
     1900    if (element.currentStyle.width != "auto") { 
     1901      var rect = element.getBoundingClientRect(); 
     1902      var width = element.offsetWidth - viewport.clientWidth + rect.left - 2; 
     1903      if (width >= 0) { 
     1904        element.runtimeStyle.borderRightWidth = "0px"; 
     1905        width = Math.max(getPixelValue(element, element.currentStyle.width) - width, 0); 
     1906        setOverrideStyle(element, "width",  width); 
     1907        return width; 
     1908      } 
     1909    } 
     1910  }; 
     1911  eval(rotate(clipWidth)); 
     1912   
     1913  function positionLeft(element, recalc) { 
     1914    // if the element's width is in % units then it must be recalculated 
     1915    //  with respect to the viewport 
     1916    if (!recalc && PERCENT.test(element.currentStyle.width)) { 
     1917      element.runtimeStyle.fixWidth = element.currentStyle.width; 
     1918    } 
     1919    if (element.runtimeStyle.fixWidth) { 
     1920      element.runtimeStyle.width = getPixelWidth(element, element.runtimeStyle.fixWidth); 
     1921    } 
     1922    //if (recalc) { 
     1923    //  // if the element is fixed on the right then no need to recalculate 
     1924    //  if (!element.runtimeStyle.autoLeft) return; 
     1925    //} else { 
     1926      element.runtimeStyle.shiftLeft = 0; 
     1927      element.runtimeStyle._left = element.currentStyle.left; 
     1928      // is the element fixed on the right? 
     1929      element.runtimeStyle.autoLeft = element.currentStyle.right != "auto" && 
     1930        element.currentStyle.left == "auto"; 
     1931    //} 
     1932    // reset the element's "left" value and get it's natural position 
     1933    element.runtimeStyle.left = ""; 
     1934    element.runtimeStyle.screenLeft = getScreenLeft(element); 
     1935    element.runtimeStyle.pixelLeft = element.runtimeStyle.screenLeft; 
     1936    // if the element is contained by another fixed element then there is no need to 
     1937    //  continually recalculate it's left position 
     1938    if (!recalc && !_isFixed(element.offsetParent)) { 
     1939      // onsrcoll produces jerky movement, so we use an expression 
     1940      _setExpression(element, "pixelLeft", "runtimeStyle.screenLeft+runtimeStyle.shiftLeft+document." + $viewport + ".scrollLeft"); 
     1941    } 
     1942  }; 
     1943  // clone this function so we can do "top" 
     1944  eval(rotate(positionLeft)); 
     1945   
     1946  // I've forgotten how this works... 
     1947  function getScreenLeft(element) { // thanks to kevin newman (captainn) 
     1948    var screenLeft = element.offsetLeft, nested = 1; 
     1949    if (element.runtimeStyle.autoLeft) { 
     1950      screenLeft = viewport.clientWidth - element.offsetWidth - getPixelWidth(element, element.currentStyle.right); 
     1951    } 
     1952    // accommodate margins 
     1953    if (element.currentStyle.marginLeft != "auto") { 
     1954      screenLeft -= getPixelWidth(element, element.currentStyle.marginLeft); 
     1955    } 
     1956    while (element = element.offsetParent) { 
     1957      if (element.currentStyle.position != "static") nested = -1; 
     1958      screenLeft += element.offsetLeft * nested; 
     1959    } 
     1960    return screenLeft; 
     1961  }; 
     1962  eval(rotate(getScreenLeft)); 
     1963   
     1964  function getPixelWidth(element, value) { 
     1965    return PERCENT.test(value) ? parseInt(parseFloat(value) / 100 * viewport.clientWidth) : getPixelValue(element, value); 
     1966  }; 
     1967  eval(rotate(getPixelWidth)); 
     1968   
     1969  // ----------------------------------------------------------------------- 
     1970  //  capture window resize 
     1971  // ----------------------------------------------------------------------- 
     1972   
     1973  function _resize() { 
     1974    // if the window has been resized then some positions need to be 
     1975    //  recalculated (especially those aligned to "right" or "top" 
     1976    var elements = _backgroundFixed.elements; 
     1977    for (var i in elements) _backgroundPosition(elements[i]); 
     1978    elements = _positionFixed.elements; 
     1979    for (i in elements) { 
     1980      _foregroundPosition(elements[i], true); 
     1981      // do this twice to be sure - hackish, I know :-) 
     1982      _foregroundPosition(elements[i], true); 
     1983    } 
     1984    _timer = 0; 
     1985  }; 
     1986   
     1987  // use a timer for some reason. 
     1988  //  (sometimes this is a good way to prevent resize loops) 
     1989  var _timer; 
     1990  addResize(function() { 
     1991    if (!_timer) _timer = setTimeout(_resize, 0); 
     1992  }); 
     1993}; 
     1994 
     1995// ========================================================================= 
     1996// ie7-oveflow.js 
     1997// ========================================================================= 
     1998 
     1999/* --------------------------------------------------------------------- 
     2000 
     2001  This module alters the structure of the document. 
     2002  It may adversely affect other CSS rules. Be warned. 
     2003 
     2004--------------------------------------------------------------------- */ 
     2005 
     2006var WRAPPER_STYLE = { 
     2007  backgroundColor: "transparent", 
     2008  backgroundImage: "none", 
     2009  backgroundPositionX: null, 
     2010  backgroundPositionY: null, 
     2011  backgroundRepeat: null, 
     2012  borderTopWidth: 0, 
     2013  borderRightWidth: 0, 
     2014  borderBottomWidth: 0, 
     2015  borderLeftStyle: "none", 
     2016  borderTopStyle: "none", 
     2017  borderRightStyle: "none", 
     2018  borderBottomStyle: "none", 
     2019  borderLeftWidth: 0, 
     2020  height: null, 
     2021  marginTop: 0, 
     2022  marginBottom: 0, 
     2023  marginRight: 0, 
     2024  marginLeft: 0, 
     2025  width: "100%" 
     2026}; 
     2027 
     2028IE7.CSS.addRecalc("overflow", "visible", function(element) { 
     2029  // don't do this again 
     2030  if (element.parentNode.ie7_wrapped) return; 
     2031 
     2032  // if max-height is applied, makes sure it gets applied first 
     2033  if (IE7.Layout && element.currentStyle["max-height"] != "auto") { 
     2034    IE7.Layout.maxHeight(element); 
     2035  } 
     2036 
     2037  if (element.currentStyle.marginLeft == "auto") element.style.marginLeft = 0; 
     2038  if (element.currentStyle.marginRight == "auto") element.style.marginRight = 0; 
     2039 
     2040  var wrapper = document.createElement(ANON); 
     2041  wrapper.ie7_wrapped = element; 
     2042  for (var propertyName in WRAPPER_STYLE) { 
     2043    wrapper.style[propertyName] = element.currentStyle[propertyName]; 
     2044    if (WRAPPER_STYLE[propertyName] != null) { 
     2045      element.runtimeStyle[propertyName] = WRAPPER_STYLE[propertyName]; 
     2046    } 
     2047  } 
     2048  wrapper.style.display = "block"; 
     2049  wrapper.style.position = "relative"; 
     2050  element.runtimeStyle.position = "absolute"; 
     2051  element.parentNode.insertBefore(wrapper, element); 
     2052  wrapper.appendChild(element); 
     2053}); 
     2054 
     2055// ========================================================================= 
     2056// ie7-quirks.js 
     2057// ========================================================================= 
     2058 
     2059function ie7Quirks() { 
     2060  var FONT_SIZES = "xx-small,x-small,small,medium,large,x-large,xx-large".split(","); 
     2061  for (var i = 0; i < FONT_SIZES.length; i++) { 
     2062    FONT_SIZES[FONT_SIZES[i]] = FONT_SIZES[i - 1] || "0.67em"; 
     2063  } 
     2064   
     2065  IE7.CSS.addFix(/(font(-size)?\s*:\s*)([\w.-]+)/, function(match, label, size, value) { 
     2066    return label + (FONT_SIZES[value] || value); 
     2067  }); 
     2068   
     2069  if (appVersion < 6) { 
     2070    var NEGATIVE = /^\-/, LENGTH = /(em|ex)$/i; 
     2071    var EM = /em$/i, EX = /ex$/i; 
     2072   
     2073    getPixelValue = function(element, value) { 
     2074      if (PIXEL.test(value)) return parseInt(value)||0; 
     2075      var scale = NEGATIVE.test(value)? -1 : 1; 
     2076      if (LENGTH.test(value)) scale *= getFontScale(element); 
     2077      temp.style.width = (scale < 0) ? value.slice(1) : value; 
     2078      body.appendChild(temp); 
     2079      // retrieve pixel width 
     2080      value = scale * temp.offsetWidth; 
     2081      // remove the temporary element 
     2082      temp.removeNode(); 
     2083      return parseInt(value); 
     2084    }; 
     2085 
     2086    var temp = createTempElement(); 
     2087    function getFontScale(element) { 
     2088      var scale = 1; 
     2089      temp.style.fontFamily = element.currentStyle.fontFamily; 
     2090      temp.style.lineHeight = element.currentStyle.lineHeight; 
     2091      //temp.style.fontSize = ""; 
     2092      while (element != body) { 
     2093        var fontSize = element.currentStyle["ie7-font-size"]; 
     2094        if (fontSize) { 
     2095          if (EM.test(fontSize)) scale *= parseFloat(fontSize); 
     2096          else if (PERCENT.test(fontSize)) scale *= (parseFloat(fontSize) / 100); 
     2097          else if (EX.test(fontSize)) scale *= (parseFloat(fontSize) / 2); 
     2098          else { 
     2099            temp.style.fontSize = fontSize; 
     2100            return 1; 
     2101          } 
     2102        } 
     2103        element = element.parentElement; 
     2104      } 
     2105      return scale; 
     2106    }; 
     2107 
     2108    // cursor:pointer (IE5.x) 
     2109    IE7.CSS.addFix(/cursor\s*:\s*pointer/, "cursor:hand"); 
     2110    // display:list-item (IE5.x) 
     2111    IE7.CSS.addFix(/display\s*:\s*list-item/, "display:block"); 
     2112  } 
     2113   
     2114  // ----------------------------------------------------------------------- 
     2115  //  margin:auto 
     2116  // ----------------------------------------------------------------------- 
     2117   
     2118  function fixMargin(element) { 
     2119    if (appVersion < 5.5) IE7.Layout.boxSizing(element.parentElement); 
     2120    var parent = element.parentElement; 
     2121    var margin = parent.offsetWidth - element.offsetWidth - getPaddingWidth(parent); 
     2122    var autoRight = (element.currentStyle["ie7-margin"] && element.currentStyle.marginRight == "auto") || 
     2123      element.currentStyle["ie7-margin-right"] == "auto"; 
     2124    switch (parent.currentStyle.textAlign) { 
     2125      case "right": 
     2126        margin = autoRight ? parseInt(margin / 2) : 0; 
     2127        element.runtimeStyle.marginRight = margin + "px"; 
     2128        break; 
     2129      case "center": 
     2130        if (autoRight) margin = 0; 
     2131      default: 
     2132        if (autoRight) margin /= 2; 
     2133        element.runtimeStyle.marginLeft = parseInt(margin) + "px"; 
     2134    } 
     2135  }; 
     2136 
     2137  function getPaddingWidth(element) { 
     2138    return getPixelValue(element, element.currentStyle.paddingLeft) + 
     2139      getPixelValue(element, element.currentStyle.paddingRight); 
     2140  }; 
     2141   
     2142  IE7.CSS.addRecalc("margin(-left|-right)?", "[^};]*auto", function(element) { 
     2143    if (register(fixMargin, element, 
     2144      element.parentElement && 
     2145      element.currentStyle.display == "block" && 
     2146      element.currentStyle.marginLeft == "auto" && 
     2147      element.currentStyle.position != "absolute")) { 
     2148        fixMargin(element); 
     2149    } 
     2150  }); 
     2151   
     2152  addResize(function() { 
     2153    for (var i in fixMargin.elements) { 
     2154      var element = fixMargin.elements[i]; 
     2155      element.runtimeStyle.marginLeft = 
     2156      element.runtimeStyle.marginRight = ""; 
     2157      fixMargin(element); 
     2158    } 
     2159  }); 
     2160}; 
     2161 
     2162 
     2163// ========================================================================= 
     2164// ie8-cssQuery.js 
     2165// ========================================================================= 
     2166 
     2167IE7._isEmpty = function(element) { 
     2168  element = element.firstChild; 
     2169  while (element) { 
     2170    if (element.nodeType == 3 || (element.nodeType == 1 && element.nodeName != "!")) return false; 
     2171    element = element.nextSibling; 
     2172  } 
     2173  return true; 
     2174}; 
     2175 
     2176IE7._isLang = function(element, code) { 
     2177  while (element && !element.getAttribute("lang")) element = element.parentNode; 
     2178  return element && new RegExp("^" + rescape(code), "i").test(element.getAttribute("lang")); 
     2179}; 
     2180 
     2181function _nthChild(match, args, position, last) { 
     2182  // ugly but it works... 
     2183  last = /last/i.test(match) ? last + "+1-" : ""; 
     2184  if (!isNaN(args)) args = "0n+" + args; 
     2185  else if (args == "even") args = "2n"; 
     2186  else if (args == "odd") args = "2n+1"; 
     2187  args = args.split("n"); 
     2188  var a = args[0] ? (args[0] == "-") ? -1 : parseInt(args[0]) : 1; 
     2189  var b = parseInt(args[1]) || 0; 
     2190  var negate = a < 0; 
     2191  if (negate) { 
     2192    a = -a; 
     2193    if (a == 1) b++; 
     2194  } 
     2195  var query = format(a == 0 ? "%3%7" + (last + b) : "(%4%3-%2)%6%1%70%5%4%3>=%2", a, b, position, last, "&&", "%", "=="); 
     2196  if (negate) query = "!(" + query + ")"; 
     2197  return query; 
     2198}; 
     2199 
     2200_PSEUDO_CLASSES = { 
     2201  "link":          "e%1.currentStyle['ie7-link']=='link'", 
     2202  "visited":       "e%1.currentStyle['ie7-link']=='visited'", 
     2203  "checked":       "e%1.checked", 
     2204  "contains":      "e%1.innerText.indexOf('%2')!=-1", 
     2205  "disabled":      "e%1.isDisabled", 
     2206  "empty":         "IE7._isEmpty(e%1)", 
     2207  "enabled":       "e%1.disabled===false", 
     2208  "first-child":   "!IE7._getPreviousElementSibling(e%1)", 
     2209  "lang":          "IE7._isLang(e%1,'%2')", 
     2210  "last-child":    "!IE7._getNextElementSibling(e%1)", 
     2211  "only-child":    "!IE7._getPreviousElementSibling(e%1)&&!IE7._getNextElementSibling(e%1)", 
     2212  "target":        "e%1.id==location.hash.slice(1)", 
     2213  "indeterminate": "e%1.indeterminate" 
     2214}; 
     2215 
     2216 
     2217// register a node and index its children 
     2218IE7._register = function(element) { 
     2219  if (element.rows) { 
     2220    element.ie7_length = element.rows.length; 
     2221    element.ie7_lookup = "rowIndex"; 
     2222  } else if (element.cells) { 
     2223    element.ie7_length = element.cells.length; 
     2224    element.ie7_lookup = "cellIndex"; 
     2225  } else if (element.ie7_indexed != IE7._indexed) { 
     2226    var index = 0; 
     2227    var child = element.firstChild; 
     2228    while (child) { 
     2229      if (child.nodeType == 1 && child.nodeName != "!") { 
     2230        child.ie7_index = ++index; 
     2231      } 
     2232      child = child.nextSibling; 
     2233    } 
     2234    element.ie7_length = index; 
     2235    element.ie7_lookup = "ie7_index"; 
     2236  } 
     2237  element.ie7_indexed = IE7._indexed; 
     2238  return element; 
     2239}; 
     2240 
     2241var keys = cssParser[_KEYS]; 
     2242var pseudoClass = keys[keys.length - 1]; 
     2243keys.length--; 
     2244 
     2245cssParser.merge({ 
     2246  ":not\\((\\*|[\\w-]+)?([^)]*)\\)": function(match, tagName, filters) { // :not pseudo class 
     2247    var replacement = (tagName && tagName != "*") ? format("if(e%1.nodeName=='%2'){", _index, tagName.toUpperCase()) : ""; 
     2248    replacement += cssParser.exec(filters); 
     2249    return "if(!" + replacement.slice(2, -1).replace(/\)\{if\(/g, "&&") + "){"; 
     2250  }, 
     2251   
     2252  ":nth(-last)?-child\\(([^)]+)\\)": function(match, last, args) { // :nth-child pseudo classes 
     2253    _wild = false; 
     2254    last = format("e%1.parentNode.ie7_length", _index); 
     2255    var replacement = "if(p%1!==e%1.parentNode)p%1=IE7._register(e%1.parentNode);"; 
     2256    replacement += "var i=e%1[p%1.ie7_lookup];if(p%1.ie7_lookup!='ie7_index')i++;if("; 
     2257    return format(replacement, _index) + _nthChild(match, args, "i", last) + "){"; 
     2258  } 
     2259}); 
     2260 
     2261keys.push(pseudoClass); 
     2262 
     2263// ========================================================================= 
     2264// ie8-css.js 
     2265// ========================================================================= 
     2266 
     2267var BRACKETS = "\\([^)]*\\)"; 
     2268 
     2269if (IE7.CSS.pseudoClasses) IE7.CSS.pseudoClasses += "|"; 
     2270IE7.CSS.pseudoClasses += "before|after|last\\-child|only\\-child|empty|root|" + 
     2271  "not|nth\\-child|nth\\-last\\-child|contains|lang".split("|").join(BRACKETS + "|") + BRACKETS; 
     2272 
     2273// pseudo-elements can be declared with a double colon 
     2274encoder.add(/::/, ":"); 
     2275 
     2276// ----------------------------------------------------------------------- 
     2277// dynamic pseudo-classes 
     2278// ----------------------------------------------------------------------- 
     2279 
     2280var Focus = new DynamicPseudoClass("focus", function(element) { 
     2281  var instance = arguments; 
     2282   
     2283  IE7.CSS.addEventHandler(element, "onfocus", function() { 
     2284    Focus.unregister(instance); // in case it starts with focus 
     2285    Focus.register(instance); 
     2286  }); 
     2287   
     2288  IE7.CSS.addEventHandler(element, "onblur", function() { 
     2289    Focus.unregister(instance); 
     2290  }); 
     2291   
     2292  // check the active element for initial state 
     2293  if (element == document.activeElement) { 
     2294    Focus.register(instance) 
     2295  } 
     2296}); 
     2297 
     2298var Active = new DynamicPseudoClass("active", function(element) { 
     2299  var instance = arguments; 
     2300  IE7.CSS.addEventHandler(element, "onmousedown", function() { 
     2301    Active.register(instance); 
     2302  }); 
     2303}); 
     2304 
     2305// globally trap the mouseup event (thanks Martijn!) 
     2306addEventHandler(document, "onmouseup", function() { 
     2307  var instances = Active.instances; 
     2308  for (var i in instances) Active.unregister(instances[i]); 
     2309}); 
     2310 
     2311// :checked 
     2312var Checked = new DynamicPseudoClass("checked", function(element) { 
     2313  if (typeof element.checked != "boolean") return; 
     2314  var instance = arguments; 
     2315  IE7.CSS.addEventHandler(element, "onpropertychange", function() { 
     2316    if (event.propertyName == "checked") { 
     2317      if (element.checked) Checked.register(instance); 
     2318      else Checked.unregister(instance); 
     2319    } 
     2320  }); 
     2321  // check current checked state 
     2322  if (element.checked) Checked.register(instance); 
     2323}); 
     2324 
     2325// :enabled 
     2326var Enabled = new DynamicPseudoClass("enabled", function(element) { 
     2327  if (typeof element.disabled != "boolean") return; 
     2328  var instance = arguments; 
     2329  IE7.CSS.addEventHandler(element, "onpropertychange", function() { 
     2330    if (event.propertyName == "disabled") { 
     2331      if (!element.isDisabled) Enabled.register(instance); 
     2332      else Enabled.unregister(instance); 
     2333    } 
     2334  }); 
     2335  // check current disabled state 
     2336  if (!element.isDisabled) Enabled.register(instance); 
     2337}); 
     2338 
     2339// :disabled 
     2340var Disabled = new DynamicPseudoClass("disabled", function(element) { 
     2341  if (typeof element.disabled != "boolean") return; 
     2342  var instance = arguments; 
     2343  IE7.CSS.addEventHandler(element, "onpropertychange", function() { 
     2344    if (event.propertyName == "disabled") { 
     2345      if (element.isDisabled) Disabled.register(instance); 
     2346      else Disabled.unregister(instance); 
     2347    } 
     2348  }); 
     2349  // check current disabled state 
     2350  if (element.isDisabled) Disabled.register(instance); 
     2351}); 
     2352 
     2353// :indeterminate (Kevin Newman) 
     2354var Indeterminate = new DynamicPseudoClass("indeterminate", function(element) { 
     2355  if (typeof element.indeterminate != "boolean") return; 
     2356  var instance = arguments; 
     2357  IE7.CSS.addEventHandler(element, "onpropertychange", function() { 
     2358    if (event.propertyName == "indeterminate") { 
     2359      if (element.indeterminate) Indeterminate.register(instance); 
     2360      else Indeterminate.unregister(instance); 
     2361    } 
     2362  }); 
     2363  IE7.CSS.addEventHandler(element, "onclick", function() { 
     2364    Indeterminate.unregister(instance); 
     2365  }); 
     2366  // clever Kev says no need to check this up front 
     2367}); 
     2368 
     2369// :target 
     2370var Target = new DynamicPseudoClass("target", function(element) { 
     2371  var instance = arguments; 
     2372  // if an element has a tabIndex then it can become "active". 
     2373  //  The default is zero anyway but it works... 
     2374  if (!element.tabIndex) element.tabIndex = 0; 
     2375  // this doesn't detect the back button. I don't know how to do that :-( 
     2376  IE7.CSS.addEventHandler(document, "onpropertychange", function() { 
     2377    if (event.propertyName == "activeElement") { 
     2378      if (element.id && element.id == location.hash.slice(1)) Target.register(instance); 
     2379      else Target.unregister(instance); 
     2380    } 
     2381  }); 
     2382  // check the current location 
     2383  if (element.id && element.id == location.hash.slice(1)) Target.register(instance); 
     2384}); 
     2385 
     2386// ----------------------------------------------------------------------- 
     2387// IE7 pseudo elements 
     2388// ----------------------------------------------------------------------- 
     2389 
     2390// constants 
     2391var ATTR = /^attr/; 
     2392var URL = /^url\s*\(\s*([^)]*)\)$/; 
     2393var POSITION_MAP = { 
     2394  before0: "beforeBegin", 
     2395  before1: "afterBegin", 
     2396  after0: "afterEnd", 
     2397  after1: "beforeEnd" 
     2398}; 
     2399 
     2400var PseudoElement = IE7.PseudoElement = Rule.extend({ 
     2401  constructor: function(selector, position, cssText) { 
     2402    // initialise object properties 
     2403    this.position = position; 
     2404    var content = cssText.match(PseudoElement.CONTENT), match, entity; 
     2405    if (content) { 
     2406      content = content[1]; 
     2407      match = content.split(/\s+/); 
     2408      for (var i = 0; (entity = match[i]); i++) { 
     2409        match[i] = ATTR.test(entity) ? {attr: entity.slice(5, -1)} : 
     2410          (entity.charAt(0) == "'") ? getString(entity) : decode(entity); 
     2411      } 
     2412      content = match; 
     2413    } 
     2414    this.content = content; 
     2415    // CSS text needs to be decoded immediately 
     2416    this.base(selector, decode(cssText)); 
     2417  }, 
     2418   
     2419  init: function() { 
     2420    // execute the underlying css query for this class 
     2421    this.match = cssQuery(this.selector); 
     2422    for (var i = 0; i < this.match.length; i++) { 
     2423      var runtimeStyle = this.match[i].runtimeStyle; 
     2424      if (!runtimeStyle[this.position]) runtimeStyle[this.position] = {cssText:""}; 
     2425      runtimeStyle[this.position].cssText += ";" + this.cssText; 
     2426      if (this.content != null) runtimeStyle[this.position].content = this.content; 
     2427    } 
     2428  }, 
     2429   
     2430  create: function(target) { 
     2431    var generated = target.runtimeStyle[this.position]; 
     2432    if (generated) { 
     2433      // copy the array of values 
     2434      var content = [].concat(generated.content || ""); 
     2435      for (var j = 0; j < content.length; j++) { 
     2436        if (typeof content[j] == "object") { 
     2437          content[j] = target.getAttribute(content[j].attr); 
     2438        } 
     2439      } 
     2440      content = content.join(""); 
     2441      var url = content.match(URL); 
     2442      var cssText = "overflow:hidden;" + generated.cssText.replace(/'/g, '"'); 
     2443      if (target.currentStyle.styleFloat != "none") { 
     2444        //cssText = cssText.replace(/display\s*:\s*block/, "display:inline-block"); 
     2445      } 
     2446      var position = POSITION_MAP[this.position + Number(target.canHaveChildren)]; 
     2447      var id = 'ie7_pseudo' + PseudoElement.count++; 
     2448      target.insertAdjacentHTML(position, format(PseudoElement.ANON, this.className, id, cssText, url ? "" : content)); 
     2449      if (url) { 
     2450        var pseudoElement = document.getElementById(id); 
     2451        pseudoElement.src = getString(url[1]); 
     2452        addFilter(pseudoElement, "crop"); 
     2453      } 
     2454      target.runtimeStyle[this.position] = null; 
     2455    } 
     2456  }, 
     2457   
     2458  recalc: function() { 
     2459    if (this.content == null) return; 
     2460    for (var i = 0; i < this.match.length; i++) { 
     2461      this.create(this.match[i]); 
     2462    } 
     2463  }, 
     2464 
     2465  toString: function() { 
     2466    return "." + this.className + "{display:inline}"; 
     2467  } 
     2468}, {   
     2469  CONTENT: /content\s*:\s*([^;]*)(;|$)/, 
     2470  ANON: "<ie7:! class='ie7_anon %1' id=%2 style='%3'>%4</ie7:!>", 
     2471  MATCH: /(.*):(before|after).*/, 
     2472   
     2473  count: 0 
     2474}); 
     2475 
     2476// ========================================================================= 
     2477// ie8-html.js 
     2478// ========================================================================= 
     2479 
     2480var UNSUCCESSFUL = /^(submit|reset|button)$/; 
     2481 
     2482// ----------------------------------------------------------------------- 
     2483// <button> 
     2484// ----------------------------------------------------------------------- 
     2485 
     2486// IE bug means that innerText is submitted instead of "value" 
     2487IE7.HTML.addRecalc("button,input", function(button) { 
     2488  if (button.tagName == "BUTTON") { 
     2489    var match = button.outerHTML.match(/ value="([^"]*)"/i); 
     2490    button.runtimeStyle.value = (match) ? match[1] : ""; 
     2491  } 
     2492  // flag the button/input that was used to submit the form 
     2493  if (button.type == "submit") { 
     2494    addEventHandler(button, "onclick", function() { 
     2495      button.runtimeStyle.clicked = true; 
     2496      setTimeout("document.all." + button.uniqueID + ".runtimeStyle.clicked=false", 1); 
     2497    }); 
     2498  } 
     2499}); 
     2500 
     2501// ----------------------------------------------------------------------- 
     2502// <form> 
     2503// ----------------------------------------------------------------------- 
     2504 
     2505// only submit "successful controls 
     2506IE7.HTML.addRecalc("form", function(form) { 
     2507  addEventHandler(form, "onsubmit", function() { 
     2508    for (var element, i = 0; element = form[i]; i++) { 
     2509      if (UNSUCCESSFUL.test(element.type) && !element.disabled && !element.runtimeStyle.clicked) { 
     2510        element.disabled = true; 
     2511        setTimeout("document.all." + element.uniqueID + ".disabled=false", 1); 
     2512      } else if (element.tagName == "BUTTON" && element.type == "submit") { 
     2513        setTimeout("document.all." + element.uniqueID + ".value='" + 
     2514          element.value + "'", 1); 
     2515        element.value = element.runtimeStyle.value; 
     2516      } 
     2517    } 
     2518  }); 
     2519}); 
     2520 
     2521// ----------------------------------------------------------------------- 
     2522// <img> 
     2523// ----------------------------------------------------------------------- 
     2524 
     2525// get rid of the spurious tooltip produced by the alt attribute on images 
     2526IE7.HTML.addRecalc("img", function(img) { 
     2527  if (img.alt && !img.title) img.title = ""; 
     2528}); 
     2529 
     2530// ========================================================================= 
     2531// ie8-layout.js 
     2532// ========================================================================= 
     2533 
     2534IE7.CSS.addRecalc("border-spacing", NUMERIC, function(element) { 
     2535  if (element.currentStyle.borderCollapse != "collapse") { 
     2536    element.cellSpacing = getPixelValue(element, element.currentStyle["border-spacing"]); 
     2537  } 
     2538}); 
     2539IE7.CSS.addRecalc("box-sizing", "content-box", IE7.Layout.boxSizing); 
     2540IE7.CSS.addRecalc("box-sizing", "border-box", IE7.Layout.borderBox); 
     2541 
     2542// ========================================================================= 
     2543// ie8-graphics.js 
     2544// ========================================================================= 
     2545 
     2546IE7.CSS.addFix(/opacity\s*:\s*([\d.]+)/, function(match, value) { 
     2547  return "zoom:1;filter:Alpha(opacity=" + ((value * 100) || 1) + ")"; 
     2548}); 
     2549 
     2550// fix object[type=image/*] 
     2551var IMAGE = /^image/i; 
     2552IE7.HTML.addRecalc("object", function(element) { 
     2553  if (IMAGE.test(element.type)) { 
     2554    element.body.style.cssText = "margin:0;padding:0;border:none;overflow:hidden"; 
     2555    return element; 
     2556  } 
     2557}); 
     2558 
     2559// ----------------------------------------------------------------------- 
     2560// initialisation 
     2561// ----------------------------------------------------------------------- 
     2562 
     2563IE7.loaded = true; 
     2564 
     2565(function() { 
     2566  try { 
     2567    // http://javascript.nwbox.com/IEContentLoaded/ 
     2568    documentElement.doScroll("left"); 
     2569  } catch (e) { 
     2570    setTimeout(arguments.callee, 1); 
     2571    return; 
     2572  } 
     2573  // execute the inner text of the IE7 script 
     2574  try { 
     2575    eval(script.innerHTML); 
     2576  } catch (e) { 
     2577    // ignore errors 
     2578  } 
     2579  PNG = new RegExp(rescape(typeof IE7_PNG_SUFFIX == "string" ? IE7_PNG_SUFFIX : "-trans.png") + "$", "i"); 
     2580 
     2581  // frequently used references 
     2582  body = document.body; 
     2583  viewport = quirksMode ? body : documentElement; 
     2584 
     2585  // classes 
     2586  body.className += " ie7_body"; 
     2587  documentElement.className += " ie7_html"; 
     2588 
     2589  if (quirksMode) ie7Quirks(); 
     2590 
     2591  IE7.CSS.init(); 
     2592  IE7.HTML.init(); 
     2593 
     2594  IE7.HTML.apply(); 
     2595  IE7.CSS.apply(); 
     2596 
     2597  IE7.recalc(); 
     2598})(); 
     2599 
     2600 
     2601})(); 
  • admin/js/ie7/ie7-recalc.js

    r0 r703  
    1 /* IE7/IE8.js - copyright 2004-2008, Dean Edwards */ 
    2 (function(){if(!IE7.loaded)return;CLASSES=/\sie7_class\d+/g;IE7.CSS.extend({elements:{},handlers:[],reset:function(){this.removeEventHandlers();var a=this.elements;for(var b in a)a[b].runtimeStyle.cssText="";this.elements={};var a=IE7.Rule.elements;for(var b in a){with(a[b])className=className.replace(CLASSES,"")}IE7.Rule.elements={}},reload:function(){this.rules=[];this.getInlineStyles();this.screen.load();if(this.print)this.print.load();this.refresh();this.trash()},addRecalc:function(b,c,d,e){this.base(b,c,function(a){d(a);IE7.CSS.elements[a.uniqueID]=a},e)},recalc:function(){this.reset();this.base()},addEventHandler:function(a,b,c){a.attachEvent(b,c);this.handlers.push(arguments)},removeEventHandlers:function(){var a;while(a=this.handlers.pop()){a[0].detachEvent(a[1],a[2])}},getInlineStyles:function(){var a=document.getElementsByTagName("style"),b;for(var c=a.length-1;(b=a[c]);c--){if(!b.disabled&&!b.ie7){var d=b.cssText||b.innerHTML;this.styles.push(d);b.cssText=d}}},trash:function(){var a=document.styleSheets,b,c;for(c=0;c<a.length;c++){b=a[c];if(!b.ie7&&!b.cssText){b.cssText=b.cssText}}this.base()},getText:function(a){return a.cssText||this.base(a)}});IE7.CSS.addEventHandler(window,"onunload",function(){IE7.CSS.removeEventHandlers()});IE7.Rule.elements={};IE7.Rule.prototype.extend({add:function(a){this.base(a);IE7.Rule.elements[a.uniqueID]=a}});if(IE7.PseudoElement){IE7.PseudoElement.hash={};IE7.PseudoElement.prototype.extend({create:function(a){var b=this.selector+":"+a.uniqueID;if(!IE7.PseudoElement.hash[b]){IE7.PseudoElement.hash[b]=true;this.base(a)}}})}IE7.HTML.extend({elements:{},addRecalc:function(b,c){this.base(b,function(a){if(!this.elements[a.uniqueID]){c(a);this.elements[a.uniqueID]=a}})}});document.recalc=function(a){if(IE7.CSS.screen){if(a)IE7.CSS.reload();IE7.recalc()}}})(); 
     1 
     2// ========================================================================= 
     3// ie7-recalc.js 
     4// ========================================================================= 
     5 
     6(function() { 
     7  /* --------------------------------------------------------------------- 
     8   
     9    This allows refreshing of IE7 style rules. If you modify the DOM 
     10    you can update IE7 by calling document.recalc(). 
     11   
     12    This should be the LAST module included. 
     13   
     14  --------------------------------------------------------------------- */ 
     15   
     16  if (!IE7.loaded) return; 
     17   
     18  // remove all IE7 classes from an element 
     19  CLASSES = /\sie7_class\d+/g; 
     20   
     21  IE7.CSS.extend({ 
     22    // store for elements that have style properties calculated 
     23    elements: {}, 
     24    handlers: [], 
     25     
     26    // clear IE7 classes and styles 
     27    reset: function() { 
     28      this.removeEventHandlers(); 
     29      // reset IE7 classes here 
     30      var elements = this.elements; 
     31      for (var i in elements) elements[i].runtimeStyle.cssText = ""; 
     32      this.elements = {}; 
     33      // reset runtimeStyle here 
     34      var elements = IE7.Rule.elements; 
     35      for (var i in elements) { 
     36        with (elements[i]) className = className.replace(CLASSES, ""); 
     37      } 
     38      IE7.Rule.elements = {}; 
     39    }, 
     40     
     41    reload: function() { 
     42      this.rules = []; 
     43      this.getInlineStyles(); 
     44      this.screen.load(); 
     45      if (this.print) this.print.load(); 
     46      this.refresh(); 
     47      this.trash(); 
     48    }, 
     49     
     50    addRecalc: function(propertyName, test, handler, replacement) { 
     51      // call the ancestor method to add a wrapped recalc method 
     52      this.base(propertyName, test, function(element) { 
     53        // execute the original recalc method 
     54        handler(element); 
     55        // store a reference to this element so we can clear its style later 
     56        IE7.CSS.elements[element.uniqueID] = element; 
     57      }, replacement); 
     58    }, 
     59     
     60    recalc: function() { 
     61      // clear IE7 styles and classes 
     62      this.reset(); 
     63      // execute the ancestor method to perform recalculations 
     64      this.base(); 
     65    }, 
     66     
     67    addEventHandler: function(element, type, handler) { 
     68      element.attachEvent(type, handler); 
     69      // store the handler so it can be detached later 
     70      this.handlers.push(arguments); 
     71    }, 
     72     
     73    removeEventHandlers: function() { 
     74      var handler; 
     75       while (handler = this.handlers.pop()) { 
     76         handler[0].detachEvent(handler[1], handler[2]); 
     77       } 
     78    }, 
     79     
     80    getInlineStyles: function() { 
     81      // load inline styles 
     82      var styleSheets = document.getElementsByTagName("style"), styleSheet; 
     83      for (var i = styleSheets.length - 1; (styleSheet = styleSheets[i]); i--) { 
     84        if (!styleSheet.disabled && !styleSheet.ie7) { 
     85          var cssText = styleSheet.cssText || styleSheet.innerHTML; 
     86          this.styles.push(cssText); 
     87          styleSheet.cssText = cssText; 
     88        } 
     89      } 
     90    }, 
     91     
     92    trash: function() { 
     93      // trash the old style sheets 
     94      var styleSheets = document.styleSheets, styleSheet, i; 
     95      for (i = 0; i < styleSheets.length; i++) { 
     96        styleSheet = styleSheets[i]; 
     97        if (!styleSheet.ie7 && !styleSheet.cssText) { 
     98          styleSheet.cssText = styleSheet.cssText; 
     99        } 
     100      } 
     101      this.base(); 
     102    }, 
     103     
     104    getText: function(styleSheet) { 
     105      return styleSheet.cssText || this.base(styleSheet); 
     106    } 
     107  }); 
     108   
     109  // remove event handlers (they eat memory) 
     110  IE7.CSS.addEventHandler(window, "onunload", function() { 
     111     IE7.CSS.removeEventHandlers(); 
     112  }); 
     113   
     114  // store all elements with an IE7 class assigned 
     115  IE7.Rule.elements = {}; 
     116 
     117  IE7.Rule.prototype.extend({ 
     118    add: function(element) { 
     119      // execute the ancestor "add" method 
     120      this.base(element); 
     121      // store a reference to this element so we can clear its classes later 
     122      IE7.Rule.elements[element.uniqueID] = element; 
     123    } 
     124  }); 
     125 
     126  // store created pseudo elements 
     127  if (IE7.PseudoElement) { 
     128    IE7.PseudoElement.hash = {}; 
     129   
     130    IE7.PseudoElement.prototype.extend({ 
     131      create: function(target) { 
     132        var key = this.selector + ":" + target.uniqueID; 
     133        if (!IE7.PseudoElement.hash[key]) { 
     134          IE7.PseudoElement.hash[key] = true; 
     135          this.base(target); 
     136        } 
     137      } 
     138    }); 
     139  } 
     140   
     141  IE7.HTML.extend({ 
     142    elements: {}, 
     143     
     144    addRecalc: function(selector, handler) { 
     145      // call the ancestor method to add a wrapped recalc method 
     146      this.base(selector, function(element) { 
     147        if (!this.elements[element.uniqueID]) { 
     148          // execute the original recalc method 
     149          handler(element); 
     150          // store a reference to this element so that 
     151          //  it is not "fixed" again 
     152          this.elements[element.uniqueID] = element; 
     153        } 
     154      }); 
     155    } 
     156  }); 
     157   
     158  // allow refreshing of IE7 fixes 
     159  document.recalc = function(reload) { 
     160    if (IE7.CSS.screen) { 
     161      if (reload) IE7.CSS.reload(); 
     162      IE7.recalc(); 
     163    } 
     164  }; 
     165 
     166})(); 
  • plugins/tags/_admin.php

    r501 r703  
    108108           
    109109          return  
    110           '<script type="text/javascript" src="index.php?pf=tags/js/jquery.autocomplete.min.js"></script>'. 
     110          '<script type="text/javascript" src="index.php?pf=tags/js/jquery.autocomplete.js"></script>'. 
    111111          '<script type="text/javascript" src="index.php?pf=tags/js/post.js"></script>'. 
    112112          '<script type="text/javascript">'."\n". 
     
    137137           
    138138          return  
    139           '<script type="text/javascript" src="index.php?pf=tags/js/jquery.autocomplete.min.js"></script>'. 
     139          '<script type="text/javascript" src="index.php?pf=tags/js/jquery.autocomplete.js"></script>'. 
    140140          '<script type="text/javascript" src="index.php?pf=tags/js/posts_actions.js"></script>'. 
    141141          '<script type="text/javascript">'."\n". 
Note: See TracChangeset for help on using the changeset viewer.

Sites map