/*
* dieu khien image slideshow
* Type:     Function use Jquery
* Name:     VLEdu_ImageSlideShow 
* Date:     July 14, 2008
* @author   Tri Do <tridn@von-inc.com >
*/
function VLEdu_ImageSlideShow(){
	var numImagesLoad=4;
	var speedScroll=1000;
	var numPageIndex=1;
	var numItems=$('.img_block').length;
	var numImgBlockWidth=$('.img_block').width();
	var numImgBlockHeight=$('.img_block').height();
	var isMove=false;
	for(var i=0;i<numItems;i++) $('.img_block:eq('+i+')').css("left",(i*numImgBlockWidth));
	$('.ctent_imglist').width(numImagesLoad * numImgBlockWidth);
	$('.ctent_imglist').height(numImgBlockHeight);
	$(".ls_btn_right").click(function(){
						if(numPageIndex<(numItems/numImagesLoad)){
							$(".img_block").animate({left:'-='+numImgBlockWidth*numImagesLoad+'px'}, speedScroll);
							numPageIndex++;
						}
					});
	$(".ls_btn_left").click(function(){
						if(numPageIndex>1){
							$(".img_block").animate({left:'+='+numImgBlockWidth*numImagesLoad+'px'}, speedScroll);
							numPageIndex--;
						}
					});
}
/*
* tao doi tuong va gan event
* Type:    
* Name:     
* Date:     July 14, 2008
* @author   Tri Do <tridn@von-inc.com >
*/
(function($) {
		$.fn.imageShow = function() 
		{
			function _initialize(){
				if ($('#img_zoom').css("background").match($(this).attr("href"))) return false;
				var strURL=$(this).attr("href")?$(this).attr("href"):"#";
				var strTitle=$(this).attr("title")?$(this).attr("title"):"";
				$('#image_description span').hide(50,function(){$(this).html(strTitle);});
				$('#img_zoom').fadeOut(300,function(){
					$(this).css("background","url("+strURL+") no-repeat center").fadeIn(600,function(){
						$('#image_description span').slideDown(300);
					});;
				});
				
				return false;
			}
			$('#img_zoom').css("background","url(" + $('.img_block a:first').attr("href") + ") no-repeat center");
			$('#image_description span').html($('.img_block a:first').attr("title"));
			return this.unbind('click').click(_initialize);
		};
})(jQuery);
