﻿$(document).ready(function() {
    $('.billboard').cycle({
        fx: 'fade',
        next: "#next",
        prev: "#prev",
        pager: "#billboardPager",
        pause: 1,
        timeout: 10000,
        pagerAnchorBuilder: function(idx, slide) {
            return '<li><a href="#"></a></li>';
        }
    });

    $("#tab .toggle").click(function() {
        $("#loginslider").slideToggle();
        $(this).toggleClass("active"); return false;
    });

    $("#tab .logout").click(function() {
        top.location.href = '/handlers/logout.ashx';
    });

    $("#login_form .top label").inFieldLabels();
    $(".new_links li label").inFieldLabels();
    $(".admin_search label").inFieldLabels();

    $('.accordion .head').click(function() {
        $(this).next().slideToggle('slow');
        $(this).toggleClass("active");
        return false;
    }).next().hide();

    lastBlock = $(".team_submissions .open .round_content");
    minWidth = 1;

    $(".rounds_four li a.toggle").click(function() {
        $(lastBlock).animate({ width: minWidth + "px" }, { queue: false, duration: 400 });
        $(this).next().animate({ width: "125px" }, { queue: false, duration: 400 });
        lastBlock = $(this).next();
    });

    $(".rounds_three li a.toggle").click(function() {
        $(lastBlock).animate({ width: minWidth + "px" }, { queue: false, duration: 400 });
        $(this).next().animate({ width: "148px" }, { queue: false, duration: 400 });
        lastBlock = $(this).next();
    });

});

function check_fb_login() {
    FB.Connect.logout();
}
//window.open('http://www.facebook.com/sharer.php?u=http://www.imaginecup.us/#fbid=' + JSfbid[1] + '&t=U.S. Imagine Cup 2010  | Home &src=sp', 'Facebook', 'height=400,width=400');

function signin_fb(objButton) {
    window.open(meteor.sharing.href("Facebook", {'title': 'Check out the ImagineCup 2012!'}), 'Facebook', 'height=400,width=400');
    objButton.className = 'btn_facebook-success';
    objButton.disabled = true;
}

function signin_fb_small(objButton) {
    window.open(meteor.sharing.href("Facebook", { 'title': 'Check out the ImagineCup 2012!' }), 'Facebook', 'height=400,width=400');
}

function signin_tw_small(objButton) {
    window.open(meteor.sharing.href("Twitter"), 'Twitter', 'height=400,width=775');
}

function signin_tw(objButton) {
    window.open(meteor.sharing.href("Twitter"), 'Twitter', 'height=400,width=775');
    objButton.className = "btn_twitter-success";
    objButton.disabled = true;
}

