			var $j = jQuery.noConflict();
            
 
			function initialize() {
			
				if (lat !="" && lng != ""){
					var myLatlng = new google.maps.LatLng(parseFloat(lat),parseFloat(lng));
					var myOptions = {
					  zoom: 13,
					  center: myLatlng,
					  disableDefaultUI: true,
					  navigationControl: true,
					  navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
					  mapTypeId: google.maps.MapTypeId.ROADMAP
					}
					var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
					
					var marker = new google.maps.Marker({
						position: myLatlng, 
						map: map,
						title:pagetitle
					});
					writeGMapURL (pagetitle,lat,lng);
				}
				
			}
		
		function jumpSelect(e) {
					g = $j(e).find("option:selected").val();
					if (typeof(g)=="undefined"){
						g = $j(this).find("option:selected").val();
					}
					//g = $j(".more_about_drogheda select").find("option:selected").val();
					//console.log(g);
					if (g != "") location.href = "/"+g;
					return false;
				}
		
		function writeGMapURL (title,goLat,goLon) {
			
			var hUrl = "http://maps.google.com?q="+escape(goLat)+","+escape(goLon)+"+("+escape(title)+")";
			$j("#map_canvas").after("<p><a href=\""+hUrl+"\" target=\"_blank\">View in larger map</a></p>");
		}
		
		
			$j(document).ready(function($) {
				
				/* Revolving banners - Home main banner and  "whats on" teaser panel */
			
				$('.fading_banner').cycle({
					speed:3000,
					timeout:10000
				});
				$('.whats_on .cycler').cycle({
					timeout: 8000
				});
				
				/* Homepage special offer panel tabs */
				
				var tb = $(".tab_container .offer");
				if (tb.length > 1) {
					$(".tab_container").append('<ul class="so_tabs"></ul>');
					tb.each(function(e){
						e+=1;
						tid = "so_tab_panel_"+e;
						$(this).attr("id",tid);
						oe = (e<10) ? new String("0"+e) : e;
						$(".tab_container .so_tabs").append('<li><a href="#'+tid+'">'+oe+'</a></li>');
						
					});
					tb.hide();
					$(".tab_container .offer:first-child").show();
					$(".tab_container .so_tabs li:first-child a").addClass("selected");
					$(".tab_container .so_tabs li a").click(function() {
						showtab = $(this).attr("href");
						tb.hide();
						$(".tab_container .so_tabs li a").removeClass("selected");
						$(showtab).show();
						$(this).addClass("selected");
						return false;
					});
					
				};
				/* applying styles to category blocks - alternating colours and omega class */
				
				var pattern = "0110";
				var pattidx = 0;
				$(".category_block").each(function(e){
					if (e%2!=0) {
						$(this).addClass("omega");
					}
					if (pattidx >= pattern.length) pattidx = 0;
					if(pattern[pattidx]=="1") {
						$(this).addClass("alt");
					}
					pattidx++;
				}).click(function(){
					location.href = $(this).find("h2 a").attr("href");
				}).css({"cursor":"pointer"});
				
				/* Kick off the google map panel */
				initialize();
				
				/* apply "active" class to topnav */
				
				var linksArr = new Array("specials",
				"things-to-do",
				"whats-on",
				"places-to-stay",
				"what-to-see",
				"eat-out",
				"nightlife",
				"shopping");
			
				var ji = document.location.href;
				var fk = $(this);
				$(linksArr).each(function(){
					bh = this.toString()
					if(ji.indexOf(bh)!=-1){
				
						$('#topnav li a[href*="'+bh+'"]').addClass("active");
					}
				});
				
				/* Listing pages - add alphas and omegas for layout */
				mod = ($(".b_specials").length ==1) ? 4 : 3;
				$(".list_item").each(function(e){
					if((e+1)%mod==0) {
						$(this).addClass("omega");
					} else if ((e+1)%mod==1 || e==0) {
						$(this).addClass("alpha");
					}
				});
				
				/* Select boxes: jump to selected destinations */
				
				$(".more_about_drogheda select, .filter_list").change(jumpSelect);
				$(".go_button").click(function(){jumpSelect($(".more_about_drogheda select"))});
				
				/* Clear contents of main search box on focus */
				$(".cleardefault").focus(function(){
					if ($(this).val()=="Enter Keywords") {
						$(this).val("");
					}
				});
				
				$(".cleardefault").blur(function(){
					if ($(this).val()=="") {
						$(this).val("Enter Keywords");
					}
				});
				
				$(".DatePicker").datepicker({
					onClose: function(dateText, inst) {
						//console.log(dateText,inst);
						if(dateText != "Search by Date") {
							/*g = new String(document.location);
							if (g.indexOf("?")!=-1){
							g = g.split("?");
							g = g[0];
							}*/
							location.href = "/whats-on.html?evt_search="+escape(dateText);
							//location.href = "/search-results.html?search="+escape(dateText);
						}
					},
					dateFormat: 'dd-mm-yy'
					
				});

				$(".shop_search").focus(function(){
					if($(this).val() == 'Search by Text') {
						$(this).val('');
					}
				});
				$(".shop_search").blur(function(){
					if($(this).val() == '') {
						$(this).val('Search by Text');
					}
				});



				$(".search_by_venue").change(function(){
					if($(this).val()!="") {
						bh = $(this).find("option:selected").text();
						/*g = new String(document.location);
							if (g.indexOf("?")!=-1){
							g = g.split("?");
							g = g[0];
							}*/
						location.href = "/whats-on.html?venue="+escape(bh);
					}
				});
				
				if ($(".book_now").attr("href") != "") {
					$(".book_now").css({"display":"block"});
				}
				
				$("a[rel=external]").attr("target","_blank");
				
				function addBodyClick(r) {
					$("body").click(function(){r.removeClass("shown")});
				}
				
				function removeBodyClick() {
					$("body").unbind("click");
				}
				
				$(".share>a").click(function() {
					r = $(".share_box");
					if(r.hasClass("shown")) {
						r.removeClass("shown");
						removeBodyClick();
					} else {
						r.addClass("shown");
						addBodyClick(r);
					}
					return false;
				});
				
				
				//show/hide image clicks in detail page
				$(".teaser_image .image2,.teaser_image .image3,.teaser_image .image4").hide();
				$(".img_crop img").click(function() {
					gr = $(this).attr("class");
					$(".teaser_image img").hide();
					$(".teaser_image ."+ gr).show(); 
					
					//.css({"cursor","pointer"})
					
				});
				
				
				Cufon.replace('.boxOne h2 a');
				Cufon.replace('.caseHome h2');
				Cufon.replace('.homeNews h2');
				
				
				$('.caseHome ul').cycle({ 
					prev:   '#prev', 
					next:   '#next', 
					timeout: 0 
				});
				

			});
			
			


