if (typeof console == "undefined") {
	var console = { log: function() { } };
}
console.log(document.domain);

/*function emailCheck (emailStr, fieldRow) {alert('test'); divToDisplayMessage = fieldRow + '_im_error';divFieldRow = fieldRow + '_row';if ( emailStr == '' ) {	document.getElementById(divToDisplayMessage).innerHTML = "Email address requires a value";			document.getElementById(divFieldRow).style.backgroundColor="#F60";	return false;	}var checkTLD=1;var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;		var emailPat=/^(.+)@(.+)$/;		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";		var validChars="\[^\\s" + specialChars + "\]";		var quotedUser="(\"[^\"]*\")";		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;		var atom=validChars + '+';		var word="(" + atom + "|" + quotedUser + ")";		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");		var matchArray=emailStr.match(emailPat);				if (matchArray==null) {			document.getElementById(divToDisplayMessage).innerHTML = "Email address seems incorrect (check @ and .'s)";			document.getElementById(divFieldRow).style.backgroundColor="#F60";			return false;		}		var user=matchArray[1];		var domain=matchArray[2];				for (i=0; i<user.length; i++) {			if (user.charCodeAt(i)>127) {				document.getElementById(divToDisplayMessage).innerHTML = "Ths username contains invalid characters.";				document.getElementById(divFieldRow).style.backgroundColor="#F60";				return false;			}		}		for (i=0; i<domain.length; i++) {			if (domain.charCodeAt(i)>127) {				document.getElementById(divToDisplayMessage).innerHTML = "Ths domain name contains invalid characters.";				document.getElementById(divFieldRow).style.backgroundColor="#F60";				return false;			}		}				if (user.match(userPat)==null) {			document.getElementById(divToDisplayMessage).innerHTML = "The username doesn't seem to be valid.";			document.getElementById(divFieldRow).style.backgroundColor="#F60";			return false;		}				var IPArray=domain.match(ipDomainPat);		if (IPArray!=null) {			for (var i=1;i<=4;i++) {				if (IPArray[i]>255) {				document.getElementById(divToDisplayMessage).innerHTML = "Destination IP address is invalid!";				document.getElementById(divFieldRow).style.backgroundColor="#F60";				return false;			}		}		return true;		}				var atomPat=new RegExp("^" + atom + "$");		var domArr=domain.split(".");		var len=domArr.length;		for (i=0;i<len;i++) {			if (domArr[i].search(atomPat)==-1) {				document.getElementById(divToDisplayMessage).innerHTML = "The domain name does not seem to be valid.";				document.getElementById(divFieldRow).style.backgroundColor="#F60";			return false;			}		}				if (checkTLD && domArr[domArr.length-1].length!=2 && 			domArr[domArr.length-1].search(knownDomsPat)==-1) {			document.getElementById(divToDisplayMessage).innerHTML = "The address must end in a well-known domain or two letter " + "country.";			document.getElementById(divFieldRow).style.backgroundColor="#F60"; return false;	}if (len<2){document.getElementById(divToDisplayMessage).innerHTML = "This address is missing a hostname!";		document.getElementById(divFieldRow).style.backgroundColor="#F60";		return false;		}			document.getElementById(divToDisplayMessage).innerHTML = "";		document.getElementById(divFieldRow).style.backgroundColor="#002740";		return true;	} */

function emailCheck2(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
 
      alert('Invalid Email Address');
      return false;
   }
}

/* legacy scripts */
var loadSWF = function(){
}

/* new site scripts */
function colorbox_video(src)  {
	var h = src; 
	var autoplay = true;
	var default_dimensions = 'width="648" height="360"';
	var autoStart = (autoplay ? 'true' : 'false');
	var fv = 'videoPath=' + h + '&autoStart=' + autoStart  + '&autoHide=true&hideLogo=true&volAudio=60' +
		'&disableMiddleButton=false&playSounds=true&soundBarColor=0x0066FF&barColor=0x0066FF&' +
		'barShadowColor=0x91BBFB&subbarColor=0xffffff&extendVideo=true'
	var ps = '/common/shared/flash-player/flvPlayer.swf';

	var flashvars = { };
	var params = {};
	params.allowNetworking = 'all';
	params.allowScriptAccess = 'true';
	flashvars.autoStart = autoStart;
	flashvars.autoHide = 'true';
	flashvars.hideLogo = 'true';
	flashvars.playSounds = 'true';
	flashvars.extendVideo = 'true';
	flashvars.volAudio = '60';
	flashvars.videoPath = h;
	var attributes = {};

	$.colorbox({html: '<div id="colorbox_video" style="width: 648px; height: 370px;"></div>'});
	swfobject.embedSWF(ps, "colorbox_video", "648", "360", "9.0.0", false, flashvars, params, attributes);

}

$(document).ready( function(){ 
		/*$('#secondary-menu li.expand, #secondary-menu li.contract').each(	function(){ $('> a', this).append('<div class="arrow"></div>'); }
		);

		var init_sub_menu = function(){
			$('#secondary-menu li').each(function(){
				$(this).append('<div class="bg-top"></div><div class="bg-hover"></div>');
			});
		}
		init_sub_menu();*/

		/* lord mayor xmas */
		/*(function(){
			if ($('a.xmas2011').length > 0){
				$('a.xmas2011').attr('href', '#');
				$('a.xmas2011').click(function(){
					colorbox_video('/assets/acc/Video/home/lord-mayor-xmas-2.flv');
					return false;
				});
			}
		})();*/



		/* parklands interactive map */
		(function(){
			if ($('body.pageid_8485').length > 0){
				$('map#parklands area').each(function(){
					var dr = $(this).attr('data-rel');
					console.log(dr);
					$(this).click(function(){
						console.log(dr);
						var e  = $('div.embed[data-rel="' + dr + '"]');				
						$.colorbox({ inline: true, href: e });
						return false;
					});
				});
			}
		})();

		/* development / beresford arms */
		(function(){
			var embed_vid = function(f){
				var ps = '/common/shared/flash-player/flvPlayer.swf';
				var default_dimensions = 'width="580" height="320"';
				var fv = 'videoPath=' + f + '&autoStart=true&autoHide=true&hideLogo=true&volAudio=60' +
					'&disableMiddleButton=false&playSounds=true&soundBarColor=0x0066FF&barColor=0x0066FF&' +
					'barShadowColor=0x91BBFB&subbarColor=0xffffff&extendVideo=true'
				var o = '<object class="flash-video" type="application/x-shockwave-flash" id="vid-id-flash-obj" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" align="left" ' + default_dimensions + '>' +
					'<param name="Movie" value="' + ps + '"/>' +
					'<param name="src" value="' + ps + '"/>' +
					'<param name="AllowNetworking" value="all"/>' +
					'<param name="AllowScriptAccess" value="always"/>' +
					'<param name="flashVars" value="' + fv + '"/>' +
					'<param name="wmode" value="transparent"/>' +
				'</object>';
				return o;
			}
			if ($('body.pageid_8175').length > 0){	
				if ($('.vid-group a').length > 0){	
					$('.vid-group').append('<div class="vid-wrap"></div>');
					var first = null;
					$('.vid-group a').each(function(){
						var h2 = $(this).attr('href');
						if (first == null) { first = h2; }
						$(this).attr('href', '#');
						$(this).click(function(){
							var o = embed_vid(h2);
							$('.vid-group .vid-wrap').html(o);
							console.log('video clicked');
							return false;
						});
					});
					if (first != null){
						var o = embed_vid(first);
						$('.vid-group .vid-wrap').html(o);
					}
				}
			}
		})();

		/* gilles st */
		(function(){
			if ($('body.pageid_8555').length > 0){
				$('.grid_7.col-b .thumb').css('display', 'none');
					
				$('.grid_7.col-b .thumb').each(function(){	
					var r = $(this).attr('src');
					r = r.replace('_thumb', '');
					$(this).click(function(){
						$.colorbox({href: r});	
					});
				});
				$('.grid_7.col-b .thumb').fadeIn('fast');
			};
		})();


		/* community courses */
		(function(){
			if ($('body.pageid_1150').length > 0){
				$.getScript('/common/acc/js/plugin-course-find.js');	
			}
		})();

		/* library catalogue search */
		(function(){
			if ($('#nav-sub-search-the-catalogue').length > 0){
				$('#nav-sub-search-the-catalogue').click(function(){
					location.href = 'http://ipac.adelaidecitycouncil.com';
					return false;
				});
			}
			if ($('#nav-search-the-catalogue').length > 0){
				$('#nav-search-the-catalogue').click(function(){
					location.href = 'http://ipac.adelaidecitycouncil.com';
					return false;
				});
			}
		})();

		(function(){
			$('.subnavigation li.has-children').each(function(){$(this).append('<div class="child-arrow"></div>');});
		})();

		(function(){
			$('#content-wrapper .col-b table').each(function(){
				if (!$(this).hasClass('no-stripe')){
					$('tr:even', this).addClass('even');
					$('tr:odd', this).addClass('odd');
				}
			});
		})();

		(function(){
			$('#svattrfbEMAIL_ADDRESS').focus(function(){
				if (!$(this).hasClass('entered')) {
					$(this).addClass('entered');
					$(this).val('');	
				}
			});
		})();

		/* fix buggy forms with extra fields from CKE */
		(function(){
			$('form input').each(function(){
				$(this).removeAttr('contenteditable');
			});
		})();

		(function(){
			var state = 'ready';
			if ($('#expiation_ajax_wrap').length > 0){	
				console.log('expiation wrap found');		
				$('select[name="offence_rules"]').change(function(){
					$('option:selected', this).each(function(){	
						var id = $(this).val();
						var url = '/ajax/expiation-rules?id=' + id; 
						console.log($(this).val());
						$('#expiation_ajax_wrap .content-info').html('<p>Please wait...</p>');
						$.ajax({
							'url': url,
							dataType: 'xml',
							success: function(o){
								$('#expiation_ajax_wrap .content-info').html('');
								$('#expiation_ajax_wrap .content-list').html('');
								$('#expiation_ajax_wrap .content-list').append('<div class="acco-wrap"></div>');
								$('item', o).each(function(){
									var q = '';
									q += '<h3 class="">' + $('> title', this).text() + '</h3>';
									q += '<div class="">' + $('> body', this).text() + '</div>';
									$('#expiation_ajax_wrap .content-info').html(q);
									$('block', this).each(function(){
										var s = '';
										s += '<h3 class="">' + $('title', this).text() + '</h3>';
										s += '<div class="">' + $('body', this).text() + '</div>';
										$('#expiation_ajax_wrap .content-list .acco-wrap').append(s);
									});
								});
								$('#expiation_ajax_wrap .content-list .acco-wrap').accordion({autoHeight: false, active: null}).show().accordion("resize");
								
							},
							error: function(o){
								alert('There was an error while fetching the expiation data. Please wait a moment or two and refresh the page');
							}
						});
					});
				});
			}
			
		})();

		/* library twitter feed */
		(function(){
			/*********************************************
			* convert twitter date to friendly format 
			*********************************************/
			var twitter_friendly_date = function(s, utc_offset, res_var){
				var cd = new Date();
				var r = s;
				var p = s.split(' ');
				var mo = { 'jan': 0, 'feb': 1, 'mar': 2, 'apr': 3, 'may': 4, 'jun': 5, 'jul': 6, 'aug': 7, 'sep': 8, 'oct': 9, 'nov': 10, 'dec': 11 };
				utc_offset = -cd.getTimezoneOffset() * 60;
				try {
					var ym = s.match(/[\ ]{1}[0-9]{4}/);
					if (ym != null && parseInt(ym[0]) > 0){
						s = s.replace(/[\ ]{1}[0-9]{4}/, '');
						s += ym[0].toString();
						r = s;
						p = s.split(' ');
					}
					
					var t = p[3].split(':'); 
					var d = null; 
					if (/[0-9]/.test(p[2].toString())){
						d = new Date(parseInt(p[5],10), mo[p[1].toLowerCase()], parseInt(p[2],10), parseInt(t[0], 10), parseInt(t[1], 10), parseInt(t[2], 10));
					} else {
						d = new Date(parseInt(p[5],10), mo[p[2].toLowerCase()], parseInt(p[1],10), parseInt(t[0], 10), parseInt(t[1], 10), parseInt(t[2], 10));
					}
					if (typeof res_var != "undefined"){
						res_var = d.getTime();
					}
					var ms = d.getTime() + (utc_offset * 1000); 
					
					d.setTime(ms);
					var da =  Math.round((cd.getTime() - d.getTime()) / (86400000));
					var h = d.getHours();
					var m = d.getMinutes();
					if (da >= 30) {
						var delta = Math.abs(cd.getMonth() - d.getMonth());
						r = 'about ' + ((delta > 0) ? delta.toString() : '1') + ' month' + ((delta > 1) ? 's': '') + ' ago';
					} if (da >= 1) {
						r = 'about ' + da.toString() + ' day' + ((da == 1) ? '': 's') + ' ago';
					} else { 
						if (cd.getMinutes() == m && cd.getHours() == h  && cd.getDate() == d.getDate() && cd.getMonth() == d.getMonth() && cd.getYear() == d.getYear()){
							var delta = (cd.getSeconds() - d.getSeconds()); 
							r = 'about ' + delta.toString() + ' second' + ((delta > 1)? 's' :'')+ ' ago';
						} else if (cd.getHours() == h  && cd.getDate() == d.getDate() && cd.getMonth() == d.getMonth() && cd.getYear() == d.getYear()){
							var delta = (cd.getMinutes() - m); 
							if (delta <= 2){
								r = "a few minutes ago";
							} else {
								r = ((delta == 0) ? '1' : delta.toString()) + ' minute' + ((delta > 1)? 's' :'')+ ' ago';
							}
						} else if (cd.getDate() == d.getDate() && cd.getMonth() == d.getMonth() && cd.getYear() == d.getYear()){
							var delta = (cd.getHours() - h); 
							r = 'about ' + delta.toString() + ' hour' + ((delta > 1) ? 's' : '') + ' ago';
						}
					}
				} catch(ex){ r = s; }
				return r;
			};

			if ($('body.pageid_1104').length > 0){
				$.ajax({
					url: '/blocks/library_twitter',
					dataType: 'html',
					success: function(o){
						var s = o.toString();
						$('.library-twitter').append(s);
						var q = twitter_friendly_date($('.library-twitter .created_at').text()); 
						$('.library-twitter .created_at').text(q);;
					}
				});
			}
		})();

		(function(){
			if ($('.slideshow').length > 0){
				$.getScript('/common/acc/js/jquery/jquery.cycle.all.js', function(){
					$('.slideshow').cycle('fade');
				});
			}
		})();

		/* expanding box */
		(function(){
			var ex_id = 0;
			$('#content-wrapper .col-b .expander').each(function(){	
console.log('expander found');
				$(this).css('overflow', 'hidden');
				var x = $(this).height();
				$(this).attr('data-orig-height', x + 'px');
				$(this).attr('data-state', 'hidden');
				$(this).css('height', '0px');
				var s = '<a class="expander_plus" id="expander_' + ex_id + '" href="#">Read More [ + ]</a>';
				$(this).after(s);
				var _this = this;
				$('a#expander_' + ex_id).click(function(){
					if ($(_this).attr('data-state') == 'hidden'){
						$(_this).attr('data-state', 'expanded');
						$(_this).css('height', x + 'px');
						$(this).text('Hide [ - ]');
					} else {
						$(_this).attr('data-state', 'hidden');
						$(_this).css('height', '0px');
						$(this).text('Read More [ + ]');
					}
					return false;
				});
				++ex_id;
			});
		})();


		/* volunteering current vacancies */
		(function(){
			if ($('.pageid_8145').length > 0){
				$('#volunteers-external-buttons').css('display', 'block');
				$('.col-b iframe, .col-b h3').css('display', 'none');
			}
		})();

		/* reconciliation */
		(function(){
/*
	<object data="/common/acc/legacy/flash/audio/player.swf" height="24" id="reconciliation_audio" name="reconciliation_audio" style="outline: none" type="application/x-shockwave-flash" width="290"><param name="wmode" value="opaque" /><param name="menu" value="false" /><param name="flashvars" value="initialvolume=15&amp;autostart=yes&amp;loop=yes&amp;transparentbg=yes&amp;soundFile={filedir_8}Video/community/reconciliation/reconciliation.mp3&amp;titles= &amp;playerID=reconciliation_audio" /></object>*/
			if ($('#initiatives-flash-wrap').length > 0){
				var ps = '/common/acc/legacy/flash/audio/player.swf';
				var flashvars = { };
				var params = {};
				params.allowNetworking = 'all';
				params.allowScriptAccess = 'true';
				flashvars.soundFile = '/assets/acc/Video/community/reconciliation/reconciliation.mp3';
				flashvars.initialvolume = 15;
				flashvars.autostart = 'yes';
				flashvars.loop = 'yes';
				var attributes = {};

				swfobject.embedSWF(ps, "initiatives-flash-wrap", "10", "10", "9.0.0", false, flashvars, params, attributes);
			}
		})();

		/* 3d city model button */
		(function(){
			if ($('#btn-launch-3d-city-model').length > 0){
				$('#btn-launch-3d-city-model').click(function(){
					location.href='http://3dmodel.adelaidecitycouncil.com/skylineglobe/webclient/presentationlayer/webclient/ACC_SG.aspx?referrer=ACC';
				});
			}
		})();

		/* media release page */
		(function(){
			if ($('.pageid_1211').length > 0){
				var cd = {};
				var q = location.href.split('?');
				if (q.length > 1){
					q = q[q.length - 1];
					q = q.split('&');
					for (var i = 0 ; i < q.length; ++i){
						(function(){
							var v = q[i].split('=');
							if (v.length > 1){
								cd[v[0]] = v[1];
							}
						})();
					}
				}
				if (typeof cd['year'] != "undefined" && typeof cd['month'] != "undefined"){
					$('#MediaSearch select[name="year"]').val(cd['year']);	
					$('#MediaSearch select[name="month"]').val(cd['month']);	
				}
			}
		})();


		/* jplayer plugin */
		(function(){
			var r = $('#content-wrapper a[rel="plugin-jplayer"]');
			if (r.length > 0){
				var s = '<link type="text/css" rel="stylesheet" href="/common/acc/js/jquery/jquery-player/blue.monday/jplayer.blue.monday.css" />';
				$('head').append(s);
	
				r.each(function(){
					var h = $(this).attr('href');
					var s = '<div id="jp_container_1" class="jplayer-container jp-video jp-video-360p" style="width: 580px; height: 320px;">'

+ '<div class="jp-type-single"> <div id="jquery_jplayer_1" class="jp-jplayer"></div> <div class="jp-gui"> <div class="jp-interface"> <div class="jp-progress"> <div class="jp-seek-bar"> <div class="jp-play-bar"></div> </div> </div> <div class="jp-current-time"></div> <div class="jp-duration"></div> <div class="jp-controls-holder"> <ul class="jp-controls" style="width: 300px;"> <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li> <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li> <li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li> <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li> <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li> <li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li> </ul> <div class="jp-volume-bar"> <div class="jp-volume-bar-value"></div> </div> <ul class="jp-toggles" style="display: none;"> <li><a href="javascript:;" class="jp-full-screen" tabindex="1" title="full screen">full screen</a></li> <li><a href="javascript:;" class="jp-restore-screen" tabindex="1" title="restore screen">restore screen</a></li> <li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li> <li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li> </ul> </div> </div> </div> <div class="jp-no-solution"> <span>Update Required</span> To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>.  </div> '
					+ '</div>';

					$(this).after(s);
					var t = $('.jp-jplayer');	

					if (!/http/.test(h)){
						h = 'http://' + document.domain + h;
					}

					t.jPlayer({
						ready : function(){
							$(this).jPlayer('setMedia', {
								m4v: h + '.x264.mp4',
								ogv: h + '.ogv',
								webmv: h + '.webm',
								flv: h + 'flv'
							}).jPlayer('play');
						},
						solution: "html, flash",
						supplied: "m4v, ogv, webmv, flv",
						swfPath: "/common/acc/js/jquery/jquery-player/",
						size: {
							width: "580px",
							height: "320px",
							cssClass: "jp-video-360p"
						}
					});
					$(this).remove();
				});
					
			}
		})();

		/* video plugin */
		(function(){
			var r = $('#content-wrapper a[rel="plugin"]');
			if (r.length > 0){
				$.getScript('/common/shared/zencoder-video-js/video.js');
				$('head').append('<link rel="stylesheet" type="text/css" charset="utf-8" href="/common/shared/zencoder-video-js/video-js-acc-plugin.css?r=' + Math.random() + '" />');

				var _t = setInterval(function(){
					if (typeof VideoJS == "undefined") return;
					clearInterval(_t);
					r.each(function(){
						var autoplay = $(this).hasClass('autoplay');
						var h = $(this).attr('href');
						var h2 = h + '-h264.mp4';
						var default_dimensions = 'width="580" height="320"';
						var autoStart = (autoplay ? 'true' : 'false');
						var fv = 'videoPath=' + h2 + '&autoStart=' + autoStart  + '&autoHide=true&hideLogo=true&volAudio=60' +
							'&disableMiddleButton=false&playSounds=true&soundBarColor=0x0066FF&barColor=0x0066FF&' +
							'barShadowColor=0x91BBFB&subbarColor=0xffffff&extendVideo=true'
						var ps = '/common/shared/flash-player/flvPlayer.swf';
						var o = '<object class="flash-video" type="application/x-shockwave-flash" id="vid-id-flash-obj" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" align="left" ' + default_dimensions + '>' +
							'<param name="Movie" value="' + ps + '"/>' +
							'<param name="src" value="' + ps + '"/>' +
							'<param name="AllowNetworking" value="all"/>' +
							'<param name="AllowScriptAccess" value="always"/>' +
							'<param name="flashVars" value="' + fv + '"/>' +
							'<param name="wmode" value="transparent"/>' +
						'</object>';

						var s = '<div class="video-js-box"><video class="video-js" autoplay="autoplay" controls="controls" preload="auto">' +
							'<source src="' + h + '" type="video/mp4; codecs=avc1.42E01E,mp4a.40.2" />' +
							o +
							'</video></div>';
						$(this).after(o);
						$(this).hide();
			
					});
					//VideoJS.setup("all");
				}, 100);
			}
		})();


		/* adelaide prize gallery */
		(function(){

var init_gallery = function(){
var galleries = $('.ad-gallery').adGallery({
  loader_image: '/common/shared/jquery-ad-gallery/loader.gif',
  width: 580, // Width of the image, set to false and it will read the CSS width
  height: 380, // Height of the image, set to false and it will read the CSS height
  thumb_opacity: 0.7, // Opacity that the thumbs fades to/from, (1 removes fade effect)
                      // Note that this effect combined with other effects might be resource intensive
                      // and make animations lag
  start_at_index: 0, // Which image should be displayed at first? 0 is the first image
  description_wrapper: false, // Either false or a jQuery object, if you want the image descriptions
                                           // to be placed somewhere else than on top of the image
  animate_first_image: false, // Should first image just be displayed, or animated in?
  animation_speed: 400, // Which ever effect is used to switch images, how long should it take?
  display_next_and_prev: true, // Can you navigate by clicking on the left/right on the image?
  display_back_and_forward: true, // Are you allowed to scroll the thumb list?
  scroll_jump: 0, // If 0, it jumps the width of the container
  slideshow: {
    enable: true,
    autostart: true,
    speed: 5000,
    start_label: 'Start',
    stop_label: 'Stop',
    stop_on_scroll: true, // Should the slideshow stop if the user scrolls the thumb list?
    countdown_prefix: '(', // Wrap around the countdown
    countdown_sufix: ')',
    onStart: function() {
      // Do something wild when the slideshow starts
    },
    onStop: function() {
      // Do something wild when the slideshow stops
    }
  },
  effect: 'slide-hori', // or 'slide-vert', 'resize', 'fade', 'none' or false
  enable_keyboard_move: true, // Move to next/previous image with keyboard arrows?
  cycle: true, // If set to false, you can't go from the last image to the first, and vice versa
  // All callbacks has the AdGallery objects as 'this' reference
  callbacks: {
    // Executes right after the internal init, can be used to choose which images
    // you want to preload
    init: function() {
      // preloadAll uses recursion to preload each image right after one another
      this.preloadAll();
    },
    // This gets fired right after the new_image is fully visible
    afterImageVisible: function() {
      // For example, preload the next image
      /*var context = this;
      this.loading(true);
      this.preloadImage(this.current_index + 1,
        function() {
          context.loading(false);
        }
      );*/
    },
    // This gets fired right before old_image is about to go away, and new_image
    // is about to come in
    beforeImageVisible: function(new_image, old_image) {
      // Do something wild!
    }
  }
});
}
			var s = '<link rel="stylesheet" href="/common/shared/jquery-ad-gallery/jquery.ad-gallery.css" />';
			$('head').append(s);
			$.getScript('/common/shared/jquery-ad-gallery/jquery.ad-gallery.pack.js', function(){
				init_gallery();
			});
		})();

		loadSWF = function(fileName) {
			var filePath = '/assets/acc/audio/' + fileName;
			if ($('#flashSound').length == 0){
				$('body').append('<div style="position: absolute; width:1px; height: 1px;" id="flashSound"></div>');
			}
			$('#flashSound').html('<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="20" height="10" type="application/x-shockwave-flash" ><param name="Movie" value="' + filePath + '" /><param name="quality" value="high" /></object>');
			return false;
		}


	}
);




