﻿// Functions specific to a site.

(function($) {
	$(document).ready(function() {
		// Place document manipulation code here
		
		Cufon.replace('.emergency-call');
		
		$('#home-slideshow').cycle({
			fx: 'fade',
			pager: '#home-cta ul',
			pagerEvent: 'mouseover',
			speed: 2000,
			timeout: 6000,
			pauseOnPagerHover: true,
			pagerAnchorBuilder: function(idx, slide) {
				var anchor = '';
				anchor = '<li><a href="#" id="btn-cycle-' + (idx + 1) + '">' + (idx + 1) + '</a></li>';
				return anchor;
			}
		});
		
		function pagerLink() {
			location.href = $(this).attr('href');
		}
		function createLinks(query, href) {
			$(query).attr('href', href).click(pagerLink);
		}
		createLinks("#btn-cycle-1", '/pulp-paper-projects.html');
		createLinks("#btn-cycle-2", '/gas-oil-projects.html');
		createLinks("#btn-cycle-3", '/energy-projects.html');
	});
	
	jQuery(function(){
		jQuery('ul.utils, #mainnavigation ul').superfish();
	});
})(jQuery);
