	// Placeholder Homepage Tabs
		var panel = document.getElementById("panel-1");
		
		if (panel) {
		
			panel.style.display="block";
	
			function showPanel1(panelID, tabID, pageID){
				document.getElementById("tab-link-1").className="";
				document.getElementById("tab-link-2").className="";
				document.getElementById("tab-link-3").className="";
				document.getElementById("panel-1").style.display="none";
				document.getElementById("panel-2").style.display="none";
				document.getElementById("panel-3").style.display="none";
				document.getElementById(panelID).style.display="block";
				document.getElementById(tabID).className="currentTab";
				document.getElementById(pageID).className="currentPage";
			}
			
		}     
       	
$(document).ready(function(){
	$("#sortable").sortable();
	$("#sortable").disableSelection();

});	

$(function() {
	$('.datepickerclass').datepicker({dateFormat: 'yy-mm-dd'});

	try{
	PersonaliseforModules = new personaliseformodules("../framework/personalise/personalisehandler.cfm");}catch(e){}
});


$(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({
		fx: "scrollHorz"
	});
	
	//Staff directory tree images
	var treeClosed = "images/arrow_blue_horiz.png";
	var treeOpen = "images/arrow_blue_down.png";
	
	///////////////// CMS specific code below /////////////////////
	
	// Search filter
	$(".searchAllModules").click(function (ev) {
		ev.preventDefault();
		var $this = $(this),
			check = true;
		if ($this.text() == "Select all") 
			$this.text("Deselect all");
		else {
			$this.text("Select all");
			check = false;
		}
		$this.nextAll("input[type=checkbox]").each(function () {
			if (check) this.checked = true;
			else this.checked = false;
		});
	}).nextAll("input[type=checkbox]").each( function () {
		if (this.checked) {
			$(".searchAllModules").text("Deselect all");
			return false; // break
		}
	});	
	
	//media file transcripts
	$(".mediaFileTranscript").hide();
	$(".toggleTranscriptView").click(function (ev) {
		ev.preventDefault();
		$(this).parent().next(".mediaFileTranscript").slideToggle(300);
	});
	
	/*for personalisation*/
	try{
	Personalise = new personalise();
	Personalise.initfrontend("#perstodofrontph","#persfavfrontph","framework/personalise/personalisehandlerforfront.cfm");
	}catch(e){}
	
	
	//Staff directory initialisation
	if (typeof StaffDirectory !== "undefined") {
		StaffDirectory = new StaffDirectory(treeOpen, treeClosed);
		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);
		}
	}
	
	//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/
	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'))) {
				/*commented out because its breaking at the moment.
				$(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');*/
			}
		});
		$(':text').blur();
		$(active).focus();
		$('form').submit(function () {
			$(this).find('.hasPlaceholder').each(function() { $(this).val(''); });
		});
	}
	
		//Rounded corners for IE
    $('ol#top_nav > li > a').corner("round 9px");
    $('.sidemenu > h2').corner("round 9px");
    $('.ph-inner > h2').corner("round 9px");
    $('#detached_menu_quicklinks > h2').corner("round 9px"); 
    $('.tabNavigation > li.tab-1').corner( "top");
    $('.tabNavigation > li.tab-3').corner( "bottom");

});	

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();}
}
