// JavaScript Document
$(function() {
	$("div#makeMeScrollable").smoothDivScroll({	
		scrollingHotSpotLeft: "div.scrollingHotSpotLeft1", // The hot spot that triggers scrolling left.
		scrollingHotSpotRight: "div.scrollingHotSpotRight1",
		scrollingSpeed: 16, 
		mouseDownSpeedBooster: 3, 
		autoScroll: "", 
		autoScrollDirection: "endlessloop", 
		autoScrollSpeed: 2, 
		visibleHotSpots: "", 
		hotSpotsVisibleTime: 9, 
		startAtElementId: "startAtMe"
	});	
});

$(document).ready(function(){
	var bIsOver = false;
	var bIsOver2 = false;
	var bIsOver3 = false;
	$(".img_banner_top a").each(function(){	
		var imgProduct = $(this).find("img");
		$(this).hover(
			function(){
				bIsOver = true;
				 imgProduct.animate({	
					opacity: 1			 
				  }, 400, function() {
					   
				  });
				
			},
			function(){
				bIsOver = false;
				imgProduct.animate({	
					opacity: 0			 
				}, 400, function() {
				
				});
			}
		);
	});
	$(".scrollableArea a").each(function(){	
		var imgProduct = $(this).find("img");
		$(this).hover(
			function(){
				bIsOver2 = true;
				  imgProduct.animate({	
					opacity: 1			 
				  }, 400, function() {
					   
				  });
			},
			function(){
				bIsOver2 = false;
				imgProduct.animate({	
					opacity: 0			 
				}, 400, function() {
				
				});
			}
		);
	});
	$(".pn_banner_bottom a").each(function(){	
		var imgProduct = $(this).find("img");
		$(this).hover(
			function(){
			  bIsOver3 = true;
			  imgProduct.animate({	
				opacity: 1			 
			  }, 400, function() {
				   
			  });

				
			},
			function(){
				bIsOver3 = false;
				imgProduct.animate({	
					opacity: 0			 
				}, 400, function() {
				
				});

			}
		);
	});
	
	var checkBannerTop = function(){
		if (bIsOver == false){
			$(".img_banner_top a").each(function(){	
				var imgProduct = $(this).find("img");								 
				imgProduct.css("opacity",0);
			});
		}
		if (bIsOver2 == false){
			var iIndex = 1;
			$(".scrollableArea a").each(function(){	
				var imgProduct = $(this).find("img");								 
				imgProduct.css("opacity",0);
			});
		}
		if (bIsOver3 == false){
			var iIndex3 = 1;
			$(".pn_banner_bottom a").each(function(){	
				var imgProduct = $(this).find("img");								 
				imgProduct.css("opacity",0);
			});
		}
		setTimeout(checkBannerTop,2000);
	}
	setTimeout(checkBannerTop,2000);
	if (aBannerTopLoad){
		for(var i in aBannerTopLoad){
			var oImage = new Image();
			oImage.src = aBannerTopLoad[i];
		}
	}	
	if (aBannerCenterLoad){
		for(var i in aBannerCenterLoad){
			var oImage = new Image();
			oImage.src = aBannerCenterLoad[i];
		}
	}	
	if (aBannerBottomLoad){
		for(var i in aBannerBottomLoad){
			var oImage = new Image();
			oImage.src = aBannerBottomLoad[i];
		}
	}	
	var calBannerCenter = function(isResize){
		var iWidnowWidth = $(window).width();
		iWidnowWidth = iWidnowWidth - 120;
		$(".pn_banner_bottom").width(iWidnowWidth);
		$(".pn_banner_center").width(iWidnowWidth);
		var iPadding_Left = Math.ceil(iWidnowWidth * 124 / 1280);
		var iPadding_Right = Math.ceil(iWidnowWidth * 122 / 1280);
		
		$("div.scrollingHotSpotRight1").css("right",60);
		$("div.scrollingHotSpotLeft1").css("left",60);	
	}
	
	calBannerCenter();
		
	$(window).bind("resize",function(){									 
			calBannerCenter();
		});		
});
