(function($){

    $(function(){

        //PNG FIX for IE6

        $(document).pngFix();



        $('div#singleGalSlider').smoothDivScroll({
            scrollingHotSpotLeft: 'div.leftHotSpot',

            scrollingHotSpotRight: 'div.rightHotSpot',

            scrollableArea: 'ul.scroller',

            scrollWrapper: 'div.scrollerWrap',

            //autoScroll: "always",

            //autoScrollDirection: "endlessloopleft",

            //autoScrollStep: 1,

            //autoScrollInterval: 15,

            visibleHotSpots: "always"

        });



        //Newsletter form validation

        $('div#footer_left form input.subscribe[type=submit]').click(function(){

            var ret = true;



            if( $('div#footer_left form input[name=name]').val() == '' )

                ret = false;



            if( $('div#footer_left form input[name=email]').val() == '' || !/^[\w\.=-]+@[\w\.-]+\.[\w]{2,3}$/.test($('div#footer_left form input[name=email]').val()) )

                ret = false;



            return ret;

        });



        //the fancybox

        myFancyBox();



        //Special Categories AJAX Load

        $('div#scrollinGallery ul.scroller a').click(function(){

            var theContainer = $('div#ajaxable div.fadeable');



            theContainer.parent('div#ajaxable').append('<img src="wp-content/themes/gtc/images/loading.gif" class="loading" />');



            theContainer.fadeOut(500);



            $.get( $(this).attr('href'),

                function(responseHTML){

                    theContainer.parent('div#ajaxable').find('img.loading').remove();

                    theContainer.html(responseHTML).fadeIn(500);

                    myFancyBox();

                });



            return false;

        });



        //The Menu

        makeMenu();



        //Frontpage transitions

        fpTransitions();

    });



    function myFancyBox(){

        //Fancy Box

        $("#various1").fancybox({

            'titlePosition'		: 'none',

            'transitionIn'		: 'none',

            'transitionOut'		: 'none'

        });

    }
function makeMenu(){
 
    $("ul.sub-menu li:last-child").addClass('last');

    $('ul#main_menu').superfish({
            autoArrows	: false,
            delay:         1200,
            animation: {
                height:'show'
            },
            speed: 'slow'
        });
}


    //Frontpage transitions

    function fpTransitions(){

        var imgColor = '';

        var imgGray = '';

        var theInterval;

        $('div#boxes div.main_box').hoverIntent({

            over: function(){

                imgColor = $(this).find('img.color');

                imgGray = $(this).find('img.gray');

                ratio = imgColor.width() / imgColor.height();



                imgColor.css({
                    'z-index': 3,
                    opacity: 0
                }).animate({

                    top: -47,

                    left: -80,

                    opacity: 1

                }, 700, 'linear');



            },

            out: function(){

                imgColor.animate({

                    top: 0,

                    left: 0,

                    opacity: 0

                }, 300, 'linear', function(){

                    $(this).removeAttr('style');

                });

            },

            interval: 25,

            sensivity: 2

        });

    }
$(function(){
    $(".people_tooltip").tooltip({
                    position: 'top',
                    relative: true,
                    offset: [30, -55]
                });
    });
})(jQuery.noConflict());
