/*
 * jQuery moveNavigation v1.1.0 
 *
 * Copyright (c) 2008 Taranets Aleksey
 * email: aleks_tar@ukr.net
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 */

jQuery.fn.moveNavigation = function(_options){
    // defaults options	
    var _options = jQuery.extend({
	    duration:500
    },_options);

    return this.each(function(){
	    var _obg = jQuery(this);
	    var _liWidth = [];
	    var _lis = jQuery(_obg).find('a.bglink');
	    var _timer = false;

		_lis.each(function(i, el){
			_liWidth[i] = jQuery(el).outerWidth();
			var _clone = jQuery(el).clone().addClass('bg');
			if (jQuery.browser.msie) jQuery(el).parent().prepend(_clone);
			else jQuery(el).after(_clone);
	    });
		jQuery(_obg).find('li').hover(function(){
			$(this).find('a.bglink').not('.bg').animate({opacity:0},{queue:false,duration:_options.duration});
		}, function(){
			$(this).find('a.bglink').not('.bg').animate({opacity:1},{queue:false,duration:_options.duration});
		});
		jQuery(_obg).find('a.bg:eq(0)').css('left',0);
		
    });
}

$(document).ready(function(){
    $('#main-nav').moveNavigation();
});
