﻿
// jQuery extensions:

(function($) {

    $.expr[':'].external = function(elem) {
        return (elem.hostname && (elem.hostname !== location.hostname)) === true;
    };

})(jQuery);


// on load:

$(function() {

	// drop down nav
	$('#nav li').hover(
		function() {
			$(this).addClass("sfhover");
		},
		function() {
			$(this).removeClass("sfhover");
		}
	);

	// external links
	$('a:external').click(
		function() {
			if (this.className.indexOf('noexit') > -1) return;
			location.href = '/Exit.aspx?u=' + encodeURIComponent(this.href) + '&t=' + encodeURIComponent(this.title);
			return false;
		}
	);

	// TODO: track pdfs
//	$('a[href$="pdf"]').click(
//		function() {
//			alert(this.pathname);
//			return false;
//		}
//	);
});



function popup(sUrl, iWidth, iHeight, scroll) {

    var pageurl = sUrl
    var smallWindow;
    var scrolling = "no";

    if (scroll == "scroll") {
        scrolling = "yes";
    }


    smallWindow = window.open(pageurl, 'popup', 'height=' + iHeight + ',width=' + iWidth + ',location=no,menubar=yes,resizable=no,scrollbars=' + scrolling + ',titlebar=yes,toolbar=yes');
    smallWindow.focus();
}


function linkDropDownChanged(select) {
  var u = select.options[select.selectedIndex];
  select.selectedIndex = 0; 
  if (u && (u = u.value) && u != '') {
    window.location = u;
  }
  return false;
}
