if( typeof(_ohana) == 'undefined' || (_ohana && _ohana.session && !_ohana.session.full_admin) ) $(document).ready(function(){
	
	var dl = [{"class":'textLarge', "title":'Enlarge text +3', "text":'Larger Text', "func":function(){
		$('div.ohana-content').addClass('sized3').removeClass('sized1 sized2');
		var pr = $(this).parent();
		pr.siblings().removeClass('active');
		pr.addClass('active');
	}}, {"class":'textMedium', "title":'Enlarge text +2', "text":'Larger Text', "func":function(){
		$('div.ohana-content').addClass('sized2').removeClass('sized1 sized3');
		var pr = $(this).parent();
		pr.siblings().removeClass('active');
		pr.addClass('active');
	}}, {"class":'textSmall', "title":'Enlarge text +1', "text":'Larger Text', "func":function(){
		$('div.ohana-content').addClass('sized1').removeClass('sized2 sized3');
		var pr = $(this).parent();
		pr.siblings().removeClass('active');
		pr.addClass('active');
	}}, {"class":'reload', "title":'Reset text size', "text":'Reset', "func":function(){
		$('div.ohana-content').removeClass('sized1 sized2 sized3');
		var pr = $(this).parent();
		pr.siblings().removeClass('active');
	}}, {"class":'print', "title":'Print content of this page', "text":'Print', "func":function(){
		if( $('div.ohana-content').length > 0 ) window.open( window.location.href + ( (window.location.href).indexOf('?') > -1 ? '&' : '?' ) + 'templateMode=print', 'printerFriendly' );
		else window.print();
	}}, {"class":'email', "title":'Email link to this page', "text":'Email', "func":function(){
		var e = prompt('Please enter the email address to send this page');
		if( e && ( e.indexOf('@') == -1 || e.indexOf('.') == -1) ) alert('The email you entered is not valid. Please enter a different email address');
		else if( e ){
			var tt = $.trim( $('title').html() );
			if( tt == '' ) tt = 'Ohana';
			$.post('/' + (window.location.pathname).split('/')[1] + '/_components/applications.cfc?method=remoteEmail', {
				to : e, 
				subject : 'Link Back to ' + tt, 
				message : 'You have requested a link back to ' + tt + '<br /><br /><a href="' + window.location.href + '">' + window.location.href + '</a>'
			}, function(){
				alert('Your email has been sent');
			});
		}
	}}];
	
	var ul = $(document.createElement('ul'));
	for( var l = 0; l < dl.length; l++ ) ul.append(
		$(document.createElement('li')).addClass( dl[l]['class'] ).append(
			$(document.createElement('a')).attr('title', dl[l]['title'] ).append(
				$(document.createElement('span')).html( dl[l]['text'] )
			).click( dl[l]['func'] )
		)
	);
	
	$('body').append( $(document.createElement('div')).addClass('ohana-disgronifier').append( ul ).append( $(document.createElement('div')).addClass('clear') ) );

});