Cufon.replace('.haccordion div.testimonials_content blockquote p.quote', {color: '#fff'});

$(function() {
	
	// Cycle through elements
	$('#accordion div.testimonials_content').cycle({ 
		fx: 'scrollDown',
		timeout: 10000
	});
	
	$('p.back a').click(function(){ history.go(-1); return false; });
	
	// Accordion
	if($("body.lighterside").length)
		$(".haccordion").haccordion({firstopenselector : ":first"});
	else
	{
		if($("body.about").length)
			$(".haccordion").haccordion({firstopenselector : ".thisshouldselectnothing"});
		else
			$(".haccordion").haccordion();
	}

	// Tooltip
	//tooltip();
	
	var show = false;

	$("#logo, #tooltip").hover(
		function () {
			show = true;
	  	},
	  	function () {
			show = false;
	  	}
	);

	function timefunc()
	{
		if(show)
			$("#tooltip").fadeIn("slow");
		else
			$("#tooltip").fadeOut("slow");
		setTimeout(timefunc, 500);
	}

	setTimeout(timefunc, 500);

	/*$("#tooltip").hover(
		function () {
			$("#tooltip").css({'display' : 'block'});
	  	},
	  	function () {
			$("#tooltip").hide();
	  	}
	);*/
	
	$("#tooltip").click(function() {
		location.href ="hummingbird/";							 
	});

	
	
	// Map
	$("div#sidebar ul.locations li a.title").click(
		function()
		{
			$(this).toggleClass("on");
			$(this).parent().find("dl").slideToggle("fast");
			return false;
		}
	);

	$("div#sidebar ul.locations li dl").hide();


	//**********************
	// Contact & First estimator page page
	//**********************
	$("body.contact").each(function(){
		if(GBrowserIsCompatible())
		{

			var new_icon = new GIcon()
			new_icon.image = "media/images/marker_map.png"
			new_icon.size = new GSize(34,49)
			new_icon.iconAnchor = new GPoint(23,20)
			new_icon.infoWindowAnchor = new GPoint(23,20)

			var map = new GMap2(document.getElementById("map"));

			function createMarker(point,html) {
				var opt = {};
				opt.icon = new_icon;
				opt.draggable = false;
				opt.clickable = true;
				opt.dragCrossMove = true;

				var marker = new GMarker(point, opt);
				GEvent.addListener(marker, "click", function() {
				  marker.openInfoWindowHtml(html);
				});
				return marker;
			  }
			
			// Set up markers with info windows

			var forum_partnership = new GLatLng(53.415262,-2.234666);
			var marker_forum_partnership = createMarker(forum_partnership,'<div style="width:140px;height:75px;"><strong>Forum House</strong><br /><br />11 Springdale Gardens<br />Didsbury<br />Manchester<br />M20 2QY</div>')
			map.addOverlay(marker_forum_partnership);

			map.setCenter(new GLatLng(53.415262,-2.234666), 13);

			map.addControl(new GSmallMapControl());

		}
	});

});
