﻿// ===================================================================
// Author: Matt Kruse <matt@ajaxtoolbox.com>
// WWW: http://www.AjaxToolbox.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. 
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================

function AjaxRequest(){var req =new Object();
req.timeout =null;
req.generateUniqueUrl =true;
req.url =window.location.href;
req.method ="GET";
req.async =true;
req.username =null;
req.password =null;
req.parameters =new Object();
req.requestIndex =AjaxRequest.numAjaxRequests++;
req.responseReceived =false;
req.groupName =null;
req.queryString ="";
req.responseText =null;
req.responseXML =null;
req.status =null;
req.statusText =null;
req.aborted =false;
req.xmlHttpRequest =null;
req.onTimeout=null;
req.onLoading=null;
req.onLoaded=null;
req.onInteractive=null;
req.onComplete=null;
req.onSuccess=null;
req.onError=null;
req.onGroupBegin=null;
req.onGroupEnd=null;
req.xmlHttpRequest =AjaxRequest.getXmlHttpRequest();
if(req.xmlHttpRequest==null){return null;}req.xmlHttpRequest.onreadystatechange =
function(){if(req==null || req.xmlHttpRequest==null){return;}if(req.xmlHttpRequest.readyState==1){req.onLoadingInternal(req);}if(req.xmlHttpRequest.readyState==2){req.onLoadedInternal(req);}if(req.xmlHttpRequest.readyState==3){req.onInteractiveInternal(req);}if(req.xmlHttpRequest.readyState==4){req.onCompleteInternal(req);}};
req.onLoadingInternalHandled=false;
req.onLoadedInternalHandled=false;
req.onInteractiveInternalHandled=false;
req.onCompleteInternalHandled=false;
req.onLoadingInternal=
function(){if(req.onLoadingInternalHandled){return;}AjaxRequest.numActiveAjaxRequests++;
if(AjaxRequest.numActiveAjaxRequests==1 && typeof(window['AjaxRequestBegin'])=="function"){AjaxRequestBegin();}if(req.groupName!=null){if(typeof(AjaxRequest.numActiveAjaxGroupRequests[req.groupName])=="undefined"){AjaxRequest.numActiveAjaxGroupRequests[req.groupName] =0;}AjaxRequest.numActiveAjaxGroupRequests[req.groupName]++;
if(AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==1 && typeof(req.onGroupBegin)=="function"){req.onGroupBegin(req.groupName);}}if(typeof(req.onLoading)=="function"){req.onLoading(req);}req.onLoadingInternalHandled=true;};
req.onLoadedInternal=
function(){if(req.onLoadedInternalHandled){return;}if(typeof(req.onLoaded)=="function"){req.onLoaded(req);}req.onLoadedInternalHandled=true;};
req.onInteractiveInternal=
function(){if(req.onInteractiveInternalHandled){return;}if(typeof(req.onInteractive)=="function"){req.onInteractive(req);}req.onInteractiveInternalHandled=true;};
req.onCompleteInternal=
function(){if(req.onCompleteInternalHandled || req.aborted){return;}req.onCompleteInternalHandled=true;
AjaxRequest.numActiveAjaxRequests--;
if(AjaxRequest.numActiveAjaxRequests==0 && typeof(window['AjaxRequestEnd'])=="function"){AjaxRequestEnd(req.groupName);}if(req.groupName!=null){AjaxRequest.numActiveAjaxGroupRequests[req.groupName]--;
if(AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==0 && typeof(req.onGroupEnd)=="function"){req.onGroupEnd(req.groupName);}}req.responseReceived =true;
req.status =req.xmlHttpRequest.status;
req.statusText =req.xmlHttpRequest.statusText;
req.responseText =req.xmlHttpRequest.responseText;
req.responseXML =req.xmlHttpRequest.responseXML;
if(typeof(req.onComplete)=="function"){req.onComplete(req);}if(req.xmlHttpRequest.status==200 && typeof(req.onSuccess)=="function"){req.onSuccess(req);}else if(typeof(req.onError)=="function"){req.onError(req);}delete req.xmlHttpRequest['onreadystatechange'];
req.xmlHttpRequest =null;};
req.onTimeoutInternal=
function(){if(req!=null && req.xmlHttpRequest!=null && !req.onCompleteInternalHandled){req.aborted =true;
req.xmlHttpRequest.abort();
AjaxRequest.numActiveAjaxRequests--;
if(AjaxRequest.numActiveAjaxRequests==0 && typeof(window['AjaxRequestEnd'])=="function"){AjaxRequestEnd(req.groupName);}if(req.groupName!=null){AjaxRequest.numActiveAjaxGroupRequests[req.groupName]--;
if(AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==0 && typeof(req.onGroupEnd)=="function"){req.onGroupEnd(req.groupName);}}if(typeof(req.onTimeout)=="function"){req.onTimeout(req);}delete req.xmlHttpRequest['onreadystatechange'];
req.xmlHttpRequest =null;}};
req.process =
function(){if(req.xmlHttpRequest!=null){if(req.generateUniqueUrl && req.method=="GET"){req.parameters["AjaxRequestUniqueId"] =new Date().getTime() + "" + req.requestIndex;}var content =null;
for(var i in req.parameters){if(req.queryString.length>0){req.queryString +="&";}req.queryString +=encodeURIComponent(i) + "=" + encodeURIComponent(req.parameters[i]);}if(req.method=="GET"){if(req.queryString.length>0){req.url +=((req.url.indexOf("?")>-1)?"&":"?") + req.queryString;}}req.xmlHttpRequest.open(req.method,req.url,req.async,req.username,req.password);
if(req.method=="POST"){if(typeof(req.xmlHttpRequest.setRequestHeader)!="undefined"){req.xmlHttpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');}content =req.queryString;}if(req.timeout>0){setTimeout(req.onTimeoutInternal,req.timeout);}req.xmlHttpRequest.send(content);}};
req.handleArguments =
function(args){for(var i in args){if(typeof(req[i])=="undefined"){req.parameters[i] =args[i];}else{req[i] =args[i];}}};
req.getAllResponseHeaders =
function(){if(req.xmlHttpRequest!=null){if(req.responseReceived){return req.xmlHttpRequest.getAllResponseHeaders();}alert("Cannot getAllResponseHeaders because a response has not yet been received");}};
req.getResponseHeader =
function(headerName){if(req.xmlHttpRequest!=null){if(req.responseReceived){return req.xmlHttpRequest.getResponseHeader(headerName);}alert("Cannot getResponseHeader because a response has not yet been received");}};
return req;}AjaxRequest.getXmlHttpRequest =function(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){/*@cc_on @*/
/*@if(@_jscript_version >=5)
try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(E){return null;}}@end @*/}else{return null;}};
AjaxRequest.isActive =function(){return(AjaxRequest.numActiveAjaxRequests>0);};
AjaxRequest.get =function(args){AjaxRequest.doRequest("GET",args);};
AjaxRequest.post =function(args){AjaxRequest.doRequest("POST",args);};
AjaxRequest.doRequest =function(method,args){if(typeof(args)!="undefined" && args!=null){var myRequest =new AjaxRequest();
myRequest.method =method;
myRequest.handleArguments(args);
myRequest.process();}};
AjaxRequest.submit =function(theform, args){var myRequest =new AjaxRequest();
if(myRequest==null){return false;}var serializedForm =AjaxRequest.serializeForm(theform);
myRequest.method =theform.method.toUpperCase();
myRequest.url =theform.action;
myRequest.handleArguments(args);
myRequest.queryString =serializedForm;
myRequest.process();
return true;};
AjaxRequest.serializeForm =function(theform){var els =theform.elements;
var len =els.length;
var queryString ="";
this.addField =
function(name,value){if(queryString.length>0){queryString +="&";}queryString +=encodeURIComponent(name) + "=" + encodeURIComponent(value);};
for(var i=0;i<len;i++){var el =els[i];
if(!el.disabled){switch(el.type){case 'text': case 'password': case 'hidden': case 'textarea':
this.addField(el.name,el.value);
break;
case 'select-one':
if(el.selectedIndex>=0){this.addField(el.name,el.options[el.selectedIndex].value);}break;
case 'select-multiple':
for(var j=0;j<el.options.length;j++){if(el.options[j].selected){this.addField(el.name,el.options[j].value);}}break;
case 'checkbox': case 'radio':
if(el.checked){this.addField(el.name,el.value);}break;}}}return queryString;};
AjaxRequest.numActiveAjaxRequests =0;
AjaxRequest.numActiveAjaxGroupRequests =new Object();
AjaxRequest.numAjaxRequests =0;



function fieldFocus(thefield) {
     if (thefield.value == thefield.defaultValue) {
       thefield.value = '';
     }
   }
   function fieldBlur(thefield) {
     if (thefield.value == '') {
       thefield.value = thefield.defaultValue;
     }
   }


function preloading(displayname)
	{
		objloading = document.getElementById(displayname);
		objloading.innerHTML = '<center><img src="image/loading.gif"></center>';
	}
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function Load_GiaiTriMenu()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_show_menu.asp',
'onSuccess':function(req){
document.getElementById("display_left_menu").innerHTML = req.responseText; }
}
);
}

function Show_Thread_In_Album(intCatID, intAlbumID)
{
thamso = 'cid=';
thamso += intCatID;
thamso +='&albumid=';
thamso += intAlbumID;
preloading('display_thread_in_album');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_show_thread_in_album.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_thread_in_album").innerHTML = req.responseText;}
}
);
}



function ShowRandomQuiz(id)
{
thamso = 'id=';
thamso += id;
preloading('show_random_quiz');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_random_quiz.asp?'+thamso,
'onSuccess':function(req){
document.getElementById('show_random_quiz').innerHTML = req.responseText; }
}
);
}

function mark_quiz_selectbox(choice){
for(i=1;i<=document.random_quizform.choice.length;i++){
document.getElementById('quiz' + i).checked=false;
}
	document.getElementById(choice).checked=true;

}

function validate_quiz_choice(id) {
myOption = -1;
var opt;
for (i=1; i<= document.random_quizform.choice.length; i++) {
opt=document.getElementById('quiz' + i);    
if (opt.checked) { 
var userselect = document.getElementById('quiz' + i).value;
myOption = i + 1; 
break;
}
}
if (myOption == -1) {
document.getElementById("show_alert").innerHTML="<img src=\"image/alert.jpg\" border=0>&nbsp;<i><font color=red>Xin bấm vào <img src=\"image/unchecked.gif\" border=0> để chọn một đáp án</font></i>";
return (false);
}
thamso ='id=';
thamso += id;
thamso +='&choice=';
thamso += userselect;
preloading('show_random_quiz');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_random_quizresult.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_random_quiz").innerHTML = req.responseText; }
}
);
}


function View_Quiz_Result(quizid) {
thamso ='id=';
thamso += quizid;
thamso +='&choice=';
preloading('show_random_quiz');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_random_quizresult.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_random_quiz").innerHTML = req.responseText; }
}
);
}

function ShowMoreQuiz(page)
{
preloading('show_more_random_quiz');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_more_quiz.asp?p='+page,
'onSuccess':function(req){
document.getElementById("show_more_random_quiz").innerHTML = req.responseText; }
}
);
}

function Close_MoreQuiz()
{
document.getElementById("show_more_random_quiz").innerHTML ="";
}


function SendQuizResult(quizid,choice)
{
 var email= trim(document.getElementById("sender_email_quizresult").value);
 if ((email==' ') || (email==null) || (email.indexOf(".") == -1) || (email.indexOf("@") == -1) || (email.length <6) ) 
 { 
alert("Địa chỉ email không hợp lệ!");
return (false);
 }
thamso='id=';
thamso+=quizid;
thamso+='&choice=';
thamso+=choice;
thamso+='&email=';
thamso+=email;
preloading('send_quiz_result');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_send_quizresult.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("send_quiz_result").innerHTML =req.responseText;  }
}
);
}

function Play_Album(albumid)
{
album   ='albumid=';
album+=albumid;
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_playalbum.asp?'+album,
'onSuccess':function(req){document.getElementById("playlist_player").innerHTML = req.responseText;scroll(0,0);}
}
);
}


function Play_Playlist()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_playlist.asp',
'onSuccess':function(req){document.getElementById("playlist_player").innerHTML = req.responseText;}
}
);
}

function Display_Playlist()
{
preloading('display_playlist');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_display_playlist.asp',
'onSuccess':function(req){
document.getElementById("display_playlist").innerHTML = req.responseText; }
}
);
}

function Add_To_Playlist(songid)
{
thamso = 'id=';
thamso += songid;
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_add_to_playlist.asp?'+thamso,
'onSuccess':function(req){Play_Playlist();Display_Playlist(); scroll(0,0);}
}
);
}

function Delete_Item_In_Playlist(songid)
{
thamso = 'id=';
thamso += songid;
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_delete_item_in_playlist.asp?'+thamso,
'onSuccess':function(req){Play_Playlist();Display_Playlist(); }
}
);
}

function Close_Playlist()
{
document.getElementById("playlist_player").innerHTML="";
}


function Delete_Playlist()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_delete_playlist.asp',
'onSuccess':function(req){Play_Playlist();Display_Playlist(); }
}
);
}


function Search_Result(page) {
		var searchby = document.getElementById("search_by");
		var searchinput = trim(document.getElementById("txtSearch").value);
		if (searchinput.length <2 || searchinput =="Nhập từ khóa tìm"){
alert("Bạn phải nhập vào nội dung tìm kiếm\nHoặc nội dung nhập vào quá ngắn!");
return (false);
}
		strquery  = "searchby=";
		strquery  += searchby.options[searchby.selectedIndex].value;
		strquery  += "&text=";
		strquery  += encodeURI(searchinput.split(' ').join('+'));
		strquery  += '&p=';
		strquery  += page;
preloading('display_search_result');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_quicksearchresult.asp?'+strquery,
'onSuccess':function(req){document.getElementById("display_search_result").innerHTML = req.responseText; }
}
);
} 

function Search_Singer_By_Alpha(Alpha, intPageNum,intRowNum,intSortBy)
{
thamso = 'alpha=';
thamso += Alpha;
thamso += '&p=';
thamso += intPageNum;
thamso += '&rownum=';
thamso += intRowNum;
thamso += '&orderby=';
thamso += intSortBy;
preloading('display_search_result');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_search_singer_by_alpha.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_search_result").innerHTML = req.responseText; 
}
}
);
}

function Search_Title_By_Alpha(Alpha, intPageNum,intRowNum,intSortBy)
{
thamso = 'alpha=';
thamso += Alpha;
thamso += '&p=';
thamso += intPageNum;
thamso += '&rownum=';
thamso += intRowNum;
thamso += '&orderby=';
thamso += intSortBy;
preloading('display_search_result');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_search_title_by_alpha.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_search_result").innerHTML = req.responseText; 
}
}
);
}

function Close_Search_Result()
{
document.getElementById("display_search_result").innerHTML ='' 
}

function Load_Browse_All(intPageNum,intRowNum,intSortBy)
{
thamso = 'p=';
thamso += intPageNum;
thamso += '&rownum=';
thamso += intRowNum;
thamso += '&orderby=';
thamso += intSortBy;
preloading('display_browseall');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_browseall.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_browseall").innerHTML = req.responseText; 
}
}
);
}


function Load_Audio_Thread(intPageNum,intRowNum,intSortBy)
{
thamso = 'p=';
thamso += intPageNum;
thamso += '&rownum=';
thamso += intRowNum;
thamso += '&orderby=';
thamso += intSortBy;
preloading('show_selected_thread');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_show_audio_Thread.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_selected_thread").innerHTML = req.responseText; 
}
}
);
}

function Load_SingerList(intPageNum,intRowNum,intSortBy)
{
thamso = 'p=';
thamso += intPageNum;
thamso += '&rownum=';
thamso += intRowNum;
thamso += '&orderby=';
thamso += intSortBy;
preloading('show_selected_thread');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_load_singerlist.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_selected_thread").innerHTML = req.responseText; 
}
}
);
}

function Load_Singer_Thread(Performer, intPageNum,intRowNum,intSortBy)
{
thamso = 'singer=';
thamso += Performer;
thamso += '&p=';
thamso += intPageNum;
thamso += '&rownum=';
thamso += intRowNum;
thamso += '&orderby=';
thamso += intSortBy;
preloading('display_selected_thread');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_load_singer_thread.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_selected_thread").innerHTML = req.responseText; 
}
}
);
}

function Load_Singer_Thread1(Performer, intPageNum,intRowNum,intSortBy)
{
thamso = 'singer=';
thamso += Performer;
thamso += '&p=';
thamso += intPageNum;
thamso += '&rownum=';
thamso += intRowNum;
thamso += '&orderby=';
thamso += intSortBy;
preloading('display_cungcasi');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_load_singer_thread1.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_cungcasi").innerHTML = req.responseText; 
}
}
);
}


function Show_Thread_In_Category(intCatID, intPageNum,intRowNum,intSortBy)
{
thamso = 'cid=';
thamso += intCatID;
thamso +='&p=';
thamso += intPageNum;
thamso += '&rownum=';
thamso += intRowNum;
thamso += '&orderby=';
thamso += intSortBy;
preloading('display_thread_in_incategory');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_show_thread_in_category.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_thread_in_incategory").innerHTML = req.responseText;}
}
);
}

function Show_Thread_In_Subject(intSubID, intPageNum,intRowNum,intSortBy)
{
thamso = 'sid=';
thamso += intSubID;
thamso +='&p=';
thamso += intPageNum;
thamso += '&rownum=';
thamso += intRowNum;
thamso += '&orderby=';
thamso += intSortBy;
preloading('display_thread_in_subject');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_show_thread_in_subject.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_thread_in_subject").innerHTML = req.responseText;}
}
);
}


function Show_CungTrinhBay(intThreadID, strThreadName)
{
thamso = 'id=';
thamso += intThreadID;
thamso +='&thread=';
thamso += strThreadName;
preloading('display_cungtrinhbay');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_display_cungtrinhbay.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_cungtrinhbay").innerHTML = req.responseText;}
}
);
}

function Show_Thread_In_Topic(intTopicID)
{
thamso = 'topicid=';
thamso += intTopicID;
preloading('display_thread_in_topic');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_show_thread_in_topic.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_thread_in_topic").innerHTML = req.responseText; }
}
);
}

function giaitri_quangnhan1972_new_update()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_new_update.asp',
'onSuccess':function(req){
document.getElementById("display_giaitri_quangnhan1972_new_update").innerHTML = req.responseText; }
}
);
}






function giaitri_quangnhan1972_2()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_2.asp',
'onSuccess':function(req){
document.getElementById("display_quangnhan1972_2").innerHTML = req.responseText; }
}
);
}
function giaitri_quangnhan1972_20()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_20.asp',
'onSuccess':function(req){
document.getElementById("display_quangnhan1972_20").innerHTML = req.responseText; }
}
);
}

function giaitri_quangnhan1972_en_quiz()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_en_quiz.asp',
'onSuccess':function(req){
document.getElementById("display_giaitri_quangnhan1972_en_quiz").innerHTML = req.responseText; }
}
);
}



function Load_ThongKe()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_thongke.asp',
'onSuccess':function(req){
document.getElementById("display_thongke").innerHTML = req.responseText; }
}
);
}



function ShowUserPoll(id)
{
thamso ='id=';
thamso +=id;
preloading('show_poll');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_userpoll.asp?'+thamso,
'onSuccess':function(req){
document.getElementById('show_poll').innerHTML = req.responseText; }
}
);
}

function validatepollchoice(id) {
myOption = -1;
var opt;
for (i=0; i< document.voteform.votepoll.length; i++) {
opt=document.getElementById('votepoll' + (i +1));    
if (opt.checked) { 
var userselect = document.getElementById('votepoll' + (i +1)).value;
myOption = i + 1; 
break;
}
}
if (myOption == -1) {
alert("Xin chọn một ý kiến");
return false;
}
  
thamso = 'id=';
thamso += id;
thamso +='&choice=';
thamso += userselect;
preloading('show_poll');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_userpollresult.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_poll").innerHTML = req.responseText; }
}
);
}

function viewpollresult(id) {
thamso = 'id=';
thamso += id;
thamso +='&choice=';
preloading('show_poll');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_userpollresult.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_poll").innerHTML = req.responseText; }
}
);
}


function Show_Article_Grading(id)
{
thamso = 'id=';
thamso += id;
preloading('show_article_grading');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_article_grading.asp?'+thamso,
'onSuccess':function(req){
document.getElementById('show_article_grading').innerHTML = req.responseText; }
}
);
}

function mark_article_selectbox(dapanid){
for(i=1;i<=10;i++){
document.getElementById('grading_choice' + i).checked=false;
}
	document.getElementById(dapanid).checked=true;

}

function validate_article_grading(id) {
myOption = -1;
var opt;
for (i=1; i<= 10; i++) {
opt=document.getElementById('grading_choice' + i);    
if (opt.checked) { 
var userselect = document.getElementById('grading_choice' + i).value;
myOption = i + 1; 
break;
}
}
if (myOption == -1) {
document.getElementById("show_grading_alert").innerHTML="<img src=\"image/alert.jpg\" border=0>&nbsp;<i><font color=red>Xin chọn một điểm số.</font></i>";
return (false);
}
thamso = 'id=';
thamso += id;
thamso +='&choice=';
thamso += userselect;
preloading('show_article_grading');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_article_grading_result.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_article_grading").innerHTML = req.responseText; }
}
);
}

function view_grading_result(id) {
thamso = 'id=';
thamso += id;
thamso +='&choice=';
preloading('show_article_grading');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_article_grading_result.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_article_grading").innerHTML = req.responseText; }
}
);
}

function Show_Article_Comment(page,articleid)
{
preloading('show_article_comment');
thamso='p=';
thamso+=page;
thamso+='&id=';
thamso+=articleid;
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_article_comment.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_article_comment").innerHTML = req.responseText; }
}
);
}

function Show_Article_Comment_Form(catid,subid,articleid,adminid,title)
{
preloading('show_article_comment_form');
thamso ='cid=';
thamso +=catid;
thamso +='&sid=';
thamso +=subid;
thamso +='&tid=';
thamso +=articleid;
thamso +='&adminid=';
thamso +=adminid;
thamso +='&title=';
thamso +=title;
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_article_comment_form.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_article_comment_form").innerHTML = req.responseText; }
}
);
}

//Hàm này đóng Comment Form
function Close_Aritlce_Comment_Form() {
if (confirm('Dữ liệu trong Form sẽ bị xóa khi đóng!')){
document.getElementById("show_article_comment_form").innerHTML ="";
}
}


function Show_Selected_Thread(SelectedType, intPageNum,intRowNum,intSortBy)
{
thamso = 'type=';
thamso += SelectedType;
thamso +='&p=';
thamso += intPageNum;
thamso += '&rownum=';
thamso += intRowNum;
thamso += '&orderby=';
thamso += intSortBy;
preloading('show_selected_thread');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_show_selected_thread.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("show_selected_thread").innerHTML = req.responseText; }
}
);
}

function Display_Selected_Thread(intThreadID, SelectedType)
{
thamso = 'type=';
thamso += SelectedType;
thamso +='&id=';
thamso += intThreadID;
preloading('display_selected_thread');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_display_selected_thread.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_selected_thread").innerHTML = req.responseText; }
}
);
}

function load_giaitri_video_21()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_video_21.asp',
'onSuccess':function(req){
document.getElementById("display_giaitri_video_21").innerHTML = req.responseText; }
}
);
}
function load_giaitri_audio_1()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_audio_1.asp',
'onSuccess':function(req){
document.getElementById("display_giaitri_audio_1").innerHTML = req.responseText; }
}
);
}

function load_giaitri_lyric_2()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_lyric_2.asp',
'onSuccess':function(req){
document.getElementById("display_giaitri_lyric_2").innerHTML = req.responseText; }
}
);
}


function Load_ThongKe()
{
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_thongke.asp',
'onSuccess':function(req){
document.getElementById("display_thongke").innerHTML = req.responseText; }
}
);
}

function copymessage(Message) {
var tempval=eval("document."+Message)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Copy")
alert("Đã chép vào Clipboard.\nBấm Ctrl-V để dán!");
}

function Bao_Loi(id,on_off){
var strOnOff = on_off;
if (strOnOff == 0){
thamso ='thread_id=';
thamso +=id;
thamso +='&ctr=';
thamso +=on_off;
preloading('client_service');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_baoloi.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("client_service").innerHTML =req.responseText;  }
}
);
}

else if (strOnOff ==1){
 var email= trim(document.getElementById("sender_baoloi_email").value);
 var message= trim(document.getElementById("baoloi_message").value);
message= encodeURI(message.split(' ').join('+'));
var security=trim(document.getElementById("baoloi_securitycode").value);
var security1=trim(document.getElementById("baoloi_securitycode1").value);
if ((security1 =="") || (security1 != security))
{alert("Mã an ninh không khớp!");
document.getElementById("baoloi_securitycode1").focus();
return (false);
}

 if ((email==' ') || (email==null) || (email.indexOf(".") == -1) || (email.indexOf("@") == -1) || (email.length <6) )  { 
alert("Xin nhập vào địa chỉ Email\nHoặc địa chỉ email không hợp lệ!");
return (false);
document.getElementById("sender_baoloi_email").focus();
 }

thamso ='thread_id=';
thamso +=id;
thamso +='&ctr=';
thamso +=on_off;
thamso +='&email=';
thamso +=email;
thamso +='&email=';
thamso +=email;
thamso +='&message=';
thamso +=message;
preloading('client_service');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_baoloi.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("client_service").innerHTML =req.responseText;  }
}
);
}
}
//Hàm này Gửi bạn bè, dùng tham số on_off để kết hợp form và chương trình gửi.

function Gui_Ban_Be(id,on_off){
var strOnOff = on_off;
if (strOnOff == 0){
thamso ='thread_id=';
thamso +=id;
thamso +='&ctr=';
thamso +=on_off;
preloading('client_service');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_guibanbe.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("client_service").innerHTML =req.responseText;  }
}
);
}

else if (strOnOff ==1){
var email= trim(document.getElementById("sender_email").value);
var email1= trim(document.getElementById("receiver_email").value);
var message= trim(document.getElementById("sender_message").value);
message= encodeURI(message.split(' ').join('+'));

var security=trim(document.getElementById("sender_securitycode").value);
var security1=trim(document.getElementById("sender_securitycode1").value);
if ((security1 =="") || (security1 != security))
{alert("Mã an ninh không khớp!");
document.getElementById("sender_securitycode1").focus();
return (false);
}

 if ((email==' ') || (email==null) || (email.indexOf(".") == -1) || (email.indexOf("@") == -1) || (email.length <6) )  { 
alert("Xin nhập vào địa chỉ Email người gửi\nHoặc địa chỉ email không hợp lệ!");
return (false);
document.getElementById("sender_email").focus();
 }

 if ((email1==' ') || (email1==null) || (email1.indexOf(".") == -1) || (email1.indexOf("@") == -1) || (email1.length <6) )  { 
alert("Xin nhập vào địa chỉ Email người nhận.\nHoặc địa chỉ email không hợp lệ!");
return (false);
document.getElementById("receiver_email").focus();
 }


thamso ='thread_id=';
thamso +=id;
thamso +='&ctr=';
thamso +=on_off;
thamso +='&email=';
thamso +=email;
thamso +='&email1=';
thamso +=email1;
thamso +='&message=';
thamso +=message;
preloading('client_service');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_guibanbe.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("client_service").innerHTML =req.responseText;  }
}
);
}
}

function Find_LyRics(ThreadName)
{
thamso ='thread=';
thamso+=ThreadName;
preloading('client_service');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_timlyrics.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("client_service").innerHTML = req.responseText; }
}
);
}

function Show_Lyrics(threadid)
{
thamso ='thread_id=';
thamso+=threadid;
preloading('display_content');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_viewlyrics.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_content").innerHTML = req.responseText; }
}
);
}


function Find_Bio(singername)
{
thamso ='singer=';
thamso+=singername;
preloading('client_service');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_timtieusu.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("client_service").innerHTML = req.responseText; }
}
);
}

function Show_Bio(threadid)
{
thamso ='thread_id=';
thamso+=threadid;
preloading('display_content');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_xemtieusu.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("display_content").innerHTML = req.responseText; }
}
);
}

function Show_Download(threadid)
{
thamso ='thread_id=';
thamso+=threadid;
preloading('client_service');
AjaxRequest.get(
{
'url':'giaitri_quangnhan1972_download.asp?'+thamso,
'onSuccess':function(req){
document.getElementById("client_service").innerHTML = req.responseText; }
}
);
}

//Hàm này đóng Client Service Area
function Close_Client_Service() {
document.getElementById("client_service").innerHTML ="";
}
function Close_Display_Content() {
document.getElementById("display_content").innerHTML ="";
}

function hidestatus(){
window.status='Load completed'
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus
