var array_marker_list = new Array;
var gLastList=-1;
//var gLastList2=-1;
function get_marker_list(markername, ListIndex, t)
{
	d = "";
	if( t >= 3600 )
	{
		d += Math.floor( t / 3600)  + ":" ;
		t -= Math.floor( t / 3600 ) * 3600;
	}
	if( t >= 60 )
	{
		if (Math.floor(t / 60) < 10)
			d += "0";
		d += Math.floor(t / 60) + ":";
		t -= Math.floor(t / 60) * 60;
	}
	else
		d += "00:"

	if (t < 10)
		d += "0";
	d += t;

	if ( markername.indexOf("*", 0) > 0 )
		markername=markername.substr(0,markername.lastIndexOf("*"));
	title=markername.substr(markername.indexOf("#")+1,markername.length-markername.indexOf("#")); //+ "  ";
	
	if (title != "")
	{
		sHtml = "<span onclick='vbscript:parent.List_onClick " + ListIndex + "'" ;
		sHtml +=" onmouseover='marker_list_on_mouse_over(this)'" + 
			" onmouseout='marker_list_on_mouse_out(this)'><nobr><span id=action></span>" +
			"<span id=listofMarker>"

		sHtml += '<img src="./images/maker_icon.gif" alt="' + '(' + d + ') ' +  title + '"></img> ';
		sHtml += '(' + d + ') ' + title + '</span></nobr></span><br>';

		return sHtml;
	}
	else
	{
		sHtml = "<span onclick='vbscript:parent.List_onClick " + ListIndex + "'" ;
		sHtml +=" onmouseover='marker_list_on_mouse_over(this)'" + 
			" onmouseout='marker_list_on_mouse_out(this)'><nobr><span id=action></span>" +
			"<span id=listofMarker>"

		//sHtml += '<img src="./img/icons.gif" alt="' + '(' + d + ') ' +  title + '"></img> ';
		sHtml += 'Index is none..</span></nobr></span>';

		return sHtml;
	}

}

//frm_marker_list////////////////
function ChangeEntry(ListIndex)
{
	if( gArrayList!="[object]" )
		return;
	if( gArrayList[ListIndex-1]!="[object]" )
		return;
	if( gLastList != -1 )
		gArrayList[gLastList].className='marker_list_on_mouse_out';
		
	gArrayList[ListIndex-1].className='marker_list_on_playing';

	frm_marker_list.scrollTo(0,(ListIndex-3)*14);

	gLastList = ListIndex - 1;
}

function InitMarkerList(lReadyState)
{
	total_list = '';
	if (MediaPlayer1.currentMedia.MarkerCount > 0)
	{

		for(i=1;i<=MediaPlayer1.currentMedia.MarkerCount;i++)
		{
			
			temp2=MediaPlayer1.currentMedia.GetMarkerName(i);
					pos = temp2.indexOf("#") - 1;

			temp=get_marker_list(temp2,i,Math.ceil(MediaPlayer1.currentMedia.GetMarkerTime(i)) );
			total_list += temp;
		}

		arr_markerlist = frm_marker_list.document.all.item("total_marker_list");
		arr_markerlist.innerHTML = total_list;
		gArrayList=frm_marker_list.document.all.item("listOfMarker");

	}

}



function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
/* Functions that swaps images. */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function DoHelp()
{
	status = "height=" + (screen.availHeight-100);
	status += ",width=600,left=0,top=0,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes"
	window.open("help/help.htm","_blank",status);
}


function IsObj(obj)
{
	if (obj!=null && obj!="undefined") return true;
	else return false;
}

