$(document).ready(function(){
		
	// For aligned images
	/*$('img[align=right]').addClass('float-right');
	$('img[align=left]').addClass('float-left');	

	// Property module tabs
	$('#tab_nav').show();
	$("#property_tabs").tabs();

	// Adds an icon and title for links that open in a new window
	$('p a[target=_blank]').attr('title', 'Opens in a new window').addClass('newindow');
	
	// Gallery Plugin
	//$("a[rel=image_gallery]").fancybox({
		//'transitionIn'		: 'elastic',
		//'transitionOut'		: 'elastic',
		//'titlePosition' 	: 'inside',
		//'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			//return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		//}
	//});
	
	//$("a.lightbox").fancybox({
		//'titleShow'		: false,
		//'transitionIn'	: 'elastic',
		//'transitionOut'	: 'elastic'
	//});

	// Quicklinks
	quicklinkgo();
	
	// Default slideshow - for opts see http://jquery.malsup.com/cycle/options.html
	//$(".slider").v1Slider();
	
	///////////////// DO NOT EDIT BELOW THIS POINT /////////////////////
	
	//media file transcripts
	$(".mediaFileTranscript").hide();
	$(".toggleTranscriptView").click(function (ev) {
		ev.preventDefault();
		$(this).parent().next(".mediaFileTranscript").slideToggle(300);
	});
	
	/*for personalisation*/
	Personalise = new personalise();
	Personalise.initfrontend("#perstodofrontph","#persfavfrontph","framework/personalise/personalisehandlerforfront.cfm");

	//Staff directory initialisation
	if (typeof StaffDirectory !== "undefined") {
		StaffDirectory = new StaffDirectory("<cfoutput>#variables.openTreeImage#</cfoutput>", "<cfoutput>#variables.closedTreeImage#</cfoutput>");
		StaffDirectory.init();
		
		//switcher for locations drop down
		$('.showLoc').click(function(){
			$('#location_div').toggle();
		});
	}
	
	//IPM initialisation
	if (typeof IPMController !== "undefined") {
		try {
			FieldManager = new fieldManager({
				handler: 'fieldManagerHandler.cfm',
				frontEndMode: true
			});
			IPM = new IPMController({
				handler: 'IPMHandler.cfm',
				parentDivId: '#IPMTemplate',
				frontEndMode: true
			});
			IPM.init();
		} catch (e) {
			alert(e.message);
		}
	}
	
	//Rounded corners for crippled browsers
	$('ol.menu li a').corner("round 14px");
	$('ol.quicklinks li a').corner("round 14px");
	$('ol.sidemenu-include-parent li a').corner("round 14px");
	
	$('[name=s]').focus(function(){
		$(this).val('');
	})
});	

/*function quicklinkgo(){
	var btn = document.getElementById('quicklinks_go');
	if(!btn)
		return false;
	btn.style.display='none';//hide the button

	btn = document.getElementById('quicklinks_select');
	if(btn)btn.onchange=function(){this.parentNode.submit();}
}

//Targets the HTML5 Placeholder element in form inputs and provides a fallback for crippled browsers
//Taken from http://www.cssnewbie.com/cross-browser-support-for-html5-placeholder-text-in-forms/
$(function() {
	if(!$.support.placeholder) { 
		var active = document.activeElement;
		$(':text').focus(function () {
			if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
				$(this).val('').removeClass('hasPlaceholder');
			}
		}).blur(function () {
			if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
				$(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
			}
		});
		$(':text').blur();
		$(active).focus();
		$('form').submit(function () {
			$(this).find('.hasPlaceholder').each(function() { $(this).val(''); });
		});
	}
});*/

