$(document).ready(function ()
{

	var oActiveTab = $("#RelatedNav li a.active");
	var selectString = oActiveTab.attr("href");
	$(selectString).show();
							
	$('.col-02').hover(
		function()
		{
			$(this).css({ 'z-index':20 });
		},
		function()
		{
			$(this).css({ 'z-index':0 });
		}
	);
	
	highlighting.init();


});

var currentFormElem = null;
var showHideValue = function(obj,val)
{
	if (obj != currentFormElem)
	{
		currentFormElem = obj;
		if (obj.value == val)
			obj.value = '';
			
		obj.onblur = function()
		{
			showHideValue(obj,val);
		}
	}
	else
	{
		if (obj.value == '')
			obj.value = val;
		
		obj.onblur = null;
		
		currentFormElem = null;
	}
};

var highlighting = {
	
	iMaxWidth : 0,
	
	iLineCount : 0,
	
	init : function() {
		
		$('.entry-box-text pre ol li').hover(function() {
			$(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		});		
		
		$('.entry-box-text pre').hover(function() {
			highlighting.iMaxWidth = 0;
			highlighting.iLineCount = 0;
			$(this).find('li').each(function()
			{
				$(this).css({ position : 'absolute' });
				highlighting.iMaxWidth = $(this).width() > highlighting.iMaxWidth ? $(this).width() : highlighting.iMaxWidth;
				$(this).css({ position : 'static' });
				
				if (document.all && !window.opera && !window.XMLHttpRequest)
				{
					highlighting.iLineCount += 1;
					$(this).attr('value',highlighting.iLineCount);
				}
			});
			
			if (highlighting.iMaxWidth <= 760)
			{
				highlighting.iMaxWidth = 760;
			}
			
			$(this).find('li').css('width', highlighting.iMaxWidth + 'px');
			$(this).css('width', '797px');
			$(this).children('ol').css('width', '767px');
			
			if (highlighting.iMaxWidth > 760)
			{
				$(this).children('ol').css('overflow-x', 'scroll');
			}
			
		}, function() {
			$(this).children('ol').css('width', '410px');
			$(this).children('ol').css('overflow-x', 'hidden');
			if (document.all && !window.opera && !window.XMLHttpRequest)
			{
				$(this).css('width', '440px');
			}
			else
			{
				$(this).css('width', 'auto');
			}
			$(this).find('li').removeClass('hover');
		})
		
		
	}
	
}

