/*jQuery.preloadImages = function(){ // image pre loader
	for(var i = 0; i<arguments.length; i++){
		jQuery("<img>").attr("src",arguments[i]);
	}
}

//$.preloadImages("img/banner/shoppingmall.jpg"); // preloads first image for slide banner, might still be too large
*/
$(document).ready(function(){ // process when DOM is ready

//window.onload = function(){ 
// process once everything is loaded */
	
	
	/* led advertisement */
	
	$("#fuzz2").css("height", $(document).height());
   	$("#fuzz2").css("width", $(document).width());    
   
	$("#fuzz2").fadeIn();  
          
   
	//When the message box is closed, fade out  
	$(".close2").click(function(){  
	$("#fuzz2").fadeOut();  
	return false;  
	});
	
	/* end led advertisement */
	
	
	
	if( $('#images').length > 0 ) {
		// vars for image bar for products
		lastBlock = $("#a1");
		maxWidth = 360; 
	  	minWidth = 225;
		newHeight = 330;
		speed = 1000;
		hSpeed = 3200;
	
		// opents the first atm description, called after image bar has animated for products
		function openATM(){
			$(lastBlock).animate({width: maxWidth+"px"}, { duration:speed});
		}
	
		// opens image bar on page load for products
		$("#images").animate({height: newHeight+"px"}, {duration:hSpeed, complete:function(){ openATM(); }} );
		
		// animates image bar on hover for products
		$("#images ul li a").hover(function(){
			//$(this.p).hide();
			$("this p").hide();
			$(lastBlock).animate({width: minWidth+"px"}, { queue:false, duration:speed });
			$("this p").fadeIn();
			$(this).animate({width: maxWidth+"px"}, { queue:false, duration:speed});
			lastBlock = this;
			}
		);
	
	}
		
	
	if( $('#slidebanner').length > 0 ){
	
	/*
		//$('#bannertext1').fadeIn(speed);
	
		//slide banner text
		function fadeText(){
		var speed = 2600;
		$('#bannertext1').fadeIn(speed, function(){
			$('#bannertext1').fadeOut(speed, function(){
				$('#bannertext2').fadeIn(speed, function(){
					$('#bannertext2').fadeOut(speed, function(){
						$('#bannertext3').fadeIn(speed, function(){
							$('#bannertext3').fadeOut(speed, function(){
								$('#bannertext4').fadeIn(speed, function(){
									$('#bannertext4').fadeOut(speed, function(){
										$('#bannertext5').fadeIn(speed, function(){
											$('#bannertext5').fadeOut(speed, function(){
												$('#bannertext6').fadeIn(speed, function(){
													$('#bannertext6').fadeOut(speed, function(){
														$('#bannertext7').fadeIn(speed, function(){
															$('#bannertext7').fadeOut(speed, function(){
																$('#bannertext8').fadeIn(speed, function(){
																	$('#bannertext8').fadeOut(speed, function(){
																		$('#bannertext9').fadeIn(speed, function(){
																			$('#bannertext9').fadeOut(speed, function(){
																				$('#replaylink').fadeIn(speed);	
																			})
																		})
																	})						
																})						
															})						
														})						
													})					
												})	
											})
										})
									})
								})
							})
						})
					})
				})
			})
		})
		}
		
		

	
	
		// slide banner on main page
		$('#slidebanner').crossSlide({
		fade: 1,
		loop: 1
	
		},[
	
		{
			src:  'img/banner/shoppingmall.jpg',
			href: '',
			from: '100% 100% 1x',
			to:   '20% 20% 2x',
			time: 4
		},{
			src:  'img/banner/slotmachine.jpg',
			href: '',
			from: '25% 50% 2x',
			to:   '75% 50% 1x',
			time: 4
		},{
			src:  'img/banner/hiexpress.jpg',
			href: '',
			from: '40% 50% 2x',
			to:   '50% 50% 0.5x',
			time: 4
		},{
			src:  'img/banner/esso.jpg',
			href: '',
			from: '30% 30% 1.5x',
			to:   '0% 0% 1.5x',
			time: 4
		},{
			src:  'img/banner/mcds.jpg',
			href: '',
			from: '50% 85% 1x',
			to:   '50% 20% 1x',
			time: 4
		}, {
			src:  'img/banner/moxies.jpg',
			href: '',
			from: '100% 40% 1x',
			to:   '100% 15% 1.7x',
			time: 4
		}, {
			src:  'img/banner/shell.jpg',
			href: '',
			from: '0% 35% 1.5x',
			to:   '75% 15% 1x',
			time: 4
		},{
			src:  'img/banner/pub.jpg',
			href: '',
			from: '0% 35% 1.5x',
			to:   '75% 15% 1x',
			time: 4
		}, {
			src:  'img/banner/ultramar.jpg',
			href: '',
			from: '100% 80% 1x',
			to:   '60% 20% 1.4x',
			time: 4
		}, {
			src:  'img/banner/lastimage.jpg',
			href: '',
			from: '0% 0% 1x',
			to:   '0% 0% 1x',
			time: 4
		}
		]);
		
		//fadeText();
	*/
	} // end if slide banner exists
	
	
	// new menu bar
	
	
	$('#menubar li a').hover(
				
		function(){ // mouse in
			if( $(this).hasClass("animateme") )
			$(this).animate( {lineHeight: "60px"},{queue:false, duration:200} );
		},
		function(){ // mouse out
			if($(this).hasClass("animateme"))
			$(this).animate( {lineHeight: "30px"}, {queue:false,duration:200} );
		}
		
		
		
	);


	$('#curpage').animate({
		lineHeight: "60px"
		},{
		queue:false,
		duration:200
		}
	);
	
	
	
	

	
});
//}

