
var isPlayed = false;
var mp;
    

function CreateMediaPlayer(id)
{
 
	mp = document.createElement("OBJECT");
	mp.id = id;
	mp.codeBase = "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715 type=application/x-oleobject";
	mp.standby = "Media player is being loaded...";
	mp.width = "320";
	mp.height = "220";
	mp.classid = "CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95";
	mp.AutoStart = "true";
	mp.ShowStatusBar = "true";
	mp.ShowControls = "false";
	//mp.AutoStart = "1";
	//mp.EnableContextMenu = "1";
	//mp.EnablePositionControls ="1";
	mp.EnableFullScreenControls ="true";
	//mp.EnableControls = "1";
	//mp.ClickToPlay = "1";
	//mp.VideoBorder3D = "1";
	//mp.AnimationAtStart = "1";
	//mp.ShowPositionControls = "1";
	//mp.ShowDisplay = "1";
	//mp.Enabled = "1";
	//mp.ShowTracker = "true";
	//mp.EnableFullScreenControls = "true";
	
	mp.PlayCount = "1";
	mp.TransparentAtStart = "false";
	mp.PreviewMode = "true";
	//obj.appendChild(mp);
	var divObj 	=document.getElementById("divGenericContainer_"+id);
	divObj.setAttribute("isPlayed",false);
	document.getElementById("divGenericContainer_"+id).appendChild(mp);
}

function CreateMediaPlayer_Small(id,file)
{
//alert(file);
 
	mp = document.createElement("OBJECT");
	mp.id = id;
	mp.codeBase = "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715 type=application/x-oleobject";
	mp.standby = "Media player is being loaded...";
	mp.width = "208";
	mp.height = "171";
	mp.classid = "CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95";
	mp.AutoStart = "1";
	
	mp.ShowStatusBar = "false";
	mp.ShowControls = "false";
	//mp.AutoStart = "1";
	//mp.EnableContextMenu = "1";
	//mp.EnablePositionControls ="1";
	mp.EnableFullScreenControls ="true";
	//mp.EnableControls = "1";
	//mp.ClickToPlay = "1";
	//mp.VideoBorder3D = "1";
	//mp.AnimationAtStart = "1";
	//mp.ShowPositionControls = "1";
	//mp.ShowDisplay = "1";
	//mp.Enabled = "1";
	//mp.ShowTracker = "true";
	//mp.EnableFullScreenControls = "true";
	
	mp.PlayCount = "1";
	mp.TransparentAtStart = "false";
	mp.PreviewMode = "true";
	mp.FileName = file;
	mp.Play();
	
	//obj.appendChild(mp);
	var divObj 	=document.getElementById("divGenericContainer_"+id);
	divObj.setAttribute("isPlayed",true);
	document.getElementById("divGenericContainer_"+id).appendChild(mp);
	
}

function CreateMediaPlayer_Big(id,file)
{
//alert(file);
 
	mp = document.createElement("OBJECT");
	mp.id = id;
	mp.codeBase = "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715 type=application/x-oleobject";
	mp.standby = "Media player is being loaded...";
	mp.width = "320";
	mp.height = "235";
	mp.classid = "CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95";
	mp.AutoStart = "false";
	
	mp.ShowStatusBar = "false";
	mp.ShowControls = "false";
	//mp.AutoStart = "1";
	//mp.EnableContextMenu = "1";
	//mp.EnablePositionControls ="1";
	mp.EnableFullScreenControls ="true";
	//mp.EnableControls = "1";
	//mp.ClickToPlay = "1";
	//mp.VideoBorder3D = "1";
	//mp.AnimationAtStart = "1";
	//mp.ShowPositionControls = "1";
	//mp.ShowDisplay = "1";
	//mp.Enabled = "1";
	//mp.ShowTracker = "true";
	//mp.EnableFullScreenControls = "true";
	
	mp.PlayCount = "1";
	mp.TransparentAtStart = "false";
	mp.PreviewMode = "true";
	mp.FileName = file;
	//mp.Play();
	
	//obj.appendChild(mp);
	var divObj 	=document.getElementById("divGenericContainer_"+id);
	divObj.setAttribute("isPlayed",false);
	document.getElementById("divGenericContainer_"+id).appendChild(mp);
	
}


function MediaPlayer_Play(id,song)
{
//alert(id);
	 mp.AutoStart = "true";
	 mp = document.getElementById(id);
	if (song != "")	
	{
		mp.FileName = song;
		mp.Play();
		var divObj 	=document.getElementById("divGenericContainer_"+id);
		divObj.setAttribute("isPlayed",true);		
	}
}

/*function MediaPlayer_Play_Big(id, song, bb)
{
alert(id);
	alert('aa');
	
	 mp.AutoStart = "true";
	 mp = document.getElementById(id);
   if (song != "")	
   {
		mp.FileName = song;
		mp.Play();
		var divObj 	=document.getElementById("divGenericContainer_"+id);
		//divObj.setAttribute("isPlayed",true);		
	
	
	//Pause
	isPlayed = divObj.getAttribute("isPlayed");
	if (isPlayed)
	{
		mp.Pause();
		bb.src ='http://www.vgames.co.il/images/Pause.gif';
		divObj.setAttribute("isPlayed",false);	
		
	}
	else
	{
		mp.Play();
		divObj.setAttribute("isPlayed",true);	
		bb.src ='http://www.vgames.co.il/images/Play.gif';
		
	}
	//End Pause
   }
}

*/
function MediaPlayer_Stop(id)
{
//alert(id);
 mp = document.getElementById(id);
 var divObj 	=document.getElementById("divGenericContainer_"+id);
 isPlayed = divObj.getAttribute("isPlayed");
	if (isPlayed)
	{
		mp.Stop();
		divObj.setAttribute("isPlayed",false);	
	}
}


	
function Mute(b,id)
{

 mp = document.getElementById(id);
//b = document.getElementById("btnMute");

if(b.src=='http://www.vgames.co.il/images/MuteOff_small.jpg')
{
	b.src='http://www.vgames.co.il/images/MuteOn_small.jpg';
}
else
{
	b.src='http://www.vgames.co.il/images/MuteOff_small.jpg';
}
	if (mp.Mute==false)
	{
		mp.Mute = true;
	}	
	else 
	{
		mp.Mute = false;
	}	
} 
function Mute_Big(b,id)
{
//alert(b);
 mp = document.getElementById(id);
//b = document.getElementById("btnMute");

if(b.src=='http://www.vgames.co.il/images/MuteOff.gif')
{
	b.src='http://www.vgames.co.il/images/MuteOn.gif';
}
else
{
	b.src='http://www.vgames.co.il/images/MuteOff.gif';
}
	if (mp.Mute==false)
	{
		mp.Mute = true;
	}	
	else 
	{
		mp.Mute = false;
	}	
} 
function MediaPlayer_Pause(id)
{
mp = document.getElementById(id);
var divObj 	=document.getElementById("divGenericContainer_"+id);
isPlayed = divObj.getAttribute("isPlayed");
	if (isPlayed)
	{
		mp.Pause();
		divObj.setAttribute("isPlayed",false);	
		
	}
	else
	{
		mp.Play();
		divObj.setAttribute("isPlayed",true);	
		
	}
}
function MediaPlayer_FullScreen()
{
    //mp.settings.setMode("showFrame");
}

function SWF(file, id, type)
{
	var FO;
	if(type == 1)
	{
        FO = {        movie:"../FlashPlayer/player_full.swf",width:"360",height:"280",majorversion:"7",build:"0",bgcolor:"#FFFFFF",
                                flashvars:"file="+file+"&showdigits=true&autostart=false&showfsbutton=true" };
        UFO.create(FO, id);
		//window.close();
         //UFO.create(        FO, id);
	}
	if(type == 2)
	{
	
		 var FO = {        movie:"../../FlashPlayer/player_mini.swf",width:"224",height:"199",majorversion:"7",build:"0",bgcolor:"#FFFFFF",
                                flashvars:"file="+file+"&showdigits=true&autostart=false&showfsbutton=true" };
         UFO.create(FO, id);
         //window.close();
         //UFO.create(        FO, id);
         
	}
}
function CloseVideo(File, id)
			{
			//alert(File);
				//str is the Image Name
				
				var ids = document.getElementById(id);
				VideoId = Math.floor(Math.random()*9999999999);
				//window.returnValue = "<div class=MediaPlayer><br>"+ CreateVideoString(VideoId, '320','220','true','false',strVideo.value ,'false','true') +"<table id=Buttons height=50 align=left><tr><td align=left>&nbsp;&nbsp;<img src='http://www.vgames.co.il/images/Play.gif' onclick=MediaPlayer_Play('"+VideoId+"','"+strVideo.value+"'); id=btnPlay/><img src='http://www.vgames.co.il/images/Pause.gif' onclick=MediaPlayer_Pause('"+VideoId+"'); id=btnPause/><img src='http://www.vgames.co.il/images/Stop.gif' onclick=MediaPlayer_Stop('"+VideoId+"'); id=btnStop/><img src='http://www.vgames.co.il/images/MuteOff.gif' onclick=Mute(this,'"+VideoId+"'); id=btnMute/></td></tr></table></div>";
				
				
				//var tt = "<div class='MediaPlayer_Small' id='divGenericContainer_"+VideoId+"'><table id=Buttons height=10 align=left><tr><td align=left>&nbsp;&nbsp;<img src='http://www.vgames.co.il/images/Play.gif' onclick=MediaPlayer_Play('"+VideoId+"','"+File+"'); id=btnPlay/><img src='http://www.vgames.co.il/images/Pause.gif' onclick=MediaPlayer_Pause('"+VideoId+"'); id=btnPause/><img src='http://www.vgames.co.il/images/Stop.gif' onclick=MediaPlayer_Stop('"+VideoId+"'); id=btnStop/><img src='http://www.vgames.co.il/images/MuteOff.gif' onclick=Mute(this,'"+VideoId+"'); id=btnMute/></td></tr></table></div>";
				//var tt = "<div class='MediaPlayer_Small'><div class='Video' id='divGenericContainer_"+VideoId+"'></div><table id=Buttons  align=left><tr valign=top><td align=left>&nbsp;&nbsp;<img src='http://www.vgames.co.il/images/MuteOff.gif' onclick=Mute(this,'"+VideoId+"'); id=btnMute/><img width=140 src='http://www.vgames.co.il/images/ProgressBar.gif'/><img src='http://www.vgames.co.il/images/Stop.gif' onclick=MediaPlayer_Stop('"+VideoId+"'); id=btnStop/><img src='http://www.vgames.co.il/images/Pause.gif' onclick=MediaPlayer_Pause('"+VideoId+"'); id=btnPause/><img src='http://www.vgames.co.il/images/Play.gif' onclick=MediaPlayer_Play('"+VideoId+"','"+File+"'); id=btnPlay/></td></tr></table></div>";
				var tt = "<div class='MediaPlayer_Small'><div class='Video' id='divGenericContainer_"+VideoId+"'></div><table id=Buttons height=10 align=left><tr><td align=left>&nbsp;&nbsp;<img src='http://www.vgames.co.il/images/Play_small.jpg' onclick=MediaPlayer_Play('"+VideoId+"','"+File+"'); id=btnPlay/><img src='http://www.vgames.co.il/images/Pause_small.jpg' onclick=MediaPlayer_Pause('"+VideoId+"'); id=btnPause/><img src='http://www.vgames.co.il/images/Stop_small.jpg' onclick=MediaPlayer_Stop('"+VideoId+"'); id=btnStop/><img width=140 src='http://www.vgames.co.il/images/ProgressBar.gif'/><img src='http://www.vgames.co.il/images/MuteOff_small.jpg' onclick=Mute(this,'"+VideoId+"'); id=btnMute/></td></tr></table></div>";
				//ProgressBarFull.gif
				//VideoId.style.
				
				
				var sp = document.createElement("span");
				sp.innerHTML = tt;
				
				ids.appendChild(sp);
				//var d = document.createElement("DIV");
				
				var scr = "CreateMediaPlayer_Small('"+VideoId+"','"+File+"')";
				window.execScript(scr);
				
				//d.className = "MediaPlayer";				
				//d.innerHTML = "<BR><table id=Buttons height=50 align=left><tr><td align=left>&nbsp;&nbsp;<img src='http://www.vgames.co.il/images/Play.gif' onclick=MediaPlayer_Play('"+VideoId+"','"+File+"'); id=btnPlay/><img src='http://www.vgames.co.il/images/Pause.gif' onclick=MediaPlayer_Pause('"+VideoId+"'); id=btnPause/><img src='http://www.vgames.co.il/images/Stop.gif' onclick=MediaPlayer_Stop('"+VideoId+"'); id=btnStop/><img src='http://www.vgames.co.il/images/MuteOff.gif' onclick=Mute(this,'"+VideoId+"'); id=btnMute/></td></tr></table>";
				//ids.appendChild(d);
				//window.execScript("CreateMediaPlayer_Small('"+VideoId+"')");
				
				//alert(ids.innerHtml);
				//document.write(ids.innerHtml);
				//ids.document.write(tt);
				//alert(ids);
				//CreateMediaPlayer();
				
				//window.close();
			}
			function do_PlayBig(id, song, bb)
			{
				//var idid = 0;
				if(mp.FileName ==null)
				{
					mp.FileName = song;
				}
				mp = document.getElementById(id);
				var divObj 	=document.getElementById("divGenericContainer_"+id);
				//if(
				//mp.AutoStart = "true";
				mp = document.getElementById(id);
				//if (song != "")	
				//{
					//mp.FileName = song;
					//mp.Play();
					
					//divObj.setAttribute("isPlayed",true);
		
					//window.setTimeOut(10, function (divObj,
					//Pause
					//alert(isPlayed);
					
					isPlayed = divObj.getAttribute("isPlayed");
					if (isPlayed)
					{
					//alert('1');
						mp.Pause();
						bb.src ='http://www.vgames.co.il/images/Play.gif';
						divObj.setAttribute("isPlayed",false);			
					}
					else
					{
					//alert('2');
					//mp.AutoStart = "true";
						mp.Play();
						divObj.setAttribute("isPlayed",true);	
						bb.src ='http://www.vgames.co.il/images/Pause.gif';
						
					}
					//End Pause
				//}
			}
			
			function CloseVideo_Big(File, id)
			{
			//alert(File);
				//str is the Image Name
				
				var ids = document.getElementById(id);
				VideoId = Math.floor(Math.random()*9999999999);
				//window.returnValue = "<div class=MediaPlayer><br>"+ CreateVideoString(VideoId, '320','220','true','false',strVideo.value ,'false','true') +"<table id=Buttons height=50 align=left><tr><td align=left>&nbsp;&nbsp;<img src='http://www.vgames.co.il/images/Play.gif' onclick=MediaPlayer_Play('"+VideoId+"','"+strVideo.value+"'); id=btnPlay/><img src='http://www.vgames.co.il/images/Pause.gif' onclick=MediaPlayer_Pause('"+VideoId+"'); id=btnPause/><img src='http://www.vgames.co.il/images/Stop.gif' onclick=MediaPlayer_Stop('"+VideoId+"'); id=btnStop/><img src='http://www.vgames.co.il/images/MuteOff.gif' onclick=Mute(this,'"+VideoId+"'); id=btnMute/></td></tr></table></div>";
				//onclick=MediaPlayer_Play_Big('"+VideoId+"','"+File+"', this);
				//var tt = "<div class='MediaPlayer_Small' id='divGenericContainer_"+VideoId+"'><table id=Buttons height=10 align=left><tr><td align=left>&nbsp;&nbsp;<img src='http://www.vgames.co.il/images/Play.gif' onclick=MediaPlayer_Play('"+VideoId+"','"+File+"'); id=btnPlay/><img src='http://www.vgames.co.il/images/Pause.gif' onclick=MediaPlayer_Pause('"+VideoId+"'); id=btnPause/><img src='http://www.vgames.co.il/images/Stop.gif' onclick=MediaPlayer_Stop('"+VideoId+"'); id=btnStop/><img src='http://www.vgames.co.il/images/MuteOff.gif' onclick=Mute(this,'"+VideoId+"'); id=btnMute/></td></tr></table></div>";
				//var tt = "<div class='MediaPlayer_Small'><div class='Video' id='divGenericContainer_"+VideoId+"'></div><table id=Buttons  align=left><tr valign=top><td align=left>&nbsp;&nbsp;<img src='http://www.vgames.co.il/images/MuteOff.gif' onclick=Mute(this,'"+VideoId+"'); id=btnMute/><img width=140 src='http://www.vgames.co.il/images/ProgressBar.gif'/><img src='http://www.vgames.co.il/images/Stop.gif' onclick=MediaPlayer_Stop('"+VideoId+"'); id=btnStop/><img src='http://www.vgames.co.il/images/Pause.gif' onclick=MediaPlayer_Pause('"+VideoId+"'); id=btnPause/><img src='http://www.vgames.co.il/images/Play.gif' onclick=MediaPlayer_Play('"+VideoId+"','"+File+"'); id=btnPlay/></td></tr></table></div>";
				var tt = "<div class='MediaPlayer'><br><div class='Video' id='divGenericContainer_"+VideoId+"'></div><table dir=ltr id=Buttons height=10 align=left><tr><td align=left>&nbsp;&nbsp;<img style='MARGIN-LEFT: 10px' src='http://www.vgames.co.il/images/Play.gif' onclick=do_PlayBig('"+VideoId+"','"+File+"',this); id=btnPlay/><img style='MARGIN-LEFT: 5px' src='http://www.vgames.co.il/images/Stop.gif' onclick=MediaPlayer_Stop('"+VideoId+"'); id=btnStop/><span style='MARGIN-LEFT: 270px' /><img src='http://www.vgames.co.il/images/MuteOff.gif' onclick=Mute_Big(this,'"+VideoId+"'); id=btnMute/></td></tr></table></div>";
				//ProgressBarFull.gif
				//VideoId.style.
				//<img src='http://www.vgames.co.il/images/Play.gif' onclick=MediaPlayer_Play('"+VideoId+"','"+File+"', this); id=btnPlay/>
				
				var sp = document.createElement("span");
				sp.innerHTML = tt;
				
				ids.appendChild(sp);
				//var d = document.createElement("DIV");
				
				var scr = "CreateMediaPlayer_Big('"+VideoId+"','"+File+"')";
				window.execScript(scr);
				
				//d.className = "MediaPlayer";				
				//d.innerHTML = "<BR><table id=Buttons height=50 align=left><tr><td align=left>&nbsp;&nbsp;<img src='http://www.vgames.co.il/images/Play.gif' onclick=MediaPlayer_Play('"+VideoId+"','"+File+"'); id=btnPlay/><img src='http://www.vgames.co.il/images/Pause.gif' onclick=MediaPlayer_Pause('"+VideoId+"'); id=btnPause/><img src='http://www.vgames.co.il/images/Stop.gif' onclick=MediaPlayer_Stop('"+VideoId+"'); id=btnStop/><img src='http://www.vgames.co.il/images/MuteOff.gif' onclick=Mute(this,'"+VideoId+"'); id=btnMute/></td></tr></table>";
				//ids.appendChild(d);
				//window.execScript("CreateMediaPlayer_Small('"+VideoId+"')");
				
				//alert(ids.innerHtml);
				//document.write(ids.innerHtml);
				//ids.document.write(tt);
				//alert(ids);
				//CreateMediaPlayer();
				
				//window.close();
			}
