
var audiolist = new Array("Daz Nundaz - Nizoee",
							"Wakali Kwanza - Sifai",							
							"P Funky Ft. Dully - Forgive me")
                  
var medialist;
var sortedmedialist;
function xy()
{
   alert("hello there");
}

function initlist(arrAddr)
{
	if (window.document.getElementById("Listbox").size==1)
	{
	  // alert("Initlist f(x), array length is: "+arrAddr.length);
	 //  for(i=0; i<arrAddr.length; i++){
		medialist = arrAddr;
		sortedmedialist = arrAddr;
	   //}
		//alert("Initlist f(x), medialist length is: "+medialist.length+", element 4 = "+medialist[4]);
		sortedmedialist = medialist.sort();
		//alert("Initlist f(x), sortedmedialist length is: "+sortedmedialist.length+", element 4 = "+sortedmedialist[4]);

	   
	   
	}
	else
	{
	//	alert("Initlist f(x), else code ");
	//   medialist = audiolist;
	  // sortedmedialist = medialist;
	}

for(i=0; i<sortedmedialist.length; i++){
   sortedmedialist = medialist.sort();
   document.form1.dropdown.options[i].text = sortedmedialist[i];
  // document.form1.dropdown.options[i+1].text = "";
   }
  filtermedia();
}

function filtermedia()
{
	document.form1.dropdown.selectedIndex=0;
   var indexN = document.form1.dropdown.selectedIndex;
	var resultmedialist=new Array(medialist.length);
	var temp=0;
	var resultorder = 0;

	for(i=0; i<medialist.length; i++)	{
	  resultmedialist[i] = " ";		
   if(((medialist[i].toLowerCase()).indexOf((document.form1.text1.value).toLowerCase()))>=0)
   {
   	temp=medialist[i].indexOf(document.form1.text1.value);
   	resultmedialist[i]=medialist[i];
   	resultorder++;
   	}
   else{
   	temp=medialist[i].indexOf(document.form1.text1.value);
   	resultmedialist[i] = ".";
   	}
   }
   sortedmedialist=resultmedialist.sort();
var x=0;
   for(n=0; n<resultmedialist.length; n++)

   {
      document.form1.dropdown.options[n].text ="";      
      if(resultmedialist[n]!="."){
         document.form1.dropdown.options[x].text = resultmedialist[n];
         x++;
      }
      else{
         document.form1.dropdown.options[n].text ="";  //resultmedialist[n];
      }
      
   }
   //Total Listed media (listcount)
   document.form1.listcout.value=x;
}
function playselectedmedia()
{
   if(!window.document.getElementById)
   {alert("Not W3C browser");return;}
   var mediaref = window.document.getElementById("HotaXMedia");
 /* for offline
 //  mediaref.URL="http://localhost/HXweb/HMediaPost.php?getlink="+form1.dropdown.options[form1.dropdown.selectedIndex].text+"&Extra="+hplayer.getinfo(form1.dropdown.options[form1.dropdown.selectedIndex].text);
 */

//  mediaref.URL="http://www.bongotrax.com/flava/HMediaPost.php?getlink="+form1.dropdown.options[form1.dropdown.selectedIndex].text+"&Extra="+hplayer.getinfo(form1.dropdown.options[form1.dropdown.selectedIndex].text);
      

/****Applet code*/
      var SongTitle = (document.form1.dropdown.options[document.form1.dropdown.selectedIndex].text); //get selected title
      hplayer.LoadLyric(SongTitle);  //load lyrics
		mediaref.URL="http://www.bongotrax.com/flava/HMediaPost.php"+hplayer.getinfo(document.form1.dropdown.options[document.form1.dropdown.selectedIndex].text);
		//mediaref.URL="requestflava.php?getlink="+form1.dropdown.options[form1.dropdown.selectedIndex].text;
		mediaref.controls.play();
		document.form1.text1.value=form1.dropdown.options[form1.dropdown.selectedIndex].text;
      TimerId=window.setInterval("getlyric()",120); // start timer
	//Description:writes a tag to embed selected media and start playing the media.
	//Ideal: Dynamically modify the scr url of embedded media object in the document and start streaming. 
	//  document.write("<p><embed autostart='true' loop='false' src=\"M:\\Java web script\\"+form1.dropdown.options[form1.dropdown.selectedIndex].text+"\""+"> <br><a href=searchscript.html>Play another song<br>")
	//return http://mydomain.com/media.php
}


//timed calls to this
function getlyric(){
		var currPos;
      var NoUse;
		currPos = parseInt(document.HotaXMedia.Controls.currentPosition);
      NoUse=hplayer.getlyric(currPos);    
	} 



//-->