jQuery.noConflict();

function form_input_classes(){

    jQuery('input[type="text"]').addClass('text');
    jQuery('input[type="password"]').addClass('text');
    jQuery('input[type="checkbox"]').addClass('checkbox');
    jQuery('input[type="radio"]').addClass('radiobutton');
    jQuery('input[type="submit"]').addClass('submit');
    jQuery('input[type="image"]').addClass('buttonImage');

}

function form_labelize(){  jQuery(".labelize input:text").clearingInput(); jQuery(".labelize textarea").clearingInput();}   

function sub_nav(){
  var path = location.pathname.substring(1);
  jQuery('.sub-nav a[href$="' + path + '"]').parent().addClass('nav_active'); // check path as typed exactly
  jQuery('.sub-nav a[href$="' + path + '/"]').parent().addClass('nav_active'); // check path with an extra trailing slash added
}

function cookie_check() {
    var cookie_value = jQuery.cookie("2011-eoy-splash");
    if (cookie_value == 'visited') {
        jQuery("body").addClass("2011-eoy-splash");
    }
}

function twitter_feed() {
    jQuery(".twitter-feed").tweet({
        username: "pih",
        join_text: "auto",
        count: 3,
        auto_join_text_default: "we said,", 
        auto_join_text_ed: "we",
        auto_join_text_ing: "we were",
        auto_join_text_reply: "we replied to",
        auto_join_text_url: "we were checking out",
        loading_text: "loading tweets...",
        template: "{text}{time}"
    });
}

function video_tabs() {
    jQuery(".video-thumbs .video-tab:first").addClass("active");
    jQuery(".video-thumbs .video-tab").click( function() {
        jQuery(".video-thumbs .video-tab").removeClass("active");
        jQuery(this).addClass("active");
        var target = jQuery(this).attr("href");
        jQuery(".video-display .video-entry").hide();
        jQuery(target).show();
        return false;
    });
}


jQuery(function($) {
  form_labelize();
  sub_nav();
  form_input_classes();
  cookie_check();
  video_tabs();
  twitter_feed();
});

