/*

	jQuery - siteFeature Plugin

	@copyright Michael Kafka - http://www.makfak.com

	@version 2.6

*/

(function ($)

{

	

    $.fn.siteFeature = function (b)

    {

        var c = $.extend({}, $.fn.siteFeature.defaults, b);

        return this.each(function (i)

        {

            obj = $(this);

            var a = {};

            a.which = i;

            createFeature(c, a);

            customizeFeature(c, a);

            eventFeature(c, a)

        })

    };

    $.fn.siteFeature.defaults = 

    {

        outputElementId : 'siteFeature', txtBoxIdPrefix : 'txtBox', imgBgIdPrefix : 'imgBg', tabIdPrefix : 'tab', 

        titleText : 'h3', containerWidth : '960px', containerHeight : '300px', imgWidth : '710px', tabsLocation : 'left', 

        tabBgImg : 'http://sise_ragnev.la01.neti.ee/1office/wp-content/themes/infocus/slider/images/tab-arrow.png', tabBgImgIE6 : 'http://sise_ragnev.la01.neti.ee/1office/wp-content/themes/infocus/slider/images/tab-arrow.gif', tabControl : 'click', 

        tabLock : 4, startTab : 1, txtBoxWidth : '300px', txtBoxHorizontalHeight : '90px', txtBoxOpacity : 0.75, 

        activeTabIsLink : true, activeWindowIsLink : true, animateInOnLoad : true, txtBoxAnimateInType : 'slideLeft', 

        txtBoxAnimateOutType : 'slideRight', txtBoxAnimateHorzAlt : true, txtBoxAnimateInHorzType : 'slideUp', 

        txtBoxAnimateOutHorzType : 'slideDown', txtBoxAnimateInDuration : 500, txtBoxAnimateOutDuration : 500, 

        txtBoxPauseBetweenInOut : 1000, cols : 10, rows : 5, imgBgsAnimationDuration : 500, imgBgsAnimateOutDuration : 500, 

        imgBgsAnimationType : 'cycle', imgBgsAnimationList : ['fade', 'wave', 'crash', 'curtain', 'zipper', 'fountain', 'cascade', 'dribble', 'checker', 'enterTheDragon'], imgBgAnimationDirection : 'random', 

        tabsAnimateInDuration : 100, tabsAnimateWidth : '+=38', autoPlay : true, autoPlayInterval : 7000, 

        pauseOnHover : true, ieEnableFilters : false, endCreateFunction : null

		//

    };

    $.fn.siteFeatureTxtBoxAnimationsOut = function (a)

    {

        if ($(this).hasClass('horizontal') && a.txtBoxAnimateHorzAlt) {

            var b = a.txtBoxAnimateOutType;

            a.txtBoxAnimateOutType = a.txtBoxAnimateOutHorzType

        }

        if (a.txtBoxAnimateOutType == 'blink') {

            $(this).css({

                'opacity' : '0', 'display' : 'none'

            })

        }

        if (a.txtBoxAnimateOutType == 'fade')

        {

            $(this).animate({

                'opacity' : '0'

            },

            a.txtBoxAnimateOutDuration, function ()

            {

                $(this).css({

                    'display' : 'none'

                })

            })

        }

        if (a.txtBoxAnimateOutType == 'slideUp')

        {

            if (!$(this).hasClass('horizontal'))

            {

                $(this).stop().animate({

                    'marginTop' : '-' + a.containerHeight

                },

                a.txtBoxAnimateOutDuration, function ()

                {

                    $(this).css({

                        'opacity' : '0', 'margin-top' : '0', 'display' : 'none'

                    })

                })

            }

            else

            {

                $(this).css({

                    'opacity' : '1'

                }).slideUp(a.txtBoxAnimateOutDuration, function ()

                {

                    $(this).css({

                        'opacity' : '0', 'display' : 'none'

                    })

                })

            }

        }

        if (a.txtBoxAnimateOutType == 'slideDown')

        {

            $(this).stop().animate({

                'marginTop' : a.containerHeight

            },

            a.txtBoxAnimateOutDuration, function ()

            {

                $(this).css({

                    'opacity' : '0', 'margin-top' : '0', 'display' : 'none'

                })

            })

        }

        if (a.txtBoxAnimateOutType == 'slideLeft')

        {

            if (a.tabsLocation == 'left')

            {

                if (!$(this).hasClass('horizontal'))

                {

                    $(this).css({

                        'right' : 'auto', 'left' : (parseInt(a.imgWidth) - parseInt(a.txtBoxWidth))

                    }).children().each(function ()

                    {

                        $(this).css({

                            'width' : $(this).width()

                        })

                    }).end().css({

                        'opacity' : '1'

                    }).stop().animate({

                        'width' : '0'

                    },

                    a.txtBoxAnimateOutDuration, function ()

                    {

                        $(this).css({

                            'opacity' : '0', 'width' : a.txtBoxWidth, 'display' : 'none'

                        })

                    })

                }

                else

                {

                    $(this).children().each(function ()

                    {

                        $(this).css({

                            'width' : $(this).width()

                        })

                    }).end().css({

                        'opacity' : '1'

                    }).stop().animate({

                        'left' : '-' + a.imgWidth

                    },

                    a.txtBoxAnimateOutDuration, function ()

                    {

                        $(this).css({

                            'opacity' : '0', 'left' : '0', 'display' : 'none'

                        })

                    })

                }

            }

            else

            {

                $(this).css({

                    'right' : 'auto', 'left' : '0'

                }).stop().animate({

                    'left' : '-' + a.imgWidth

                },

                a.txtBoxAnimateOutDuration, function ()

                {

                    $(this).css({

                        'opacity' : '0', 'left' : '0', 'display' : 'none'

                    })

                })

            }

        }

        if (a.txtBoxAnimateOutType == 'slideRight')

        {

            if (a.tabsLocation == 'left')

            {

                if (!$(this).hasClass('horizontal'))

                {

                    $(this).css({

                        'opacity' : '1', 'left' : 'auto', 'right' : '0'

                    }).stop().animate({

                        'right' : '-' + a.txtBoxWidth

                    },

                    a.txtBoxAnimateOutDuration, function ()

                    {

                        $(this).css({

                            'opacity' : '0', 'right' : '0', 'display' : 'none'

                        })

                    })

                }

                else

                {

                    $(this).css({

                        'opacity' : '1', 'left' : 'auto'

                    }).stop().animate({

                        'right' : '-' + a.imgWidth

                    },

                    a.txtBoxAnimateOutDuration, function ()

                    {

                        $(this).css({

                            'opacity' : '0', 'right' : '0', 'display' : 'none'

                        })

                    })

                }

            }

            else

            {

                if (!$(this).hasClass('horizontal'))

                {

                    $(this).css({

                        'left' : '0px'

                    }).stop().animate({

                        'left' : '-' + a.txtBoxWidth

                    },

                    a.txtBoxAnimateOutDuration, function ()

                    {

                        $(this).css({

                            'opacity' : '0', 'display' : 'none', 'left' : '0px'

                        })

                    })

                }

                else

                {

                    $(this).css({

                        'left' : '0px'

                    }).stop().animate({

                        'left' : '-' + a.imgWidth

                    },

                    a.txtBoxAnimateOutDuration, function ()

                    {

                        $(this).css({

                            'opacity' : '0', 'display' : 'none', 'left' : '0px'

                        })

                    })

                }

            }

        }

        if ($(this).hasClass('horizontal') && a.txtBoxAnimateHorzAlt) {

            a.txtBoxAnimateOutType = b

        }

        return this;

    };

    $.fn.siteFeatureTxtBoxAnimationsIn = function (a)

    {

        if ($(this).hasClass('horizontal') && a.txtBoxAnimateHorzAlt) {

            var b = a.txtBoxAnimateInType;

            a.txtBoxAnimateInType = a.txtBoxAnimateInHorzType

        }

        if (a.txtBoxAnimateInType == 'blink')

        {

            $(this).animate({

                'opacity' : '0'

            },

            a.txtBoxPauseBetweenInOut, function ()

            {

                $(this).css({

                    'opacity' : '1', 'display' : 'block'

                })

            })

        }

        if (a.txtBoxAnimateInType == 'fade')

        {

            $(this).animate({

                'opacity' : '0'

            },

            a.txtBoxPauseBetweenInOut, function ()

            {

                $(this).css({

                    'display' : 'block'

                }).animate({

                    'opacity' : '1'

                },

                a.txtBoxAnimateInDuration, function ()

                {

                    ieStyleFilterCleanup($(this), a)

                })

            })

        }

        if (a.txtBoxAnimateInType == 'slideUp')

        {

            $(this).animate({

                'opacity' : '0'

            },

            a.txtBoxPauseBetweenInOut, function ()

            {

                $(this).css({

                    'display' : 'block', 'opacity' : '1', 'margin-top' : a.containerHeight

                }).animate({

                    'marginTop' : '0'

                },

                a.txtBoxAnimateInDuration, function ()

                {

                    ieStyleFilterCleanup($(this), a)

                })

            })

        }

        if (a.txtBoxAnimateInType == 'slideDown')

        {

            if (!$(this).hasClass('horizontal'))

            {

                $(this).animate({

                    'opacity' : '0'

                },

                a.txtBoxPauseBetweenInOut, function ()

                {

                    $(this).css({

                        'display' : 'block', 'opacity' : '1', 'margin-top' : '-' + a.containerHeight

                    }).animate({

                        'marginTop' : '0'

                    },

                    a.txtBoxAnimateInDuration, function ()

                    {

                        ieStyleFilterCleanup($(this), a)

                    })

                })

            }

            else

            {

                $(this).animate({

                    'opacity' : '0'

                },

                a.txtBoxPauseBetweenInOut, function ()

                {

                    $(this).css({

                        'display' : 'block', 'opacity' : '1'

                    }).slideUp(0).slideDown(a.txtBoxAnimateInDuration, function ()

                    {

                        ieStyleFilterCleanup($(this), a)

                    })

                })

            }

        }

        if (a.txtBoxAnimateInType == 'slideLeft')

        {

            if (a.tabsLocation == 'left')

            {

                if (!$(this).hasClass('horizontal'))

                {

                    $(this).animate({

                        'opacity' : '0'

                    },

                    a.txtBoxPauseBetweenInOut, function ()

                    {

                        $(this).css({

                            'display' : 'block', 'opacity' : '1', 'right' : '-' + a.txtBoxWidth

                        }).animate({

                            'right' : '0'

                        },

                        a.txtBoxAnimateInDuration, function ()

                        {

                            ieStyleFilterCleanup($(this), a)

                        })

                    })

                }

                else

                {

                    $(this).animate({

                        'opacity' : '0'

                    },

                    a.txtBoxPauseBetweenInOut, function ()

                    {

                        $(this).css({

                            'display' : 'block', 'opacity' : '1', 'left' : 'auto', 'right' : '-' + a.imgWidth

                        }).animate({

                            'right' : '0'

                        },

                        a.txtBoxAnimateInDuration, function ()

                        {

                            ieStyleFilterCleanup($(this), a)

                        })

                    })

                }

            }

            else

            {

                if (!$(this).hasClass('horizontal'))

                {

                    $(this).animate({

                        'opacity' : '0'

                    },

                    a.txtBoxPauseBetweenInOut, function ()

                    {

                        $(this).css({

                            'display' : 'block'

                        }).children().each(function ()

                        {

                            $(this).css({

                                'width' : $(this).width()

                            })

                        }).end().css(

                        {

                            'display' : 'block', 'opacity' : '1', 'width' : '0', 'left' : 'auto', 'right' : parseInt(a.imgWidth) - parseInt(a.txtBoxWidth)

                        }).animate({

                            'width' : a.txtBoxWidth

                        })

                    })

                }

                else

                {

                    $(this).animate({

                        'opacity' : '0'

                    },

                    a.txtBoxPauseBetweenInOut, function ()

                    {

                        $(this).css({

                            'display' : 'block', 'opacity' : '1', 'left' : 'auto', 'right' : '-' + a.imgWidth

                        }).animate({

                            'right' : '0'

                        },

                        a.txtBoxAnimateInDuration, function ()

                        {

                            ieStyleFilterCleanup($(this), a)

                        })

                    })

                }

            }

        }

        if (a.txtBoxAnimateInType == 'slideRight')

        {

            if (a.tabsLocation == 'left')

            {

                if (!$(this).hasClass('horizontal'))

                {

                    $(this).animate({

                        'opacity' : '0'

                    },

                    a.txtBoxPauseBetweenInOut, function ()

                    {

                        $(this).css(

                        {

                            'display' : 'block', 'right' : 'auto', 'left' : (parseInt(a.imgWidth) - parseInt(a.txtBoxWidth))

                        }).children().each(function ()

                        {

                            $(this).css({

                                'width' : $(this).width()

                            })

                        }).end().css({

                            'opacity' : '1', 'width' : '0'

                        }).animate({

                            'width' : a.txtBoxWidth

                        },

                        a.txtBoxAnimateInDuration, function ()

                        {

                            ieStyleFilterCleanup($(this), a)

                        })

                    })

                }

                else

                {

                    $(this).animate({

                        'opacity' : '0'

                    },

                    a.txtBoxPauseBetweenInOut, function ()

                    {

                        $(this).css({

                            'display' : 'block', 'right' : 'auto', 'left' : '-' + a.imgWidth

                        }).children().each(function ()

                        {

                            $(this).css({

                                'width' : $(this).width()

                            })

                        }).end().css({

                            'opacity' : '1'

                        }).animate({

                            'left' : '0'

                        },

                        a.txtBoxAnimateInDuration, function ()

                        {

                            ieStyleFilterCleanup($(this), a)

                        })

                    })

                }

            }

            else

            {

                $(this).animate({

                    'opacity' : '0'

                },

                a.txtBoxPauseBetweenInOut, function ()

                {

                    $(this).css({

                        'display' : 'block', 'opacity' : '1', 'left' : '-' + a.imgWidth

                    }).animate({

                        'left' : '0'

                    },

                    a.txtBoxAnimateInDuration, function ()

                    {

                        ieStyleFilterCleanup($(this), a)

                    })

                })

            }

        }

        if ($(this).hasClass('horizontal') && a.txtBoxAnimateHorzAlt) {

            a.txtBoxAnimateInType = b

        }

        return this;

    };

    $.fn.siteFeatureImgAnimations = function (a, b, c)

    {

        b.imgIsAnimating = true;

        a.width = parseInt(a.imgWidth);

        a.height = parseInt(a.containerHeight);

        $imgs = $(this);

        if (a.imgBgsAnimationType == 'random' || a.animationMemory == 'random')

        {

            a.animationMemory = 'random';

            var d = a.imgBgsAnimationList.slice(0);

            var e =- 1;

            for (var i = 0; i < d.length; i++) {

                if (d[i] == a.imgBgsAnimationType) {

                    e = i;

                    break

                }

            }

            d.splice(e, 1);

            d.sort(function ()

            {

                return 0.5 - Math.random();

            });

            a.imgBgsAnimationType = d[0]

        }

        if (a.imgBgsAnimationType == 'cycle' || a.animationMemory == 'cycle')

        {

            a.animationMemory = 'cycle';

            for (i = 0; i < a.imgBgsAnimationList.length; i++)

            {

                if (a.imgBgsAnimationList[i] == a.imgBgsAnimationType) {

                    a.currentAni = i;

                    break

                }

                else {

                    a.currentAni =- 1

                }

            }

            if (a.currentAni < 0 || a.currentAni == a.imgBgsAnimationList.length - 1) {

                a.currentAni = 0

            }

            else {

                a.currentAni++

            }

            a.imgBgsAnimationType = a.imgBgsAnimationList[a.currentAni]

        }

        if (a.imgBgsAnimationType == 'enterTheDragon') {

            $target = $(this).filter('.selected');

            $current = $(this).filter(c)

        }

        else {

            $target = $(this).filter(c);

            $current = $(this).filter('.selected')

        }

        $copy = $target.clone();

        if (a.imgBgAnimationDirection == 'random')

        {

            a.directionList = ['left', 'right'];

            a.directionMemory = a.directionList.sort(function ()

            {

                return 0.5 - Math.random();

            })[0]

        }

        else {

            a.directionMemory = a.imgBgAnimationDirection

        }

        var f = [];

        var g = [];

        var h = [];

        var k = parseInt(a.width / a.cols);

        var l = parseInt(a.height / a.rows);

        var m = a.width - (k * a.cols);

        var n = a.height - (l * a.rows);

        var o = 0;

        var p = 0;

        var q = 1;

        var r = 0;

        var s = a.imgBgsAnimationDuration / 8;

        var t = 1;

        for (i = 0; i < a.cols; i++)

        {

            if (m > 0) {

                tcolWidth = k + 1;

                m--

            }

            else {

                tcolWidth = k

            }

            var u = $target.clone().show().attr({

                'id' : ''

            }).addClass('col-' + i).css(

            {

                'background-position' :- o + 'px top', 'width' : tcolWidth + "px", 'height' : a.height + "px", 

                'float' : 'left', 'position' : 'absolute', 'left' : o

            });

            if (a.imgBgsAnimationType == 'wave' || a.imgBgsAnimationType == 'cascade') {

                u.css({

                    'height' : 0

                })

            }

            if (a.imgBgsAnimationType == 'fall') {

                u.css({

                    'top' : a.height *- 1

                })

            }

            if (a.imgBgsAnimationType == 'curtain') {

                u.data('width', u.css('width')).css({

                    'width' : 0

                })

            }

            if (a.imgBgsAnimationType == 'zipper') {

                if ((i + 1) % 2 == 0) {

                    u.css({

                        'top' : a.height

                    })

                }

                else {

                    u.css({

                        'top' : a.height *- 1

                    })

                }

            }

            if (a.imgBgsAnimationType == 'fountain') {

                u.css({

                    'top' : a.height

                })

            }

            if (a.imgBgsAnimationType == 'crash' || a.imgBgsAnimationType == 'dribble') {

                u.css({

                    'top' : a.height *- 1

                })

            }

            if (a.imgBgsAnimationType == 'checker') {

                u.css({

                    'background-image' : 'none', 'opacity' : 1

                })

            }

            if (a.imgBgsAnimationType == 'enterTheDragon') {

                $current.css({

                    'opacity' : '1', 'display' : 'block'

                })

            }

            $current.append(u[0]);

            g.push(u);

            if (a.imgBgsAnimationType == 'checker')

            {

                for (j = 0; j < a.rows; j++)

                {

                    if (n > 0) {

                        trowHeight = l + 1;

                        n--

                    }

                    else {

                        trowHeight = l

                    }

                    var v = $target.clone().show().attr({

                        'id' : ''

                    }).addClass('row-' + i + '-' + j).css(

                    {

                        'background-position' :- o + 'px ' + - p + 'px', 'height' : 0, 'width' : 0, 'float' : 'left', 

                        'position' : 'absolute', 'left' : tcolWidth / 2, 'top' : p + (trowHeight / 2), 

                        'opacity' : 1

                    }).data('info', {

                        width : tcolWidth, height : trowHeight, 'left' : 0, 'top' : p

                    });

                    $('.col-' + i).append(v[0]);

                    f.push(v[0]);

                    p += trowHeight

                };

                p = 0

            }

            o += tcolWidth;

        };

        if (a.imgBgsAnimationType == 'checker')

        {

            if (a.directionMemory == 'right') {

                var w = a.cols - 1;

                var x = 0;

                var y = a.cols - 1;

                var z = 1

            }

            else {

                var w = 0;

                var x = 0;

                var y = 0;

                var z = 1

            }

            for (i = 0; i < f.length; i++)

            {

                if (a.directionMemory == 'right')

                {

                    if (w < 0) {

                        w = w + z;

                        x = x + z;

                        z++

                    }

                    h[i] = w.toString() + '-' + x.toString();

                    if (w == a.cols - 1 || x >= a.rows - 1) {

                        y--;

                        w = y;

                        x = 0

                    }

                    else {

                        w++;

                        x++

                    }

                }

                else

                {

                    if (w > a.cols - 1) {

                        w = w - z;

                        x = x + z;

                        z++

                    }

                    h[i] = w.toString() + '-' + x.toString();

                    if (w == 0 || x >= a.rows - 1) {

                        y++;

                        w = y;

                        x = 0

                    }

                    else {

                        w--;

                        x++

                    }

                }

            };

            g = [];

            $.each(h, function (i)

            {

                g.push($(f).filter('[class$="-' + this + '"]'))

            })

        }

        if (a.imgBgsAnimationType == 'fountain' || a.imgBgsAnimationType == 'cascade' || a.imgBgsAnimationType == 'dribble' || a.imgBgsAnimationType == 'enterTheDragon')

        {

            var q = 1;

            var A = g.length / 2;

            for (i = 0; i < g.length; i++)

            {

                mafs = A - (parseInt((i + 1) / 2) * q);

                h[i] = mafs;

                if (a.imgBgsAnimationType == 'enterTheDragon')

                {

                    if (i == 0) {

                        q = 0

                    }

                    var B = $(g[parseInt(h[i] - 1)]);

                    var C = (B.width() / 2) * q;

                    if (q < 0) {

                        $ref = B.prev()

                    }

                    else if (q > 0) {

                        $ref = B.next()

                    }

                    else {

                        $ref = B

                    }

                    bgPos = parseInt($ref.css('background-position')) + C;

                    B.data('bgPos-o', B.css('background-position')).css('background-position', bgPos + 'px 0px').data('bgPos-n', 

                    bgPos + 'px 0px');

                    if (i == 0) {

                        q = 1;

                    }

                }

                q *=- 1

            };

            h[a.cols - 1] = 0;

            if (a.imgBgsAnimationType == 'enterTheDragon') {

                $.each(g, function ()

                {

                    $(this).css('background-position', $(this).data('bgPos-o'))

                })

            }

        }

        if (a.directionMemory == 'right' && a.imgBgsAnimationType != 'checker') {

            g.reverse()

        }

        if (a.imgBgsAnimationType == 'fade')

        {

            $(this).filter('.selected').animate({

                'opacity' : '0'

            },

            a.imgBgsAnimationDuration, function ()

            {

                $(this).css({

                    'display' : 'none'

                }).empty();

                b.imgIsAnimating = false;

            }).end().filter(c).css({

                'display' : 'block'

            }).animate({

                'opacity' : '1'

            },

            a.imgBgsAnimationDuration)

        }

        if (a.imgBgsAnimationType == 'wave')

        {

            $.each(g, function (i)

            {

                $(this).animate({

                    'letter-spacing' : '0'

                },

                r, function ()

                {

                    $(this).animate({

                        'opacity' : '1', 'height' : a.height

                    },

                    a.imgBgsAnimationDuration, function ()

                    {

                        if ((i + 1) == g.length)

                        {

                            r = 0;

                            $target.css({

                                'opacity' : '1'

                            }).show();

                            $current.empty().css({

                                'opacity' : '0'

                            }).hide();

                            b.imgIsAnimating = false;

                        }

                    })

                });

                r = (r * t + s)

            })

        }

        if (a.imgBgsAnimationType == 'curtain')

        {

            $.each(g, function (i)

            {

                $(this).animate({

                    'letter-spacing' : '0'

                },

                r, function ()

                {

                    $(this).animate({

                        'opacity' : '1', 'width' : $(this).data('width')

                    },

                    a.imgBgsAnimationDuration, function ()

                    {

                        if ((i + 1) == g.length)

                        {

                            r = 0;

                            $target.css({

                                'opacity' : '1'

                            }).show();

                            $current.empty().css({

                                'opacity' : '0'

                            }).hide();

                            b.imgIsAnimating = false;

                        }

                    })

                });

                r = (r * t + s)

            })

        }

        if (a.imgBgsAnimationType == 'zipper' || a.imgBgsAnimationType == 'crash')

        {

            $.each(g, function (i)

            {

                $(this).animate({

                    'letter-spacing' : '0'

                },

                r, function ()

                {

                    $(this).animate({

                        'opacity' : '1', 'top' : '0'

                    },

                    a.imgBgsAnimationDuration, function ()

                    {

                        if ((i + 1) == g.length)

                        {

                            r = 0;

                            $target.css({

                                'opacity' : '1'

                            }).show();

                            $current.empty().css({

                                'opacity' : '0'

                            }).hide();

                            b.imgIsAnimating = false;

                        }

                    })

                });

                r = (r * t + s)

            })

        }

        if (a.imgBgsAnimationType == 'fountain' || a.imgBgsAnimationType == 'dribble')

        {

            $.each(h, function (i)

            {

                g[this].animate({

                    'letter-spacing' : '0'

                },

                r, function ()

                {

                    $(this).animate({

                        'opacity' : '1', 'top' : '0'

                    },

                    a.imgBgsAnimationDuration, function ()

                    {

                        if ((i + 1) == g.length)

                        {

                            r = 0;

                            $target.css({

                                'opacity' : '1'

                            }).show();

                            $current.empty().css({

                                'opacity' : '0'

                            }).hide();

                            b.imgIsAnimating = false;

                        }

                    })

                });

                r = (r * t + s)

            })

        }

        if (a.imgBgsAnimationType == 'cascade')

        {

            $.each(h, function (i)

            {

                g[this].animate({

                    'letter-spacing' : '0'

                },

                r, function ()

                {

                    $(this).animate({

                        'opacity' : '1', 'height' : a.height

                    },

                    a.imgBgsAnimationDuration, function ()

                    {

                        if ((i + 1) == g.length)

                        {

                            r = 0;

                            $target.css({

                                'opacity' : '1'

                            }).show();

                            $current.empty().css({

                                'opacity' : '0'

                            }).hide();

                            b.imgIsAnimating = false;

                        }

                    })

                });

                r = (r * t + s)

            })

        }

        if (a.imgBgsAnimationType == 'checker')

        {

            var s = a.imgBgsAnimationDuration / 25;

            $.each(g, function (i)

            {

                $(this).animate({

                    'letter-spacing' : '0'

                },

                r, function ()

                {

                    $(this).animate(

                    {

                        'width' : $(this).data('info').width, 'height' : $(this).data('info').height, 

                        'top' : $(this).data('info').top, 'left' : $(this).data('info').left

                    },

                    a.imgBgsAnimationDuration, function ()

                    {

                        if ((i + 1) == f.length)

                        {

                            r = 0;

                            $target.css({

                                'opacity' : '1'

                            }).show();

                            $current.empty().css({

                                'opacity' : '0'

                            }).hide();

                            b.imgIsAnimating = false;

                        }

                    })

                });

                r = (r * t + s)

            })

        }

        if (a.imgBgsAnimationType == 'enterTheDragon')

        {

            if ($.browser.msie) {

                var D = 700

            }

            else {

                var D = a.imgBgsAnimationDuration - 100

            }

            $target.css({

                'opacity' : '0'

            }).hide();

            $.each(h, function (i)

            {

                g[this].animate({

                    'background-position' : g[this].data('bgPos-n')

                },

                D, function ()

                {

                    if (i + 1 == g.length)

                    {

                        h.sort(function ()

                        {

                            return 0.5 - Math.random();

                        });

                        $.each(h, function (j)

                        {

                            g[this].animate({

                                'letter-spacing' : '0'

                            },

                            r, function ()

                            {

                                $(this).animate({

                                    'top' : a.containerHeight

                                },

                                a.imgBgsAnimationDuration, function ()

                                {

                                    if (j + 1 == g.length) {

                                        $current.empty();

                                        b.imgIsAnimating = false;

                                    }

                                })

                            });

                            r = (r * t + s)

                        })

                    }

                })

            })

        }

        return this;

    };

    function ieStyleFilterCleanup(a, b)

    {

        if ($.browser.msie && b.ieEnableFilters)

        {

            a.attr('style', a.attr('style').replace(/filter+[^\;]*./gi, '')).children().each(function ()

            {

                $(this).attr('style', $(this).attr('style').replace(/filter+[^\;]*./gi, ''))

            })

        }

    }

    function outerHTML(a)

    {

        return $('<div>').append(a.eq(0).clone()).html()

    }

    function createFeature(a, b)

    {

        var c;

        var d = "<div id='" + a.txtBoxIdPrefix + "Container'>";

        var e = "<div id='" + a.imgBgIdPrefix + "Container'>";

        var f = "<div id='" + a.tabIdPrefix + "Container'>";

        if ($.browser.msie && $.browser.version == 6) {

            if (a.tabBgImgIE6 != null || a.tabBgImgIE6 != '') {

                a.tabBgImg = a.tabBgImgIE6;

            }

        }

        obj.children().each(function (i)

        {

            sfcurrent = $(this);

            cloned = sfcurrent.clone().attr({

                id : a.tabIdPrefix + i

            }).children('img').remove().end().wrapInner('<div>').prepend('<span></span>');

            d += outerHTML(cloned);

            e += '<div id="' + a.tabIdPrefix + i + '" style="background-image:url(' + sfcurrent.find('img').attr('src') + '); width:' + a.imgWidth + '; height:' + a.containerHeight + ';"></div>';

            f += '<a href="#' + a.tabIdPrefix + i + '" id="' + a.tabIdPrefix + i + '" style="background-image:url('+sfcurrent.find('img').attr('data-tabPic')+')"><h4>' + sfcurrent.find('img').attr('title') + '</h4></a>'

        });

        d += "</div>";

        e += "</div>";

        f += "</div>";

        c = (e + d + f);

        obj.empty().attr({

            'id' : a.outputElementId, 'class' : a.tabsLocation

        }).css({

            'width' : a.containerWidth, 'height' : a.containerHeight

        }).append(c);

        obj.addClass('SF-' + b.which);

        if ($.isFunction(a.endCreateFunction)) {

            a.endCreateFunction.apply(this, [a])

        }

    }

    function customizeFeature(a, b)

    {

        var c = $('#' + a.txtBoxIdPrefix + 'Container', obj);

        var d = $('#' + a.imgBgIdPrefix + 'Container', obj);

        var e = $('#' + a.tabIdPrefix + 'Container', obj);

        d.css({

            'width' : a.imgWidth, 'height' : a.containerHeight

        });

        if (!a.tabLock)

        {

            b.calcdTabHeight = Math.round((parseInt(a.containerHeight) / e.children().length) - ((1 / e.children().length)))

        }

        else

        {

            b.calcdTabHeight = Math.round((parseInt(a.containerHeight) / a.tabLock) - ((1 / e.children().length)));

            b.tabTriggers = obj.after('<div id="' + a.outputElementId + '-nav"><a href="#" id="SF-n-prev"><i>prev</i></a><a href="#" id="SF-n-next"><i>next</i></a><a href="#" id="SF-n-reset"><i>reset</i></a></div>').next().children();

            b.offsetCount = 0;

            b.tabTriggers.hide().filter('#SF-n-prev').click(function ()

            {

                if (e.children().length - a.tabLock - b.offsetCount != e.children().length - a.tabLock) {

                    e.animate({

                        'top' : '+=' + (b.calcdTabHeight + 1)

                    }, 500);

                    b.offsetCount++;

                    return false

                }

                else {

                    return false;

                }

            }).end().filter('#SF-n-next').click(function ()

            {

                if (e.children().length - a.tabLock + b.offsetCount != 0) {

                    e.animate({

                        'top' : '-=' + (b.calcdTabHeight + 1)

                    }, 500);

                    b.offsetCount--;

                    return false

                }

                else {

                    return false;

                }

            }).end().filter('#SF-n-reset').click(function ()

            {

                e.animate({

                    'top' : '+=' + ((b.calcdTabHeight + 1) * (b.offsetCount *- 1))

                }, 500);

                b.offsetCount = 0;

                return false;

            }).end().hover(function ()

            {

                b.overTriggers = true;

            },

            function ()

            {

                b.overTriggers = false;

                $(this).animate({

                    'azimuth' : '0'

                },

                200, function ()

                {

                    if (!b.overTabs) {

                        b.tabTriggers.fadeOut(350)

                    }

                })

            });

            b.tabTriggers.filter('#SF-n-prev').css({

                'top' : obj[0].offsetTop - b.tabTriggers.filter('#SF-n-prev').height() - 1

            }).end().filter('#SF-n-next').css({

                'top' : obj[0].offsetTop + obj.height()

            });

            if (a.tabsLocation == 'left')

            {

                b.tabTriggers.css(

                {

                    'left' : obj[0].offsetLeft + ((parseInt(a.containerWidth) - parseInt(a.imgWidth)) / 2) - (b.tabTriggers.filter('#SF-n-prev').width() / 2)

                })

            }

            else

            {

                b.tabTriggers.css(

                {

                    'left' : obj[0].offsetLeft + (parseInt(a.containerWidth) - ((parseInt(a.containerWidth) - parseInt(a.imgWidth)) / 2)) - (b.tabTriggers.filter('#SF-n-prev').width() / 2)

                })

            }

            e.hover(function ()

            {

                b.overTabs = true;

                if (!b.overTriggers) {

                    b.tabTriggers.fadeIn(350)

                }

            },

            function ()

            {

                b.overTabs = false;

                $(this).animate({

                    'azimuth' : '0'

                },

                200, function ()

                {

                    if (!b.overTriggers) {

                        b.tabTriggers.fadeOut(350)

                    }

                })

            })

        }
        //laius
        e.children().css(

        {

            'width' : 250, 'height' : 75

        }).children('span').css(

        {

            'width' : (parseInt(a.containerWidth) - parseInt(a.imgWidth)), 'height' : b.calcdTabHeight

        }).children('img').css(

        {

            'left' : ((a.tabsLocation == 'left') ? parseInt(a.containerWidth) - parseInt(a.imgWidth) : '0')

        }).prev().css({

            'width' : (parseInt(a.containerWidth) - parseInt(a.imgWidth))

        });

        c.css({

            'width' : a.imgWidth, 'height' : a.containerHeight

        }).children('div:not(.horizontal)').css({

            'width' : a.txtBoxWidth, 'height' : '100%'

        }).end().children('div.horizontal').css(

        {

            'width' : a.imgWidth, 'height' : a.txtBoxHorizontalHeight, 'top' : (parseInt(a.containerHeight) - parseInt(a.txtBoxHorizontalHeight)), 

            'left' : '0px'

        }).end().find('div span').css({

            'opacity' : a.txtBoxOpacity

        }).next().css({

            'opacity' : '1'

        })

    }

    function eventFeature(c, d)

    {

        var f = obj;

        var g = $('#' + c.txtBoxIdPrefix + 'Container', obj).children();

        var h = $('#' + c.imgBgIdPrefix + 'Container', obj).children();

        var i = $('#' + c.tabIdPrefix + 'Container', obj).children();

        if (c.startTab > i.length || c.startTab < 1)

        {

            if (window.console && window.console.log)

            {

                console.log('Your startTab value(' + c.startTab + ') isn\'t in range of the number of tabs(1 - ' + i.length + '). The first tab has been shown.')

            }

            else

            {

                //alert('Your startTab value(' + c.startTab + ') isn\'t in range of the number of tabs(1 - ' + i.length + '). The first tab has been shown.')

            }

            c.startTab = 1

        }

        i.click(function (e)

        {

            if (d.imgIsAnimating) {

                return false

            }

            if (!i.hasClass('selected'))

            {

                if (c.animateInOnLoad)

                {

                    g.css({

                        'opacity' : '0', 'display' : 'none'

                    }).filter(this.hash).siteFeatureTxtBoxAnimationsIn(c);

                    h.css({

                        'opacity' : '0', 'display' : 'none'

                    }).filter(this.hash).css({

                        'display' : 'block'

                    }).animate({

                        'opacity' : '1'

                    },

                    c.imgBgsAnimationDuration, null);

                    i.filter(this.hash).children('span').animate({

                        'width' : c.tabsAnimateWidth

                    },

                    c.tabsAnimateInDuration, null)

                }

                else

                {

                    g.css({

                        'opacity' : '0', 'display' : 'none'

                    }).filter(this.hash).css({

                        'opacity' : '1', 'display' : 'block'

                    });

                    h.css({

                        'opacity' : '0', 'display' : 'none'

                    }).filter(this.hash).css({

                        'opacity' : '1', 'display' : 'block'

                    });

                    i.filter(this.hash).children('span').animate({

                        'width' : c.tabsAnimateWidth

                    }, 0, null)

                }

            }

            else

            {

                if (!$(this).hasClass('selected'))

                {

                    var a = this.hash;

                    g.filter('.selected').siteFeatureTxtBoxAnimationsOut(c).end().filter(this.hash).siteFeatureTxtBoxAnimationsIn(c);

                    h.siteFeatureImgAnimations(c, d, this.hash);

                    i.filter('.selected').children('span').css({

                        'width' : (parseInt(c.containerWidth) - parseInt(c.imgWidth)), 'display' : 'none'

                    });

                    i.filter(a).children('span').animate({

                        'width' : c.tabsAnimateWidth

                    },

                    c.tabsAnimateInDuration)

                }

                else

                {

                    if (c.activeTabIsLink) {

                        window.location = g.filter(this.hash).find('a').attr('href');

                        return false;

                    }

                }

            }

            f.find('.selected').removeClass('selected').end().find(this.hash).addClass('selected');

            return false;

        }).filter(':eq(' + (c.startTab - 1) + ')').click();

        if ($.browser.msie && $.browser.version == 6)

        {

            if (g.filter(':eq(' + (c.startTab - 1) + ')').hasClass('horizontal')) {

                g.filter(':eq(' + (c.startTab - 1) + ')').css({

                    'height' : c.txtBoxHorizontalHeight

                })

            }

            else {

                g.filter(':eq(' + (c.startTab - 1) + ')').css({

                    'height' : c.containerHeight

                })

            }

        }

        if (c.activeWindowIsLink)

        {

            $('#' + c.txtBoxIdPrefix + 'Container').css({

                'cursor' : 'pointer'

            }).click(function (e)

            {

                if (e.target.tagName == 'A') {

                    return true

                }

                else

                {

                    var a = i.filter('.selected').attr('href');

                    var b = a.lastIndexOf('#');

                    a = a.substring(b, a.length);

                    window.location = g.filter(a).find('a').attr('href');

                    return false;

                }

            })

        }

        if (c.autoPlay)

        {

            SiteFeatureAutoPlayInterval['which' + d.which] = setInterval("siteFeatureAutoPlayer(" + d.which + ")", 

            c.autoPlayInterval);

            if (c.pauseOnHover)

            {

                obj.hover(function ()

                {

                    clearInterval(SiteFeatureAutoPlayInterval['which' + d.which])

                },

                function ()

                {

                    SiteFeatureAutoPlayInterval['which' + d.which] = setInterval("siteFeatureAutoPlayer(" + d.which + ")", 

                    c.autoPlayInterval);

                })

            }

        }

        if (c.tabControl == 'hover')

        {

            i.mouseover(function ()

            {

                if (!$(this).hasClass('selected'))

                {

                    var a = this.hash;

                    g.filter('.selected').siteFeatureTxtBoxAnimationsOut(c).end().filter(this.hash).siteFeatureTxtBoxAnimationsIn(c);

                    h.siteFeatureImgAnimations(c, d, this.hash);

                    i.filter('.selected').children('span').css({

                        'width' : 288, 'display' : 'none'

                    });

                    i.filter(a).children('span').animate({

                        'width' : c.tabsAnimateWidth

                    },

                    c.tabsAnimateInDuration)

                }

                f.find('.selected').removeClass('selected').end().find(this.hash).addClass('selected')

            })

        }

    }

    function tabReset() {}

    if (!document.defaultView || !document.defaultView.getComputedStyle)

    {

        var E = jQuery.curCSS;

        jQuery.curCSS = function (a, b, c)

        {

            if (b === 'background-position') {

                b = 'backgroundPosition'

            }

            if (b !== 'backgroundPosition' || !a.currentStyle || a.currentStyle[b]) {

                return E.apply(this, arguments)

            }

            var d = a.style;

            if (!c && d && d[b]) {

                return d[b]

            }

            return E(a, 'backgroundPositionX', c) + ' ' + E(a, 'backgroundPositionY', c);

        }

    }

    var F = $.fn.animate;

    $.fn.animate = function (a)

    {

        if ('background-position'in a) {

            a.backgroundPosition = a['background-position'];

            delete a['background-position']

        }

        if ('backgroundPosition'in a) {

            a.backgroundPosition = '(' + a.backgroundPosition

        }

        return F.apply(this, arguments);

    };

    function toArray(a)

    {

        a = a.replace(/left|top/g, '0px');

        a = a.replace(/right|bottom/g, '100%');

        a = a.replace(/([0-9\.]+)(\s|\)|$)/g, "$1px$2");

        var b = a.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);

        return [parseFloat(b[1], 10), b[2], parseFloat(b[3], 10), b[4]]

    }

    $.fx.step.backgroundPosition = function (a)

    {

        if (!a.bgPosReady)

        {

            var b = $.curCSS(a.elem, 'backgroundPosition');

            if (!b) {

                b = '0px 0px'

            }

            b = toArray(b);

            a.start = [b[0], b[2]];

            var c = toArray(a.options.curAnim.backgroundPosition);

            a.end = [c[0], c[2]];

            a.unit = [c[1], c[3]];

            a.bgPosReady = true

        }

        var d = [];

        d[0] = ((a.end[0] - a.start[0]) * a.pos) + a.start[0] + a.unit[0];

        d[1] = ((a.end[1] - a.start[1]) * a.pos) + a.start[1] + a.unit[1];

        a.elem.style.backgroundPosition = d[0] + ' ' + d[1];

    }

})(jQuery);

var SiteFeatureAutoPlayInterval = [];

function siteFeatureAutoPlayer(a)

{

    var b = jQuery('.SF-' + a).find('#' + jQuery.fn.siteFeature.defaults.tabIdPrefix + 'Container').children();

    if ((b.length - 1) == b.index(b.filter('.selected')))

    {

        b.filter(':first').click();

        jQuery('.SF-' + a).next('#siteFeature-nav').find('#SF-n-reset').click()

    }

    else

    {

        b.filter('.selected').next().click();

        jQuery('.SF-' + a).next('#siteFeature-nav').find('#SF-n-next').click()

    }

	



	

}

jQuery(document).ready(function() {



	jQuery('#preFeature').siteFeature();

	Cufon.refresh();

	

	jQuery('#loading_slider').css('display', 'none');

	jQuery('#sliderContainer').css('margin-left', '0px');

	jQuery('.slider_inner').css('background', 'transparent url(http://sise_ragnev.la01.neti.ee/1office/wp-content/themes/infocus/slider/images/slider-shadow.png) no-repeat scroll center 310px');



});
