/*
 * Copyright (c) 2009 Rodrigo Saboya
 * Licensed under the MIT license.
 * http://github.com/saboya/jquery-facelift-plugin/tree/master
 * version 0.1a
 */
var flirIEHovers={hoverIE6:function(b){var a=$(this.obj[b]).flirGenerateUrl(this.opts[b],this.img[b].alt);this.obj[b].flirHoverURL=a;this.img[b].style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+a+'", sizingMethod="image")'},hoverIE7:function(b){var a=$(this.obj[b]).flirGenerateUrl(this.opts[b],this.img[b].alt);this.obj[b].flirHoverURL=a;this.img[b].src=a},hoverNew:function(d,c,a){var b=this.obj.length;this.obj[b]=d;this.opts[b]=c;this.img[b]=a;return b},obj:[],opts:[],img:[]};$.browser.msie6=$.browser.msie&&/MSIE 6\.0/i.test(window.navigator.userAgent)&&!/MSIE 7\.0/i.test(window.navigator.userAgent);(function(j){j.fn.facelift=function(q){var r=j.extend({},h,q);return this.each(function(){if(this.flirReplaced){return}this.flirMainObj=true;this.flirOpts=r;k(this);g(this,r)})};j.fn.flirGenerateUrl=function(s,q){var r=l(this[0],s,q);return r};var h={mode:"",output:"auto",realFontHeight:false,dpi:96,useBackgroundMethod:false,hoverRenderAlways:false,inheritStyle:true,useExtendedStyles:false,ignoredElements:"br,hr,img,input,select",realFontHeight:false};function k(u){if(u&&u.hasChildNodes()&&u.childNodes.length>1){for(var r in u.childNodes){var t=u.childNodes[r];if(t&&t.nodeType==3){var s=document.createElement("SPAN");s.style.margin=s.style.padding=s.style.border="0px";s.className="flir-span";s.flirSpan=true;var q=t.nodeValue.replace(/[\t\n\r]/g," ").replace(/\s\s+/g," ");if(jQuery.browser.msie){s.innerHTML=t.nodeValue.replace(/^\s+|\s+$/g,"&nbsp;")}else{s.innerHTML=q}u.replaceChild(s,t)}}}}function g(w,t){if(typeof __flir_replacetree_recurse=="undefined"){__flir_replacetree_recurse=1}else{__flir_replacetree_recurse++}if(__flir_replacetree_recurse>1000){console.error("Facelift: Too much recursion.");return}var v=!w.hasChildNodes()||(w.hasChildNodes()&&w.childNodes.length==1&&w.childNodes[0].nodeType==3)?[w]:w.childNodes;var r;for(var u=0;u<v.length;u++){r=v[u];if(r.innerHTML==""){continue}if(j(r).is(t.ignoredElements)){continue}if(r.nodeName=="A"&&!r.flirHasHover){m(r,t)}if(r.hasChildNodes()&&(r.childNodes.length>1||r.childNodes[0].nodeType!=3)){k(r);g(r,t);continue}var q=document.createElement("IMG");var s=l(r,t);q.alt=e(r.innerHTML);if(jQuery.browser.msie6){q.flirImage=true;q.className="flir-image";q.src=t.path+"spacer.png";q.style.width=w.offsetWidth+"px";q.style.height=w.offsetHeight+"px";q.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+s+'", sizingMethod="image")'}else{if(q.onerror){q.onerror=function(){var x=document.createElement("SPAN");x.innerHTML=q.alt;try{w.replaceChild(x,q)}catch(y){}}}q.flirImage=true;q.className="flir-image";q.src=s;q.style.border="none"}r.innerHTML="";r.appendChild(q);r.flirOrig=s;r.className+=" flir-replaced";r.flirReplaced=true}}function m(r,q){r.flirHasHover=true;r.flirOpts=q;j(r).mouseover(c).mouseout(c)}function c(w){var s=w.target;var x=(w.type=="mouseover");while(s!=document.body&&!s.flirHasHover){s=j(s).parent().get(0)}if(s==document.body){return}var v=j(s).children();if(v.length==0||(v.length==1&&(v[0].flirImage||v[0].flirHasHover))){v=[s]}else{if(v.length==1&&!j(v[0]).is(options.ignoredElements)){var r=j(v[0]).children();if(r.length>0){if((r.length==1&&!r[0].flirImage)||r.length>1){v=r}}}}var y;for(var t=0;t<v.length;t++){y=v[t];if(!y.innerHTML||y.nodeName=="IMG"){continue}var u=y.flirImage?y:j(y).children()[0];if((x&&!y.flirHoverURL)){if(jQuery.browser.msie){var z=flirIEHovers.hoverNew(y,s.flirOpts,u,x);if(/^6/.test(jQuery.browser.version)){setTimeout("flirIEHovers.hoverIE6("+z+");",0)}else{setTimeout("flirIEHovers.hoverIE7("+z+");",0)}}else{y.flirHoverURL=l(y,s.flirOpts,u.alt);u.src=y.flirHoverURL}}else{var q=x?y.flirHoverURL:y.flirOrig;if(jQuery.browser.msie&&/^6/.test(jQuery.browser.version)){u.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+q+'", sizingMethod="image")'}else{u.src=q}}}}var l=function(s,r,u){if(u){var t=u}else{var t=s.innerHTML}var q=j(s).css("text-transform");switch(q){case"capitalize":t=t.replace(/\w+/g,function(v){return v.charAt(0).toUpperCase()+v.substr(1).toLowerCase()});break;case"lowercase":t=t.toLowerCase();break;case"uppercase":t=t.toUpperCase().replace(/&[a-z0-9]+;/gi,function(v){return v.toLowerCase()});break}t=encodeURIComponent(t.replace(/&/g,"{amp}").replace(/\+/g,"{plus}"));if(jQuery.browser.msie&&/^6/.test(jQuery.browser.version)){t=escape(t)}return r.path+"generate.php?text="+t+"&h="+s.offsetHeight+"&w="+s.offsetWidth+"&fstyle="+p(s,r)};function p(t,u){var s="";var q={mode:u.mode,output:u.output,realFontHeight:u.realFontHeight,dpi:u.dpi};if(u.size){q.cSize=u.size}else{q.cSize=o(t)}q.cColor=n(t);if(u.font){q.cFont=u.font}else{q.cFont=j(t).css("font-family").split(",")[0].replace(/['"]/g,"").toLowerCase()}q.cLine=f(t,q);q.cSpacing=i(t,q);q.cBackground=j(t).css("background-color");q.cAlign=j(t).css("text-align");q.cTransform=j(t).css("text-transform");q.cWeight=b(t);q.cFontStyle=j(t).css("font-style");for(var r in q){if(q[r]==null||typeof q[r]=="undefined"||q[r]=="NaN"){continue}s+=',"'+r+'":"'+q[r].toString().replace(/"/g,"'")+'"'}s="{"+s.substr(1)+"}";return escape(s)}function f(t,q){var v=j(t).css("line-height");var u=q.cSize;var s=parseFloat(v);if(v.indexOf("em")>-1){ret=(s*u)/u}else{if(v.indexOf("px")>-1){ret=s/u}else{if(v.indexOf("pt")>-1){var r=s;ret=(r/(72/q.dpi))/u}else{if(v.indexOf("%")>-1){return 1}else{ret=s}}}}return d(ret)}function b(r){var q=j(r).css("font-weight");switch(q.toString()){case"100":case"200":case"300":case"lighter":return"lighter";case"400":case"normal":return"";case"500":case"600":case"700":case"bold":return"bold";case"800":case"900":case"bolder":return"bolder"}}function n(r){var q=j(r).css("color");if(q.substr(0,1)=="#"){q=q.substr(1)}return q.replace(/['"]/g,"").toLowerCase()}function o(q){return a(q)}function i(t,r){var v=j(t).css("letter-spacing");var u=r.cSize;var q;if(v!="normal"){if(v.indexOf("em")>-1){q=(parseFloat(v)*u)}else{if(v.indexOf("px")>-1){q=parseFloat(v)}else{if(v.indexOf("pt")>-1){var s=parseFloat(v);q=s/(72/r.dpi)}}}return d(q)}return""}function e(q){return q.replace(/<[^>]+>/g,"")}function d(q){return Math.round(q*10000)/10000}function a(r){var s=document.createElement("DIV");s.style.border="0";s.style.padding="0";s.style.position="absolute";s.style.visibility="hidden";s.style.left=s.style.top="-1000px";s.style.left=s.style.top="10px";s.style.lineHeight="100%";s.innerHTML="Flir_Test";r.appendChild(s);var q=s.offsetHeight;r.removeChild(s);return q}})(jQuery);
;jQuery.fn.supersleight=function(a){a=jQuery.extend({imgs:true,backgrounds:true,shim:"x.gif",apply_positioning:true},a);return this.each(function(){if(jQuery.browser.msie&&parseInt(jQuery.browser.version,10)<7&&parseInt(jQuery.browser.version,10)>4){jQuery(this).find("*").andSelf().each(function(d,f){var b=jQuery(f);if(a.backgrounds&&b.css("background-image").match(/\.png/i)!==null){var c=b.css("background-image");var h=c.substring(5,c.length-2);var g=(b.css("background-repeat")=="no-repeat"?"crop":"scale");var e={filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+h+"', sizingMethod='"+g+"')","background-image":"url("+a.shim+")"};b.css(e)}if(a.imgs&&b.is("img[src$=png]")){var e={width:b.width()+"px",height:b.height()+"px",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b.attr("src")+"', sizingMethod='scale')"};b.css(e).attr("src",a.shim)}if(a.apply_positioning&&b.is("a, input")&&(b.css("position")===""||b.css("position")=="static")){b.css("position","relative")}})}})};