/*** Lava Utilities*/(function($) {	$.extend({		lava:{			vars:{ autoGoogleMapStarted:false,				   autoGoogleMapTags:undefined },			utils:{				urlEncode:function(s) {					return encodeURIComponent(s).replace(/\%20/g, '+').replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/\~/g, '%7E');				},				urlDecode:function(s) {					return decodeURIComponent(s.replace(/\+/g, '%20').replace(/\%21/g, '!').replace(/\%27/g, "'").replace(/\%28/g, '(').replace(/\%29/g, ')').replace(/\%2A/g, '*').replace(/\%7E/g, '~'));				},				navigateTo:function(p_url) {					window.location = p_url;				},				refresh:function() {					window.location.reload(true);				},				autoGoogleMap:function(p_mapTags) {					if(p_mapTags == undefined) p_mapTags = '.google_map';					if($(p_mapTags).length > 0) {						$.lava.vars.autoGoogleMapTags = p_mapTags;						var l_scriptURL = 'http://maps.google.com/maps/api/js?sensor=false&callback=$.lava.utils.autoGoogleMapEmbed',							l_script = '<script type="text/javascript" src="' + l_scriptURL + '"></script>';						$('body').append(l_script);					}				},				autoGoogleMapEmbed:function() {					var	l_defaults = { zoom:'14', type:'ROADMAP', lat:'-37.813187', lng:'144.96298' },						l_parameters,						l_settings,						l_map,						l_jSpan;					$($.lava.vars.autoGoogleMapTags).each(function() {						// retrieve parameters embedded in the page						l_parameters = {};						$(this).find('span').each(function() {							l_jSpan = $(this);							if(l_jSpan.attr('class') != '') {								l_parameters[l_jSpan.attr('class')] = l_jSpan.text();							}							l_jSpan.remove();						});						l_parameters = jQuery.extend(l_defaults, l_parameters);						// create the settings object						l_settings = { };						l_settings.zoom = parseInt(l_parameters.zoom);						l_settings.center = new google.maps.LatLng(l_parameters.lat, l_parameters.lng);						l_settings.mapTypeId = google.maps.MapTypeId[l_parameters.type.toUpperCase()];						// create the map						l_map = new google.maps.Map($(this)[0], l_settings);						// make the item visible						$(this).removeClass('invisible');						// set markers (#needs to be converted)						/*var bounds = new google.maps.LatLngBounds();						for(i = 0; i < markers.length; i ++) {							var marker = markers[i];							var position = new google.maps.LatLng(marker.lat, marker.lng);							bounds.extend(position);							var marker = new google.maps.Marker({								position: position,								map: map,								icon: "/images/markers/" + marker.letter + ".png"							});						}						map.setZoom(12);						map.fitBounds(bounds);*/					});				/*var bounds = new google.maps.LatLngBounds();					for(i = 0; i < markers.length; i ++) {						var marker = markers[i];						var position = new google.maps.LatLng(marker.lat, marker.lng);						bounds.extend(position);						var marker = new google.maps.Marker({							position: position,							map: map,							icon: "/images/markers/" + marker.letter + ".png"						});					}					map.setZoom(12);					map.fitBounds(bounds);*/				},				//embedAudio:function() {				//},				embedVideo:function(p_divID, p_width, p_height, p_video, p_image, p_autoPlay) {					if(p_autoPlay == undefined) p_autoPlay = "false";					var l_flashvars = {},						l_params = {},						l_attributes = {},						l_stageW = p_width,						l_stageH = p_height + 26;					l_params.scale						= "noscale";					l_params.allowfullscreen			= "true";					l_params.salign						= "tl";					l_params.bgcolor					= "000000";					l_flashvars.imagePath				= p_image;					l_flashvars.videoPath				= p_video;					l_flashvars.title					= "Welcome from the Director";					l_flashvars.description				= "An introduction to the ANZSOG Institute for Governance by Professor Mark Evans.";					l_flashvars.viewInfoButton			= "false";					l_flashvars.viewFullscreenButton 	= "false";					l_flashvars.viewScaleButton 		= "false";					l_flashvars.viewVolumeControls		= "true";					l_flashvars.viewTime				= "true";					l_flashvars.viewBigPlayButton		= "true";					l_flashvars.viewRightClickMenu		= "false";					l_flashvars.mouseHide				= "true";					l_flashvars.mouseHideTime			= "3";					l_flashvars.doubleClick				= "true";					l_flashvars.oneClick				= "true";					l_flashvars.spaceKey				= "true";					l_flashvars.videoLoop				= "false";					l_flashvars.videoAutoPlay			= p_autoPlay;					l_flashvars.videoBufferTime			= "0.1";					l_flashvars.tlInterval				= "100000";					l_flashvars.soundVolume				= "0.8";					l_flashvars.fullSizeView			= "1";					l_flashvars.spacing					= "10";					l_flashvars.controlHeight			= "25";					l_flashvars.volumeLengthW			= "50";					l_flashvars.color1					= "0x2e2e2e";	// controls background					l_flashvars.color2					= "0x000000";					l_flashvars.alpha1					= "1";					l_flashvars.alpha2					= "1";					l_flashvars.borderColor				= "0x555555";	// controls border					l_flashvars.borderAlpha				= "1";					l_flashvars.timeColor1				= "0x333333";					l_flashvars.timeColor2				= "0x111111";					l_flashvars.timeAlpha1				= "1";					l_flashvars.timeAlpha2				= "1";					l_flashvars.timeTextColor1			= "0xffffff";					l_flashvars.timeTextColor2			= "0x888888";					l_flashvars.scrubberHeight			= "3";					l_flashvars.scrubberColor1			= "0x333333";					l_flashvars.scrubberAlpha1			= "1";					l_flashvars.scrubberColor2			= "0x47d2ff";					l_flashvars.scrubberAlpha2			= "1";					l_flashvars.filterColor				= "0x0066ff";					l_flashvars.filterAlpha				= "1";					//l_flashvars.buttonColor			=  "0x000000";					l_flashvars.titleColor				= "0x47d2ff";	// info view colors					l_flashvars.descriptionColor		= "0xD3D3D3";					l_flashvars.infoBackgroundColor		= "0x000000";					l_flashvars.infoBackgroundAlpha		= "0.5";					// embed the video player					swfobject.embedSWF("/media/swf/videoplayer.swf", p_divID, l_stageW, l_stageH, "9.0.0", false, l_flashvars, l_params, l_attributes);				},				trimSpaces:function(p_string) {					return p_string.replace(/\s\s+/g, ' ');				},				trimCommas:function(p_string,p_collapse,p_addspace) {					p_string = p_string.replace(/[,\s]*,[,\s]*/g, ",").replace(/^,/, "").replace(/,$/, "");					if (p_collapse) p_string = p_string.replace(/[\s]+/, " ");					if (p_addspace) p_string = p_string.replace(/,/g, ", ");					return $.trim(p_string);				},				cleanCreditCard:function(p_jField) {					var l_jField = $(p_jField);					l_jField.val(l_jField.val().split(' ').join('').split('-').join(''));				},				setupFormSubmit:function(p_jForm, p_callback, p_noEnterHandler) {					var l_jButton = $('.button.submit', p_jForm),						l_return = false,						l_func = function() {							l_return = false;							if(p_callback) {								if(p_jForm.valid) {									if(p_jForm.valid()) {										l_return = p_callback();										p_jForm.submit();									}								} else {									l_return = p_callback();									p_jForm.submit();								}							} else {								l_return = true;								if($('input, textarea, select', p_jForm).length > 0) p_jForm.submit();							}						};					l_jButton.bind('click', l_func);					if(!p_noEnterHandler) $('input', p_jForm).clickOnEnter(l_func);					p_jForm.submit(function() { return l_return; });				},				disableFormSubmit:function(form) {					$('.button.submit', $(form)).addClass('disabled').unbind('click');					form.submit();				},				getFormData:function(p_jForm) {					var l_data = {},						l_jThis;					p_jForm.find('input:visible, textarea:visible, select:visible, input[type="hidden"]').each(function() {						l_jThis = $(this);						l_data[l_jThis.attr('name')] = l_jThis.val();					});					return l_data;				}			},			validators:{				ck:function() {					$.validator.addMethod("ck", function(value, element, parameter) {						var l_ckInstance = (CKEDITOR.instances[$(element).attr('id')]),							l_valid = (l_ckInstance.getData() != ""),							l_jCkContainer = $(l_ckInstance.container.$); // final $ is a property, don't delete						l_jCkContainer.removeClass('error');						if(!l_valid) l_jCkContainer.addClass('error');						return l_valid;					}, "Please enter a value");				},				corporatedomainmatch:function() {					$.validator.addMethod("corporatedomainmatch", function(value, element) {						var l_memberType = $('#join_membertype').val();						if(l_memberType == 'corporate_small' || l_memberType == 'corporate_large') {							var l_domain = $('#join_domain').val(),								l_email = $('#join_email').val();							if(l_email == '' || l_email.indexOf('@') == -1) return false;							var l_emailDomain = l_email.split('@')[1];							if(l_emailDomain != l_domain) return false;						}						return true;					}, "Must end in the same domain as specified above");				},				creditcardfix:function() {					$.validator.addMethod("creditcardfix", function(value, element, p_required) {						if(!p_required) return true;						var l_ccString = value.split(' ').join('').split('-').join('');						element.value = l_ccString;						if(l_ccString == '') return false;						return $.validator.methods.creditcard(l_ccString);					}, "Please enter a valid credit card number");				}			}		}	});})(jQuery);/*** ANZSOG Namespace*/(function($) {	$.extend({		anzsog:{			pages:{},			validators:{},			shared:{				buttons:{				},				funcs:{				}			}		}	});})(jQuery);/* * Pages */$.anzsog.pages.page_index = {	init:function() {		var l_jUpcomingBox = $('#featured .box .box_inner'),			l_jUpcomingItems = $('.upcoming_item', l_jUpcomingBox),			l_index = 1,			l_count = l_jUpcomingItems.length,			l_controls = '',			l_timerID;		// build the controls		for(var i = 0; i<l_count; i++) {			l_controls += '<a href="#item_' + (i+1) + '" title="View upcoming item ' + (i+1) + '"></a>';		}		l_jUpcomingBox.append('<div class="controls">' + l_controls + '</div>');		var l_jControls = $('.controls a');		l_jControls.first().addClass('selected');		l_jControls.click(function() {			l_jControls.removeClass('selected');			$(this).addClass('selected');			l_showItem($(this).attr('href').split('_')[1]);			return false;		});		// show a particular item		var l_showItem = function(p_item) {						// wrap and record the index			p_item = parseInt(p_item);			if(p_item > l_count) p_item = 1;			if(p_item < 0) p_item = l_count - 1;			l_index = p_item;			// clear the timer			l_clearTimer();			// show the item			l_jUpcomingItems.filter(':visible').fadeOut(400, function() {				l_jUpcomingItems.filter(':nth-child(' + p_item + ')').fadeIn();			});			if(!l_jControls.filter(':nth-child(' + p_item + ')').is('.selected')) {				l_jControls.removeClass('selected');				l_jControls.filter(':nth-child(' + p_item + ')').addClass('selected');			}		}		// show the next item		var l_showNextItem = function() {			l_showItem(l_index + 1);			l_restartTimer();		}		// auto progress (with pause during hover)		var l_clearTimer = function() { if(l_timerID) { clearTimeout(l_timerID); l_timerID = null; } }		var l_restartTimer = function() { l_timerID = setTimeout(l_showNextItem, 7000); }		l_restartTimer();		l_jUpcomingBox.hover(l_clearTimer, l_restartTimer);	}}$.anzsog.pages.page_about_us_contact = {	init:function() {		// setup the contact form		var l_jForm = $("#form_contact");		$.anzsog.validators.form_contact = l_jForm.validate({			rules: {				"firstname":{required:true},				"organisation":{required:true},				"email":{required:true,email:true},				"regarding":{required:true},				"referral":{required:true},				"message":{required:true}			},			messages: {				"firstname":{required: "Enter your first name"},				"organisation":{required: "Enter your organisation"},				"email":{required: "Enter your email address",email:"Enter a valid email address"},				"regarding":{required: "Select what your comment is regarding"},				"referral":{required: "Enter how you heard about us"},				"message":{required: "Enter your comment"}			},			submitHandler:$.lava.utils.disableFormSubmit		});		$.lava.utils.setupFormSubmit(l_jForm);	}}$.anzsog.pages.blog = {	init:function() {		// setup the blog twitter feed		$("#twitter_widget_embed").tweet({            username: "anzsog",            count: 3,            //loading_text: "loading tweets...",			template: "{text}{time}"        });		// setup the blog comment form		var l_jForm = $('body.blog #comments form');		if(l_jForm.length > 0) {			$.anzsog.validators.form_comment = l_jForm.validate({				rules: {					"name":{required:true},					"comment":{required:true}				},				messages: {					"name":{required: "Enter your name"},					"comment":{required: "Enter your comment"}				},				submitHandler:$.lava.utils.disableFormSubmit			});			$.lava.utils.setupFormSubmit(l_jForm);		}	}}$.anzsog.pages.events_calendar = {	init:function() {			$('#event_category').change(function() {			var l_location = window.location.pathname,				l_eventString = '/events/events-calendar',				l_parametersString = l_location.substr(l_eventString.length),				l_parameters = [];			if(l_parametersString.indexOf('/') === 0) l_parametersString = l_parametersString.substr(1);			if(l_parametersString) l_parameters = l_parametersString.split('/');			if($(this).val() == '') {				// return to showing all categories for the currently selected date				if(l_parameters[0] > 2000) {					$.lava.utils.navigateTo(l_eventString + '/' + l_parameters[0] + '/' + l_parameters[1]);				// return to showing all categories (for upcoming dates)				} else {					$.lava.utils.navigateTo('/events/events-calendar');				}			} else {				// no category or date specified				if(l_parameters.length == 0) {					$.lava.utils.navigateTo(l_location + '/' + $(this).val());				// a date has been specified				} else if(l_parameters[0] > 2000) {					if(l_parameters.length == 2) $.lava.utils.navigateTo(l_location + '/' + $(this).val());					else $.lava.utils.navigateTo(l_eventString + '/' + l_parameters[0] + '/' + l_parameters[1] + '/' + $(this).val());				// a category is already selected				} else {					$.lava.utils.navigateTo(l_eventString + '/' + $(this).val());				}			}		});		$('#form_event').submit(function() { return false; });		var l_jSearchInput = $('#event_keyword');		l_jSearchInput.clickOnEnter(function() {			var l_string = l_jSearchInput.val();			if(l_string == '') return false;			$.lava.utils.navigateTo('?keyword=' + $.lava.utils.urlEncode(l_string));			return false;		});		// ensure the sidebar is the same height as the content		var l_jSidebar = $('#event_sidebar'),			l_jEventsList = $('#content .events_list, #content .event_content'),			l_sidebarHeight = l_jSidebar.innerHeight(),			l_contentHeight = l_jEventsList.innerHeight();			if(l_sidebarHeight < l_contentHeight) l_jSidebar.css('min-height', (l_contentHeight - 45) + 'px');			else l_jEventsList.css('min-height', (l_sidebarHeight - 30) + 'px');	}}$.anzsog.pages.multimedia_gallery = {	init:function() {		$('#gallery_type').change(function() {			var l_location = window.location.pathname,				l_eventString = '/about-us/media-centre/multimedia-gallery',				l_parametersString = l_location.substr(l_eventString.length),				l_parameters = [];			if(l_parametersString.indexOf('/') === 0) l_parametersString = l_parametersString.substr(1);			if(l_parametersString) l_parameters = l_parametersString.split('/');			if($(this).val() == '') {				if(l_parameters.length > 1) {					$.lava.utils.navigateTo(l_eventString + '/' + l_parameters[0] + '/' + l_parameters[1]);				} else {					$.lava.utils.navigateTo(l_eventString);				}			} else {				// an album is already selected				if(l_parameters.length > 1) {					$.lava.utils.navigateTo(l_eventString + '/' + l_parameters[0] + '/' + l_parameters[1] + '/' + $(this).val());				} else {					$.lava.utils.navigateTo(l_eventString + '/' + $(this).val());				}			}		});	}}$.anzsog.pages.page_subscribe = {	init:function() {		// setup the subscribe form		var l_jForm = $("#form_subscribe");		if(l_jForm.length > 0) {			$.anzsog.validators.form_subscribe = l_jForm.validate({				rules: {					"firstname":{required:true},					"lastname":{required:true},					"email":{required:true, email:true}				},				messages: {					"firstname":{required: "Enter your first name"},					"lastname":{required: "Enter your last name"},					"email":{required: "Enter your email address", email:"Enter a valid email address"}				},				submitHandler:$.lava.utils.disableFormSubmit			});			$.lava.utils.setupFormSubmit(l_jForm);		}	}}$.anzsog.pages.page_programs_executive_master_of_public_administration_faq = {	init:function() {		$('.faq_category h3').click(function() {			var l_jDivs = $(this).siblings('.faq_entry'),				l_visible = !l_jDivs.is(':visible');			l_jDivs.toggle(l_visible);			if(l_visible) $(this).parent().addClass('expanded').removeClass('collapsed');			else $(this).parent().addClass('collapsed').removeClass('expanded');		}).siblings('.faq_entry').hide().parent().addClass('collapsed');		// setup expand/collapse		$('.faq_entry h3, .faq_entry h4').click(function() {			var l_jDiv = $(this).next('div');			l_jDiv.toggle(!l_jDiv.is(':visible'));		}).next('div').hide();		// auto expand based on anchor		//var l_hash = document.location.hash.substring(1);		//$.log(l_hash);		//$('#' + document.location.hash.substring(1)).click();	}}$.anzsog.pages.dropdownmenu = {	init:function() {				// create a dropdown menu holder just inside the body		$('body').append('<div id="dropdown_holder"><div id="dropdown_overflow"><div id="dropdown_panels"></div></div></div>');		// modify and move each menu item into drop down menu holder		var l_jDropDownHolder = $('#dropdown_panels'),			l_panelCount = 0;		$('#menu').children('.group').each(function() {			l_panelCount++;			$(this).wrap('<div id="panel_' + l_panelCount + '" class="dropdown_panel" />').show().find('.group');			l_jDropDownHolder.append($(this).parent().prepend($(this).children('.title')));		});		// set the height of each dropdown panel & hide everything		var l_maxHeight = 0,			l_outerHeight = 0;		$('.dropdown_panel', l_jDropDownHolder).each(function() {			// determine and set the maximum height of this panel			l_maxHeight = 0;			$('.group', $(this)).each(function() {				l_outerHeight = $(this).outerHeight();				if(l_outerHeight > l_maxHeight) l_maxHeight = l_outerHeight;			});			$(this).height(l_maxHeight).hide();			// activate all links within the panel			$('a', $(this)).mouseover(function() {				var l_jParent = $(this).parent(),					l_jNext = $(this).next();				$('.group', l_jParent).css('visibility', 'hidden');				$('a', l_jParent).removeClass('hover');				if(l_jNext.is('.group')) {					$(this).addClass('hover');					l_jNext.css('visibility', 'visible').hide().fadeIn();				}			});		});		// show/hide each dropdown panel on rollover		var l_hoverDelayTimeout;		$('#menu').children('a').mouseover(function() {			if($(this).is('.hover')) return;			var l_jMenuTab = $(this),				l_jClass = $.lava.utils.trimSpaces(l_jMenuTab.attr('class')).split(' ')[0],				l_jDropDown = $('.' + l_jClass, l_jDropDownHolder).parent(),				l_id = l_jDropDown.attr('id');			// destroy previous hover delays			clearTimeout(l_hoverDelayTimeout);			// hide all previous dropdown panels			$('.dropdown_panel', l_jDropDownHolder).hide();			// reset the panel			$('#menu').children('a').removeClass('hover');			$('body').unbind('mouseover');			l_jDropDown.stop(true, true).hide();			l_jDropDownHolder.stop(true, true).hide();			$('a', l_jDropDown).removeClass('hover');			// the dropdown exists			if(l_jDropDown.length > 0) {				// hide the sub links (previously rolled over items)				$('.dropdown_panel .group .group', l_jDropDownHolder).css('visibility', 'hidden');				// show any submenus which have already been selected				$('a.selected', l_jDropDown).each(function() {					var l_jParent = $(this).parent(),						l_jNext = $(this).next();					$('.group', l_jParent).css('visibility', 'hidden');					$('a', l_jParent).removeClass('hover');					if(l_jNext.is('.group')) {						l_jNext.css('visibility', 'visible').hide().fadeIn();					}				});				// add the hover class				l_jMenuTab.addClass('hover');				// create a new hover delay				// delays slightly before showing the dropdown				l_hoverDelayTimeout = setTimeout(function() {					l_jDropDown.stop(true, true).fadeIn();					l_jDropDownHolder.stop(true, true).slideDown();				}, 200);				// listen for the user moving outside of the dropdown				$('body').mouseover(function(e) {					var l_jTarget = $(e.target)					if(l_jTarget[0] != l_jMenuTab[0] && l_jTarget.parents('#dropdown_holder').length == 0) {						clearTimeout(l_hoverDelayTimeout);						$('body').unbind('mouseover');						l_jDropDown.stop(true, true).hide();						l_jDropDownHolder.stop(true, true).hide();						l_jMenuTab.removeClass('hover');					}				});			}		});		// hide the main drop down holder		l_jDropDownHolder.hide();	}}/** Initialise ANZSOG*/$(window).load(function() {	// initialise the dropdown menu	$.anzsog.pages.dropdownmenu.init();	// activate sidebar expand/collapse	$('#sidebar a.has_children').each(function() {		if($(this).next().is('.group') && $(this).next().children().length > 0) {			$(this).click(function() {				if(!$(this).is('.selected')) {					if($(this).is('.open')) $(this).removeClass('open').next().slideUp();					else $(this).addClass('open').next().slideDown();				}				return false;			});		} else {			$(this).next().remove();			$(this).removeClass('has_children');		}	});	$('#sidebar a.has_children.selected').addClass('open').next().show();	if($('body.blog').length > 0) $.anzsog.pages.blog.init();	if($('body.events_calendar').length > 0) $.anzsog.pages.events_calendar.init();	if($('body.multimedia_gallery').length > 0) $.anzsog.pages.multimedia_gallery.init();	// activate the gallery specific code	if($('.media_list').length > 0) $("a[rel^='prettyPhoto']").prettyPhoto({ social_tools:'',																			 default_width:450,			// inline default width																			 default_height:450,		// inline default height																			 default_width_video:800,   // video default width																			 default_height_video:450,  // video default width																			 overlay_gallery:false});		// setup input hints	$('input.hint').inputHint();	// setup togglers	$('.toggler').toggler();	// create the search box	var l_jSearchInput = $('#header #search .search_input');	l_jSearchInput.clickOnEnter(function() {		var l_string = l_jSearchInput.val();		if(l_string == '') return false;		$.lava.utils.navigateTo('/search/' + $.lava.utils.urlEncode(l_string));	});	// execute the appropriate page code	var l_pageName = $('body').attr('id'),		l_pageObject = $.anzsog.pages[l_pageName];	if(l_pageObject) l_pageObject.init();	//else $.log('Missing: ' + l_pageName, 'error');});
