/*/
showtime = 0;
function changtab(id,count,clear){
	for(i=1;i<=count;i++){
		try{
			document.getElementById('tab_'+i).className='tab_nomal';
			document.getElementById('tabconten_'+i).style.display='none';
			$("#tabconten_"+id).hide();
		}
		catch(e){}			
	}
	document.getElementById('tab_'+id).className='tab_select';
	//document.getElementById().style.display='block';
	$("#tabconten_"+id).show();
}
//*/


//Thay doi tab cua vietlong
//*/ 
showtime = 0;
function changtab(id,count,clear){
	for(i=1;i<=count;i++){
		document.getElementById('tab_'+i).className='tab_nomal';
	}
	document.getElementById('tab_'+id).className='tab_select';
	valueHtml = document.getElementById('content_'+id).innerHTML;
	//alert(removeHTMLTags(valueHtml));
	document.getElementById('tab_content').innerHTML = valueHtml;
	if(clear==1) clearInterval(showtime);
}
function removeHTMLTags(strInputCode){
	strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
		return (p1 == "lt")? "<" : ">";
	});
	var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
	alert(strTagStrippedText);
}

function mouseout(id,count){
	showtime = setInterval(function() {changtab(id,count,1)},6000);
}
//*/

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + '.' + '$2');
	}
	return x1;
}
function formatCurrency(div_id,str_number){
	/*Convert tu 1000->1.000*/
	var mynumber=1000;	
	str_number = str_number.replace(/\./g,"");
	document.getElementById(div_id).innerHTML = addCommas(str_number);
}
// JavaScript Document
function tabdiv(id,count){
	for(i=1;i<=count;i++){
		try{
			document.getElementById('tabt_'+i).className='n';
			document.getElementById('tabc_'+i).style.display='none';
		}
		catch(e){}			
	}
	document.getElementById('tabt_'+id).className='s';
	document.getElementById('tabc_'+id).style.display='block';
}
function tabkuku(id,count){
	for(i=1;i<=count;i++){
		try{
			document.getElementById('tabg_'+i).className='n';
			document.getElementById('tabh_'+i).style.display='none';
		}
		catch(e){}			
	}
	document.getElementById('tabg_'+id).className='s';
	document.getElementById('tabh_'+id).style.display='block';
}

function tabnews(id,count){
	for(i=1;i<=count;i++){
		try{
			document.getElementById('tabt_'+i).className='tab_nomal';
			document.getElementById('tabc_'+i).style.display='none';
		}
		catch(e){}			
	}
	document.getElementById('tabt_'+id).className='tab_select';
	document.getElementById('tabc_'+id).style.display='block';
}

function tabdetail(id,count){
	for(i=1;i<=count;i++){
		try{
			document.getElementById('detail_'+i).className='tab_nomal';
			document.getElementById('description_'+i).style.display='none';
		}
		catch(e){}			
	}
	document.getElementById('detail_'+id).className='tab_select';
	document.getElementById('description_'+id).style.display='block';
}
function tabhome(id,count){
	for(i=0;i<=count;i++){
		try{
			document.getElementById('home_'+i).className='n';
			document.getElementById('homecontent_'+i).style.display='none';
		}
		catch(e){}			
	}
	document.getElementById('home_'+id).className='s';
	document.getElementById('homecontent_'+id).style.display='block';
	if(id>0){
		idtruoc = id-1;
		document.getElementById('home_'+idtruoc).className='nbg';
	}else{
		document.getElementById('home_'+id).className='sf';
	}
	
}
function showdiv(divid){
	var obj = document.getElementById(divid);
	obj.style.display=(obj.style.display=='none') ? '' : 'none';
}
function tabhomenews(id,count){
	for(i=1;i<=count;i++){
		try{
			document.getElementById('homenews_'+i).className='n';
			document.getElementById('homecontentnews_'+i).style.display='none';
		}
		catch(e){}			
	}
	document.getElementById('homenews_'+id).className='s';
	document.getElementById('homecontentnews_'+id).style.display='block';
}
function FadeIn(obj){
	obj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=100);  -moz-opacity: 1";
	obj.filters[0].apply();
	obj.filters[0].play();
}

function FadeOut(obj){
	obj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=50);  -moz-opacity: 0.5";
	obj.filters[0].apply();
	obj.filters[0].play();
}
function EmbedVideo(url)
{
	var prefix = "http://192.168.1.38:2939";
	var str = "<object width=\"425\" height=\"350\">"+
					  "<param name=\"movie\" value=\"" + url + " />" +
					  "<param name=\"quality\" value=\"high\" />" +
					  "<param name=\"allowFullScreen\" value=\"true\" />" + 
					  "<param name=\"allowScriptAccess\" value=\"always\" />" +		
					  "<embed src=\"http://192.168.1.38:2939/video_player/mediaplayer.swf?file=" + url + "&logo=\"" +  " type=\"application/x-shockwave-flash\" width=\"448\" height=\"372\"></embed>" +
				"</object>";


$('#divEmbed').val(str)
	
}

/*
lastScrollY=0;
function heartBeat(){ 
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
    diffY = document.documentElement.scrollTop;
else if (document.body)
    diffY = document.body.scrollTop
else
    { }

percent=.1*(diffY-lastScrollY); 
if(percent>0)percent=Math.ceil(percent); 
else percent=Math.floor(percent); 
document.getElementById("full").style.top=parseInt(document.getElementById("full").style.top)+percent+"px";

lastScrollY=lastScrollY+percent; 
}
suspendcode="<div id=\"full\" style='right:2px; top:300px; position:absolute;'><div align=\"center\"><a href=\"#_top\"><img src=\"/images/top.gif\" border=\"0\"></a></div><div align=\"center\" style=\"padding-top:5px;\"><a href=\"/en/contact.php\"><img src=\"/images/gmail.gif\" border=0 width=25></a></div></div>"

document.write(suspendcode);
window.setInterval("heartBeat()",1);
//*/

