$(document).ready(function(){

	// ie bugs
		if($.browser.msie & $.browser.version == 6){
		$('.service li, .topmenu li').hover(function(){
			$(this).addClass('iehover');
		},function(){
			$(this).removeClass('iehover');
		})


	}

//	$("#menuu").load("/menuu/index.html");

	$("#taggs").load("/taggs/");
	
	$('.carousel').jcarousel({scroll: 1, start: 3});
	$('.topmenu li').hover(function(){
		$(this).find('ul').stop(true, true);
		$(this).children('ul').fadeIn('fast');
	}, function(){
		$(this).children('ul').fadeOut('fast');
	})

                  $("a#single_image").fancybox();
                $("a#inline").fancybox({
                    'titleShow'     :   false
                });

                $("a.group").fancybox({
                    'transitionIn'  :   'elastic',
                    'transitionOut' :   'elastic',
                    'speedIn'   :   600,
                    'speedOut'  :   200,
                    'overlayShow'   :   false,
                    'titleShow' :   false
                });


// fix
    $.fn.fixFloat = function(options){  /**We have named our plugin 'fixFloat'**/

        var defaults = {
            enabled: true
        };
        var options = $.extend(defaults, options);

        var offsetTop;      /**Distance of the element from the top of window**/
        var s;              /**Scrolled distance from the top of window through which we have moved**/
        var fixMe = true;
        var repositionMe = true;

        var tbh = $(this);
        var originalOffset = tbh.css('top');    /**Get the actual distance of the element from the top**/

        tbh.css({'position':'absolute'});

        if(options.enabled){
            $(window).scroll(function(){
                var offsetTop = tbh.offset().top;   /**Get the current distance of the element from the top**/
                var s = parseInt($(window).scrollTop(), 10);    /**Get distance from the top of window through which we have scrolled**/
                var fixMe = true;
                if(s > offsetTop){
                    fixMe = true;
                }else{
                    fixMe = false;
                }

                if(s < parseInt(originalOffset, 10)){
                    repositionMe = true;
                }else{
                    repositionMe = false;
                }

                if(fixMe){
                    var cssObj = {
                        'position' : 'fixed',
                        'top' : '0px'
                    }
                    tbh.css(cssObj);
                }
                if(repositionMe){
                    var cssObj = {
                        'position' : 'absolute',
                        'top' : originalOffset
                    }
                    tbh.css(cssObj);
                }
            });
        }
    };



})


