$(function(){
	//Remove »º´æ
	$.ajaxSetup({
		cache: false //close AJAX cache
	});
	
	//Var
	var Time;//Time=Interval(ImagesScroll)
	var change=1;//change=btn(it).it
	
	//btn.mousemove(it){Images.Scroll(it)}
	$(".page").css({top:"10",left:$(".top").offset().left+8});	   
		   
	$(".div-hide").css({top:$("#viewer").offset().top+223,left:$("#viewer").offset().left+8});
	$(".div-text").css({top:$("#viewer").offset().top+223,left:$("#viewer").offset().left+8});
	//$(".div-text").find("td:first").load("../dataload/ImagesScroll.asp?it=1");
	 $(".div-text").find("td:first").html(vstr[0])		
		   $(".div-hide").fadeTo(1,0.5);
		   //$(".div-hide").hide();
		
	//ImagesScroll()
	
	var ImagesScroll = function(it){
	if (it>5){it=it % 5};
	if (change!=it)
	{
		
		//alert($(".page").offset().top);
		//alert($(".page").offset().left);
		//alert("111");
		$("#btn"+change).find("img").attr("src","main/images/in/btn.jpg");
		$("#btn"+it).find("img").attr("src","main/images/in/btn1.jpg");
		//Rmover>setTimeout
		window.clearTimeout(Time);
		
		$(".div-hide").stop(true)
		$(".div-text").stop(true)
		$(".div-hide").hide();
		$(".div-text").hide();
		//$(".div-hide").fadeTo(1,1);
		
		//$(".div-show").fadeTo(1,0.25);
		
			$("#viewerFrame").stop(true,true);
			$("#viewerFrame").find("img:last").attr("src",imgs[it-1])
			$("#viewerFrame").animate( {marginLeft:-585}, '1000', function(){
				$("#viewerFrame").find("img:first").appendTo( $("#viewerFrame") );
				$("#viewerFrame").css("marginLeft",0);
			});
			
		$(".div-hide").css({top:$("#viewer").offset().top+223,left:$("#viewer").offset().left+8});
		$(".div-text").css({top:$("#viewer").offset().top+223,left:$("#viewer").offset().left+8});
		/*
	$(".div-text").find("td:first").load(vstr[it],function(){
			//hide.div.fadeTo()
			$(".div-hide").fadeTo(2000,0.5);$(".div-text").fadeTo(2000,1);
		}
		
		
		);
*/



    $(".div-text").find("td:first").html(vstr[it-1])
	$(".div-hide").fadeTo(2000,0.5);$(".div-text").fadeTo(2000,1);
		change=it;
		a=change+1
		Time=window.setTimeout(swap(a),6000);
	}
	};

	//Is form.size.change()
	$(window).resize(function(){
							  
		$(".page").css("left",$(".top").offset().left+8);
		$(".div-hide").css({top:$("#viewer").offset().top+223,left:$("#viewer").offset().left+8});					  
		$(".div-text").css({top:$("#viewer").offset().top+223,left:$("#viewer").offset().left+8});
	})
	
	$("#viewerFrame").find("img").css("cursor","hand").click(function(){
		window.open("../main/News_Detail.asp"+vlinks[change-1]);
	})
	
		//swap
	var swap=function(it){
	return function(){
	ImagesScroll(it);
	};
	};
	
	
		//paly.hover()
	var size=function(){
		$(this).animate({width:"40",height:"40"},50);
	};
	var sizet=function(){
		$(this).stop(true);
		//clearInterval(play);
		$(this).css({width:"36",height:"36"});
	};
	$(".div-text").find("img:last").hover(size,sizet);
	$(".div-text").css("cursor","hand").click(function(){
		window.open("../main/News_Detail.asp" + vlinks[change-1]);
	});
	
	
		//Is load>Time
	setTimeout(swap(2),3000);
	
	$("#btn1").css("cursor","hand").mouseover(function(){
		ImagesScroll(1);
	});
	$("#btn2").css("cursor","hand").mouseover(function(){
		ImagesScroll(2);
	});	
	$("#btn3").css("cursor","hand").mouseover(function(){
		ImagesScroll(3);
	});	
	$("#btn4").css("cursor","hand").mouseover(function(){
		ImagesScroll(4);
	});
	$("#btn"+"5").css("cursor","hand").mouseover(function(){
		ImagesScroll(5);
	});

});






