	

	/* BUTTONS TO LINKS
	-------------------------------------------------*/

	var UID = new Number(0);

	function styleAllButtons() {
		$('input[type=submit].style_button').each(function(){
			UID++;
			var btn = $(this);
			var btnForm = btn.parents('form');
			btn.css('display', 'none');
			btnClassesAll = btn.attr('class').split(' ');
			btnClasses = '';
			jQuery.each( btnClassesAll, function() {
				if ( this != 'style_button' ) {
					btnClasses += ' ' + this;
				}
			});
			//<![CDATA[
			btn.before('<a href="#btn_'+UID+'" class="'+btnClasses+'" id="btn_'+UID+'" name="btn_'+UID+'"><span>'+btn.attr('value')+'<\/span><\/a>');
			//]]>
		  	$('#btn_'+UID).bind('click', function(){ btn.closest('form').submit(); return false; });
		});
	}

	$(document).ready(function(){

		styleAllButtons();

		/* MATCH FIELDS
		-------------------------------------------------*/

		var match = 'input.match';
		$(match).focus(function(){
			this.valuedefault = this.valuedefault || this.value;
			if (this.value == this.valuedefault) this.value = '';
		});

		$(match).blur(function(){
			if (this.valuedefault && this.value.length==0) this.value = this.valuedefault;
		});
		

		/* SPOTLIGHT
		-------------------------------------------------*/
	
		var interval = 3000;
		var speed = 500;
	
		//<![CDATA[
		var spots = new Array();
		spots[1] = new Array('img/temp/spotlight_home.jpg', '<h2>The Gateway with unique distribution solutions<\/h2><h3>Our services centre around your supply chain<\/h3><p>The KMUK service offering allows our customers to rely on us in providing a gateway to their customers and consumers; this allows customers to focus on their competency to produce their products and allows us to focus in getting them to their customers and consumers. Customers are in control of speed to market by opting for various service options KMUK provides.<\/p>');
		spots[2] = new Array('img/temp/spotlight_home_storage.jpg', '<h2 class="storage">Storage, Pick & Pack<\/h2><h3>We will provide you the services and options <br/>you need at the right price.<\/h3>');
		spots[3] = new Array('img/temp/spotlight_home_gateway.jpg', '<h2 class="gateway">Gateway Operations<\/h2><h3>A fast and efficient service tailored to <br/>your needs.<\/h3>');
		spots[4] = new Array('img/temp/spotlight_home_distribution.jpg', '<h2 class="distribution">Cost effective <br/>Mail Distribution<\/h2><h3>We can find the solution that you need, we will <br/>work with you to understand the requirement <br/>and propose the right solution.<\/h3>');
		spots[5] = new Array('img/temp/spotlight_home_logistics.jpg', '<h2 class="logistics">Cost effective <br/>Parcel Distribution<\/h2><h3>You tell us your requirements and needs, we <br/>will then find the right solution for you.<\/h3>');
		//]]>
	
		var current_spot = 0;
		var spots_total = spots.length;
	
		switchSpotlight = function( noAdd ){
			
			if( !noAdd ) current_spot++;
	
		    if(current_spot >= spots_total) current_spot = 1;
		    if(current_spot < 0) current_spot = spots_total;
			
			load_image = $('#spotlight .spotlight-images .image img.load_image');
			main_image = $('#spotlight .spotlight-images .image img.main_image');
			
			load_image.attr('src', spots[current_spot][0])
				.load( function(){
					$('#spotlight .selector a').removeClass('active');
					$('#spotlight .selector a.spot'+current_spot).addClass('active');
					main_image.fadeOut(speed, function(){
						main_image.attr('src', spots[current_spot][0]);
						main_image.show();
					});
					$('#spotlight .spotlight-info').html( spots[current_spot][1] );
				});
			
		}
		
		$('#spotlight .selector a').click(function(){
			current_spot = $(this).attr('rel').substring(4);
			clearInterval( timer );
			switchSpotlight( true )
			timer = setInterval('switchSpotlight(false)', interval);
			return false;
		});
		
		
		/* TABS
		-------------------------------------------------*/
		
		$('.tab-container').each(function(){
			
			$('.tab-name:first', this).addClass('active');
			$('.tab-item:first', this).addClass('active');
			
			$('.tab-name:first', this).bind('click', function(){
				$('.tab-name').removeClass('active');
				$(this).addClass('active');
				$('.tab-item').hide();
				$('.tab-item:first').show();
				return false;
			});
			$('.tab-name:last', this).bind('click', function(){
				$('.tab-name').removeClass('active');
				$(this).addClass('active');
				$('.tab-item').hide();
				$('.tab-item:last').show();
				return false;
			});
			
		});


		/* TOOLTIP
		-------------------------------------------------*/

		$('.tooltip-link a').click(function(){
			$('.tooltip.'+$(this).attr('rel')).toggle();
			return false;
		})

	});

