/* Author: Foxrocket Media
*/

$(document).ready(function() {
		// let's do some preloading !
		$('#uk-banner').show();
		$('#uk-banner').append('<h1 class="loading">loading ..</h1>');
		$.preLoadImages(
		     [
						'/images/oak.jpg',
						'/images/document.jpg',
						'/images/bank.jpg'
		     ],function(){
						//alert('I am Ready !');
						$('h1.loading').remove();
						$ukbanner.init();
		     }
		);
});


$ukbanner = {
	
	init: function() {
		this.oak();
	}, 
	
	oak: function(next) {
		$('#uk-banner').empty();
		
		bg = $('<div></div>').hide().addClass('bg-oak');
		el = $('<h1>IDT Limited joins Bottomline Technologies</h1>').hide();
		bg.append(el);
		ex = $('<div></div>').hide().addClass('expander');
		el = $('<h2>Delivering Business Process Management solutions<br/>to maximise efficiency and minimise cost</h2>').hide();
		ex.append(el);
		bg.append(ex);
		button = $('<a href="http://www.bottomline.co.uk/contact.html">Contact Us &rarr;</a>').hide();
		bg.append(button);
		
		$('#uk-banner').append(bg);
		
		bg.fadeIn(2000);
		$('#uk-banner h1').fadeIn(2000, function(){
			ex.fadeIn().animate({width: 360, left: '2%'}, 1000).animate({width: 330, left: '4%'}, 800, function(){
				$('h2').fadeIn('slow', function(){
					button.fadeIn('slow', function(){
						bg.delay(4000).fadeOut(2000, function(){
							if (next == 'banking') {
								$ukbanner.banking();
							} else{
								$ukbanner.documents();
							};
						});
					});
				});
			});
		});
			
	}, 
	
	documents: function() {
		$('#uk-banner').empty();
		
		bg = $('<div></div>').hide().addClass('bg-documents');
		el = $('<h1>Extend the reach of your ERP</h1>').hide();
		bg.append(el);
		ex = $('<div></div>').hide().addClass('expander');
		el = $('<h2>With inbound and outbound<br/>document process automation</h2>').hide();
		ex.append(el);
		bg.append(ex);
		button = $('<a href="http://www.bottomline.co.uk/document_management/index.html">Learn More &rarr;</a>').hide();
		bg.append(button);
		
		$('#uk-banner').append(bg);
		
		bg.fadeIn(2000);
		$('#uk-banner h1').fadeIn(2000, function(){
			ex.fadeIn().animate({width: 234, left: '2%'}, 1000).animate({width: 204, left: '4%'}, 800, function(){
				$('h2').fadeIn('slow', function(){
					button.fadeIn('slow', function(){
						bg.delay(4000).fadeOut(2000, function(){
								$ukbanner.oak();
						});
					});
				});
			});
		});
		
	}, 

	
	banking: function() {
		$('#uk-banner').empty();
		
		bg = $('<div></div>').hide().addClass('bg-banking');
		el = $('<h1>Connecting Banks to their Most Important Customers</h1>').hide();
		bg.append(el);
		ex = $('<div></div>').hide().addClass('expander');
		el = $('<h2>Grow revenue, retain customers and increase deposits<br/>with WebSeries&reg; Global Cash Management</h2>').hide();
		ex.append(el);
		bg.append(ex);
		button = $('<a href="http://www.bottomline.co.uk/banking/index.html">Learn More &rarr;</a>').hide();
		bg.append(button);
		
		$('#uk-banner').append(bg);
		
		bg.fadeIn(2000);
		$('#uk-banner h1').fadeIn(2000, function(){
			ex.fadeIn().animate({width: 374, left: '2%'}, 1000).animate({width: 344, left: '4%'}, 800, function(){
				$('h2').fadeIn('slow', function(){
					button.fadeIn('slow', function(){
						bg.delay(4000).fadeOut(2000, function(){ $ukbanner.oak('collections'); });
					});
				});
			});
		});
	}
	
	
}


