// JavaScript Document
function LiveShowFirstData() { //v3.0
  	var d=document; 
  	if(d.images){
		if(dataLiveShow.length > 0){
			for(var i = 0; i < dataLiveShow.length; i++){
				var image1 = new Image; 
				image1.src = dataLiveShow[i].data;
				dataLiveShow[i].dataLoading = 0;
				doWhileLoading(image1, i, 1);
				
				var image2 = new Image; 
				image2.src = dataLiveShow[i].thumb;
				dataLiveShow[i].thumbLoading = 0;
				doWhileLoading(image2, i, 2);
			}	
		}
	}
}

function doWhileLoading (tempimage, index, type) {
	if (tempimage.complete ) {
		if(type == 1)
			dataLiveShow[index].dataLoading = 1;
		else if(type == 2)
			dataLiveShow[index].thumbLoading = 1;
   	}else{
		setTimeout(function () {	 
			doWhileLoading(tempimage, index, type)
		}, 100);
	}
}
function findPosXs(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (1) {
            curleft+=obj.offsetLeft;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.x) {
        curleft+=obj.x;
    }
    return curleft;
}

function findPosYs(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (1) {
            curtop+=obj.offsetTop;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.y) {
        curtop+=obj.y;
    }
    return curtop;
}
function Show_element(element, max_opacity) {
	var reduceOpacityBy = 4;
	var rate = 40;	// 15 fps
	if (opacityLiveShow < max_opacity) {
		opacityLiveShow += reduceOpacityBy;
		if (opacityLiveShow > max_opacity) {
			opacityLiveShow = max_opacity;
		}
		if(opacityLiveShow == max_opacity){
			keyCheck = true;
			mainLiveShow.style.cursor = 'default';
		}
		if (element.filters) {
			try {
				element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacityLiveShow;
			} catch (e) {
				// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
				element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacityLiveShow + ')';
			}
		} else {
			element.style.opacity = opacityLiveShow / 100;
		}
	}
	if (opacityLiveShow < max_opacity) {
		setTimeout(function () {
			Show_element(element, max_opacity);
		}, rate);
	}
}
function Show_obj(element, opacity) {
	var reduceOpacityBy = 4;
	var rate = 40;	// 15 fps
	var max_opacity = 100;
	if (opacity < max_opacity) {
		opacity += reduceOpacityBy;
		if (opacity > max_opacity) {
			opacity = max_opacity;
		}

		if (element.filters) {
			try {
				element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
			} catch (e) {
				// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
				element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity + ')';
			}
		} else {
			element.style.opacity = opacity / max_opacity;
		}
	}

	if (opacity < max_opacity) {
		setTimeout(function () {
			Show_obj(element, opacity);
		}, rate);
	}
}
function Hide_obj(element, opacity) {
	var reduceOpacityBy = 4;
	var rate = 40;	// 15 fps
	if (opacity > 0) {
		opacity -= reduceOpacityBy;
		if (opacity < 0) {
			opacity = 0;
		}
		if(opacity == 0){
			element.style.visibility = 'hidden';
			return false;
		}
		if (element.filters) {
			try {
				element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
			} catch (e) {
				// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
				element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity + ')';
			}
		} else {
			element.style.opacity = opacity / 100;
		}
	}
	if (opacity > 0) {
		setTimeout(function () {
			Hide_obj(element, opacity);
		}, rate);
	}
}
function Hide_element(element, opacity) {
	var reduceOpacityBy = 4;
	var rate = 40;	// 15 fps
	if (opacityLiveShow > opacity) {
		opacityLiveShow -= reduceOpacityBy;
		if(opacityLiveShow < 0) {
			opacityLiveShow = 0;
		}
		if(opacityLiveShow <= opacity){
			opacityLiveShow = opacity;
		}
		if (element.filters) {
			try {
				element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacityLiveShow;
			} catch (e) {
				// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
				element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacityLiveShow + ')';
			}
		} else {
			element.style.opacity = opacityLiveShow / 100;
		}
		if(opacityLiveShow <= opacity){
			kich_hoat = false;
			setTimeout(function () {				 
				NewItemLiveShow(element);
			}, 40);
			return;		
		}
	}
	if (opacityLiveShow > opacity) {
		setTimeout(function () {
			Hide_element(element, opacity);
		}, rate);
	}
}
function setOpacityLive(element, opacity){
	if (element.filters) {
		try {
			element.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
		} catch (e) {
			// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
			element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity + ')';
		}
	} else {
		element.style.opacity = opacity / 100;
	}
	//element.style.display = "block";
}
var rates = 25;
var dataLiveShow = [];
var gogo = 1;	// 1:qua phai	2:qua trai
var kich_hoat = false;
var showIndex = -1;
var opacityLiveShow = 100;
var currentWidth = 400;
var currentHeight = 300;
var mainLiveShow = null;
var keyCheck = true;
var play = true;
var timeOut;
function RunLiveShow(div_run){
	
	mainLiveShow = document.getElementById(div_run);
	currentWidth = parseInt($(mainLiveShow).width());
	currentHeight = parseInt($(mainLiveShow).height());
	
	var thumb_section = document.createElement("div");
	window.document.body.appendChild(thumb_section);
	thumb_section.id = "thumb-section";
	thumb_section.style.left = (findPosXs(mainLiveShow)+(currentWidth-425)) + 'px';
	thumb_section.style.top = (findPosYs(mainLiveShow)+currentHeight-65) + 'px';
	thumb_section.style.visibility = 'visible';
	thumb_section.style.width = '100px';
	thumb_section.style.height = '14px';
	thumb_section.style.position = 'absolute';
	thumb_section.style.zIndex = 200;
	thumb_section.style.overflow = 'hidden';
	loadThumb();
//	thumb_section.onclick = function(event) {
//		moveThumb(event);
//	}
	/*
	var controller = document.getElementById("controller-liveshow");	
	controller.style.left = (findPosXs(mainLiveShow)+Math.round((currentWidth-238)/2)) + 'px';
	controller.style.top = (findPosYs(mainLiveShow)+Math.round((currentHeight-42)/2)) + 'px';
	controller.style.visibility = 'hidden'; */
	
	if(showIndex > dataLiveShow.length-1) showIndex = 0; 
	//thumb_
	for(var i = 0; i < dataLiveShow.length; i++){
		if(i == showIndex){
			setOpacityLive(document.getElementById('thumb_'+i), 100);	
		}else{
			setOpacityLive(document.getElementById('thumb_'+i), 50);	
		}	
	}
	kich_hoat = true;
	mainLiveShow.style.background = 'url('+dataLiveShow[showIndex].data+') no-repeat scroll';
	mainLiveShow.style.backgroundPosition = '0px 0px';	
	//setOpacityLive(mainLiveShow, 0);
	//Show_element(mainLiveShow, 100);
	
	var maxWidth = dataLiveShow[showIndex].width;
	var maxHeight = dataLiveShow[showIndex].height;
	if(maxWidth > currentWidth || maxHeight > currentHeight)
		LiveShow(mainLiveShow, maxWidth, maxHeight, 0, 0, 1);	
	/*	
	mainLiveShow.onmouseover = function(){
	//	setOpacityLive(controller, 0);
		controller.style.visibility = 'visible';	
	//	Show_obj(controller,0);
	};		
	mainLiveShow.onmouseout = function(){
		controller.style.visibility = 'hidden';
	//	Hide_obj(controller,100);	
	};
	controller.onmouseover = function(){
	//	setOpacityLive(controller, 0);
		controller.style.visibility = 'visible';	
	//	Show_obj(controller,0);
	};	
	*/
}
function playLiveShow(){
	if(keyCheck){
		play = true;
		keyCheck = false;
	}	
}
function pauseLiveShow(){
//	if(keyCheck){
		if(play){
			play = false;
			document.getElementById("playOrpause").className = 'play';
		}else{
			play = true;
			document.getElementById("playOrpause").className = 'pause';	
		}
//		keyCheck = false;
//	}
}
function nextLiveShow(){
	if(keyCheck){
		setOpacityLive(document.getElementById('thumb_'+showIndex), 50);	
		showIndex ++;
		if(showIndex > dataLiveShow.length-1) showIndex = 0; 
		if(showIndex < 0) showIndex = dataLiveShow.length-1;
		setOpacityLive(document.getElementById('thumb_'+showIndex), 100);
		Hide_element(mainLiveShow, 20);
		keyCheck = false;
	}
}
function PrevLiveShow(){
	if(keyCheck){
		setOpacityLive(document.getElementById('thumb_'+showIndex), 50);	
		showIndex --;
		if(showIndex > dataLiveShow.length-1) showIndex = 0; 
		if(showIndex < 0) showIndex = dataLiveShow.length-1;
		setOpacityLive(document.getElementById('thumb_'+showIndex), 100);
		Hide_element(mainLiveShow, 20);
		keyCheck = false;
	}
}
function LastLiveShow(){
	if(keyCheck){
		setOpacityLive(document.getElementById('thumb_'+showIndex), 50);	
		showIndex = dataLiveShow.length-1;
		if(showIndex > dataLiveShow.length-1) showIndex = 0; 
		if(showIndex < 0) showIndex = dataLiveShow.length-1;
		setOpacityLive(document.getElementById('thumb_'+showIndex), 100);
		Hide_element(mainLiveShow, 20);
		keyCheck = false;
	}
}
function FirstLiveShow(){
	if(keyCheck){
		setOpacityLive(document.getElementById('thumb_'+showIndex), 50);	
		showIndex = 0;
		if(showIndex > dataLiveShow.length-1) showIndex = 0; 
		if(showIndex < 0) showIndex = dataLiveShow.length-1;
		setOpacityLive(document.getElementById('thumb_'+showIndex), 100);
		Hide_element(mainLiveShow, 20);
		keyCheck = false;
	}	
}
function MoveIndexLiveShow(index, e){
	if(keyCheck){
		setOpacityLive(document.getElementById('thumb_'+showIndex), 50);	
		showIndex = index;
		
		if(showIndex > dataLiveShow.length-1) showIndex = 0; 
		if(showIndex < 0) showIndex = dataLiveShow.length-1;
		setOpacityLive(document.getElementById('thumb_'+showIndex), 100);
		moveThumb(e);
		mainLiveShow.style.cursor = 'wait';
		Hide_element(mainLiveShow, 20);
		keyCheck = false;
	}
}
function NewItemLiveShow(mainLiveShow){
	
	kich_hoat = true;
	mainLiveShow.style.background = 'url('+dataLiveShow[showIndex].data+') no-repeat scroll';
	mainLiveShow.style.backgroundPosition = '0px 0px';	
	//setOpacityLive(mainLiveShow, 0);
	Show_element(mainLiveShow, 100);
	var maxWidth = dataLiveShow[showIndex].width;
	var maxHeight = dataLiveShow[showIndex].height;
	if(maxWidth > currentWidth || maxHeight > currentHeight)
		LiveShow(mainLiveShow, maxWidth, maxHeight, 0, 0, 1);
}
// huongdi: 1:di xuong  -	2:di len	-	3:qua phai	4:qua trai
function LiveShow(element, maxWidth, maxHeight, top, left, huongdi){
	if(!kich_hoat){
		return;
	}
	if(huongdi == 1){	// Di xuong
		if(maxHeight - currentHeight + top <= 0){	// Gap tro ngai, khong the di
			if(left <= currentWidth-maxWidth && top <= currentHeight-maxHeight){
				if(play) nextLiveShow();
				gogo = 2;
			}else if(left >= 0 && top >= 0){
				gogo = 1;	
			}
			if(gogo == 1){
				if(maxWidth - currentWidth + left > 0){	// Di qua phai
					LiveShow(element, maxWidth, maxHeight, top, left, 3);
				}else if(left < 0){	// Di qua trai
					LiveShow(element, maxWidth, maxHeight, top, left, 4);	
				}else if(top < 0){	// Di len
					LiveShow(element, maxWidth, maxHeight, top, left, 2);		
				}		
			}else if(gogo == 2){
				if(left < 0){	// Di qua trai
					LiveShow(element, maxWidth, maxHeight, top, left, 4);	
				}else if(maxWidth - currentWidth + left > 0){	// Di qua phai
					LiveShow(element, maxWidth, maxHeight, top, left, 3);
				}else if(top < 0){	// Di len
					LiveShow(element, maxWidth, maxHeight, top, left, 2);		
				}	
			}
			return;
		}
		top -= 1;
	}else if(huongdi == 2){	// Di len
		if(top >= 0){
			if(left <= currentWidth-maxWidth && top <= currentHeight-maxHeight){
				if(play) nextLiveShow();
				gogo = 2;	
			}else if(left >= 0 && top >= 0){
				gogo = 1;	
			}
			if(gogo == 1){
				if(maxWidth - currentWidth + left > 0){	// Di qua phai
					LiveShow(element, maxWidth, maxHeight, top, left, 3);
				}else if(left < 0){	// Di qua trai
					LiveShow(element, maxWidth, maxHeight, top, left, 4);	
				}else if(maxHeight - currentHeight + top > 0){	// Di xuong
					LiveShow(element, maxWidth, maxHeight, top, left, 1);		
				}	
			}else if(gogo == 2){
				if(left < 0){	// Di qua trai
					LiveShow(element, maxWidth, maxHeight, top, left, 4);	
				}else if(maxWidth - currentWidth + left > 0){	// Di qua phai
					LiveShow(element, maxWidth, maxHeight, top, left, 3);
				}else if(maxHeight - currentHeight + top > 0){	// Di xuong
					LiveShow(element, maxWidth, maxHeight, top, left, 1);		
				}	
			}
			return;
		}
		top += 1;
	}else if(huongdi == 3){	// di qua phai
		goRight(element, maxWidth, maxHeight, top, left, huongdi, 0);
		return;
	}else if(huongdi == 4){	// di qua trai
		goLeft(element, maxWidth, maxHeight, top, left, huongdi, 0);
		return;
	}
	element.style.backgroundPosition = left + 'px ' + top + 'px';
	setTimeout(function () {
		LiveShow(element, maxWidth, maxHeight, top, left, huongdi);
	}, rates);
}
function goLeft(element, maxWidth, maxHeight, top, left, huongdi, dem){
	if(!kich_hoat){
		return;
	}
	if(dem >= currentWidth || left >= 0){
		if(left <= currentWidth-maxWidth && top <= currentHeight-maxHeight){
			if(play) nextLiveShow();
			gogo = 2;
		}else if(left >= 0 && top >= 0){
			gogo = 1;	
		}
		if(top < 0){	// Di len
			LiveShow(element, maxWidth, maxHeight, top, left, 2);		
		}else if(maxHeight - currentHeight + top > 0){ // Di xuong
			LiveShow(element, maxWidth, maxHeight, top, left, 1);		
		}else if(maxWidth - currentWidth + left > 0){	// Di qua phai
			LiveShow(element, maxWidth, maxHeight, top, left, 3);	
		}
		return;	
	}
	dem ++;
	left += 1;
	element.style.backgroundPosition = left + 'px ' + top + 'px';
	setTimeout(function () {
		goLeft(element, maxWidth, maxHeight, top, left, huongdi, dem);
	}, rates);
}
function goRight(element, maxWidth, maxHeight, top, left, huongdi, dem){
	if(!kich_hoat){
		return;
	}
	if(dem >= currentWidth || maxWidth - currentWidth + left <= 0){
		if(left <= currentWidth-maxWidth && top <= currentHeight-maxHeight){
			if(play) nextLiveShow();
			gogo = 2;	
		}else if(left >= 0 && top >= 0){
			gogo = 1;	
		}
		if(top < 0){	// Di len
			LiveShow(element, maxWidth, maxHeight, top, left, 2);		
		}else if(maxHeight - currentHeight + top > 0){ // Di xuong
			LiveShow(element, maxWidth, maxHeight, top, left, 1);		
		}else if(left < 0){	// Di qua trai
			LiveShow(element, maxWidth, maxHeight, top, left, 4);	
		}
		return;	
	}
	dem ++;
	left -= 1;
	element.style.backgroundPosition = left + 'px ' + top + 'px';
	setTimeout(function () {
		goRight(element, maxWidth, maxHeight, top, left, huongdi, dem);
	}, rates);
}
var km = 0;
var timerID, timeTam;
var dem_km = 0;
var kc = 155;

function move_obj(ty){
	if(ty == 'right'){
		dem_km = 0;
		var objkm = document.getElementById('thumb-section');
		var tbl_km = document.getElementById('rpdata1_listimg');									
		var len = tbl_km.offsetWidth - objkm.offsetWidth;
		var len_2 = tbl_km.offsetWidth - objkm.offsetWidth - objkm.scrollLeft;
		if(len >= kc && len_2 >= kc) start_r();
	}else if(ty == 'left'){
		dem_km = 0;
		start_l();
	}
}
	
function start_r() {
 	var objkm = document.getElementById('thumb-section');
	var tbl_km = document.getElementById('rpdata1_listimg');									
	var len = tbl_km.offsetWidth - objkm.offsetWidth;
	objkm.scrollLeft = km;
	if (km < len){
		if(dem_km < kc){
			dem_km += 5;
			km = km + 5;
			timerID = setTimeout("start_r()", 5);
		}else{
			dem_km = 0;
			DungLai();
		}
	}
	else{
		DungLai();
	}
}	

function start_l() {	
 	var objkm = document.getElementById('thumb-section');	
	objkm.scrollLeft = km;
	if (km > 0){
		if(dem_km < kc){
			dem_km += 5;
			km = km - 5;
			timerID = setTimeout("start_l()", 5);
		}else{
			dem_km = 0;
			DungLai();
		}
	}
	else{
		DungLai();
	}		
}
function DungLai(){
	if(timerID){
		timeTam = timerID;
		clearTimeout(timerID);
	}
}
function moveThumb(e){
//	if(keyCheck){
		if(document.all)e = event;
		var thumb_section = document.getElementById("thumb-section");	
		
		var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
		
		var leftPos = e.clientX-thumb_section.offsetLeft;
		if(leftPos < 0)leftPos = 0;	
		var topPos = e.clientY + st-thumb_section.offsetTop;
		if(topPos < 0) topPos = 0;
		
	//	var pos_x = parseInt(e.offsetX?(e.offsetX):e.pageX-thumb_section.offsetLeft);
	//	var pos_y = parseInt(e.offsetY?(e.offsetY):e.pageY-thumb_section.offsetTop);
	//	alert('x: '+leftPos+' y: '+topPos);
		if(leftPos <= 155){
			move_obj('left');	
		}else if(leftPos > 310){
			move_obj('right');		
		}
//	}
}

function loadThumb(){
	var str = '';
	var str_data = '';
	if(dataLiveShow.length > 0){
		str += '<table id="rpdata1_listimg" cellpadding="0" cellspacing="0" border="0">';
		str += '<tr>';		
		for(var i = 0; i < dataLiveShow.length; i++){
			str += '<td align="left" valign="top">';
			str += '<table cellpadding="0" cellspacing="0" border="0" width="22px">';
			str += '<tr><td width="100%" align="left" valign="middle"><div style="width:15px; height:15px; border:1px solid #949fa7; cursor:pointer; background:url('+dataLiveShow[i].thumb+') transparent;" id="thumb_'+i+'"></div></td></tr>';
			str += '</table>';
			str += '</td>';
			str_data += '<div id="images_'+i+'" style="width:'+currentWidth+'px; height:'+currentHeight+'px; position:absolute; top:0px; left:'+currentWidth+'px; z-index:90; background:url('+dataLiveShow[i].data+') no-repeat"></div>';
		}	
		str += '</tr>';
		str += '</table>';
	}
	$("#thumb-section").empty().append(str);
	$(mainLiveShow).empty().append(str_data);
	for(var j = 0; j < dataLiveShow.length; j++){
		document.getElementById("thumb_"+j).onclick = function(){
			checkSelect = true;
			var arr__ = this.id.split("_");
			MoveIndexLiveShow2(parseInt(arr__[arr__.length-1]));			
		}
	}	
}
function loaddata(){
	var str = '';
	if(dataLiveShow.length > 0){
		for(var i = 0; i < dataLiveShow.length; i++){
			str += '<div id="images_'+i+'" style="width:580px; height:342px; position:absolute; top:0px; left:'+currentWidth+'px; z-index:90; background:url('+dataLiveShow[i].data+') no-repeat"></div>';
		}	
	}
	$(mainLiveShow).empty().append(str);	
}
var checkSelect = false;
function MoveIndexLiveShow2(index_){	//thumb_
	if(document.getElementById("mainImages")){
		if(index_ != showIndex){		
			for(var i = 0; i < dataLiveShow.length; i++){
				if(i == showIndex){
					document.getElementById("images_"+i).style.zIndex = 95;
				//	document.getElementById("thumb_"+i).style.border = "1px solid #fdb736";
				}else if(i != index_){
					document.getElementById("images_"+i).style.zIndex = 90;		
				//	document.getElementById("thumb_"+i).style.border = "1px solid #949fa7";
				}	
			}
			for(var i = 0; i < dataLiveShow.length; i++){
				if(i == index_){
					document.getElementById("thumb_"+i).style.border = "1px solid #fdb736";
				}else{
					document.getElementById("thumb_"+i).style.border = "1px solid #949fa7";
				}	
			}
					
			showIndex = index_;
			
			var image_index2 = document.getElementById("images_"+showIndex);
			image_index2.style.zIndex = 100;
			image_index2.style.left = currentWidth+'px';
			
			$(image_index2).animate({
			  left: 0
			}, 1000);
		}
	}else{ clearTimeout(timeOut);	}
}
function AutoPlay(){
	if(document.getElementById("mainImages")){
		var time = 5000;	
		if(checkSelect){
			time = 10*1000;
			checkSelect = false;
		}else{	
			var dem = showIndex+1;
			if(dem > dataLiveShow.length-1) dem = 0;
			MoveIndexLiveShow2(dem);		
		}
		timeOut = setTimeout(function () {		 
			AutoPlay();			 
		}, time);
	}else{
		clearTimeout(timeOut);	
	}
}

function MoveIndexMain(){
	var image_index2 = document.getElementById("images_main");
	image_index2.style.zIndex = 100;
	image_index2.style.left = currentWidth+'px';
	
	$(image_index2).animate({
	  left: 0
	}, 1000);
	
	setTimeout(function () {
		AutoPlay();			 
	}, 5000); 
}
function WaitingLoadImage(){
	var i = 0;
	for(i = 0; i < dataLiveShow.length; i++){
		if(typeof(dataLiveShow[i].dataLoading) == "undefined" || typeof(dataLiveShow[i].thumbLoading) == "undefined"){
			timeOut = setTimeout(function () {
				WaitingLoadImage();
			}, 100);
			return;
		}else{
			if(dataLiveShow[i].dataLoading == 0 || dataLiveShow[i].thumbLoading == 0){
				timeOut = setTimeout(function () {
					WaitingLoadImage();
				}, 100);
				return;	
			}
		}		
	}
	if(i >= (dataLiveShow.length - 1)){
		loadThumb();
		timeOut = setTimeout(function () {
			MoveIndexLiveShow2(0);
			timeOut = setTimeout(function () {
				AutoPlay();			 
			}, 5000); 	
		}, 500);
		timeOut = setTimeout(function () {
			$("#thumb-section").show("drop");	
		}, 500);	
	}
}

function RunLiveShow2(div_run){	
	
	mainLiveShow = document.getElementById(div_run);
	currentWidth = parseInt($(mainLiveShow).width());
	currentHeight = parseInt($(mainLiveShow).height());
	
	var thumb_section = document.createElement("div");
	document.getElementById("mainImages").appendChild(thumb_section);
	thumb_section.id = "thumb-section";
	var width_thumb = 22*dataLiveShow.length - 5;
	/*thumb_section.setAttribute("style", 'float:right; width:'+width_thumb+'px; position:relative; overflow:hidden; z-index:200; margin-top:-25px; margin-right:10px; display:none');*/
	$("#thumb-section").css("float", 'right');
	$("#thumb-section").css("width", width_thumb+'px');
	$("#thumb-section").css("position", 'relative');
	$("#thumb-section").css("overflow", 'hidden');
	$("#thumb-section").css("z-index", '200');
	$("#thumb-section").css("margin-top", '-25px');
	$("#thumb-section").css("margin-right", '10px');
	$("#thumb-section").css("display", 'none');
	WaitingLoadImage();
}
function loadDataLiveShow(div_run,str){
	dataLiveShow = [];
	if(str != ''){
		var arr_ = str.split("<@>");
		if(arr_.length > 0){
			for(var i = 0; i < arr_.length; i++){
				var arr__ = arr_[i].split("<^>");
				var obj = new Object();
				obj.data = arr__[0];
				obj.thumb = arr__[1];
			//	obj.width 	= parseInt(arr__[2]);
			//	obj.height 	= parseInt(arr__[3]);	
				dataLiveShow[dataLiveShow.length] = obj;
			}	
		}
	}
	if(dataLiveShow.length > 0){
	//	play = false;
		LiveShowFirstData();
		RunLiveShow2(div_run);	
	}
}













