$(document).ready(function(){
  // LINK MARKING
  $("#content a[href*=http]").not(".noIcon").not("a[href*=.mynisi.com]").not("a[href$=.pdf]").attr({title: "This link takes you to an external website."}).attr({target: "_blank"}).append("<img src='/images/external.gif' alt='This link takes you to an external website.' width='15' height='11' /></a>");
  $("a[href$=.pdf]").not(".noIcon").attr({title: "This link opens a PDF document."}).attr({target: "_blank"}).append("<img src='/images/pdf.gif' alt='This link opens a PDF document.' width='27' height='10' /></a>");
  $("a[href$=.doc]").not(".noIcon").attr({title: "This link opens a Word document."}).attr({target: "_blank"}).append("<img src='/images/doc.gif' alt='This link opens a Word document.' width='27' height='10' /></a>");
  $("a[href$=.xls]").not(".noIcon").attr({title: "This link opens a Excel document."}).attr({target: "_blank"}).append("<img src='/images/xls.gif' alt='This link opens a Excel document.' width='27' height='10' /></a>");
  $("a[href$=.ppt]").not(".noIcon").attr({title: "This link opens a PowerPoint document."}).attr({target: "_blank"}).append("<img src='/images/ppt.gif' alt='This link opens a PowerPoint document.' width='27' height='10' /></a>");

  // TABLE STRIPING
  $(".tableStripe tr:even").addClass("even");
  $(".tableStripe tr").hover(function(){
	$(this).addClass("tableOver")
  }, function() {
	$(this).removeClass("tableOver")
  });
  $(".tableStripe td").hover(function(){
	$(this).addClass("tdOver")
  }, function() {
	$(this).removeClass("tdOver")
  });

  // POPUP WINDOW
  function launchwin(winUrl, winName, w, h) {
	settings='height='+h+',width='+w+',scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=yes,dependent=no';
	window.open (winUrl, winName, settings)
  }
	
  // SLIDE TOGGLE, START HIDDEN - SLIDE DOWN - EMPLOYER MINI SITES
  $('.slideContainer').removeClass('hide').hide();
  $("a.slideLink").toggle(function(){
	$(this).parent().prev().slideDown('fast'),$(this).text("Return to condensed view");
  },function(){
	$(this).parent().prev().slideUp('fast'),$(this).text("Expand to learn more");
  });

  // SLIDE TOGGLE, START HIDDEN - SLIDE DOWN
  $('.slideContainer').removeClass('hide').hide();
  $("a.slideLinkDown").toggle(function(){
	$(this).parent().prev().slideDown('fast');
  },function(){
	$(this).parent().prev().slideUp('fast');
  });  
  
  // INPUT HELPER TEXT PLUGIN
	$.fn.inputHelper = function() {
	  return this.each(function(){
		var inputText = $(this).attr('value');
		var helperText = $(this).attr('alt');
		$(this).attr("value", helperText).addClass('inputHelper');
		// On focus clear input, remove helper class
		$(this).focus(function (){
		  $(this).removeClass('inputHelper');
		  if ($(this).val() == helperText) {
			$(this).val('');
		  }
		});
		// On blur, replace empty input with helper text if nothing was entered
		$(this).blur(function (){
		  if ($(this).val() == ""){
			$(this).attr("value", helperText).addClass('inputHelper');
		  } else {
			return;
		  }
		});
	  });
	};
	
	// POPUP WINDOW PLUGIN
	jQuery.fn.popupWindow = function(options) {
		var defaults = {
			width: screen.width/2,
			height: screen.height/2,
			titlebar: false,
			scrollbars: true,
			toolbar: true,
			location: false,
			status: false,
			menubar: false,
			resizable: true,
			dependent: false
		};
		var options = jQuery.extend(defaults, options);
		
		Boolean.prototype.setProperty = function() {
			if (this == true) { return "yes"; } else { return "no"; }
		};
		
		return this.each( function() {
			jQuery(this).click( function() {
				var target = this.target;
				var href = this.href;
				var posY = (parseInt(screen.height/2)) - (parseInt(options.height/2));
				var posX = (parseInt(screen.width/2)) - (parseInt(options.width/2));
				var win = window.open(href, target, 'titlebar=' + options.titlebar.setProperty() + ', screenX='+ posX +', screenY='+ posY +', left='+ posX +', top='+ posY +', scrollbars=' + options.scrollbars.setProperty() + ', toolbar=' + options.toolbar.setProperty() + ', location=' + options.location.setProperty() + ', status=' + options.status.setProperty() + ', menubar=' + options.menubar.setProperty() + ', resizable=' + options.resizable.setProperty() + ', dependent=' + options.dependent.setProperty() + ', width='+ options.width +', height='+ options.height);
				win.focus();
				return false;
			});
		});
	};  
});// END $(DOCUMENT).READY();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////	
  // HIDE MAIN SITE NAV
  function removeMainNav() {
	$('div#nav').addClass('hide');
  }
  // ADD TEXT RESIZE
  function addTextResize(){
	$('div#header').prepend('<div id="header-size"><img src="/images/text_size.gif" alt="" width="59" height="19" /> <a href="#" class="small"><img src="/images/text1.gif" alt="" width="24" height="23" /></a> <a href="#" class="medium"><img src="/images/text2.gif" alt="" width="24" height="23" /></a> <a href="#" class="large"><img src="/images/text3.gif" alt="" width="24" height="23" /></a></div>');
	if($.cookie('TEXT_SIZE')) {
		$('html').addClass($.cookie('TEXT_SIZE'));
	}
	$('#header-size a').click(function() {
		var textSize = $(this).attr('class');
		$('html').removeClass('small medium large').addClass(textSize);
		$.cookie('TEXT_SIZE',textSize, { path: '/', expires: 0 });
		return false;
	});
  }
