/* ------------------------------------------------------------------------
	Class: prettyPhoto
	Use: Lightbox clone for jQuery
	Author: Stephane Caron (http://www.no-margin-for-errors.com)
	Version: 2.1.1
------------------------------------------------------------------------- */

	$(document).ready(function(){
		prettyPhoto.init();
		prettyComments.init('textarea');
	});

	prettyPhoto = {
		options : {
			'animationSpeed' : 'fast', /* fast/normal/slow */
			'padding' : 40, /* padding for each side of the picture */
			'showTitle' : false
		},
		init : function(){
			// Find all the images to overlay
			prettyPhoto.imagesArray = [];
			$("a[rel^='prettyOverlay'],a[rel^='prettyPhoto']").each(function(){
				prettyPhoto.imagesArray[prettyPhoto.imagesArray.length] = this;
				$(this).bind('click',function(){
					prettyPhoto.open(this); return false;
				});
			});
			
			$(window).scroll(function(){ prettyPhoto.centerPicture(); });
			$(window).resize(function(){ prettyPhoto.centerPicture(); prettyPhoto.resizeOverlay(); })
		},
		open : function(caller) {
			prettyPhoto.caller = caller;
			
			// Find out if the picture is part of a set
			theRel = $(caller).attr('rel');
			galleryRegExp = /\[(?:.*)\]/;
			theGallery = galleryRegExp.exec(theRel);
			
			// Calculate the number of items in the set, and the position of the clicked picture.
			prettyPhoto.setCount = 0; /* Total images in the set */
			prettyPhoto.setPosition = 0; /* Position in the set */
			prettyPhoto.arrayPosition = 0; /* Total position in the array */
			prettyPhoto.isSet = false;
			for (i = 0; i < prettyPhoto.imagesArray.length; i++){
				if($(prettyPhoto.imagesArray[i]).attr('rel').indexOf(theGallery) != -1){
					prettyPhoto.setCount++;
					if(prettyPhoto.setCount > 1) prettyPhoto.isSet = true;

					if($(prettyPhoto.imagesArray[i]).attr('href') == $(caller).attr('href')){
						prettyPhoto.setPosition = prettyPhoto.setCount;
						prettyPhoto.arrayPosition = i;
					};
				};
			};
			
			prettyPhoto.buildOverlay(prettyPhoto.isSet);

			// Display the current position
			$('div.popup span.currentText').html('<span>' + prettyPhoto.setPosition + '</span>' + '/' + prettyPhoto.setCount);

			// Position the picture in the center of the viewing area
			prettyPhoto.centerPicture();
			
			$('div.popup #fullResImageContainer').hide();
			$('.loaderIcon').show();

			// Preload the neighbour images
			prettyPhoto.preload();
		},
		next : function(){
			// Change the current position
			prettyPhoto.arrayPosition++;
			prettyPhoto.setPosition++;

			// Fade out the current picture
			$('div.popup #fullResImageContainer').fadeOut(prettyPhoto.options['animationSpeed'],function(){
				$('.loaderIcon').show();
				
				// Preload the neighbour images
				prettyPhoto.preload();
			});
			
			prettyPhoto.hideTitle();
			$('div.popup .hoverContainer').fadeOut(prettyPhoto.options['animationSpeed']);
			$('div.popup .details').fadeOut(prettyPhoto.options['animationSpeed'],function(){
				prettyPhoto.checkPosition();
			});
		},
		previous: function(){
			// Change the current position
			prettyPhoto.arrayPosition--;
			prettyPhoto.setPosition--;

			// Fade out the current picture
			$('div.popup #fullResImageContainer').fadeOut(prettyPhoto.options['animationSpeed'],function(){
				$('.loaderIcon').show();
				
				// Preload the image
				prettyPhoto.preload();
			});

			prettyPhoto.hideTitle();
			$('div.popup .hoverContainer').fadeOut(prettyPhoto.options['animationSpeed']);
			$('div.popup .details').fadeOut(prettyPhoto.options['animationSpeed'],function(){
				prettyPhoto.checkPosition();
			});
		},
		checkPosition : function(){
			// If at the end, hide the next link
			(prettyPhoto.setPosition == prettyPhoto.setCount) ? $('div.popup a.next').hide() : $('div.popup a.next').show();
			
			// If at the beginning, hide the previous link
			(prettyPhoto.setPosition == 1) ? $('div.popup a.previous').hide() : $('div.popup a.previous').show();
			
			// Change the current picture text
			$('div.popup span.currentText span').text(prettyPhoto.setPosition);
			
			if (prettyPhoto.isSet) {
				if($(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr('title')){
					$('div.popup .description').html(unescape($(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr('title')));
				}else{
					$('div.popup .description').text('');
				};
				
				if($(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).find('img').attr('alt') && prettyPhoto.options['showTitle']){
					prettyPhoto.hasTitle = true;
					$('div.prettyPhotoTitle .prettyPhotoTitleContent').html(unescape($(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).find('img').attr('alt')));
				}else{
					prettyPhoto.hasTitle = false;
				};
			}else{
				if($(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr('title')){
					$('div.popup .description').html(unescape($(prettyPhoto.caller).attr('title')));
				}else{
					$('div.popup .description').text('');
				};
				
				if($(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).find('img').attr('alt') && prettyPhoto.options['showTitle']){
					prettyPhoto.hasTitle = true;
					$('div.prettyPhotoTitle .prettyPhotoTitleContent').html(unescape($(prettyPhoto.caller).find('img').attr('alt')));
				}else{
					prettyPhoto.hasTitle = false;
				};
			};
		},
		centerPicture : function(){
			//Make sure the gallery is open
			if($('div.popup').size() > 0){
				
				var scrollPos = prettyPhoto.getScroll();
				
				$('div.popup').css({
					'top': ($(window).height()/2) + scrollPos['scrollTop'] - ($('div.popup').height()/2),
					'left': ($(window).width()/2) + scrollPos['scrollLeft'] - ($('div.popup').width()/2)
				});
				
				$('div.prettyPhotoTitle').css({
					'top' : $('div.popup').offset().top - 22,
					'left' : $('div.popup').offset().left + (prettyPhoto.options['padding']/2)
				});
			};
		},
		preload : function(){
			// Hide the next/previous links if on first or last images.
			prettyPhoto.checkPosition();
			
			// Set the new image
			imgPreloader = new Image();
			
			// Preload the neighbour images
			nextImage = new Image();
			if(prettyPhoto.isSet) nextImage.src = $(prettyPhoto.imagesArray[prettyPhoto.arrayPosition + 1]).attr('href');
			
			prevImage = new Image();
			if(prettyPhoto.isSet && prettyPhoto.imagesArray[prettyPhoto.arrayPosition - 1]) prevImage.src = $(prettyPhoto.imagesArray[prettyPhoto.arrayPosition - 1]).attr('href');

			$('div.popup .content_foto').css('overflow','hidden');
			
			(prettyPhoto.isSet) ? $('div.popup #fullResImage').attr('src',$(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr('href')) : $('div.popup #fullResImage').attr('src',$(prettyPhoto.caller).attr('href'));

			imgPreloader.onload = function(){
				var correctSizes = prettyPhoto.resize(imgPreloader.width,imgPreloader.height);
				imgPreloader.width = correctSizes['width'];
				imgPreloader.height = correctSizes['height'];
				
				// Need that small delay for the anim to be nice
				setTimeout('prettyPhoto.showimage(imgPreloader.width,imgPreloader.height,'+correctSizes["containerWidth"]+','+correctSizes["containerHeight"]+','+correctSizes["contentWidth"]+')',500);
			};
			
			(prettyPhoto.isSet) ? imgPreloader.src = $(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr('href') : imgPreloader.src = $(prettyPhoto.caller).attr('href');
		},
		showimage : function(width,height,containerWidth,containerHeight,contentWidth){
			$('.loaderIcon').hide();
			
			$('div.popup .content_foto').animate({'height':contentHeight},prettyPhoto.options['animationSpeed']);

			var scrollPos = prettyPhoto.getScroll();

			// Resize the holder
			$('div.popup').animate({
				'top': scrollPos['scrollTop'] + (($(window).height()/2) - (containerHeight/2)),
				'left': (($(window).width()/2) - (containerWidth/2)),
				'width':containerWidth
			},prettyPhoto.options['animationSpeed'],function(){
				$('#fullResImage').attr({
					'width':width,
					'height':height
				});

				// Show the nav elements
				prettyPhoto.shownav();

				$('div.popup .hoverContainer').height(height).width(width);

				// Fade the new image
				$('div.popup #fullResImageContainer').fadeIn(prettyPhoto.options['animationSpeed']);
			});	
		},
		shownav : function(){
			if(prettyPhoto.isSet) $('div.popup .hoverContainer').fadeIn(prettyPhoto.options['animationSpeed']);
			$('div.popup .details').fadeIn(prettyPhoto.options['animationSpeed']);

			prettyPhoto.showTitle();
		},
		showTitle : function(){
			if(prettyPhoto.options['showTitle'] && prettyPhoto.hasTitle){
				$('div.prettyPhotoTitle').css({
					'top' : $('div.popup').offset().top,
					'left' : $('div.popup').offset().left + (prettyPhoto.options['padding']/2),
					'display' : 'block'
				});
				
				$('div.prettyPhotoTitle div.prettyPhotoTitleContent').css('width','auto');
				
				if($('div.prettyPhotoTitle').width() > $('div.popup').width()){
					$('div.prettyPhotoTitle div.prettyPhotoTitleContent').css('width',$('div.popup').width() - (prettyPhoto.options['padding'] * 2));
				}else{
					$('div.prettyPhotoTitle div.prettyPhotoTitleContent').css('width','');
				};
				
				$('div.prettyPhotoTitle').animate({'top':($('div.popup').offset().top - 22)},prettyPhoto.options['animationSpeed']);
			};
		},
		hideTitle : function() {
			$('div.prettyPhotoTitle').animate({'top':($('div.popup').offset().top)},prettyPhoto.options['animationSpeed'],function() { $(this).css('display','none'); });
		},
		buildOverlay : function(){
			
			// Build the background overlay div
			backgroundDiv = "<div class='popupOverlay'></div>";
 			$('body').append(backgroundDiv);
			$('div.popupOverlay').css('height',$(document).height());
			$('.popupOverlay').bind('click',function(){
				prettyPhoto.close();
			});
			
			// Basic HTML for the picture holder
			pictureHolder = '<div class="popup popup_foto"><div class="top"><div class="left"></div><div class="middle"></div><div class="right"></div></div><div class="content_foto"><div class="loaderIcon"></div><div class="hoverContainer"><a class="next" href="#">next</a><a class="previous" href="#">previous</a></div><div id="fullResImageContainer"><img id="fullResImage" src="" /></div><div class="details clearfix"><a class="close" href="#">Close</a><p class="description"></p><p class="currentTextHolder"><span class="currentText"><span>0</span>/<span class="total">0</span></span></p></div></div><div class="bottom"><div class="left"></div><div class="middle"></div><div class="right"></div></div></div>';
			
			// Basic html for the title holder
			titleHolder = '<div class="prettyPhotoTitle"><div class="prettyPhotoTitleLeft"></div><div class="prettyPhotoTitleContent"></div><div class="prettyPhotoTitleRight"></div></div>';

			$('body').append(pictureHolder).append(titleHolder);

			$('.popup,.titleHolder').css({'opacity': 0});
			$('a.close').bind('click',function(){ prettyPhoto.close(); return false; });
			
			$('.popup .previous').bind('click',function(){
				prettyPhoto.previous();
				return false;
			});
			
			$('.popup .next').bind('click',function(){
				prettyPhoto.next();
				return false;
			});

			$('.hoverContainer').css({
				'margin-left':prettyPhoto.options['padding']/2,
				'margin-right':prettyPhoto.options['padding']/2
			});
			
			// If it's not a set, hide the links
			if(!prettyPhoto.isSet) {
				$('.hoverContainer').hide();
				$('.currentTextHolder').hide();
			};

			// Then fade it in
			$('div.popupOverlay').css('opacity',0);
			$('div.popupOverlay').fadeTo(prettyPhoto.options['animationSpeed'],0.35, function(){
				$('div.popup').fadeTo(prettyPhoto.options['animationSpeed'],1,function(){
					// To fix an IE bug
					$('div.popup').attr('style','left:'+$('div.popup').css('left')+';top:'+$('div.popup').css('top')+';');
				});
			});
		},
		resize : function(width,height){
			$('div.popup .details').width(width); /* To have the correct height */
			$('div.popup .details p.description').width(width - parseFloat($('div.popup a.close').css('width'))); /* So it doesn't overlap the button */
			
			// Get the container size, to resize the holder to the right dimensions
			contentHeight = parseFloat($('div.popup .details').height()) + parseFloat($('div.popup .details').css('margin-top')) + parseFloat($('div.popup .details').css('margin-bottom'));
			containerHeight = contentHeight + parseFloat($('div.popup .top').height()) + parseFloat($('div.popup .bottom').height());
			containerWidth = parseFloat($('div.popup .content_foto').css("padding-left")) + parseFloat($('div.popup .content_foto').css("padding-right")) + prettyPhoto.options['padding'];
			
			var newWidth = width;
			var newHeight = height;
			
			// If there's a title, take it into consideration unpon resizing
			if(prettyPhoto.options['showTitle']) containerHeight -= 22;
			
			if((containerWidth + width) > $(window).width() || (containerHeight + height) > $(window).height()) {
				// Get the original geometry and calculate scales
				var xscale=(width+containerWidth + 100)/$(window).width();
				var yscale=(height+containerHeight + 100)/$(window).height();
			
				// Recalculate new size with default ratio
				if (yscale>xscale){
					newWidth = Math.round(width * (1/yscale));
					newHeight = Math.round(height * (1/yscale));
				} else {
					newWidth = Math.round(width * (1/xscale));
					newHeight = Math.round(height * (1/xscale));
				};
			};

			// Get the container size, to resize the holder to the right dimensions
			containerHeight += newHeight;
			contentHeight += newHeight;
			containerWidth += newWidth;
		
			$('div.popup .details').width(newWidth); /* To have the correct height */
			$('div.popup .details p.description').width(newWidth - parseFloat($('div.popup a.close').css('width'))); /* So it doesn't overlap the button */

			return {
				width:newWidth,
				height:newHeight,
				containerHeight:containerHeight,
				containerWidth:containerWidth,
				contentHeight:contentHeight
			};
		},
		resizeOverlay : function() {
			$('div.popupOverlay').css({
				'height':$(document).height(),
				'width':$(window).width()
			});
		},
		getScroll : function(){
			scrollTop = window.pageYOffset || document.documentElement.scrollTop || 0;
			scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || 0;
			return {scrollTop:scrollTop,scrollLeft:scrollLeft};
		},
		close : function(){
			$('div.popup,div.prettyPhotoTitle').fadeTo(prettyPhoto.options['animationSpeed'],0, function(){
				$('div.popupOverlay').fadeTo(prettyPhoto.options['animationSpeed'],0, function(){
					$('div.popupOverlay').remove();
					$('div.popup').remove();
				});
			});
		}
	}

/* ------------------------------------------------------------------------
	Pretty Comments
	
	Developped By: Stephane Caron (http://www.no-margin-for-errors.com)
	Inspired By: The facebook textarea :)
	Version: 1.2
	
	Copyright: Feel free to redistribute the script/modify it, as
			   long as you leave my infos at the top.
------------------------------------------------------------------------- */

	var prettyComments = {
		version : '1.2',
		options : {
			'animate' : true,
			'animationSpeed' : 'fast', /* fast/slow/normal */
			'alreadyAnimated' : false,
			'init' : true /* DONT CHANGE */
		},
		init : function(which){
			// Create the div in which the content will be copied
			$('body').append('<div id="comment_hidden"></div>');
			
			$(which).each(function(){
				$(this).css({
					'overflow':'hidden',
					'display':'inline'
				})
				.bind('keyup',function(){ prettyComments.copyContent($(this)); });
				
				// Make sure all the content in the textarea is visible
				prettyComments.setCSS(this);
				prettyComments.copyContent($(this));
				
				$(this).height($("#comment_hidden").height());
			});
			
			prettyComments.options['init'] = false;
		},
		setCSS : function(which){
			// Init the div for the current textarea
			$("#comment_hidden").css({
				'display': 'none',
				'width': $(which).width(),
				'min-height': $(which).height(),
				'font-family': $(which).css('font-family'),
				'font-size': $(which).css('font-size'),
				'line-height': $(which).css('line-height')
			});
			
			if($.browser.msie && parseFloat($.browser.version) < 7){
				$("#comment_hidden").css('height',$(which).height());
			}
		},
		copyContent : function(which){
			// Convert the line feeds into BRs
			theValue = $(which).attr('value') || "";
			theValue = theValue.replace(/\n/g,'<br />')
			
			$("#comment_hidden").html(theValue);
			
			if(!prettyComments.options['init']){
				if($("#comment_hidden").height() > $(which).height()){
					this.expand(which);
				}else if($("#comment_hidden").height() < $(which).height()){
					this.shrink(which);
				};
			};
		},
		expand : function(which){			
			if(this.options['animate'] && !this.options['alreadyAnimated']){
				this.options['alreadyAnimated'] = true;
				$(which).animate({'height':$("#comment_hidden").height()},this.options['animationSpeed'],function(){
					prettyComments.options['alreadyAnimated'] = false;
				});
			}else if(!this.options['animate'] && !this.options['alreadyAnimated']){
				$(which).height($("#comment_hidden").height());
			};
		},
		shrink : function(which){
			this.options['alreadyAnimated'] = true;
			$(which).animate({'height':$("#comment_hidden").height()},this.options['animationSpeed'],function(){
				prettyComments.options['alreadyAnimated'] = false;
			});
		}
	};


	
/*
 * jQuery corner plugin
 *
 * version 1.92 (12/18/2007)
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

/**
 * The corner() method provides a simple way of styling DOM elements.  
 *
 * corner() takes a single string argument:  $().corner("effect corners width")
 *
 *   effect:  The name of the effect to apply, such as round or bevel. 
 *            If you don't specify an effect, rounding is used.
 *
 *   corners: The corners can be one or more of top, bottom, tr, tl, br, or bl. 
 *            By default, all four corners are adorned. 
 *
 *   width:   The width specifies the width of the effect; in the case of rounded corners this 
 *            will be the radius of the width. 
 *            Specify this value using the px suffix such as 10px, and yes it must be pixels.
 *
 * For more details see: http://methvin.com/jquery/jq-corner.html
 * For a full demo see:  http://malsup.com/jquery/corner/
 *
 *
 * @example $('.adorn').corner();
 * @desc Create round, 10px corners 
 *
 * @example $('.adorn').corner("25px");
 * @desc Create round, 25px corners 
 *
 * @example $('.adorn').corner("notch bottom");
 * @desc Create notched, 10px corners on bottom only
 *
 * @example $('.adorn').corner("tr dog 25px");
 * @desc Create dogeared, 25px corner on the top-right corner only
 *
 * @example $('.adorn').corner("round 8px").parent().css('padding', '4px').corner("round 10px");
 * @desc Create a rounded border effect by styling both the element and its parent
 * 
 * @name corner
 * @type jQuery
 * @param String options Options which control the corner style
 * @cat Plugins/Corner
 * @return jQuery
 * @author Dave Methvin (dave.methvin@gmail.com)
 * @author Mike Alsup (malsup@gmail.com)
 */
(function($) { 

$.fn.corner = function(o) {
    var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent);
    function sz(el, p) { return parseInt($.css(el,p))||0; };
    function hex2(s) {
        var s = parseInt(s).toString(16);
        return ( s.length < 2 ) ? '0'+s : s;
    };
    function gpc(node) {
        for ( ; node && node.nodeName.toLowerCase() != 'html'; node = node.parentNode ) {
            var v = $.css(node,'backgroundColor');
            if ( v.indexOf('rgb') >= 0 ) { 
                if ($.browser.safari && v == 'rgba(0, 0, 0, 0)')
                    continue;
                var rgb = v.match(/\d+/g); 
                return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
            }
            if ( v && v != 'transparent' )
                return v;
        }
        return '#ffffff';
    };
    function getW(i) {
        switch(fx) {
        case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
        case 'cool':   return Math.round(width*(1+Math.cos(Math.asin(i/width))));
        case 'sharp':  return Math.round(width*(1-Math.cos(Math.acos(i/width))));
        case 'bite':   return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
        case 'slide':  return Math.round(width*(Math.atan2(i,width/i)));
        case 'jut':    return Math.round(width*(Math.atan2(width,(width-i-1))));
        case 'curl':   return Math.round(width*(Math.atan(i)));
        case 'tear':   return Math.round(width*(Math.cos(i)));
        case 'wicked': return Math.round(width*(Math.tan(i)));
        case 'long':   return Math.round(width*(Math.sqrt(i)));
        case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
        case 'dog':    return (i&1) ? (i+1) : width;
        case 'dog2':   return (i&2) ? (i+1) : width;
        case 'dog3':   return (i&3) ? (i+1) : width;
        case 'fray':   return (i%2)*width;
        case 'notch':  return width; 
        case 'bevel':  return i+1;
        }
    };
    o = (o||"").toLowerCase();
    var keep = /keep/.test(o);                       // keep borders?
    var cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);  // corner color
    var sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);  // strip color
    var width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10; // corner width
    var re = /round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;
    var fx = ((o.match(re)||['round'])[0]);
    var edges = { T:0, B:1 };
    var opts = {
        TL:  /top|tl/.test(o),       TR:  /top|tr/.test(o),
        BL:  /bottom|bl/.test(o),    BR:  /bottom|br/.test(o)
    };
    if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
        opts = { TL:1, TR:1, BL:1, BR:1 };
    var strip = document.createElement('div');
    strip.style.overflow = 'hidden';
    strip.style.height = '1px';
    strip.style.backgroundColor = sc || 'transparent';
    strip.style.borderStyle = 'solid';
    return this.each(function(index){
        var pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };

        if ($.browser.msie) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        var cssHeight = $.curCSS(this, 'height');

        for (var j in edges) {
            var bot = edges[j];
            // only add stips if needed
            if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
                var d = document.createElement('div');
                $(d).addClass('jquery-corner');
                var ds = d.style;

                bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

                if (bot && cssHeight != 'auto') {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.bottom = ds.left = ds.padding = ds.margin = '0';
                    if ($.browser.msie)
                        ds.setExpression('width', 'this.parentNode.offsetWidth');
                    else
                        ds.width = '100%';
                }
                else if (!bot && $.browser.msie) {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
                    
                    // fix ie6 problem when blocked element has a border width
                    var bw = 0;
                    if (ie6 || !$.boxModel)
                        bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
                    ie6 ? ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"') : ds.width = '100%';
                }
                else {
                    ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                        (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
                }

                for (var i=0; i < width; i++) {
                    var w = Math.max(0,getW(i));
                    var e = strip.cloneNode(false);
                    e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                    bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                }
            }
        }
    });
};

$.fn.uncorner = function(o) { return $('.jquery-corner', this).remove(); };
    
})(jQuery);