jQuery.fn.extend({connect:function(type,obj,method,args){return this.each(function(){var f=function(){var a=args||[this].concat(jQuery.makeArray(arguments));var r=(typeof method=='string'?obj[method].apply(obj,a):method.apply(obj,a));return typeof r=='boolean'?r:false};var ccache=jQuery.data(this,'connect:'+type)||[];ccache.push([obj,method,f]);jQuery.data(this,'connect:'+type,ccache);$(this).bind(type,f)})},disconnect:function(type,obj,method){return this.each(function(){var ccache=jQuery.data(this,'connect:'+type)||[];var hdlrs=[];var ncache=[];var elmt=this;jQuery.each(ccache,function(i,rec){if(rec[0]==obj&&rec[1]==method){hdlrs.push(rec[2])}else{ncache.push(rec)}});jQuery.each(hdlrs,function(i,hdlr){$(elmt).unbind(type,hdlr)});jQuery.data(this,'connect:'+type,ncache.length?ncache:false)})},liveConnect:function(type,obj,method,args){var f=function(){var a=args||[this].concat(jQuery.makeArray(arguments));var r=(typeof method=='string'?obj[method].apply(obj,a):method.apply(obj,a));return typeof r=='boolean'?r:false};var cacheid='liveconnect:'+type+':'+this.selector;var ccache=jQuery.data(window,cacheid)||[];ccache.push([obj,method,f]);jQuery.data(window,cacheid,ccache);$(this.selector).live(type,f);return this},liveDisconnect:function(type,obj,method){var cacheid='liveconnect:'+type+':'+this.selector;var ccache=jQuery.data(window,cacheid)||[];var hdlrs=[];var ncache=[];var elmt=this;jQuery.each(ccache,function(i,rec){if(rec[0]==obj&&rec[1]==method){hdlrs.push(rec[2])}else{ncache.push(rec)}});jQuery.each(hdlrs,function(i,hdlr){$(elmt).die(type,hdlr)});jQuery.data(window,cacheid,ncache.length?ncache:false);return this},hitTest:function(x,y){var o=this.getPosition();var ox=o.left;var oy=o.top;var w=this[0].offsetWidth;var h=this[0].offsetHeight;var ex=ox+w;var ey=oy+h;return(x>=ox&&y>=oy&&x<=ex&&y<=ey)?true:false},getPosition:function(){var elmt=this[0];var left=0;var top=0;while(elmt.offsetParent){left+=elmt.offsetLeft+(elmt.currentStyle?(parseInt(elmt.currentStyle.borderLeftWidth)).NaN0():0);top+=elmt.offsetTop+(elmt.currentStyle?(parseInt(elmt.currentStyle.borderTopWidth)).NaN0():0);elmt=elmt.offsetParent}left+=elmt.offsetLeft+(elmt.currentStyle?(parseInt(elmt.currentStyle.borderLeftWidth)).NaN0():0);top+=elmt.offsetTop+(elmt.currentStyle?(parseInt(elmt.currentStyle.borderTopWidth)).NaN0():0);return{'left':left,'top':top}},replaceWith:function(value){return this.each(function(){var e=$(this);var p=e.parent();var s=e.prev();e.remove();if(s[0]){s.after(value)}else{p.prepend(value)}})},fixPngImage:function(){if(!$.browser.msie||parseInt($.browser.version)>=7.0){return this}this.filter('[src$=png]').each(function(){var i=$(this);i.after('<div style="display:block; width: '+i.width()+'px; height: '+i.height()+'px; padding: 0px; margin: 0px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+i.attr('src')+'\', sizingMethod=\'image\');" ></div>').hide()});return this},fixPngBackground:function(){if(!$.browser.msie||parseInt($.browser.version)>=7.0){return this}return this.each(function(){this.style.backgroundImage='';var m=this.currentStyle.backgroundImage.match(/^url\("([^"]+)"\)/);if(!m||!m[1]){return}var sz=this.currentStyle.backgroundRepeat=='no-repeat'?'crop':'scale';this.style.backgroundImage='none';this.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+m[1]+'", sizingMethod="'+sz+'")'})},fixHoverPngBackground:function(){if($.browser.msie&&$.browser.version<7){var fn=function(){this.style.backgroundImage="";$(this).toggleClass("hover").fixPngBackground()};return this.each(function(){$(this).mouseover(fn).mouseout(fn).fixPngBackground()})}return this},idle:function(time,callback){return this.animate({delay:1},time,callback)},showComment:function(){return this.each(function(){var child=this.firstChild;if(child.nodeType===8){this.innerHTML='';$(this).replaceWith(child.nodeValue)}})}});jQuery.extend({getStyle:function(url){if(url&&typeof jQuery._syn.loaded_ui[url]=="undefined"){jQuery._syn.loaded_ui[url]=true;var ts=(new Date()).getTime();url+=((url.match(/\?/))?'&':'?')+'_='+ts;$("head").eq(0).append('<link href="'+url+'" rel="stylesheet" type="text/css" />')}},getStyles:function(urls,prefix){urls_array=$.makeArray(urls);$.each(urls_array,function(i,url){$.getStyle(prefix+url)})},removeStyle:function(url){if(url){var ts_url=$("head").find("link[href^="+url+"?_]").attr('href');$("head").find("link[href="+ts_url+"]").remove();if(url&&typeof jQuery._syn.loaded_ui[url]!="undefined"){jQuery._syn.loaded_ui[url]=null;delete jQuery._syn.loaded_ui[url]}}},removeStyles:function(urls,prefix){urls_array=$.makeArray(urls);$.each(urls_array,function(i,url){$.removeStyle(prefix+url)})},getScripts:function(urls,callback,prefix){if(urls.length==0){callback();return}var prefix=(prefix)?prefix:"";urls=$.makeArray(urls);if(jQuery._syn.loaded_ui[prefix+urls[0]]){$.getScripts(urls.slice(1),callback,prefix)}else{$.getScript(prefix+urls[0],function(){jQuery._syn.loaded_ui[prefix+urls[0]]=true;$.getScripts(urls.slice(1),callback,prefix)})}}});jQuery._syn={loaded_ui:[]};
