$(function(){
		   $("#salesBanner").corner("4px");
		   $("#productTopBar").corner("top 4px");
		   $("#productBottomBar").corner("bottom 4px");
		   $("#saunaLevel").corner("bottom 4px");
		   $("#productSlider").corner("4px");
		   $("#mainContent").corner("4px");
		   $("#newsletter").corner("4px");
		   $("#viewall").corner("4px");
		   $(".buyNow").corner("4px");
		   $("#join h3").corner("top 4px");
		   $("#productTitle").corner("top 4px");
		   $("#productMainTitle").corner("top 4px");
		   $("#productNav").corner("4px");
		   $("#mainProduct").corner("4px");
		   setTimeout(loadImages);
		   function images() {
			   if ($("#ck").css("display") != "none") {
				   //alert("ck");
				   imageArray = $("#ck .slide").toArray();
			   } else if ($("#d").css("display") != "none") {
				   //alert("d");
				   imageArray = $("#d .slide").toArray();
			   } else {
				   //alert("h");
				   imageArray = $("#h .slide").toArray();
			   }
			   imageSum = imageArray.length;
			   //alert(imageSum)
		   }
		   function loadImages () {;
			   images();
			   //alert("step 1 done");
			   imageProcess();
			   //alert("step 2 done");
			   slideFrame();
			   //alert("step 3 done");
		   }
		   function imageProcess(){
			   var n = 0;
			   if ($("#ck").css("display") != "none") {
				   $("#ck .imageContainer ul li a").each(function(){
																
																  var i = n;
																 
																   if(n<imageArray.length)
																  {
																  $(this).html("<div class='imgFrame' style=''><h1 class='slideTitle'>" + $(imageArray[i]).attr("title") + "</h1><img src=" +  $(imageArray[i]).attr("src") + " class='slide' title=" + $(imageArray[i]).attr("title") + " /></div>");
																  }
																  n++;
																  
																  });
			   } 
			   
			   n = 0;
			   if ($("#h").css("display") != "none") {
				   $("#h .imageContainer ul li a").each(function(){
																 
																 
																 var i = n;
																  if(n<imageArray.length)
																  {
																 $(this).html("<div class='imgFrame' style=''><h1 class='slideTitle'>" + $(imageArray[i]).attr("title") + "</h1><img src=" +  $(imageArray[i]).attr("src") + " class='slide' title=" + $(imageArray[i]).attr("title") + " /></div>");
																  }
																n++;
																
																 });
			   } 
			   n = 0;
			   if($("#d").css("display") != "none") {
				   $("#d .imageContainer ul li a").each(function(){
																 
																 
																 var i = n;
																  if(n<imageArray.length)
																  {
																 $(this).html("<div class='imgFrame' style=''><h1 class='slideTitle'>" + $(imageArray[i]).attr("title") + "</h1><img src=" +  $(imageArray[i]).attr("src") + " class='slide' title=" + $(imageArray[i]).attr("title") + " /></div>");
																 }
																 n++;
																  
																 });
			   }
		   }
		   function slideFrame() {
			   var imageWidth = $(".imgFrame").width();
//			  alert(imageWidth);
			   if(imageWidth==0) imageWidth=160;
			   
			   var num = imageArray.length;
			  
			   var imageContainer = (imageWidth + 20) * num;
			  
			   $(".imageContainer").css({
										"height" : $(".slide").height(),
										"width" : imageContainer,
										});
		   }
		   $(".SEKD").click(function(){
									$(".product").fadeOut(1000);
									$("#d").fadeIn(1000,function(){
																 setTimeout(loadImages);
																 });
									 });
		   $(".SEKCK").click(function(){
									$(".product").fadeOut(1000);
									$("#ck").animate({opacity: 1.0}, 1001).fadeIn();
									setTimeout(loadImages, 2001);
									 });
		   $(".SEKH").click(function(){
									$(".product").fadeOut(1000);
									$("#h").animate({opacity: 1.0}, 1001).fadeIn();
									setTimeout(loadImages, 2001);
									 });		    
		   $(".rightArrow").hover(function(){                                          
											window.status=$(".imageContainer").width();
                                            newWidth=parseInt($(".imageContainer").css("width"));
                                            if (newWidth > 540) {
												$(".imageContainer").animate({"left": -(newWidth - 540)}, 1000);
											}
										},
										function() {
												$(".imageContainer").stop();
										});
		   $(".leftArrow").hover(function(){
										    var position = $(".imageContainer").offset();
										   // alert (position.left);
										    $(".imageContainer").animate({"left": ($(".imageContainer").width() - $(".imageContainer").width())}, 1000);
										},
										function(){
										   $(".imageContainer").stop();
										});
		   $("#sekck").click(function(){
									  $(".footerProduct").stop();
									  $(".footerProduct").slideUp();
									  $("#footerck").slideDown();
									  });
		   $("#sekd").click(function(){
									  $(".footerProduct").stop();
									  $(".footerProduct").slideUp();
									  $("#footerd").slideDown();
									  });
		   $("#sekh").click(function(){
									  $(".footerProduct").stop();
									  $(".footerProduct").slideUp();
									  $("#footerh").slideDown();
									  });
		   $(".premium").click(function() {
										$(".productLevel").fadeOut(1000);
										$("#premium").animate({opacity: 1.0}, 1001).fadeIn();
										})
		   $(".luxory").click(function() {
										$(".productLevel").fadeOut(1000);
										$("#luxory").animate({opacity: 1.0}, 1001).fadeIn();
										})
		   $(".elite").click(function() {
										$(".productLevel").fadeOut(1000);
										$("#elite").animate({opacity: 1.0}, 1001).fadeIn();
										})
		   });
