//real_ie.js 

     j = 2;
     viewFilm='';

function goMovie(destination,type) {
	clearInterval(loadInterval);
	clearInterval(bufferingInterval);

	viewFilm=destination;

	thePath.DoStop();


	Video(type);	


	//thePath.SetSource("http://www.psslbaseball.com");
	thePath.SetSource(viewFilm);
	thePath.DoPlayPause();
     //thePath = eval(document.all["G2Control"]);
     loadInterval = setInterval("LoadClip()",5000);
     bufferingInterval = setInterval("Buffering()",500);
	cleanImage(photoCheck);
}

function Video(type){

     if (type == "video"){
          document.all["mpplayer"].style.pixelLeft="29";
          document.all["ad"].visibility = "hide";
          document.all["mpplayer"].style.zIndex = "-10";
          document.all["ad"].visibility = "show";


 }else{
          if ( !random ) {
               var abc = Math.random() + "";
               var random = abc.substring(2,abc.length);
          }

          if ( !dclkteam ) {
               var dclkteam = "NUL";
          }

          var text=('<A TARGET="spln" HREF="http://ad.doubleclick.net/jump/buttons.mvp.com/mlb;arena=mlb;type=psa;pos=store;sz=120x60;tile=4;ord='+ random + '?"><img TARGET="spln" HSPACE="60" VSPACE="60" src="http://ad.doubleclick.net/ad/buttons.mvp.com/mlb;arena=mlb;type=psa;pos=store;sz=120x60;tile=4;ord='+random + '?" height=60 width=120 border=0></A>');

          document.all["ad"].visibility = "show";
          document.all["mpplayer"].style.pixelLeft="-500";
          document.all["ad"].innerHTML = (text);

 }
}

function cleanImage(photoCheck){

if (photoCheck == 1){
	document.relatedImage.src = ('/u/mp/1/images/transparent.gif'); 
	document.relatedphototext.src = ('/u/mp/1/images/transparent.gif');
	}
}

function Stop() {
	thePath.DoStop();

     stateInfo = thePath.GetPlayState();
     state = PlayerState(stateInfo);

     document.all["buffer"].innerHTML = "<center><font face=Arial size=-2 color=00ff00>" + state + "</font></center>";
     if (stateInfo == 0){clearInterval(bufferingInterval);}
     j = 1;
	}

function onPause() {
	stateInfo = thePath.GetPlayState();
	state = PlayerState(stateInfo);
     clearInterval(bufferingInterval);

	if (j == 1){
	bufferingInterval = setInterval("Buffering()",500);
	thePath.DoPlayPause();
     j = 2;
     }else if (j == 2){
     j = 1;
	thePath.DoPlayPause();
     document.all["buffer"].innerHTML = "<center><font face=Arial size=-2 color=00ff00>Paused</font></center>";
	}
}

function Buffering() {

     stateInfo = thePath.GetPlayState();
     state = PlayerState(stateInfo);

     buffering = thePath.GetBufferingTimeElapsed();
	checkbuffering = buffering;
	buffering =  Math.round(buffering/1000);


     if (checkbuffering >= 50){
     document.all["buffer"].innerHTML = "<center><font face=Arial size=-2 color=00ff00>Buffering " + buffering + " </font></center>";
     }

     if(stateInfo == 0)
          {
          document.all["buffer"].innerHTML = "<center><font face=Arial size=-2 color=00ff00>" + state + "</font></center>";
//          clearInterval(bufferingInterval);
          j = 1;
          }
     if(checkbuffering <= 50 && stateInfo == 3)
		{
          document.all["buffer"].innerHTML = "<center><font face=Arial size=-2 color=00ff00>" + state + "</font></center>";
          //clearInterval(bufferingInterval);
          j = 2;
          }
}

function PlayerState (stateInfo){
     if(stateInfo == 0){
          playerstate = "Stopped";
          }
     else if(stateInfo == 1)
		{
          playerstate = "Contacting";
          }
     else if(stateInfo == 2)
		{
          playerstate = "Buffering"; 
		}
     else if(stateInfo == 3)
		{
          playerstate = "Playing"; 
		}
     else if(stateInfo == 4)
		{
          playerstate = "Paused"; 
		}
     else if(stateInfo == 5)
		{
          playerstate = "Seeking";
          }
     else{
          playerstate = " ";
          }
return (playerstate);
}


function VolUp() {
	i = thePath.GetVolume();
	if (i <= 100) i = i + 5;
	else if (i >= 100) i = 100;
	thePath.SetVolume(i);
}

function VolDown() {
	if (i <= 0) i = thePath.GetVolume();
	else if (i >= 0) i = i - 5;
	thePath.SetVolume(i);
}

function LoadClip() {
     quest = /\W/;
	theTitle = thePath.GetTitle();
	theAuthor = thePath.GetAuthor(); 
//	theCopyright = thePath.GetCopyright(); 


     theCopyright = new String(thePath.GetCopyright());
     theCopyright = theCopyright.replace(quest,"&copy;");
     com = /&copy;com/g;
     theCopyright = theCopyright.replace(com,".com");

	var tacMessage = "<font face=Arial size=-2 color=00ff00> " + theTitle + "<br> " + theAuthor + "<br> " + theCopyright + "</font>";	
	document.all["tac"].innerHTML = tacMessage;
	
	if (theCopyright != "") clearInterval(loadInterval);
	return(false);
}

function Load(type) {

	//thePath = eval("document.all.G2Player");
	//thePath = eval("document.all['mpplayer'].G2Control");
	//thePath.SetAutoStart(true);

	viewFilm='playfirst';
	thePath = document.all.G2Control;

	Video(type);	


	test = 1;

	i = thePath.GetVolume();
	
	loadInterval = setInterval("LoadClip()",5000);
	bufferingInterval = setInterval("Buffering()",500);
	//return (viewFilm);
}
