jQuery.noConflict();

/*overstate*/
jQuery(document).ready(function () {


    jQuery(".dates-tooltip").hover(function () {
        jQuery(this).children(".dates-tooltip-list").fadeIn('slow');
    }, function () {
        jQuery(this).children(".dates-tooltip-list").fadeOut('slow');
    });

    jQuery(".dates-tooltip-list").hide();

    jQuery("#subnav li a").hover(function () {
        jQuery(this).stop().animate({ opacity: 0.8 }, 200);
        jQuery(this).animate({ "top": "+10px" }, "fast");
    }, function () {
        jQuery(this).stop().animate({ opacity: 1.0 }, 200);
        jQuery(this).animate({ "top": "0px" }, "fast");
    });

    //footer tabs
    jQuery("#footer-tabs-nav").delay(500).tabs("div.footer-tab");

    var w;
    jQuery.tools.tabs.addEffect("horizontal", function (i, done) {
        // store original width of a pane into memory
        if (!w) { w = this.getPanes().eq(0).width(); }

        // set current pane's width to zero

        this.getCurrentPane().find(".home-tab-right").fadeOut("fast", "linear");

        this.getCurrentPane().stop(false, false).animate({ width: 0 }, 1200, function () {
            jQuery(this).find(".home-tab-right").css("display", "none");
            jQuery(this).hide();
        });

        // grow opened pane to it's original width
        this.getPanes().eq(i).stop(false, false).animate({ width: w }, 1200, function () {
            jQuery(this).find(".home-tab-right").fadeIn("slow", "linear");
            jQuery(this).show();

            done.call();
        });
    });

    /*
    jQuery('#home-tabs')
    .cycle({
    fx: 'scrollLeft',
    delay: 2000,
    pager: '#home-tabs-nav' ,
    pagerAnchorBuilder: function(idx, slide) { 
    // return selector string for existing anchor 
    return '#home-tabs-nav a:eq(' + idx + ')';
    } 
    });
    */

    //home tabs
    var api = jQuery("#home-tabs-nav").tabs("div.home-tab", {
        event: 'mouseover',
        effect: 'horizontal',
        rotate: true,
        initialIndex: 0
    }).slideshow(
    {
        autoplay: true,
        interval: 8000,
        fadeOutSpeed: 'slow'
    });


    //event tabs
    jQuery("#events-tab-nav").tabs("div.event-tab", {
        effect: 'horizontal',
        wait: '200',
        duration: 'slow'
    });

    if (jQuery("#events-tab-nav a").hasClass('current')) {
        jQuery(".current").children('.event-current').show();
    }

    jQuery("#events-tab-nav a").click(function () {
        jQuery('.event-current').hide();
        if (jQuery("#events-tab-nav a").hasClass('current')) {
            jQuery(".current").children('.event-current').show();
        }
    });

    jQuery("#avatar-hide").click(function () {
        jQuery("#avatar-wrapper").hide();
    });


    jQuery("#iframe-login").fancybox({
        'width': 479,
        'height': 401,
        'autoScale': false,
        'transitionIn': 'none',
        'transitionOut': 'none',
        'padding': 0,
        'type': 'iframe',
        'scrolling': 'no'
    });



    jQuery("#iframe-register").fancybox({
        'width': 499,
        'height': 1384,
        'autoScale': false,
        'transitionIn': 'none',
        'transitionOut': 'none',
        'padding': 0,
        'type': 'iframe',
        'scrolling': 'no'
    });

    jQuery("#iframe-edit").fancybox({
        'width': 499,
        'height': 1384,
        'autoScale': false,
        'transitionIn': 'none',
        'transitionOut': 'none',
        'padding': 0,
        'type': 'iframe',
        'scrolling': 'no'
    });

    jQuery("#reco-slideshow").cycle({
        fx: 'scrollHorz',
        prev: '#arrow-left',
        next: '#arrow-right',
        timeout: 9500,
        pager: '#reco-slider-right',
        after: onAfter
    });

    jQuery("#flickrgallery").cycle({
        fx: 'scrollHorz',
        speed: 1500,
        timeout: 5500
    });

    function onAfter(curr, next, opts, fwd) {
        var index = opts.currSlide;
        //get the height of the current slide
        var ht = jQuery(this).height();
        //set the container's height to that of the current slide
        jQuery(this).parent().animate({ height: ht });
    }


    jQuery(".sidebox-news").hover(function () {
        jQuery(this).removeClass("sidebox-news").addClass("sidebox-news-latest");
    },
        function () {
            jQuery(this).removeClass("sidebox-news-latest").addClass("sidebox-news");
        });

   


    jQuery("#iframe-enquiry").fancybox({
        'width': 479,
        'height': 501,
        'autoScale': false,
        'transitionIn': 'none',
        'transitionOut': 'none',
        'padding': 0,
        'type': 'iframe'
    });



});

