var boxY	= 530;
var step	= 1;
var margin	= 0;
var newsY	= 0;
var z1Y		= 0;
var stop = false;

$(document).ready(function(){
	cC = $("#z1 > *").length;
	for(i=1;i<=cC;i++){
		czH = $("#z1 > *:nth-child("+i+")").css("height");
		newsY += Math.round(parseInt(czH));
	}
	z1Y = Math.round(parseInt($(".bgMovie").css("height")));
	$("#more_view").mouseover(function(){
		stop = false;
		slideUp(2000);
	});
	$("#more_view").mouseout(function(){
		stop = true;
	});
	$("#less_view").mouseover(function(){
		stop = false;
		slideDown(2000);
	});
	$("#less_view").mouseout(function(){
		stop = true;
	});
});

function slideUp(t){
	if(stop)return true;
	slide = Math.round(parseInt( $("#z1 > *:nth-child("+step+")").css("height") )) + 4;
	if( margin+boxY>=newsY ){
		rr = z1Y - boxY;
		$("#z1").animate({
				marginTop: "-" + rr + "px"
		},1500);
		return true;
	}else{
		margin += slide;
		rr = z1Y - boxY;
		margin = margin>rr?rr:margin;
		$("#z1").animate({
				marginTop: "-" + margin + "px"
		},1500);
		step++;
		window.setTimeout("slideUp("+t+")",t);
	}
}

function slideDown(t){
	if(stop)return true;
	if(step<=0){
		stop = true;
		$("#z1").animate({
				marginTop: "0px"
		},1500);
		return true;
	}
	slide = Math.round(parseInt( $("#z1 > *:nth-child("+step+")").css("height") )) + 4;
	if(margin<=0){
		stop = true;
		$("#z1").animate({
				marginTop: "0px"
		},1500);
		return true;
	}else{
		margin -= slide;
		margin = margin<0?0:margin;
		$("#z1").animate({
				marginTop: "-" + margin + "px"
		},1500);
		step--;
		window.setTimeout("slideDown("+t+")",t);
	}
	
}
