var $tt = jQuery.noConflict();
$tt(document).ready(function(){
	// tooltip
	var $tool_cookie = 0;
	$tt('a.dictionary').tooltip({
	  track: true,
	  top:10,
	  left:-80,
	  delay: 0,
	  showURL: false,
	  bodyHandler: function(){
		$tt(this).css('cursor','progress');
		var $tooltip_id = $tt(this).attr('rel');
		if($tool_cookie == $tooltip_id){
		  $tt(this).css('cursor','help');
		  return '';
		}
		$tool_cookie = $tooltip_id;
		$tt('#tooltip').load($tooltip_id);
	    $tt(this).css('cursor','help');
		return '';
	  }
	});
	
	// colorbox handling
	$tt('a.modal').colorbox({
		close: '',
		width: '500',
    initialWidth: '420',
    opacity: '0.4',
    overlayClose: false,
    scrolling: false
  });
	$tt('a.modal_file').colorbox({
		close: '',
    initialWidth: '420',
    opacity: '0.4',
    overlayClose: false,
    scrolling: false
  });
	$tt('a.modal_scroll').colorbox({
		close: '',
		width: '500',
    height: '500',
    initialWidth: '420',
    opacity: '0.4',
    overlayClose: false,
    scrolling: true
  });
        $tt('#subscribe_modal_button a').colorbox({
		close: '',
		width: '452',
                initialWidth: '452',
                opacity: '0.4',
                overlayClose: false,
                scrolling: false
              });

	$tt().bind('cbox_complete',function(){
		$tt('#cboxClose').css('visibility','visible');
	});
	$tt().bind('cbox_closed',function(){
		$tt('#cboxClose').css('visibility','hidden');
	});
	
	$tt('.accordion').next().addClass('accordionItem');
	$tt('.accordion').css('cursor', 'pointer').click(function() {	  
		  if($tt(this).next().css('display')=='none') {
			$tt(this).toggleClass('open');
		    $tt(this).next().slideDown('fast');
		  }
		  else {
			$tt(this).next().slideUp('fast', function()
					{ $tt(this).prev().toggleClass('open'); });		
		  }
	  });
	
	// change modal links
	$tt('a.modal').each(function(){
		var $href = $tt(this).attr('href');
		$tt(this).attr('href', '/modal' + $href);
	});
	$tt('a.modal_file').each(function(){
		var $href = $tt(this).attr('href');
		$tt(this).attr('href', '/modal_file' + $href);
	});

  // stripe tables
  $tt('table.striped tr:even td').each(function(){
    $tt(this).css('background','#F5F1ED');
  });

  $tt('#fundtoggler').click(function(){
    $tt('#fundpersons').toggle();
return false;
  });
});
