var version = "other"
browserName = navigator.appName;   
browserVer = parseInt(navigator.appVersion);
		
if (browserName == "Netscape" && browserVer >= 3) version = "n3";
else if (browserName == "Netscape" && browserVer < 3) version = "n2";
else if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) version = "e4";
else if (browserName == "Microsoft Internet Explorer" && browserVer < 4) version = "e3";
	
function stopError(){
		return true;
}
window.onerror = stopError;
	
function wireOpen(){
		if (version == "e4"){
			document.write("<marquee behavior='scroll' direction='up' width='100%' height='180' scrollamount='1' scrolldelay='100' onmouseover='this.stop()' onmouseout='this.start()'>")
		}
}
	
function wireClose(){
		if (version == "e4"){
			document.write("</marquee>")
		}
}

//  player_special by jeff
function openChannelSpecial(url){
	try
	{
		document.Player.Controls.stop();
	} catch(e) {}
	win = window.open(url,'index','scrollbars=yes,width=1024,height=650,left=0,top=0');
}


function openbannercode(){
	 window.open("linkcode.html","codewin","height=250,width=600,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbar=0,resizeable=0");
	}

function openChannelMode(url){
	try
	{
		document.Player.Controls.stop();
	} catch(e) {}
	win = window.open(url,'index','scrollbars=no,width=967,height=441,left=0,top=0');
}
function openChannelModeMvtv(url){
	try
	{
		document.Player.Controls.stop();
	} catch(e) {}
	win = window.open(url,'index','scrollbars=no,width=1010,height=700,left=0,top=0');
}


function openChannelModePracatah(url){
	try
	{
		document.Player.Controls.stop();
	} catch(e) {}
	win = window.open(url,'index','scrollbars=no,width=601,height=501,left=0,top=0');
}

function openChannelModeNic(url){
	try
	{
		document.Player.Controls.stop();
	} catch(e) {}
	win = window.open(url,'index','scrollbars=no,width=1024,height=900,left=0,top=0');
}
function openChannelModeTTV(url){
	try
	{
		document.Player.Controls.stop();
	} catch(e) {}
	win = window.open(url,'index','scrollbars=no,width=500,height=500,left=0,top=0');
}
function openChannelModeOndemand(url){
	try
	{
		document.Player.Controls.stop();
	} catch(e) {}
	win = window.open(url,'ondemand','scrollbars=no,width=649,height=500,left=100,top=100');
}

function openChannelModeSmall(url){
	try
	{
		document.Player.Controls.stop();
	} catch(e) {}
	win = window.open(url,'index','scrollbars=no,width=610,height=475,left=0,top=0');
}

function doSubmitIfRequired(strElementName) {
  var strSelectedValue = strElementName;
  if(strSelectedValue != 0) {
    window.open("http://www.myiptv.tv/player_ondemand.php?url=mms://203.170.198.56/ondemand/ghost/" + strSelectedValue + "&channel=Ghost&roomID=1&Mode=1&ProgramID=14437&MediaID=21", 'index', 'width=1010,height=526,left=0,top=0')
  }
  return;
}

function doSubmitIfRequired_2(strElementName) {
  //var strSelectedValue = eval("document.myForm." + strElementName + ".options[document.myForm." + strElementName + ".selectedIndex].value");
  var strSelectedValue = strElementName;
  if(strSelectedValue != 0) {
    window.open("http://www.myiptv.tv/player_ondemand.php?url=mms://203.170.198.56/ondemand/remote_enc1_prog1/" + strSelectedValue + "&channel=MID25&roomID=1&Mode=1&ProgramID=11710&MediaID=25", 'index', 'width=1010,height=526,left=0,top=0')
  }
  return;
}

function UP_Picture(){
	window.open('membersentfile.php?MediaID={MediaID}&ProgramID={ProgramID}','upload','width=500,height=250');
	//window.open('membersentfile.php?MediaID={MediaID}&ProgramID=' + this.programID,'upload','width=500,height=250');
}

function Play(){
	document.mediaPlayer.Controls.Play();
}
function x1(){
	document.mediaPlayer.stretchToFit = "false";
//	document.mediaPlayer.URL = "{MediaURL}";
	document.mediaPlayer.Controls.Play();
}
function x2(){
	document.mediaPlayer.stretchToFit = "true";
//	document.mediaPlayer.URL = "{MediaURL}";
	document.mediaPlayer.Controls.Play();
}

function SoundON(){
	document.mediaPlayer.settings.mute = false;
    document.mediaPlayer.Controls.Play();
}

function SoundOFF(){
	document.mediaPlayer.settings.mute = true;
    document.mediaPlayer.controls.Play();
}

function replaceBandwidthWith(iBandwidth) {
	var sRet = document.mediaPlayer.URL;
	var sReg = /(WMContentBitrate=)\d*/gi;
	return sRet.replace(sReg, "WMContentBitrate=" + iBandwidth);
}

function b56(){
	document.mediaPlayer.URL = "mms://203.170.198.56/webcast_channel1?WMContentBitrate=50000"
    document.mediaPlayer.Controls.Play()
}

function b128(){
	document.mediaPlayer.URL = "mms://203.170.198.56/webcast_channel1?WMContentBitrate=128000"
    document.mediaPlayer.Controls.Play()
}

function b256(){
	document.mediaPlayer.URL = "mms://203.170.198.56/webcast_channel1?WMContentBitrate=250000"
    document.mediaPlayer.Controls.Play()
}

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;
}

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 MM_findObj(n, d) { //v4.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);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

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 getChannel(ChID){
	var ChID;
	if(ChID==1){ // MyiPTV Channel
		window.index_program.location='http://www.myiptv.tv/index_program_myiptv_N.php';
	}
	else if(ChID==2){ // MVTV
		window.location.href='http://www.myiptv.tv/mvtv.php';
	}
	else if(ChID==3){ // D-TV
		window.index_program.location='http://www.myiptv.tv/index_program_dhub.php';
	}
	else if(ChID==4){ // MUN - TV
		window.index_program.location='http://www.myiptv.tv/index_body_channel.php';
	}
	else if(ChID==5){ // Education TV
		window.open('http://www.educationtv-sbi.com');
	}
	else if(ChID==6){ // ITV
		window.index_program.location='http://www.myiptv.tv/freetv.php';
	}
	else if(ChID==7){ // RADIO
		window.index_program.location='http://www.myiptv.tv/radiothainland.php';
	}
	else if(ChID==8){ // Nic
		openChannelModeNic('player_nic.php?ProgramID=1-1');
	}
	else if(ChID==9){ // ???
		window.location='http://www.myiptv.tv/pracatah.php';
	}
}

function LMenu(ChID){
	if(ChID==1){ // ???????? http://www.myiptv.tv/index_sub.php
		window.location.href='http://www.myiptv.tv/index_sub.php';
	}
	else if(ChID==2){ // Outdoor
		window.location.href='http://www.myiptv.tv/special_cute.php';
	}
	else if(ChID==3){ // Commercial : http://www.myiptv.tv/commercial.php
		window.location.href='http://www.myiptv.tv/commercial.php';
	}
	else if(ChID==4){ // Game Zone : http://www.myiptv.tv/game.php
		window.location.href='http://www.myiptv.tv/game.php';
	}
	else if(ChID==5){ // Podcasts : http://www.myiptv.tv/myiptv_podcast.php
		window.location.href='http://www.myiptv.tv/myiptv_podcast.php';
	}
	else if(ChID==6){ // MY IPTV ?????
		window.index_program.location='http://www.myiptv.tv/index_news.php';
	}
	else if(ChID==7){ // Donwload
		//window.location.href='http://www.myiptv.tv/index_program_dhub.php';
	}
	else if(ChID==8){ // webboard : http://www.miumu.com/boards/index.php?mforum=MYIPTV&act=idx
		window.open('http://www.miumu.com/boards/index.php?mforum=MYIPTV&act=idx');
	}
	else if(ChID==9){ // ????????? MY IPTV
		window.location.href='http://www.myiptv.tv/aboutus.php';
	}
	else if(ChID==10){ // ?????????????
		window.location.href='http://www.myiptv.tv/faq.php';
	}							
	else if(ChID==11){ // Site Map
		//window.location.href='http://www.myiptv.tv/index_program_dhub.php';
	}
}

function getprogram()
{
	//openChannelMode('playerfirst.php?ProgramID=IPTV1&MediaID={MediaID}&memberID={memberID}');
}

function ShowTopTen()
{
	window.open('./vote_topten/index_vote.php','wtopten','height=360,width=1000,left=0,top=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbar=0,resizeable=0');
}
