
function clickIE() {if (document.all) return false;}
function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) if (e.which==2||e.which==3) return false;}
if (document.layers) 
{
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS;
}
else
{
	document.onmouseup=clickNS;
	document.oncontextmenu=clickIE;
}

document.oncontextmenu = new Function("return false")


var playSound = null;
var videoDiv = null;
var lastVideoId = 0;
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) ie = 1;
else ie = 0;

function play(file, type)
{
	if(playSound != null) 
	{
		if (ie) 
		{
			playSound.Stop();
			document.getElementById('playDiv').removeChild(eval(playSound));
		}
		else document.body.removeChild(eval(playSound));
		playSound = null;
	}
	if (file != '0')
	{
		if (type == 'ringtone') path = "/MobitApi/Ringtone/Swf/";
		else if (type == 'truetone') path = "/MobitApi/Truetone/Swf/";
		else if (type == 'fulltone') path = "/MobitApi/Fulltone/Swf/";
		else retrun;
		
		playSound=document.createElement('embed')
		playSound.setAttribute('width','0');
		playSound.setAttribute('height','0');
		playSound.setAttribute('src', path+file+'.swf');
		playSound.setAttribute('name', 'playRingtone');
		if (ie) document.getElementById('playDiv').appendChild(playSound);
		else document.body.appendChild(playSound); 
	}
}

function playVideo(file, id)
{
	if(videoDiv != null) 
	{
		if (ie) 
		{
			videoDiv.Stop();
			document.getElementById('vid'+lastVideoId).removeChild(eval(videoDiv));
		}
		else document.getElementById('vid'+lastVideoId).removeChild(eval(videoDiv));
		videoDiv = null;
		lastVideoId = id;
	}
	if (file != '0')
	{
		lastVideoId = id;
		path = "/MobitApi/Video/Swf/";
		
		videoDiv=document.createElement('embed')
		videoDiv.setAttribute('width','100');
		videoDiv.setAttribute('height','100');
		videoDiv.setAttribute('loop','false');
		videoDiv.setAttribute('src', path+file+'.swf');
		videoDiv.setAttribute('name', 'playVid');
		videoDiv.style.marginTop = '-100px';
		document.getElementById('vid'+id).appendChild(videoDiv);
	}
}

function goDownload(id, title)
{
	loadwindow('TM_MobitDownload.php?get=1&rid='+id, 470, 300, title);
	return false;
}
