/**
 * jQEm v0.2 - noconflict
 * Interact with the base 'em' unit.
 * http://davecardwell.co.uk/javascript/jquery/plugins/jquery-em/
 *
 * Copyright (c) 2006 Dave Cardwell, dual licensed under the MIT and GPL licenses
 */

new function(){var Public={'auto':function(bool){return bool!=undefined?Private.auto=bool:Private.auto},'init':function(){return Private.init()},'bind':function(callback){return Private.bind(callback)},'unbind':function(callback){return Private.unbind(callback)},'trigger':function(force,args){return Private.trigger(force,args)},'active':function(){return Private.active},'delay':function(milliseconds){return milliseconds?Private.delay=milliseconds:Private.delay},'start':function(){return Private.start()},'stop':function(){return Private.stop()},'current':function(){return Private.current},'previous':function(){return Private.previous}};jQuery.jqem=Public;var Private={'jQueryem':jQuery(document.createElement('ins')),'active':false,'canExp':undefined,'current':undefined,'delay':100,'iid':undefined,'previous':undefined,'auto':true,'init':init,'bind':bind,'unbind':unbind,'trigger':trigger,'update':function(){Private.trigger(false);return'1em'},'start':start,'stop':stop};jQuery(document).ready(function(){if(Private.auto)init()});function init(){jQuery('body').prepend(Private.jQueryem.css({'display':'block','left':'-1em','top':'-1em','position':'absolute','visibility':'hidden','width':'1em'}).attr({'name':'top'}));Private.canExp=(Private.jQueryem.style!=undefined&&Private.jQueryem.style.setExpression!=undefined);Private.start()};function bind(callback){Private.jQueryem.bind('emchange',callback)};function unbind(callback){Private.jQueryem.unbind('emchange',callback)};function trigger(force,args){if(force==undefined)force=false;if(force||Private.jQueryem.width()!=Private.current){Private.previous=Private.current;Private.current=Private.jQueryem.width();jQuery.event.trigger('emchange',args)}};function start(){if(Private.active)return;Private.current=Private.previous=Private.jQueryem.width();if(Private.canExp){Private.jQueryem.style.setExpression('width','jQuery.jqem.update();')}else{Private.iid=window.setInterval(Private.update,Private.delay)}Private.active=true};function stop(){if(!Private.active)return;if(Private.canExp){Private.jQueryem.style.removeExpression('width')}else{window.removeInterval(Private.iid)}}}();

