document.write('<span id="page_mobilemagic_div" style="z-index=99; position:absolute; display:none;">');
var WMP7;
if(window.ActiveXObject)
{
	WMP7 = new ActiveXObject("WMPlayer.OCX.7");
}
else if (window.GeckoActiveXObject)
{
	try
	{
		WMP7 = new GeckoActiveXObject("WMPlayer.OCX.7");
	}
	catch (ex)
	{
	}
}
// Windows Media Player 7 Code
if (WMP7)
{
	document.write('<a href="javascript:popupDownloadStop();"><img src="Images/page_mobilemagic_wmp7.gif" border=0></a><br>');
	document.write ('<OBJECT ID=page_mobilemagic_wmp ');
	document.write (' CLASSID=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6');
	document.write (' standby="Loading Microsoft Windows Media Player components..."');
	document.write (' TYPE="application/x-oleobject" width="160" height="64">');
	document.write ('<PARAM NAME="url" VALUE="">');
	document.write ('<PARAM NAME="AutoStart" VALUE="true">');
	document.write ("<PARAM NAME='PlayCount' VALUE='1000'>");
	document.write ('<PARAM NAME="ShowControls" VALUE="1">');
	document.write ('<PARAM NAME="uiMode" VALUE="maxi">');
	//document.write ('<PARAM NAME="uiMode" VALUE="mini">');
	
	document.write ('</OBJECT>');
}

// Windows Media Player 6.4 Code
else
{
	//IE Code

document.write('<object id="page_mobilemagic_wmp" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width=200 height=20 style="display:block;">');
document.write('<param name="ShowControls" value="false">');
document.write('<param name="ShowAudioControls" value="false">');
document.write('<param name="ShowDisplay" value="false">');
document.write('<param name="ShowGotoBar" value="false">');
document.write('<param name="ShowPositionControls" value="false">');
document.write('<param name="ShowStatusBar" value="true">');
document.write('<param name="ShowTracker" value="false">');
document.write('<param name="AutoSize" value="false">');
	//Netscape code
/*	document.write ('    <Embed type="application/x-mplayer2"');
	document.write ('        pluginspage="http://www.microsoft.com/windows/windowsmedia/"');
	document.write ('        filename=""');
	document.write ('        src=""');
	document.write ('        Name=page_mobilemagic_wmp');
	document.write ('        ShowControls=0');
	document.write ('        ShowDisplay=0');
	document.write ('        ShowStatusBar=1');
	document.write ('        width=200');
	document.write ('        height=20>');
	document.write ('    </embed>');
*/
	document.write ('</object>');
	//document.write('<a href="javascript:popupDownloadStop();"><img src="http://mobilemagic.sanook.com/php/page_mobilemagic_wmp_stop.gif" border=0></a>');
}

/*
document.write('<a href="javascript:popupDownloadStop();"><img src="http://mobilemagic.sanook.com/php/page_mobilemagic_wmp7.gif" border=0></a><br>');
document.write ('<OBJECT ID="page_mobilemagic_wmp" ');
document.write (' CLASSID=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6');
document.write (' standby="Loading Microsoft Windows Media Player components..."');
document.write (' TYPE="application/x-oleobject" width="160" height="64">');
document.write ('<PARAM NAME="AutoStart" VALUE="true">');

document.write('<param name="ShowControls" value="0">');
document.write('<param name="ShowDisplay" value="0">');
document.write('<param name="ShowStatusBar" value="0">');
document.write('<param name="ShowGotoBar" value="0">');
document.write('<param name="ShowPositionControls" value="0">');
document.write ('<PARAM NAME="uiMode" VALUE="mini">');
document.write ('<PARAM NAME="url" VALUE="">');
document.write ('</OBJECT>');
*/
//document.write('<a href="javascript:popupDownloadStop();"><img src="http://mobilemagic.sanook.com/php/page_mobilemagic_wmp_stop.gif" border=0></a>');
document.write('</span>');
window.onload = page_mobilemagic_init;

var page_mobilemagic_div_display = false;
function page_mobilemagic_init() {
	if (window.Event) {
		document.captureEvents(Event.MOUSEMOVE);
	}
	document.onmousemove = page_mobilemagic_getXY;
}

function page_mobilemagic_getXY(e) {
	x = (window.Event) ? e.pageX : event.clientX;
	y = (window.Event) ? e.pageY : event.clientY;

	x+= (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
	y+= (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	// Use x and y to do what ever you want
	if(!page_mobilemagic_div_display) {
		if(WMP7) {
			document.getElementById('page_mobilemagic_div').style.left = x-180;
			document.getElementById('page_mobilemagic_div').style.top = y-40;
		}
		else {
			document.getElementById('page_mobilemagic_div').style.left = x+10;
			document.getElementById('page_mobilemagic_div').style.top = y-30;
		}
	}
}

function popupDownloadPlay(downloadID) {
	page_mobilemagic_div_display = false;
	page_mobilemagic_getXY();
	if(WMP7) {
		document.getElementById('page_mobilemagic_wmp').controls.Stop();
		document.getElementById('page_mobilemagic_wmp').url = downloadID;
		document.getElementById('page_mobilemagic_wmp').controls.Play();
	}
	else {
		page_mobilemagic_wmp.stop();
		page_mobilemagic_wmp.FILENAME =  downloadID;
		page_mobilemagic_wmp.play();
	}
	document.getElementById('page_mobilemagic_div').style.display = "block";
	document.getElementById('page_mobilemagic_wmp').style.display = "block";
	page_mobilemagic_div_display = true;

}

function popupDownloadStop() {
	if(WMP7) {
		document.getElementById('page_mobilemagic_wmp').controls.Stop();
	}
	else {
		page_mobilemagic_wmp.stop();
	}
	
	document.getElementById('page_mobilemagic_div').style.display = "none";
	document.getElementById('page_mobilemagic_wmp').style.display = "none";
	page_mobilemagic_div_display = false;
}



//function popupDownload(param)
//{
//	window.open("http://mobilemagic.sanook.com/howto2/?" + param,"_blank","toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=660,height=560");
//}