function show_hide(obj,is_close,element) {
	var hideshow = document.getElementById(obj);
	if (is_close) {
		document.getElementById(obj).style.display = 'none';
	}
	else {
		if(hideshow.style.display != "none") {
			hideshow.style.display = "none";
			document.getElementById(element).innerHTML = '<img src="img/Maximize.gif" width="15" height="15" alt="Mở rộng" border="0" title="Mở rộng" />';
		}
		else {
			hideshow.style.display = "block";
			document.getElementById(element).innerHTML = '<img src="img/Minimize.gif" width="15" height="15" alt="Thu nhỏ" border="0" title="Thu nhỏ" />';
		}
	}
	return false;
}
function dangkyfrom(obj_submit) { 
	//Object_show='search';
	var date_bron=document.form_reg.namdangky.value+"-"+document.form_reg.thangdangky.value+"-"+document.form_reg.ngaydangky.value;
     var poststr = "?hoten="+encodeURIComponent(document.form_reg.hoten.value)+"&date_bron="+date_bron+"&email="+encodeURIComponent(document.form_reg.email.value)+"&nickname="+encodeURIComponent(document.form_reg.nickname.value)+"&num="+encodeURIComponent(document.form_reg.num.value); 
	loadingtext='<div align="center" style="margin:5px; font-size:8pt;"><img src="img/reg.gif" width="18" height="18" alt="" border="0" style="margin:5px;" /><br />Đang đăng ký thành viên...</div>';
	statusload='Đang đăng ký thành viên ...';
	statuscomp='Đã đăng ký thành công';
	Object_show = 'dangkytv';
	retrieveURL('submit_dangky',poststr);
   // StatusClick('submit_dangky',poststr,'dangkytv');
   }  
  
function doimatkhau(obj_submit) { 
	//Object_show='search';
     var poststr = "?nickname="+encodeURIComponent(document.doimatkhau_frm.nickname.value)+"&matkhaumoi="+encodeURIComponent(document.doimatkhau_frm.matkhaumoi.value)+"&matkhaucu="+encodeURIComponent(document.doimatkhau_frm.matkhaucu.value)+"&mxn="+encodeURIComponent(document.doimatkhau_frm.mxn.value);
	loadingtext='<div align="center" style="margin:5px; font-size:8pt;"><img src="img/reg.gif" width="18" height="18" alt="" border="0" style="margin:5px;" /><br />Đang mã hóa mật khẩu mới<br>Mật khẩu mới sẽ được gởi tới địa chỉ mail của bạn...</div>';
	statusload='Đang đổi mật khẩu ...';
	statuscomp='Đổi mật khẩu thành công';
	Object_show = 'doimatkhau';
	retrieveURL('submit_doimatkhau',poststr);
   // StatusClick('submit_dangky',poststr,'dangkytv');
   }  
  
function add2playlist(poststr,string_song_name) { 

	statusload='Đang thêm ca khúc '+string_song_name+' vào playlist ...';
	statuscomp='Đã thêm thành công ca khúc '+string_song_name;
	string_song_name='Đã thêm ca khúc <b>&quot;'+string_song_name+'&quot;</b> vào playlist của bạn ';	
	loadingtext='&nbsp;';
	Object_show = 'add2playlist';
	retrieveURL('add2playlist',poststr);
	toolTipAdd(string_song_name,'50');
   }  
   
function del(poststr,string_song_name) { 

	loadingtext='&nbsp;';
	statusload='Đang xóa ca khúc '+string_song_name+' khỏi playlist ...';
	statuscomp='Đã xóa xong ca khúc '+string_song_name+' khỏi playlist';
	Object_show = 'add2playlist';
	string_song_name='Đã xóa ca khúc <b>&quot;'+string_song_name+'&quot;</b> trong playlist của bạn ';	
	retrieveURL('delplaylist',poststr);
	toolTipAdd(string_song_name,'50');
	StatusClick('showmyplaylist','','playlist');
   }  
   
   
//Gán nội dung HTML vào một đối tượng
function eSetHTML(_objName, html)
{
	eval(_objName).innerHTML=html;
}

//Ẩn một đối tượng
function eHide(_objName)
{
	eval(_objName).style.display="none";
}

//Hiện một đối tượng
function eShow(_objName)
{
	eval(_objName).style.display="block";
}

//Ẩn hiện một đối tượng
function eSwitch(_objName)
{
	if (eval(_objName).style.display=="block")
		eval(_objName).style.display="none";
	else
		eval(_objName).style.display="block";
}


function toolTip(CndD)
{	
	if (tipMsg!='')
	{
		eSetHTML('load_add2playlist', tipMsg);
		eShow('toolTipHandle');
	}
	toolTipHandle.style.left=(document.body.clientWidth/2)-200;
	//toolTipHandle.style.top=(document.body.clientWidth/2)-300;
	setInterval("document.getElementById('toolTipHandle').style.top=document.body.scrollTop+200+'px'", 1)
	tipCnt--;
	if (tipCnt<0)
	{
		tipMsg='';
		eHide('toolTipHandle');	
		tipCnt=CndD;
	}
}

function toolTipAdd(_tip,CndD)
{
	//alert(_tip);
	tipCnt=CndD;
	tipMsg=_tip;
	toolTip(CndD);
	setInterval("toolTip("+CndD+")",CndD);
}

function xemhinh(strhref){
var kichco = 10;

	var xwidth = 400	
	var xheight = 500
	var left = (screen.availWidth - xwidth) / 2
	var top = ((screen.availHeight - xheight)-50) / 2
	window.open(strhref,"","resizable=no,scrollbars=yes,directories=no,width="+xwidth+",height="+xheight+", menubar=no,toolbar=no, left="+left+", top="+top)
}
