/*
 * jQuery ifixpng plugin
 * (previously known as pngfix)
 * Version 3.1.2  (2008/09/01)
 * @requires jQuery v1.2.6 or above, or a lower version with the dimensions plugin
 * 
 * Based on the plugin by Kush M., http://jquery.khurshid.com
 *
 * Background position Fixed
 * Also fixes non-visible images
 * (c) Copyright Yereth Jansen (yereth@yereth.nl)
 * personal website: http://www.yereth.nl
 * Company website: http://www.wharf.nl
 * 
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * For a demonstration of the background-position being fixed:
 * http://www.yereth.nl/bgpos.html
 *
 * Plugin page:
 * http://plugins.jquery.com/project/iFixPng2
 *
 */
(function(B){B.ifixpng=function(C){B.ifixpng.pixel=C};B.ifixpng.regexp={bg:/^url\(["']?(.*\.png([?].*)?)["']?\)$/i,img:/.*\.png([?].*)?$/i},B.ifixpng.getPixel=function(){return B.ifixpng.pixel||"images/pixel.gif"};var A={base:B("base").attr("href"),ltie7:B.browser.msie&&B.browser.version<7,filter:function(C){return"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+C+"')"}};B.fn.ifixpng=A.ltie7?function(){function C(H,E,F,G,D){H.css({filter:A.filter(E),width:F,height:G}).attr({src:B.ifixpng.getPixel()}).positionFix()}return this.each(function(){var G=B(this);if(G.is("img")||G.is("input")){var E,F;if(this.src&&this.src.match(B.ifixpng.regexp.img)){E=(A.base&&this.src.substring(0,1)!="/"&&this.src.indexOf(A.base)===-1)?A.base+this.src:this.src;if(!this.width||!this.height){B(new Image()).one("load",function(){C(G,E,this.width,this.height);B(this).remove()}).attr("src",E)}else{C(G,E,this.width,this.height)}}}else{if(this.style){var I=G.css("backgroundImage");if(I&&I.match(B.ifixpng.regexp.bg)&&this.currentStyle.backgroundRepeat=="no-repeat"){I=RegExp.$1;var D=this.currentStyle.backgroundPositionX||0,J=this.currentStyle.backgroundPositionY||0;if(D||J){var H={},F;if(typeof D!="undefined"){if(D=="left"){H.left=0}else{if(D=="right"){H.right=G.width()%2===1?-1:0}else{H.left=D}}}if(typeof J!="undefined"){if(J=="bottom"){H.bottom=G.height()%2===1?-1:0}else{if(J=="top"){H.top=0}else{H.top=J}}}F=new Image();B(F).one("load",function(){var K,O,M={},N;if(/center|%/.test(H.top)){M.top="(this.parentNode.offsetHeight - this.offsetHeight) * "+(H.top=="center"?0.5:(parseInt(H.top)/100));delete H.top}if(/center|%/.test(H.left)){M.left="(this.parentNode.offsetWidth - this.offsetWidth) * "+(H.left=="center"?0.5:(parseInt(H.left)/100));delete H.left}G.positionFix().css({backgroundImage:"none"}).prepend(B("<div></div>").css(H).css({width:this.width,height:this.height,position:"absolute",filter:A.filter(I)}));if(M.top||M.left){var L=G.children(":first")[0];for(N in M){L.style.setExpression(N,M[N],"JavaScript")}}B(this).remove()});F.src=I}else{G.css({backgroundImage:"none",filter:A.filter(I)})}}}}})}:function(){return this};B.fn.positionFix=function(){return this.each(function(){var C=B(this);if(C.css("position")!="absolute"){C.css({position:"relative"})}})}})(jQuery);