function prepare_shout()
{
	for(var i=3;i>=0;i--)
	{
		ele='shout' + i;
		nextele = 'shout' + (i+1);
		$(nextele).innerHTML = $(ele).innerHTML;
	}
	fill_new_shout();
}

function fill_new_shout()
{
		var memID = $('textsenderid').value;
		var ava = "<img width='25' height='25' src='/mem/" + memID + ".jpg'/>";
		var html = "<div class='left_comment'>" + ava + "</div>";
		html  = html + "<div class='right_comment'>";
		var username = $('textsender').value;
		var mytv="<a href='/mytv/" + username + "'/>" + username + "</a>"; 
		html  = html + "<div class='time_post'>" + mytv + lang.some_seconds +"</div>";
		var content = $('txtcontent').value;
		html  = html + "<div class='mess_content'>" + content + "</div>";
		$('shout0').innerHTML= html;			
}

function shout()
{
	var content = $("txtcontent").value;
	var content = content.replace(/\&/g, '%26');	
	if (content.length>=512){
		alert ("Do dai bai viet khong vuot qua 512 ky tu.");
	}
	else{
		if (content.length>0){
			prepare_shout();
			var url='/spec/?page=the10&opt=shout_out';
			getHTML(url,'content='+content,'');
			$("txtcontent").value="";    
		}
		else{
			alert("Ban chua dien noi dung!");
		}
	}
}
function displayMonth(month)
{
	url='/spec/?page=the10&opt=theten_displaymonth&month='+month;
	getHTML(url,'','calendar');
}
function showMonths(year)
{
	if ($('month_list').style.display=='')
	{
		$('month_list').style.display='none';
	}
	else
	{
		$('month_list').style.display='';
	}
}
function add_to_faves(movID){
	if (confirm(lang.FAVOURITE_CONFIRM))
	{
		url='/spec/index.php?page=the10&opt=addfave&movID='+movID;
		getHTML(url,'','star_update');
	}
}
function ToggleTextView(s, l, t, b)
{
  var $ = function (id) {return document.getElementById(id); };
  s=$(s); l=$(l); t=$(t); b=$(b);
  if (t) { t.detailView = !t.detailView; t.innerHTML=t.detailView?l.innerHTML:s.innerHTML; b.innerHTML=t.detailView?"[-]":"[+]"; }
}

function field2clipboard(id,shareid)
{
	fieldEle=$(id);
	fieldEle.focus();
	fieldEle.select();
	text2clipboard(sharevalue[shareid]);
	fieldEle.value=lang.CLIPBOARD_COPIED;
	fieldEle.style.background='#FFFFCC';
	fieldEle.style.color='#000';
	t="$('"+id+"').value='" + sharevalue[shareid] + "';";
	t=t+"$('"+id+"').style.background='#FFF';";
	t=t+"$('"+id+"').style.color='';"
	setTimeout(t,500);
}

function text2clipboard(text){
		if (window.clipboardData)
		{ // IE
			window.clipboardData.setData("Text", text);
		}
		else
		{ // others : Flash Copyer help us sold the problem
			var flashcopyer = "flashCopyer";
			if(!$('flashCopyer'))
			{
				var divholder = document.createElement('div');
				divholder.id = flashcopyer;
				document.body.appendChild(divholder);
			}
			$(flashcopyer).innerHTML = '';
			var divinfo = '<embed src="/spec/the10/flash/clipboard.swf" FlashVars="clipboard='+escape(text)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
			$(flashcopyer).innerHTML = divinfo;
		}
	}
function toggle_des(i)
{
	id='description_'+i;
	$(id).toggle();
}