(function($) {
	/*
		jquery.twitter.js v1.5
		Last updated: 08 July 2009

		Created by Damien du Toit
		http://coda.co.za/blog/2008/10/26/jquery-plugin-for-twitter

		Licensed under a Creative Commons Attribution-Non-Commercial 3.0 Unported License
		http://creativecommons.org/licenses/by-nc/3.0/
	*/

	$.fn.getTwitter = function(options) {

		$.fn.getTwitter.defaults = {
			userName: null,
			numTweets: 5,
			loaderText: "Loading tweets...",
			slideIn: true,
			slideDuration: 750,
			showHeading: true,
			headingText: "Latest Tweets",
			showProfileLink: true,
			showTimestamp: true
		};

		var o = $.extend({}, $.fn.getTwitter.defaults, options);

		return this.each(function() {
			var c = $(this);

			// hide container element, remove alternative content, and add class
			c.hide().empty().addClass("twitted");

			// add heading to container element
			if (o.showHeading) {
				c.append("<h2>"+o.headingText+"</h2>");
			}

			// add twitter list to container element
			var twitterListHTML = "<ul id=\"twitter_update_list\"><li></li></ul>";
			c.append(twitterListHTML);

			var tl = $("#twitter_update_list");

			// hide twitter list
			tl.hide();

			// add preLoader to container element
			var preLoaderHTML = $("<p class=\"preLoader\">"+o.loaderText+"</p>");
			c.append(preLoaderHTML);

			// add Twitter profile link to container element
			if (o.showProfileLink) {
				var profileLinkHTML = "<p class=\"profileLink\"><a href=\"http://twitter.com/"+o.userName+"\">http://twitter.com/"+o.userName+"</a></p>";
				c.append(profileLinkHTML);
			}

			// show container element
			c.show();

			$.getScript("http://twitter.com/javascripts/blogger.js");
			$.getScript("http://twitter.com/statuses/user_timeline/"+o.userName+".json?callback=twitterCallback2&count="+o.numTweets, function() {
				// remove preLoader from container element
				$(preLoaderHTML).remove();

				// remove timestamp and move to title of list item
				if (!o.showTimestamp) {
					tl.find("li").each(function() {
						var timestampHTML = $(this).children("a");
						var timestamp = timestampHTML.html();
						timestampHTML.remove();
						$(this).attr("title", timestamp);
					});
				}

				// show twitter list
				if (o.slideIn) {
					// a fix for the jQuery slide effect
					// Hat-tip: http://blog.pengoworks.com/index.cfm/2009/4/21/Fixing-jQuerys-slideDown-effect-ie-Jumpy-Animation
					var tlHeight = tl.data("originalHeight");

					// get the original height
					if (!tlHeight) {
						tlHeight = tl.show().height();
						tl.data("originalHeight", tlHeight);
						tl.hide().css({height: 0});
					}

					tl.show().animate({height: tlHeight}, o.slideDuration);
				}
				else {
					tl.show();
				}

				// add unique class to first list item
				tl.find("li:first").addClass("firstTweet");

				// add unique class to last list item
				tl.find("li:last").addClass("lastTweet");
			});
		});
	};
})(jQuery);





$(document).ready(function() {

	
	$(".scrollable").scrollable({
			circular: true, mousewheel: false, speed : 600
		}).navigator().autoscroll({
			interval: 5000		
	});	
		
	$("#twitter").getTwitter({
		userName: "mersonsigns",
		numTweets: 1,
		loaderText: "Loading tweets...",
		slideIn: false,
		slideDuration: 750,
		showHeading: true,
		headingText: "Latest Tweets",
		showProfileLink: true,
		showTimestamp: true
	});
	//$('body').attr('onload', 'firemap()');
	$(".clienttable tr:odd").css("background-color", "#FEEEDD");
	
})
	

  function initializeMap() {
    var latlng = new google.maps.LatLng(51.845124, -1.024797);
    var myOptions = {
    zoom: 12,
	 mapTypeControl: false,
	mapTypeControlOptions: {
        style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
        position: google.maps.ControlPosition.BOTTOM_LEFT,
		style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
    },
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
	var marker = new google.maps.Marker({
		position: latlng, 
		map: map,
		title:'Merson i-level retail'
	});  	
	
	var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	var defoList = "<dl><dt>I-LEVEL OFFICE</dt><dd>Unit 7,</dd><dd>Clearfield Farm</dd><dd>Kingswood Road</dd><dd>Wotton Underwood</dd><dd>Aylesbury</dd><dd>HP18 ORS</dd></dl>";
	//var contentString = $('#contactcard').html()
	//var fullDl = '<dl>' + contentString + '</dl>'
	var infowindow = new google.maps.InfoWindow({
		content: defoList
	});
	//google.maps.event.addListener(marker, 'click', function() {
	  infowindow.open(map,marker);
	//});	
	marker.setMap(map);  
  }

  function initializeMap2() {
    var latlng = new google.maps.LatLng(55.777081, -4.179363);
    var myOptions = {
      zoom: 12,
	  mapTypeControl: false,

	mapTypeControlOptions: {
        style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
        position: google.maps.ControlPosition.BOTTOM_LEFT,
		style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
    },
	  
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
	var marker = new google.maps.Marker({
		position: latlng, 
		map: map,
		title:'Merson i-level retail'
	});  	
	
	var map = new google.maps.Map(document.getElementById("map_canvas2"), myOptions);
	var defoList = "<dl><dt>HEAD OFFICE</dt><dd>1 Law Place,</dd><dd>Nerston Mains,</dd><dd>East Kilbride,</dd><dd>Glasgow,</dd><dd>G74 4QQ</dd></dl>";	
	//var contentString = $('#contactcard').html()
	//var fullDl = '<dl>' + contentString + '</dl>'
	var infowindow = new google.maps.InfoWindow({
		content: defoList
	});
	//google.maps.event.addListener(marker, 'click', function() {
	  infowindow.open(map,marker);
	//});	
	marker.setMap(map);  
  }




$(window).load(function () {
	
	
	if ($('#thumb-gallery a').length) {
		$('#thumb-gallery a').lightBox(); // Select all links in object with gallery ID
	}

	//$("#iaminterestedform").validate();	
	
	if($("#iaminterestedform, #enviroaudit").length) {
		$("#iaminterestedform, #enviroaudit").validate({
		rules: {
			FirstName: "required",
			email: {
				required: true,
				email: true
			},
			customermessage: {
				required: true,
				maxlength: 1024
			}
		},
		messages: {
			FirstName: "Please enter your name",
			email: "Please enter a valid email address",
			customermessage: "The message should be less then 1024 characters"
		}
		});	
	}


	//window.gOverride = {gColor: '#FF0000', pColor: '#0000FF', gOpacity: 0.30, pOpacity: 0.40, pHeight: 18, gOffset: 20, setupEnabled: false}	
	//document.body.appendChild(document.createElement('script')).src='assets/js/gridder.js';
})



		 $(function(){
		 
		 // Widget
		 
		 var url = location.pathname;
         if (url === "/merson-group.html") {
			 	
				$("#widget-container").css("right", 35);	 
			 
			 }
		 
		 
	   $("#widget-container").fadeTo(1000, 0.4);
	    $("#widget-container").hover(function(){		
			  $(this).stop().fadeTo(200, 1);
		  },function(){	  
			  $(this).stop().fadeTo(500, 0.4);
		  });
		  
		   });
		  
		 
		  
	


