$(document).ready(function(){
	$('a.video_open').click(function () {
		$("div.div_block").width("958px");
		$("div.div_block").animate({ 
		height: $("div.content").height()+270,
        opacity: 0.3
      }, 100);
		
		$("div.video_pnl").animate({ marginTop: 0 }, 500);
		
		var movie = window.document.e_card;
		movie.Rewind();
		movie.Play();
		
		return false;
	});
	
	$('a.video_close').click(function () {
		var margT = -357;
		if (jQuery.browser.msie) {
			margT = -360;
		}
		var movie = window.document.e_card;
		movie.StopPlay();
		
		$("div.video_pnl").animate({ marginTop: margT }, 500);
		$("div.div_block").animate({ height: 0, opacity: 0}, 100);
		$("div.div_block").width("0px");
		return false;
	});
	
	/*
	$('a.watch_video').click(function () {
		//$(document).scrollTop(0);
		//$("body").animate({ scrollTop: 100 }, "slow");

		
		$("div.div_block").width("958px");
		$("div.div_block").animate({ 
		height: $("div.content").height()+270,
        opacity: 0.3
      }, 100);
		
		$("div.video_pnl").animate({ marginTop: 0 }, 500);

		var movie = window.document.e_card;
		movie.Rewind();
		movie.Play();
		
		return false;
	});
	*/
	
	var step = 555;
	var someScroll = function (sign, num) {
		var move = 0;
		if (sign>0)
			move = -step*(num-1);
		else if (sign<0)
			move = -step*num;
		return move;
	};
	var length = 0;
	$('.div_quat table td').each(function(num){
		length++;
	});
	var co = 1;
	$('a.slide_left').click(function () {
		if (co<length) {
			$('.div_quat table').animate({marginLeft:someScroll(-1, co)},300);
			co++;
		}
		return false;
	});
	$('a.slide_right').click(function () {
		if (co>1) {
			co--;
			$('.div_quat table').animate({marginLeft:someScroll(1, co)},300);
		}
		return false;
	});
});