/*
 * jQuery alignWith plug-in v1.0.2
 * Align two or more elements with each other
 *
 * @requires jQuery v1.2 or later
 *
 * Copyright (c) 2009 Gilmore Davidson
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 */
(function(a){a.fn.extend({alignWith:function(e,l,q){e=a(e);var o=e.offset(),c=o.left,r=o.top,d=e.outerWidth(),m=e.outerHeight(),g="",b="",k=[],n=/^([tbcm]{2}|lr|rl)$/i,j=/^r?[rtbcm]r?$/i,h=/^([lrcm]{2}|tb|bt)$/i,p=/^b?[lrbcm]b?$/i,f={position:"absolute",left:c,top:r},i={x:0,y:0,appendToBody:false};if(undefined!==q){a.extend(i,q)}if(!/^[tblrcm]{1,4}$/.test(l)){l="c"}k=l.split("");switch(k.length){case 1:g=b=""+l+l;break;case 2:g=b=l;break;case 3:g=""+k[0]+k[1];b=""+k[2]+k[2];break;case 4:g=""+k[0]+k[1];b=""+k[2]+k[3];break}return this.each(function(){var v=a(this),s=c,x=r,u=v.outerWidth(),w=v.outerHeight();if(n.test(g)){s-=(u/2)}else{if(j.test(g)){s-=u}}if(n.test(b)){s+=(d/2)}else{if(j.test(b)){s+=d}}if(h.test(g)){x-=(w/2)}else{if(p.test(g)){x-=w}}if(h.test(b)){x+=(m/2)}else{if(p.test(b)){x+=m}}s-=parseInt(v.css("margin-left"),10)||0;x-=parseInt(v.css("margin-top"),10)||0;if(0!==i.x){s+=parseInt(i.x,10)}if(0!==i.y){x+=parseInt(i.y,10)}f.left=s;f.top=x;v.css(f);if(i.appendToBody){v.appendTo("body")}})}})})(jQuery);
