jQuery.noConflict();
jQuery(document).ready(function ($) {

    // Corners for Top Navigation
	  $(function(){ 
	  
	  settings = {
			  tl: { radius: 10 },
			  tr: { radius: 10 },
			  bl: { radius: 0 },
			  br: { radius: 0 },
			  antiAlias: true,
			  autoPad: true
		  }

	  $('li.static').corner(settings);
	  });

    // Sticky Footer
    //$("#footer").constantfooter({
    //    "classmodifier": "constantfooter",
        //"feedlink": "Read more »",
    //    "opacity": "1",
    //    "closebutton": "",
        //"feed": "http://blogs.msdn.com/b/sharepoint/",
    //    "showclose": "false"
    //});

    // Bottom of Page Footer
		$("#footer").footer({
			timeOut: 20,
			zIndex: 3
		});

    // Styled Search Scope DropDown
    $('td.ms-sbscopes select#ctl00_PlaceHolderSearchArea_SearchBoxEx_SBScopesDDL').selectmenu({
        style: 'dropdown',
        menuWidth: 210
    });


    // Highlight Current Location in Top Nav
    var MatchURL = GetCurrentUrl();
    $('#TopNavDiv a[href$="' + MatchURL + '"]').addClass('HighlightCurrentNav');

    function GetCurrentUrl() {
        var rex = new RegExp("\\/[^\\/]+");
        var match = rex.exec(location.pathname);
        return match;
    }

    // Fix Top Nav Hover Issue with IE
    $('a.static span.menu-item-text').hover(function() { 
       $(this).parent().parent().parent().prev().css('background-image','url("/_layouts/images/TKI.Novasource/TopNavSelected.png")'); 
     }, function() { 
       $(this).parent().parent().parent().prev().css('background-image','url("/_layouts/images/TKI.Novasource/TopNavUnselected.png")'); 
    }); 

    // Add arrow to dropdown search scope
    $('a.ui-selectmenu').prepend('<span id="searchDownArrow">&nbsp;</span>');

	// Change Distributors Link Text to Spanish and Spanish URL
	$(function(){ 
		var url = location.pathname;

			if (url.substring(0, 8) == "/spanish")
		{ 
				$('a#distributorLink').html('Distribuidores').attr('href','/spanish/pages/distributors.aspx').parent().css('left','925px');
		}
	});


	// When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});


});

