
(function($) {
	
	Drupal.fw_blocks_plus = Drupal.fw_blocks_plus || {};
	
	Drupal.behaviors.fw_blocks_plus = {
		attach: function(context, settings) {
			var basepath = settings.fw_blocks_plus.basepath;
			var clockChange = function() {
				$('#fw_blocks_plus_clocks').find('img.fw_blocks_plus_clock_face_img').each(function(index, element) {
                    var current = this.alt;
					if(current >= 720) {
						current == 1;
					} else {
						current++;
					}
					this.alt = current;
					this.src = basepath + 'clock_images/' + current + '.png';
					
                });;
				
				featureTimeout = setTimeout(clockChange, 60000);	
				return false;
			};
			
			var x = new Date();
			var y = x.getSeconds();
	 
			var firstchange = (60-y)*1000;
			var featureTimeout = setTimeout(clockChange, firstchange);
			
			$('#fw_blocks_plus_blocks', context).once(function(){
      			Drupal.fw_blocks_plus.prepare(this);
			});

		}
	};
	
	Drupal.fw_blocks_plus.prepare = function(el) {
		var id = 1;
		$(el).find('li').each(function(index, element) {
			$(this).bind('click',id,Drupal.fw_blocks_plus.map_change);
			id ++;
		});
	}
	
	Drupal.fw_blocks_plus.map_change = function(value) {
		var id = value.data;
		$('#fw_blocks_plus_blocks').children('li.active').removeClass('active');
		$('#fw_blocks_plus_box_'+id).addClass('active');
		
		$('#fw_blocks_plus_info').children('div.active').fadeOut('fast','',function() {
			$(this).removeClass('active')
			$('#fw_blocks_plus_map_info_'+id).fadeIn('fast').addClass('active');;
		});
	}

}(jQuery));
;
// JavaScript Document


(function($) {
	Drupal.behaviors.fw_internal = {
		attach: function(context, settings) {
			var featureRotate = function() {
				var activeTab = $('#quicktabs-homepage_quicktabs ul.quicktabs-tabs').children('li.active');
				var nextTab = activeTab.next();
				var innerContent = $("#quicktabs-homepage_quicktabs .quicktabs_tabpage > *")
	
				if(nextTab.length){
					nextTab.find('a').trigger('click');
					innerContent.hide();
					innerContent.fadeIn(1000);
				}
				else {
					$('#quicktabs-homepage_quicktabs ul.quicktabs-tabs').children('li:first').children('a').trigger('click');
					innerContent.hide();
					innerContent.fadeIn(1000);
				}
	
				featureTimeout = setTimeout(featureRotate, rotateSpeed);
	
				return false;
			};
	
			// Define delay time here
			var rotateSpeed = 7500;
			// Comment the next line to disable auto-rotate
			var featureTimeout = setTimeout(featureRotate, rotateSpeed);
	
			// Disable auto-rotate when the mouse is over the quicktabs div
			$("#quicktabs-homepage_quicktabs").bind("mouseenter", function() {
				clearTimeout(featureTimeout);
				featureTimeout = false;
				return false;
			} ) . bind("mouseleave", function() {
				featureTimeout = setTimeout(featureRotate, rotateSpeed);
				return false;
			});
			
			//Intermodal Services Pages Scripts
			$("#fw_intermodal_services_list li").each(function(index, element) {
                $(this).bind("click", function() {
					$("#fw_intermodal_services_list li.active").removeClass('active');
					var next = $(this).attr('title');
					$(this).addClass('active');
					$("#fw_intermodal_services_content li.active").removeClass('active').fadeOut('fast',function() {
						$("#"+next).fadeIn().addClass('active');    
					});			
				});
            });
		}
	};
}(jQuery));;

