function postRes(div,src,param){	
	var xmlHttp = false;
	if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}
	else if(window.ActiveXObject){
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	var obj = document.getElementById(div);
	if(xmlHttp){
		xmlHttp.open("GET",src,true);
		//xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8;");
		xmlHttp.onreadystatechange = function(){
			if(xmlHttp.readyState == 1 || xmlHttp.readyState == 2){
				obj.innerHTML = "";
			}
			else if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
				obj.innerHTML = xmlHttp.responseText;
			}			
		}	
		xmlHttp.send(null);
	}
	return false;
}

var theloaiOverBgImage = '';
var theloaiOverTxt = '';
function theloaiOver (sr) {
	sr.style.backgroundImage=theloaiOverBgImage;
	if (sr.childNodes && theloaiOverTxt && theloaiOverTxt!='') {
		var i, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color=theloaiOverTxt;
		}
	}
}
function theloaiOut (sr) {
	sr.style.backgroundImage='';
	if (sr.childNodes && theloaiOverTxt && theloaiOverTxt!='') {
		var i, sti, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color='';
		}
	}
}

	theloaiOverBgImage = 'url(http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/sub_content_menu_hover.gif)';
	theloaiOverTxt = '000000';
	
	
/*function theloaiOver (sr,img_over,color_over) {	
	sr.style.backgroundImage=img_over;
	sr.color=color_over;
	if (sr.childNodes && color_over && color_over!='') {
		var i, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color=color_over;
		}
	}
}*/

function chinaOver (sr,img_over,color_over) {	
	sr.style.backgroundImage=img_over;
	//sr.color=color_over;
	if (sr.childNodes && color_over && color_over!='') {
		var i, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color=color_over;
		}
	}
}

/*function theloaiOut (sr,color_out) {
	sr.style.backgroundImage='';
	sr.color=color_out;
	if (sr.childNodes && color_out && color_out!='') {
		var i, sti, imax = sr.childNodes.length;
		for (i=0; i<imax; i++) {
			sti = sr.childNodes.item(i).style;
			if (sti) sti.color=color_out;
		}
	}
}*/

function selectOption(obj,val,img_selected){
	var keyType = document.getElementById('searchType');
	var img_song = document.getElementById('img_song');
	var img_singer = document.getElementById('img_singer');
	var img_album = document.getElementById('img_album');
	switch(obj.id){
		case "img_song":
			img_singer.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/casy.gif';
			img_album.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/album.gif';
			break;
		case "img_singer":
			img_song.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/baihat.gif';
			img_album.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/album.gif';
			break;
		case "img_album":
			img_song.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/baihat.gif';
			img_singer.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/casy.gif';
			break;
		
	}
	keyType.value = val; 
	obj.src = img_selected;
}

function selectOptionBottom(obj,val,img_selected){
	var keyType = document.getElementById('searchTypeBottom');
	var img_song = document.getElementById('img_song_bottom');
	var img_singer = document.getElementById('img_singer_bottom');
	var img_album = document.getElementById('img_album_bottom');
	switch(obj.id){
		case "img_song_bottom":
			img_singer.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/casy.gif';
			img_album.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/album.gif';
			break;
		case "img_singer_bottom":
			img_song.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/baihat.gif';
			img_album.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/album.gif';
			break;
		case "img_album_bottom":
			img_song.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/baihat.gif';
			img_singer.src = 'http://'+ location.host+'/nghe-nhac-mp3/templates/funnycolors/img/search/casy.gif';
			break;
		
	}
	keyType.value = val; 
	obj.src = img_selected;
}

function chooseTab(tab,p_song,p_singer,p_album,p_composer,p_lyric,p_searchType){
	var song = document.getElementById(p_song);
	var singer = document.getElementById(p_singer);
	var album = document.getElementById(p_album);
	
	var composer = document.getElementById(p_composer);
	var lyric = document.getElementById(p_lyric);
	
	var searchType = document.getElementById(p_searchType);
	
	 if(navigator.appName == "Netscape")
	{
		 switch(tab){
			case 1:			
				/*For song*/
				song.setAttribute("class", "search_active");
				singer.setAttribute("class", "search_invisibe");
				album.setAttribute("class", "search_invisibe");
				composer.setAttribute("class", "search_invisibe");
				lyric.setAttribute("class", "search_invisibe");
				searchType.value = 'song';
				break;
			case 2:
				/*For singer*/
				song.setAttribute("class", "search_invisibe");
				singer.setAttribute("class", "search_active");
				album.setAttribute("class", "search_invisibe");
				composer.setAttribute("class", "search_invisibe");
				lyric.setAttribute("class", "search_invisibe");
				searchType.value = 'singer';
				break;
			case 3:
				/*For album*/
				song.setAttribute("class", "search_invisibe");
				singer.setAttribute("class", "search_invisibe");
				album.setAttribute("class", "search_active");
				composer.setAttribute("class", "search_invisibe");
				lyric.setAttribute("class", "search_invisibe");
				searchType.value = 'album';
				break;
			case 4:
				/*For composer*/
				composer.setAttribute("class", "search_active");
				lyric.setAttribute("class", "search_invisibe");
				song.setAttribute("class", "search_invisibe");
				singer.setAttribute("class", "search_invisibe");
				album.setAttribute("class", "search_invisibe");
				searchType.value = 'composer';
				break;
			case 5:
				/*For lyric*/
				composer.setAttribute("class", "search_invisibe");
				lyric.setAttribute("class", "search_active");
				song.setAttribute("class", "search_invisibe");
				singer.setAttribute("class", "search_invisibe");
				album.setAttribute("class", "search_invisibe");
				searchType.value = 'lyric';
				break;
		}
	}
	
	 if(navigator.appName == "Microsoft Internet Explorer")
	{
		switch(tab){
			case 1:			
				/*For song*/
				song.className =  "search_active";
				singer.className = "search_invisibe";
				album.className = "search_invisibe";
				composer.className = "search_invisibe";
				lyric.className = "search_invisibe";
				searchType.value = 'song';
				break;
			case 2:
				
				/*For singer*/
				song.className = "search_invisibe";
				singer.className = "search_active";
				album.className =  "search_invisibe";	
				composer.className = "search_invisibe";
				lyric.className = "search_invisibe";
				searchType.value = 'singer';
				
				break;
			case 3:
				/*For album*/
				song.className = "search_invisibe";
				singer.className = "search_invisibe";
				album.className = "search_active";
				composer.className = "search_invisibe";
				lyric.className = "search_invisibe";
				searchType.value = 'album';
				break;
			case 4:			
				/*For composer*/
				song.className =  "search_invisibe";
				singer.className = "search_invisibe";
				album.className = "search_invisibe";
				composer.className = "search_active";
				lyric.className = "search_invisibe";
				searchType.value = 'composer';
				break;
			case 5:			
				/*For lyric*/
				song.className =  "search_invisibe";
				singer.className = "search_invisibe";
				album.className = "search_invisibe";
				composer.className = "search_invisibe";
				lyric.className = "search_active";
				searchType.value = 'lyric';
				break;
		}
	}
}


function CreateBookmarkLink() {

 title = "Nhac.vui.vn"; 
 url = "http://nhac.vui.vn";


	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }

