		var offset = null;
		var counter = null;

				// for areas of study
		
		function getOffsetTop(element) {
	var offset = element.offsetTop
	while (element = element.offsetParent) {
		offset += element.offsetTop
	}
	
	return offset;
}

function adjustSpacer( height ) {
	var contanerId = 'studyareas_desc';
	var spacerId = 'KU_spacer';
	var eSpacer = ''
	var finalHeight = null;
	
	// get element
	if( document.getElementById(spacerId) == null ){
		eSpacer		= document.createElement('div');
		eSpacer.id	= spacerId;
		eSpacer.style.height = 0 + 'px';
		document.getElementById('studyareas_desc').appendChild(eSpacer);
	}
	else{
		eSpacer = document.getElementById(spacerId);
	}
	
	finalHeight	= height + eSpacer.offsetHeight;
	if( finalHeight < 0 ){
		finalHeight = 0;
	}
	eSpacer.style.height = finalHeight + 'px';
}

function resetSpacer() {
	var spacerId = 'KU_spacer';
	var eSpacer = ''
	
	// get element
	if( document.getElementById(spacerId) != null ){
		eSpacer = document.getElementById(spacerId);
		eSpacer.style.height = '0px';
	}
}

$('.studyareas ul li.discipline').each(function(){
//		if ($(this).hasClass('discipline')) {
			$(this).mouseover(function(event){
				if ($(this).hasClass('active')) {
					$(this).removeClass('active');
					$(this).find('dl').hide();
					$('#active_dd').css('display','none');
					$('#active_dd_left_open').css('display','none');
					resetSpacer();
					$(this).blur();
					return;
				}
				offset = $(this).attr('value');
				$('#active_dd').css('display','none');
				$('#active_dd_left_open').css('display','none');
				$('dl a.active').removeClass('active');
				$('.studyareas ul li.active dl').hide();
				$('.studyareas ul li.active').removeClass('active');
				$(this).find('dl').show();
				$(this).addClass('active');
				$(this).blur();
				resetSpacer();
			});
//		}
	});
	
	counter = 1;
	$('.studyareas div dl dt').each(function(){
		$(this).attr('id','t'+counter);
		counter++;
	});
	
	counter = 1;
	$('.studyareas div dl dd').each(function(){
		$(this).attr('id','d'+counter);
		counter++;
	});


			$('.studyareas div ul li dl dt > a').each(function(){
		$(this).mouseover(function(event){
		    
            
			// determine where the active_dd div will sit
			var top = $(this).offset().top - $($('.studyareas div ul li > a')[0]).offset().top + offset;
			var topForLink = 0;
			var topForBox = 0;
			var topForImg = 0;
			var ad = $('#active_dd');
			if($(this).attr('id') == 'wide_box')
			{
			    $('#active_dd').css("background","transparent url(/sitecollectionimages/degree_data_bg.gif) no-repeat scroll 1px top");
			    $('#active_dd').css("height","400px");
			    $('#active_dd').css("width","370px");
			    //alert($(this).attr('id'));
			}
			else
			{
			    $('#active_dd').css("background","transparent url(/kaplanimages/degree_data_bg.gif) no-repeat scroll left top");
			    $('#active_dd').css("height","265px");
			    $('#active_dd').css("width","300px");
			}
			var adOpenImg = $('#active_dd_left_open');
			var duh = new String($(this).parent().attr('id'));
			var minTop = $('.program_group').offset().top - $('.studyareas').offset().top;
			var spacerHeight = 0;
			var isAlreadyActive = 0;
			if( top < minTop ){
				top = minTop;
			}
			
			
			
			duh = 'd' + duh.substring(1, duh.length);
			duh.replace('t','d');
			if( $('#'+duh).hasClass('active_dd_contect') ){
				//isAlreadyActive = 1;
			}
			$('.active_dd_contect').removeClass('active_dd_contect');
			$('#'+duh).addClass('active_dd_contect');
			//ad.html($('#'+duh+' .active_dd_contect').html());
			ad.html($('#'+duh).html());
			
			// if not repeated click, move box
			if( isAlreadyActive == 0 ){
				ad.css('top',top + 'px');
				ad.css('display','block');
			}
			
			
			
			topForLink =  getOffsetTop(this);
			topForBox = getOffsetTop(document.getElementById('active_dd'));
			
			// generic location for box image opening
			topForImg = top + topForLink - topForBox - 3;
			// fixes per browser
			if( navigator.userAgent.indexOf('MSIE') >= 0 ){
				topForImg += 3;
			}
			
			else if( navigator.userAgent.indexOf('Firefox') >= 0 ){
				
				if( $('.studyareas ul li dl:even:visible').length == 0 ){
			
				topForImg += 1;
				}			
			}
			else if( navigator.userAgent.indexOf('Safari') >= 0 ){
				topForImg -= 1;
			}
			
			// if not repeated click, move box opening image
			if( isAlreadyActive == 0 ){
			
				adOpenImg.css('top', topForImg + 'px');
				adOpenImg.css('display','block');
			}
			
			$('dl a.active').removeClass('active');
			$(this).addClass('active');
			activeObj = this;
			
			
			$(this).blur();
			event.stopPropagation();
			
			//$('.studyareas').attr('id', 'studyareas_container');
			// adjust spacer for then box is lower than container
			if(document.getElementById('studyareas_desc') != null)
			    spacerHeight = ad.height() + top - document.getElementById('studyareas_desc').offsetHeight;
			
			adjustSpacer( spacerHeight );
			
			
			
		});
});