window.onload = function(){

	$('.toc a').each(function(){
		if(this.href.split('#') == top.location.href.split('#')[0])
			$(this).addClass('selected');
		else
			$(this).removeClass('selected');
	})

	$('a.tips').each(function(){
		if(this.name == top.location.href.split('#')[1])
			$(this).addClass('selected');
		else
			$(this).removeClass('selected');
	})


	$('a.tips').cluetip({
		showTitle: false, 
		positionBy: 'bottomTop',
		sticky: true,
		width: 500,
		hoverIntent: {interval:600},
		closeText: '<img src="icons/cross.png" alt="" />',
		closePosition: 'bottom',
		activation: 'click',
		dropShadowSteps: 0,
		cluetipClass: 'jtip',
		fx: { open: 'slideDown', openSpeed: 100 }
	})
}

function toggle(elem){
	targetid = elem.id.replace('toggle', 'target')
	$('#' + targetid).toggle(150)
}
