<\/b><\/b>')
+ .before('?<\/a>');
+ }
+ }
+ }
+};
+
+$(document).ready(function()
+{
+ UTIL.loadEvents();
+});
+
+/*
+ * After a certain amount of time has passed, checks to see if
+ * the loading icon is still visible. If so, there was a problem
+ * grabbing the data, so we will display an error message instead.
+ */
+function checkLoadTime()
+{
+ var visibility = $('.loading_icon').css("display");
+
+ if(visibility != "none")
+ {
+ $('.loading_icon').fadeOut(750, function()
+ {
+ var err_msg = "Tweets could not be grabbed at this time.";
+ $('#latest_tweets').append(err_msg).hide().fadeIn(750);
+ });
+ }
+}
+
+/*
+ * Handle configuration for a floating side nav bar that stays in
+ * view as you scroll.
+ */
+function floatNavBar()
+{
+ // Make nav bar scroll
+ var startOffset = $('#sticky').parent().offset().top;
+
+ // Adjust the nav bar's maximum height if the content section is bigger
+ if($('#main_content_nav').height() > $('#sticky').parent().height())
+ $('#sticky').parent().height($('#main_content_nav').height());
+
+ $(window).scroll(function()
+ {
+ var bottomPos;
+
+ // get the maximum scrollTop value
+ bottomPos = $('#sticky').parent().height() - $('#sticky').height() - 20;
+ if(bottomPos < 0)
+ bottomPos = 0;
+
+ // check if the window was scrolled down more than the start
+ // offset declared.
+ var pastStartOffset = $(document).scrollTop() > 0;
+ // check if the object is at it's top position (starting point)
+ var objFartherThanTopPos = $('#sticky').offset().top > startOffset;
+
+ // if window scrolled down more than startOffset OR obj position is
+ // greater than the top position possible
+ if(pastStartOffset || objFartherThanTopPos)
+ {
+ var newpos = ($(document).scrollTop() - startOffset);
+
+ if ( newpos > bottomPos )
+ newpos = bottomPos;
+
+ // if window scrolled < starting offset, then reset Obj position
+ // (opts.offsetY);
+ if ( $(document).scrollTop() < startOffset )
+ newpos = 0;
+
+ $("#sticky").animate({top: newpos}, {duration: 500, queue: false});
+ }
+ });
+}
+
+/* Handle highlighting of related input fields. */
+function highlightConfig()
+{
+ $(".wrapper input, .wrapper select, .wrapper textarea").focus(function()
+ {
+ $(this).parents(".wrapper-parent").addClass("highlight");
+ }).blur(function()
+ {
+ $(this).parents(".wrapper-parent").removeClass("highlight");
+ });
+}
+
+/*
+ * Handles configuration of video/image galleries using
+ * the yoxview jQuery files.
+ */
+function learn_yoxViewConfig()
+{
+ // The video gallery on the Learn page
+ $("#vid-gallery").yoxview({ skin: "top_menu" });
+}
+
+/*
+ * Handles configuration of the participate page's
+ * drop down menus.
+ */
+function participate_dropdown()
+{
+ var $dropMenus = $('.drop-menu > li');
+
+ $dropMenus.bind('mouseover', jsddm_open);
+ $dropMenus.bind('mouseout', jsddm_timer);
+
+ $dropMenus.find('a[href^=#]').bind('click', function(e) {
+ e.preventDefault();
+ });
+
+ $(document).bind('click', function(e) {
+ if (ddmenuitem && !e.isDefaultPrevented() ) {
+ jsddm_close();
+ }
+ });
+
+}
+
+/*
+ * Handles configuration of primer navigation.
+ * Specifically, styling to show only the
+ * expected section.
+ */
+function primer_navigationConfig()
+{
+ var page = document.location.href;
+
+ window.all_shown = false;
+
+ // For external links and reloads
+ if(page.search("primer") > 0)
+ {
+ //If there's no hash value, set at the first one
+ if (window.location.hash)
+ {
+ var arr = page.split("#");
+ var div_id = "#" + arr[1];
+ }
+ else
+ {
+ var div_id = "#primer_main";
+ }
+
+ $('#primer_content').find('div.p_container').hide();
+
+ // Handle visibility for guidance sections
+ if(div_id == "#guidance1")
+ div_id = "#serviceprovider_startingpoint";
+ else if(div_id == "#guidance2")
+ div_id ="#oslc_resources";
+ else if(div_id == "#guidance3")
+ div_id ="#resource_shapes";
+ else if(div_id == "#guidance4")
+ div_id ="#query_mechanisms";
+ else if(div_id == "#guidance5")
+ div_id ="#serviceprovidercatalog";
+
+ $(div_id).show();
+
+ //Add current class to nav
+ $('#main_nav a[href$="' + div_id + '"]').parent().addClass('current');
+ }
+ // Primer Nav
+ $('.primer_nav').find('a').click(function(e) {
+
+ if (!window.all_shown) {
+ var div_id;
+ div_id = $(this).attr('href');
+ $('#primer_content').find('div.p_container').hide();
+
+ // Handle visibility for guidance sections
+ if(div_id == "#guidance1")
+ div_id = "#serviceprovider_startingpoint";
+ else if(div_id == "#guidance2")
+ div_id ="#oslc_resources";
+ else if(div_id == "#guidance3")
+ div_id ="#resource_shapes";
+ else if(div_id == "#guidance4")
+ div_id ="#query_mechanisms";
+ else if(div_id == "#guidance5")
+ div_id ="#serviceprovidercatalog";
+
+ $(div_id).show();
+
+ //Add current classes
+ $('#main_nav li').removeClass('current');
+ $('#main_nav a[href$="' + div_id + '"]').parent().addClass('current');
+ }
+
+ });
+ // Primer Next/Previous Buttons
+ $('.p_next_prev_nav').find('a').click(function(e) {
+
+ if (!window.all_shown) {
+
+ var div_id;
+ div_id = $(this).attr('href');
+
+ $('#primer_content').find('div.p_container').hide();
+ $(div_id).show();
+
+ //Change current navigation
+ $('#main_nav li').removeClass('current');
+ $('#main_nav a[href$="' + div_id + '"]').parent().addClass('current');
+
+ }
+
+ });
+
+ // Handle Browser's Back/Forward button presses
+ $(window).hashchange( function(){
+
+ if (!window.all_shown) {
+ var div_id;
+ div_id = location.hash;
+
+ if (!location.hash) {
+ div_id = '#primer_main';
+ }
+
+ $('#primer_content').find('div.p_container').hide();
+
+ // Handle visibility for guidance sections
+ if(div_id == "#guidance1")
+ div_id = "#serviceprovider_startingpoint";
+ else if(div_id == "#guidance2")
+ div_id ="#oslc_resources";
+ else if(div_id == "#guidance3")
+ div_id ="#resource_shapes";
+ else if(div_id == "#guidance4")
+ div_id ="#query_mechanisms";
+ else if(div_id == "#guidance5")
+ div_id ="#serviceprovidercatalog";
+
+
+ $(div_id).show();
+
+ //Change current navigation
+ $('#main_nav li').removeClass('current');
+ $('#main_nav a[href$="' + div_id + '"]').parent().addClass('current');
+ }
+
+ });
+
+ $(window).hashchange();
+
+ //Need a 'Show all' button for people coming from search engines
+ $('#tut-show-all').click( function(e){
+
+ //Show all sections
+ $('#primer_content').find('div.p_container').show();
+ //Remove any "current" highlight
+ $('#main_nav li').removeClass('current');
+ //Remove prev/next navigation buttons
+ $('.prev, .next').hide();
+ //Hide the button
+ $(this).hide();
+
+ //Set "all_shown" to true
+ window.all_shown = true;
+
+ e.preventDefault();
+
+ });
+}
+
+/* Handle submission of the support form. */
+function submitSupportForm()
+{
+ // Support Form
+ $("#supportSubmit").click(function()
+ {
+ // Validate before submitting the form
+ var valid = $("#supportForm").validationEngine('validate');
+
+ // if the form is valid, go ahead and submit it
+ if(valid)
+ {
+ $.ajax(
+ {
+ url: "includes/support.php",
+ type: "post",
+ data:
+ {
+ fname: $("#fname").val(),
+ mi: $("#mi").val(),
+ lname: $("#lname").val(),
+ company: $("#company").val(),
+ email: $("#email").val(),
+ role: $("#role").val()
+ },
+ complete: function(data)
+ {
+ $('#supportDialog').html(
+ 'Thank you for your interest. Care to share with others?<\/p>' +
+ '