/* -----------------06/06/2006 13:25-----------------
revision history

 video_loaded_status_text changed to ''

 dsd fixed path to supdoc
	added !isFirefox  around Realplugin API functions
	added autostart=true for firefox and embedded the src attribute too.

 --------------------------------------------------*/
// FUNCTIONS /////////////////////////////////////////////////////////////////////////////////////////
// Universal get playstate of presentation
var FLVLoaded=false;
if(admin){
	SetProperty('adminusertext','innerHTML',dpxuser)
}
var altskinobj=new Object();

function getPS(elementID,media){
	if(document.videoscreen){
  	switch (media) {
    	case 'real':
    //	if(!isFirefox){
			Playstatevalue=elementID.GetPlayState();
			//Playstatevalue=(!beenplaying&&Playstatevalue==0)?1:Playstatevalue;
		 //	}else{
		 //	 Playstatevalue=3;
		 //		}
    	break
    	case 'wm':
    	Playstatevalue=getPlayState();
    	break
		  case 'qt':
			qtPS_string=document.videoscreen.GetPluginStatus();
			switch(qtPS_string){
				case 'Waiting':
				Playstatevalue=0;
				break
				case 'Loading':
				Playstatevalue=0;
				break
				case 'Playable':
				Playstatevalue=3;
				break
				case 'Complete':
				Playstatevalue=3;
				break
				case 'Error:':
				Playstatevalue=0;
				break
  			default:
				Playstatevalue=1;
				break
			}
    	break
		  case 'flash':
			FLVPS_string=FLVStatus;
			switch(FLVPS_string){
				case 'Stopped':
				Playstatevalue=0;
				break
				//case 'NetStream.Buffer.Full':
				//Playstatevalue=3;
				//break
				case 'Playing':
				Playstatevalue=3;
				break
				case 'Paused':
				Playstatevalue=4;
				break
			//	case 'Ready':
				//Playstatevalue=5;
				//break
  			default:
				Playstatevalue=0;
				break
			}
			//if(FLVDur>0){Playstatevalue=3}
    	break

		}
	}else{
		alert('screen not ready');
	}
  return Playstatevalue;
}

// Windows media playstate function
function getPlayState() {
	if(!isFirefox){
		if (activeX){
    	theps= document.videoscreen.playState;
  	}else{
    	theps=document.videoscreen.GetPlayState();
  	}
  	if (theps==1){theps=4;}
  	if (theps==2){theps=3;}
  	if (theps==6){theps=6;}
	}else{
		if(isXP || isVista){
			theps=0;
			if (ffwmp_state==2){theps=4;}
  		if (ffwmp_state==3){theps=3;}
  		if (ffwmp_state==10){theps=6;}
		}else{

		}
	}
	return theps;
}

function go_mediachoice(mediachoice,this_id){
	if(useCookies){
		if(!thechoiceismade){
			if(isWinMedia && isRealMedia){
				theurl='choosemedia.html';
  			settings='scrollbars=yes,status=yes,resizable=yes,width=320,height=120,left=100,top=100';
				webwin=window.open(theurl,'webwin',settings);
				an_interval2=setInterval("retry(mediachoice,this_id)",400);
			}else{
				if(isRealMedia){
					mediachoice='real'
					init_player(mediachoice,this_id)
				}else{
					if(isWinMedia){
						mediachoice='wm'
						init_player(mediachoice,this_id)
					}else{
						// no media plugins installed
						alert('please download either realplayer or windowsmedia player to play this presentation.');
					}
				}
			}
		}else{
 			mediachoice=themediachoice;
 			init_player(mediachoice,this_id);
 		}
	}else{
		init_player(mediachoice,this_id);
	}
}

function retry(mediachoice,this_id){
		if(!choicemade){
		}else{
			clearInterval(an_interval2);
			init_player(mediachoice,this_id)
		}
	}

function init_player(mediachoice,this_id){
	// routine for Universally instating,loading and playing any streaming media.
	screenstatus	=	'unestablished';
	media					=	mediachoice;
	id						=	this_id;
	if((media=='qt' && isQtMedia==false)|| (media=='wm' && isWinMedia==false)|| (media=='real' && isRealMedia==false)){
		//	return
	}
	autostart	=	false;
	init_player_clear(this_id);
	if(admin){
		SetProperty('stgmarkers',				'innerHTML','');
		SetProperty('stgtimeslottext',	'innerHTML','');
		if(slide_details_row_state=='green'){
			toggle_slide_details(slide_details_row_state);
		}
		marks_drawn=false;
	}
	switch (media) {
  	case 'real':
		MediaTypeKnown	=	true;
		movie						=	dp.presentations[id].urlreal;
		break
		case 'wm':
		MediaTypeKnown	=	true;
		movie						=	dp.presentations[id].urlwm;
		break
		case 'qt':
		MediaTypeKnown	=	true;
		movie						=	dp.presentations[id].urlqt;
		break
		case 'flash':
		MediaTypeKnown	=	true;
		movie						=	dp.presentations[id].urlflash;
		break
  	default:
		MediaTypeKnown	=	false;
		alert('The media type option code('+media+') you have selected to play for ('+movie+') is unknown.');
		break
 	}
	if(MediaTypeKnown){
		if(!player_open){
			dpxminimise();
		}
		slidetimes=(cd=='1')?id+'/slides_'+id+'.html'+'?dpxuser='+dpxuser:'slides.php?presentation='+id+'&dpxuser='+dpxuser;
		if(cd=='1'){
			amovie=movie.split('/');
			movie=id+'/'+amovie[amovie.length-1];
		}
		document.getElementById('activeslidewindow').style.visibility='hidden';
		//SetProperty('slide_title_txt',				'innerHTML','Slides loading... Please wait.');

		MakeVidObjML(screenid,video_screen_width,video_screen_height,media,movie,autostart);


		SetProperty('activevideowindow',			'innerHTML',esObj);
		SetProperty('presentationtitlesmall',	'innerHTML',dp.presentations[id].title);
		SetProperty('video_loaded_status_txt','innerHTML',dp.presentations[id].title);
		window.frames['slideframe'].location=slidetimes;
		txt('requesting slides now for pres',id);
		pdf_visibility=(dp.presentations[id].pdflink!='')?'visible':'hidden';
		SetStyle('pdfbutton','visibility',pdf_visibility);
		setTimeout('play_video();', 2000);
	}
}

function MakeVidObjML(VidObjId,w,h,MediaType,source,autostart){
	switch (MediaType) {
		case 'real':
			if(osMac && !isIE){
				esObj='<OBJE'+'CT id="rvocx" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"';
        esObj+='width="'+w+'" height="'+h+'">';
        esObj+='<param name="src" value="'+source+'">';
        esObj+='<param name="autostart" value="true">';
        esObj+='<param name="controls" value="imagewindow">';
        esObj+='<param name="console" value="video">';
        esObj+='<param name="loop" value="false">';
  		  esObj+='<EM';
				esObj+='BED id="'+VidObjId+'" src="'+source+'" width="'+w+'" height="'+h+'" ';
				esObj+='loop="false" type="audio/x-pn-realaudio-plugin" controls="imagewindow" console="video" autostart="true">';
        esObj+='</EMB'+'ED></OBJ'+'ECT>';
			}
			if(!osMac){
				ns_object_tag_start=(isNetscape)?'<object id="'+VidObjId+'_ns" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" height="'+w+'" width="'+h+'">':'';
				ns_object_tag_end=(isNetscape)?'</object>':'';
				autostarter='false';
				esObj=ns_object_tag_start+'<embed id='+VidObjId+' name=videoscreen src='+source+' width='+w+' height='+h+' center=true console=one controls=ImageWindow nologo="true" autostart='+autostarter+' maintainaspect=true TYPE="audio/x-pn-realaudio-plugin"></embed>'+ns_object_tag_end;
			}
		break;
		case 'wm':
			if(osMac && !isIE){
				esObj='<OBJECT id="videoscreen_ns" width="'+w+'" height="'+h+'" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"><param name="fileName" value="';
				esObj+=source;
				esObj+='"><param name="animationatStart" value="true"><param name="transparentatStart" value="true"><param name="autoStart" value="true"><param name="showControls" value="false"><param name="loop" value="false"><EMBED type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" id="videoscreen" name="videoscreen" displaysize="4" autosize="-1" bgcolor="darkblue" showcontrols="false" showtracker="-1" showdisplay="0" showstatusbar="-1" videoborder3d="-1" width="'+w+'" height="'+h+'" src="';
				esObj+=movie;
				esObj+='" autostart="true" designtimesp="5311" loop="true"></EMBED></OBJECT>';
			}else{
				if(isFirefox){
					if(isXP|| isVista){
						esObj = '<object id="videoscreen" type="application/x-ms-wmp" data="'+source+'" width="'+w+'" height="'+h+'">';
						esObj += '<param name="URL" value="'+source+'" />';
						esObj += '<param name="uiMode" value="none">';
						esObj += '<param name="windowlessVideo" value="true">';
						esObj += '<param name="enableContextMenu" value="true">';
						esObj += '<param name="autoStart" value="false">';
						esObj += '</object>';
					}
				}else{
					esObj='<embed TYPE="application/x-mplayer2" PLUGINSPAGE="http://microsoft.com/windows/mediaplayer/en/download/" id="videoscreen" name="videoscreen" WIDTH='+video_screen_width+'  HEIGHT='+video_screen_height+'  AUTOSTART="-1" SHOWCONTROLS="0" DESIGNTIMESP="5311"></embed>';
				}
			}
		break;
		case 'qt':
			if(osMac && !isIE){
				 esObj='<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="'+w+'" HEIGHT="'+h+'" ';
				 esObj+='CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" ';
				 esObj+='TYPE="application/x-oleobject">';
				 esObj+='<PARAM NAME="src" VALUE="'+source+'">';
				 esObj+='<PARAM NAME="bgcolor" VALUE="#000000">';
				 esObj+='<PARAM NAME="autoplay" VALUE="true">';
				 esObj+='<PARAM NAME="controller" VALUE="true">';
				 esObj+='<EMBED SRC="'+source+'" WIDTH="'+w+'" HEIGHT="'+h+'" AUTOPLAY="true" CONTROLLER="true" PLUGINSPAGE="http://www.apple.com/quicktime/download/"></EMBED>';
				 esObj+='</OBJECT>';
				 esObj+='';
			}
			if(!osMac){
			//	ns_object_tag_start=(isNetscape)?'<object id="'+VidObjId+'_ns" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" height="'+w+'" width="'+h+'">':'';
			//	ns_object_tag_end=(isNetscape)?'</object>':'';
			//	esObj=ns_object_tag_start+'<embed id='+VidObjId+' name=videoscreen width='+w+' height='+h+' center=true console=one controls=ImageWindow nologo="true" autostart=false maintainaspect=true TYPE="audio/x-pn-realaudio-plugin"></embed>'+ns_object_tag_end;
				 esObj='<OBJECT id="videoscreen" CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="'+w+'" HEIGHT="'+h+'" ';
				 esObj+='CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" ';
				 esObj+='>';
				 esObj+='<PARAM NAME="src" VALUE="'+source+'">';
				 esObj+='<PARAM NAME="scale" VALUE="aspect">';
				 esObj+='<PARAM NAME="controller" VALUE="false">';
				 esObj+='<EMBED SRC="'+source+'" WIDTH="'+w+'" HEIGHT="'+h+'" AUTOPLAY="true" TYPE="video/quicktime" enablejavascript="true" LOOP="false" name="videoscreen" PLUGINSPAGE="http://www.apple.com/quicktime/download/"></EMBED>';
				 esObj+='</OBJECT>';
				 esObj+='';
			}
			break;
		case 'flash':
			//alert(source);
			if(osMac && !isIE){
				esObj ='<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="videoscreen">';
				esObj+='<param name="movie" value="G2flv.swf"/>';
				esObj+='<param name="allowScriptAccess" value="always"/>';
				esObj+='<param name="FlashVars" value="streamName='+source+'"/>';
				esObj+='<param name="quality" value="high"/>';
				esObj+='<param name="scale" value="noscale"/>';
				esObj+='<param name="salign" value="lt"/>';
				esObj+='<embed name="videoscreen" src="'+source+'" flashvars="streamName='+source+'" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" quality="high" scale="noscale" salign="lt" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always"/>';
				esObj+='</object>';
			}
			if(!osMac){
				var astream=false;
				if(!astream){
					esObj ='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="videoscreen" >';
					esObj+='<param name="allowScriptAccess" value="always" />';
					esObj+='<param name="allowFullScreen" value="true" />';
					esObj+='<param name="movie" value="simplevideostreaming.swf" />';
					esObj+='<param name="FlashVars" value="StreamName='+source+'&Application=rtmp://dmflashy.astream.com/datmedia" />';
					esObj+='<param name="quality" value="high" />';
					esObj+='<param name="bgcolor" value="#000000" />';
					esObj+='<embed name="videoscreen" src="simplevideostreaming.swf" flashvars="StreamName='+source+'&Application=rtmp://dmflashy.astream.com/datmedia" quality="high" bgcolor="#000000" width="'+w+'" height="'+h+'" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
					esObj+='</object>';
				}else{
					esObj ='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="videoscreen" align="middle">';
					esObj+='<param name="allowScriptAccess" value="always" />';
					esObj+='<param name="movie" value="player.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="player.swf" quality="high" bgcolor="#ffffff" width="'+w+'" height="'+h+'" name="videoscreen" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
					esObj+='</object>';
				}
			}
			//alert(esObj):
			break;
	}
	return esObj;
}
/* -----------------28/09/2007 21:32-----------------
******** FLV stuff

 --------------------------------------------------*/
		function FLVSetDur(dur){
		//alert('flvsetdur'+dur);
		FLVDur=dur;//movie.FLVGetDur();
		}

		function FLVSetStatus(the_state){
			if(verbose=='1'){
			//alert(the_state);
			}
			FLVStatus=the_state;
		}
		function FLVSendMessage(the_mess){
			if(verbose=='1'){
			//alert(the_mess);
			}
		}

		function flashsetpos(the_pos){
if(document.getElementById('videoscreen')){
		    var callResult = document.videoscreen.FLVSetPos(the_pos);
}
		}

function flashfullscreen(){
if(document.getElementById('videoscreen')&& FLVLoaded){
   var callResult = document.videoscreen.FLVFullScreen();
}
}

function flashpause(){
if(document.getElementById('videoscreen')&& FLVLoaded){
   var callResult = document.videoscreen.FLVPause();
}
}
function flashstop(){
	if(document.getElementById('videoscreen')&& FLVLoaded){
    var callResult = document.videoscreen.FLVStop();
	}
}

function flashplay(){
	if(document.getElementById('videoscreen')&& FLVLoaded){
//alert(Playstatevalue);
 	var callResult = document.videoscreen.FLVPlay();

}
}

		function FLVLoaded1(){
    FLVLoaded=true;
//alert('FLVLoaded'+FLVLoaded);
				return 'Message Sent';
    }

/* -----------------15/10/2007 13:20-----------------
WMP FIREFOX stuff

 --------------------------------------------------*/

// This function will run every time the Media changes in Windows Media Player
function wmpMediaChange(item) {

	// get a handle to the Windows Media Player

	var wmp = document.getElementById('videoscreen');


	// send the media change info (name and url) into flash as plain text
	try {
//		document.getElementById('wmpSWF').mediaChange(wmp.currentMedia.name, wmp.currentMedia.sourceURL);
//alert('mediachange: '+item);
	} catch(e) {}

}


// This function will run every time the Play State changes in Windows Media Player
function wmpPlayStateChange(newState)  {
if(isFirefox && (isXP|| isVista)){
	// send the play state change as plain text to flash
	try {
//		document.getElementById('wmpSWF').playStateChange(playstateValues[newState]);
//alert('playstate change to: '+newState);
	 ffwmp_state=newState;
	} catch(e) {}
}else{

}
}



function controlAction(action) {

	switch (action) {
		case "play":
			document.getElementById('videoscreen').controls.play();
			break;
		case "pause":
			document.getElementById('videoscreen').controls.pause();
			break;
		case "stop":
			document.getElementById('videoscreen').controls.stop();
			break;
	}

}

function checkWMPVer() {

	var wmpInfo;

	try {
		wmpInfo = document.getElementById('videoscreen').versionInfo;
	} catch (e) {
		wmpInfo = "error!";
	}

	return wmpInfo;

}

function checkNetStats() {

	var wmp = document.getElementById('videoscreen');


	var dataObject = new Object();

	dataObject.bandWidth = wmp.network.bandWidth;
	dataObject.bitRate = wmp.network.bitRate;
	dataObject.bufferingProgress = wmp.network.bufferingProgress;
	dataObject.downloadProgress = wmp.network.downloadProgress;
	dataObject.status = wmp.status;
	dataObject.playheadPercent = (wmp.controls.currentPosition / wmp.controls.currentItem.duration);

	return dataObject;

}

function toggleMute() {

	var wmp = document.getElementById('videoscreen');

	if (wmp.settings.mute) {
		wmp.settings.mute = false;
		return wmp.settings.volume + "%";
	} else {
		wmp.settings.mute = true;
		return "Mute";
	}



}

function setVolume(dir) {

	var wmp = document.getElementById('videoscreen');

	wmp.settings.mute = false;

	switch (dir) {
		case "up":
			if (wmp.settings.volume < 100) {
				wmp.settings.volume += 10;
			}
			break;
		case "down":
			if (wmp.settings.volume > 0) {
				wmp.settings.volume -= 10;
			}
			break;
	}

	return wmp.settings.volume + "%";

}


function status(){
	run_when_status_is_polled();
	if (screenstatus=='established'){
		pstat=getPS(document.getElementById(screenid),media);
		if(dur_ok==false){
			switch (media) {
	 			case 'real':
				my_dur=document.getElementById(screenid).GetLength();
				break;
				case 'wm':
				if(!isFirefox){
					my_dur=parseInt(document.videoscreen.duration*1000);
				}else{
					if(isXP|| isVista){
						my_dur=parseInt(document.getElementById('videoscreen').controls.currentItem.duration*1000);
						//alert(my_dur);
					}
				}
				break;
	 			case 'qt':
				my_dur=parseInt(document.getElementById(screenid).GetDuration()/document.getElementById(screenid).GetTimeScale()*1000);
				break;
	 			case 'flash':
				my_dur=FLVDur*1000;
				break;

			}
			fixed_dur=my_dur+0;
		}
		if(fixed_dur>0){
				txt('fixed_dur: ',fixed_dur);
				dur_ok=true;
		}else{
				txt('fixed_dur unset: ',fixed_dur);
		}
		my_tottime_full=nicetime(fixed_dur);

		// Main unconditional loop
		// Set pstate to the latest state
		pstate=pstat;

		// Constantly construct the bandwidth and position values for normal mode playing
		SetProperty('video_status_txt',			'innerHTML',Pst[pstat]);
		//class_suffix=Pst[pstat].toLowerCase();
		//SetStyle('video_status_txt',			'className','dpxinfobar_'+class_suffix);
			// as long as the slides have loaded go and update the slide panel
			if(slidelistready){
		//		txt('update slide panel',the_position);
				update_slide_panel(the_position);
			}


		if (pstate==3){
			// Playing
			switch (media){
  			case 'real':
				the_position=document.getElementById(screenid).GetPosition();
				bandwidthsimple=Math.round(document.getElementById(screenid).GetBandwidthCurrent()/1000);
				break;
				case 'wm':
				if(!isFirefox){
					the_position=Math.round(document.videoscreen.CurrentPosition*1000);
					bandwidthsimple='---';
				}else{
					if(isXP|| isVista){
						the_position=Math.round(document.getElementById('videoscreen').controls.currentPosition*1000)
						bandwidthsimple=Math.round(document.getElementById('videoscreen').network.bandWidth/1000);
					//alert(the_position);
					}
				}
				break;
				case 'qt':
				the_position=Math.round(document.videoscreen.GetTime()*1000/document.videoscreen.GetTimeScale());
				bandwidthsimple='---';
				break;
				case 'flash':
    if(document.getElementById('videoscreen')&& FLVLoaded){
		  pos_temp=(isNaN(document.videoscreen.FLVGetPos()))?0:document.videoscreen.FLVGetPos();
    }else{
    pos_temp=0;
				}
				the_position=Math.round(pos_temp*1000);
				bandwidthsimple='---';
				break;

      }

			// as long as the slides have loaded go and update the slide panel
			//if(slidelistready){
			//	txt('update slide panel',the_position);
			//	update_slide_panel(the_position);
			//}
			pos_latch		=	the_position;
			nt_the_pos	=	nicetime(the_position);
			SetProperty('video_timer_txt',			'innerHTML',nt_the_pos+' / ' + my_tottime_full);

			// Update video slider details
			if(fixed_dur){
				trf=parseInt(videoslider_lh_end+((the_position/fixed_dur)*(videotrack_width-videoslider_width)));
				//txt('trf',trf);
				if(!dragging){
					if(document.getElementById(videoslider_id)){
						SetStyle(videoslider_id,			'left',trf+'px');
					}

				}
				//SetProperty(videoslider_id,			'alt',nt_the_pos);
			 if(admin){
						 admin_slide_cursor_pos=parseInt( ((the_position/fixed_dur)*723) )+6+9;
						 if(document.getElementById('stgcursor') && !dragcur){
							SetStyle('stgcursor',			'left',admin_slide_cursor_pos+'px');
							SetProperty('stbcurrenttimetext',			'innerHTML',nt_the_pos);
						}else{
							 if(document.getElementById('stgcursor') && dragcur){
							 SetProperty('stbcurrenttimetext',			'innerHTML',nt_the_pos);
							}
						}
				}
			}

		}else{
			 				 if(admin && nt_the_pos){
						 //admin_slide_cursor_pos=parseInt( ((the_position/fixed_dur)*723) )+6+9;
						 if(document.getElementById('stgcursor') && !dragcur){
						 //	document.getElementById('stgcursor').style.left=admin_slide_cursor_pos+'px';
							SetProperty('stbcurrenttimetext',			'innerHTML',nt_the_pos);
						 }else{
							 if(document.getElementById('stgcursor') && dragcur){
							SetProperty('stbcurrenttimetext',			'innerHTML',nt_the_pos);
							 }
							}
				}
			//Currently NOT playing so bandwidth to ---
			bandwidthsimple='--';
		}
				// PLAYING OR NOT DO THE FOLLOWING.........
		SetProperty('info_bandwidth_txt',			'innerHTML',bandwidthsimple + 'Kbps');

		the_vol=parseInt(100*(rpx(document.getElementById(volumeslider_id).style.left)-volumeslider_lh_end)/(volumetrack_width-volumeslider_width));
		//if(my_dur){
		//	the_pos=( parseInt(my_dur*((rpx(document.getElementById(videoslider_id).style.left)-videoslider_lh_end) /(videotrack_width-videoslider_width))));
		//}
		if(!muted ){
			setVol(the_vol);
	 	}

	}
	setTimeout('status();',800);
	if(admin && poll){
		if(tick>=period){
			if(still_waiting){
				var server_timeout_msg='Your connection to the datpresenter service has timed out, or the server or network may be busy!'+"\nPlease click OK, the connection will then be re-tested automatically."+"\n\nIf you receive this message repeatedly, contact your network administrator.";
				alert(server_timeout_msg);
			}
			send_ping();
			still_waiting=true;
			tick=0;
		}
		tick++;
	}
}

function play_video(){
	txt('setting movie source to',movie);
	if(movie!=''){
		switch (media){
  		case 'real':
			if(!isFirefox){
				document.getElementById(screenid).SetSource(movie);
			}

			break
			case 'wm':
			if(!isFirefox){
			if (activeX){
  			document.videoscreen.fileName=movie;
			}else{
  			document.videoscreen.SetFileName(movie);
			}
			}else{
			if(isXP|| isVista){
			 document.videoscreen.URL=movie;

			}else{

			}
			}
			break
  		case 'qt':
			//document.getElementById(screenid).SetSource(movie);
			break
  		case 'flash':
			//document.getElementById(screenid).SetSource(movie);
			break
			default:
			alert('The choice of media you have selected to play ('+movie+') is unknown.');
			requestedmode='';
			break
 		}
		requestedmode='play';
		dpxplay();
		txt('AUTOPLAY NOW',id);
		screenstatus='established';
		volpos=parseInt(volumeslider_lh_end+((volumetrack_width-volumeslider_width)*(getVol()/99)));
		txt('setting volume slider for 1st time',volpos-volumeslider_lh_end);
		document.getElementById(volumeslider_id).style.left=volpos+'px';
	}
}

function dpx_full_screen(){
	switch (media) {
  	case 'real':
		document.getElementById(screenid).SetFullScreen();
		break
   	case 'wm':
		if(!isFirefox){
			document.videoscreen.DisplaySize=3;
		}else{
			if(isXP|| isVista){
				//alert('wmp fs');
				//document.getElementById('videoscreen').fullScreen='true';
				}else{
					}
		}
		break
  	case 'flash':
		flashfullscreen();
		break
  	default:
		alert('The choice of media you have selected to play ('+movie+') is unknown.');
		requestedmode='';
		break
 	}
}

function dpxplay(){
	if(movie!=''){
		p_offset=dp.presentations[id].playoffset;
		switch (playbuttonfunction){
  		case 'play':
			requestedmode='play';
			// Play mode options
			switch (media){
  			case 'real':
				document.getElementById(screenid).DoPlay();
				break
   			case 'wm':
				if(!isFirefox){
					document.videoscreen.Play();
				}else{
					if(isXP|| isVista){
						controlAction('play');
					}else{
					}
				}
				break
   			case 'qt':
				document.videoscreen.Play();
				break
   			case 'flash':
				flashplay();
				break
  			default:
				//alert('The choice of media you have selected to play ('+movie+') is unknown.');
				break
 			}

			// Ok play has been asked for, so now check to see if we should offset into the presentation

			// Presentation has fixed offset
			if(((p_offset!='')&&(p_offset!=0)) && !playfromslide){
				gotoTime(p_offset);
			}

			// It's a play from slide command or a url based command
			if(playfromslide || sstart!='' || tstart!=''){
				temp=(sstart!='')?sstart-1:slidetoplay;
				temp=(tstart=='')?temp:0;
				if(slides[temp]){
					pslide_offset=(tstart=='')?slides[temp].time:parseInt(tstart);
					setTimeout('gotoTime(pslide_offset);',300);
				}else{
					//alert('Slides not loaded, the slides may load if you try again.');
				}
				if(type=='autofocus'){
					tstart='';
					sstart='';
				}
				playfromslide=false;
			}

			// started to play so play button becomes pause button
			button_type('play','play','pause','Pause presentation');
			playbuttonfunction='pause';
			requestedmode='';
			break
 			case 'pause':
			requestedmode='pause';
			switch (media) {
				case 'real':
				document.getElementById(screenid).DoPause();
				break
  			case 'wm':
				if(!isFirefox){
					document.videoscreen.Pause();
				}else{
					if(isXP|| isVista){
						controlAction('pause');
					}else{
					}
				}
				break
  			case 'qt':
	 			document.videoscreen.Stop();
				break
  			case 'flash':
				flashplay();
				break
				default:
				alert('The choice of media you have selected to play ('+movie+') is unknown.');
				break
 			}
			// Paused
			button_type('play','pause','play','Play presentation');
			playbuttonfunction='play';
			requestedmode='';
			break
  		default:
			break
 		}
	}
}

function dpxstop(){
	if(movie!=''){
		switch (media){
  		case 'real':
			document.getElementById(screenid).DoStop();
			break
			case 'wm':

				if(!isFirefox){
					document.videoscreen.Stop();
				}else{
				if(isXP|| isVista){
					controlAction('stop');
					}else{
					}
				}

			break
			case 'qt':
			document.videoscreen.Stop();
			break
			case 'flash':
			flashstop();
			break
  		default:
			alert('The choice of media you have selected to play ('+movie+') is unknown.');
			break
 		}
		requestedmode='stop';
		// Stopped
		button_type('play','pause','play','Play presentation');
		requestedmode='';
		playbuttonfunction='play';
	}
}

function init_player_clear(id){
	txt('INITIALISING PLAYER, Slides found:',slides.length);
	slidelistready					=	false;
	admin_slide_list_drawn	=	false;
	current_slide						=	-1;
	newslide								=	'';
	big_slide								=	false;
	playbuttonfunction			=	'play';
	dur_ok									=	false;
	fixed_dur								=	0;
 FLVLoaded=false;
	window.scrollTo(0,0);

	SetStyle('activeslidewindow',						'visibility',	'hidden');
	SetProperty('active_slide_window',			'src'				,	'images/t.gif');

	if(smediaWin){
		smediaWin.close();
	}
	document.getElementById('video_status_txt').innerHTML = '';
}

function stgcursor_drag(){
	dragcur=true;
	//alert('down');
	}

function stgcursor_nodrag(){
	dragcur=false;
	//alert('up');
	}

function slidepaneltoggle(){
	if(!player_open){dpxminimise();}
	if (slidelistready==true){
		if (screenstatus=='established'){
			if(slidepanelcontent=='slide'){
				document.getElementById('activeslidewindow').style.visibility ='hidden';
				document.getElementById('textslidewindow').style.visibility ='hidden';
				document.getElementById('activeslidelistwindow').style.visibility ='visible';

				slidepanelcontent='slidelist';
			}else{
				document.getElementById('activeslidelistwindow').style.visibility='hidden';
				document.getElementById('textslidewindow').style.visibility ='visible';
				document.getElementById('activeslidewindow').style.visibility ='visible';

				slidepanelcontent='slide';
			}
		}
	}
}

function dsd(id){
	id	=	an_id;
	url2mediadirectory    	=	'http://'+mediahostname+'/'+pmediapath+dp.presentations[id].slidedirectory+'/'+dp.presentations[id].id+'/';
	supdoclink							=	(cd=='1')?id+'/'+dp.presentations[id].pdflink:url2mediadirectory+dp.presentations[id].pdflink;
	var	desiredWidth	=	800;
	var desiredHeight	=	550;
	var left		=	(screen.width-desiredWidth-10)/2;
	var top			=	40;
	theurl			=	supdoclink;
  settings		=	'status=yes,resizable=yes,width='+desiredWidth+',height='+desiredHeight+',left='+left+',top='+top;
	pdfmediaWin	=	window.open(theurl,'pdfmediaWin',settings);
}

function dsd2(){
	 	supdoclink	=	(cd=='1')?'supporting_documents.htm?id='+id:'supporting_documents.php?id='+id;
 		settings		=	'status=no,resizable=yes,width=400,height=150,left=600,top=200';
		theurl			=	supdoclink;
		supWin			=	window.open(theurl,'supWin',settings);
	}

function swappanels(){
  if (left_screen=='slide'){
	  left_screen_x=document.getElementById('activeslidewindow').style.left;
	  left_screen_w=document.getElementById('activeslidewindow').style.width;
		if(document.getElementById('swapscreensbutton')){
		left_swap_icon_x=document.getElementById('swapscreensbutton').style.left;
		}
		left_window_x=document.getElementById('slidebase').style.left;
	  left_window_x_diff=rpx(left_screen_x)-rpx(left_window_x);
	  right_screen_x=document.getElementById('activevideowindow').style.left;
	  right_screen_w=document.getElementById('activevideowindow').style.width;
	  right_window_x=document.getElementById('videobase').style.left;
		if(document.getElementById('presentationtitlesmall')){
			right_title_x=document.getElementById('presentationtitlesmall').style.left;
		}
		gap=rpx(right_screen_x)-rpx(left_screen_x)-rpx(left_screen_w);
	  document.getElementById('activevideowindow').style.left=left_screen_x;
	  document.getElementById('videobase').style.left=left_window_x;
	  title_x=rpx(left_window_x)+2;
		if(document.getElementById('presentationtitlesmall')){
			document.getElementById('presentationtitlesmall').style.left=title_x+'px';
		}
		left_offset=rpx(left_screen_x)+rpx(right_screen_w)+gap;
		if(document.getElementById('swapscreensbutton')){
			left_swap_icon_new=rpx(left_swap_icon_x)-694;
			document.getElementById('swapscreensbutton').style.left=left_swap_icon_new+'px';
	 	}
		document.getElementById('activeslidewindow').style.left=left_offset+'px';
	 	document.getElementById('activeslidelistwindow').style.left=left_offset+'px';
	 	left_window_offset=left_offset-left_window_x_diff;
	 	document.getElementById('slidebase').style.left=left_window_offset+'px';
	 	left_screen='video';
	 	right_screen='slide';
  }else{
	  left_screen_x=document.getElementById('activevideowindow').style.left;
	  left_screen_w=document.getElementById('activevideowindow').style.width;
	if(document.getElementById('swapscreensbutton')){
		left_swap_icon_x=document.getElementById('swapscreensbutton').style.left;
	  }
	  left_window_x=document.getElementById('videobase').style.left;
	  left_window_x_diff=rpx(left_screen_x)-rpx(left_window_x);
	  right_screen_x=document.getElementById('activeslidewindow').style.left;
	  right_screen_w=document.getElementById('activeslidewindow').style.width;
	  right_window_x=document.getElementById('slidebase').style.left;
		if(document.getElementById('presentationtitlesmall')){
		right_title_x=document.getElementById('presentationtitlesmall').style.left;
		}
		gap=rpx(right_screen_x)-rpx(left_screen_x)-rpx(left_screen_w);
	  document.getElementById('activeslidewindow').style.left=left_screen_x;
	  document.getElementById('activeslidelistwindow').style.left=left_screen_x;
	  document.getElementById('slidebase').style.left=left_window_x;
	  left_offset=rpx(left_screen_x)+rpx(right_screen_w)+gap;
		if(document.getElementById('swapscreensbutton')){
			left_swap_icon_new=rpx(left_swap_icon_x)+694;
			document.getElementById('swapscreensbutton').style.left=left_swap_icon_new+'px';
		}
	 	document.getElementById('activevideowindow').style.left=left_offset+'px';
	 	left_window_offset=left_offset-left_window_x_diff;
	 	document.getElementById('videobase').style.left=left_window_offset+'px';
		if(document.getElementById('presentationtitlesmall')){
			title_x=left_window_offset+2;
			document.getElementById('presentationtitlesmall').style.left=title_x+'px';
		}
		left_screen='slide';
	 	right_screen='video';
	}
}

function dpxmute(){
	if(movie!=''){
		if(muted){
			if(!isFirefox){
			setVol(the_vol);
			//document.getElementById('volume_button').src='volume_control_button.jpg';
			}else{
				if(isXP|| isVista){
			document.getElementById('videoscreen').settings.mute=false;
			}else{

			}
			}
			muted=false;
		}else{
			if(!isFirefox){
			the_vol=getVol();
			setVol(0);
			//document.getElementById('volume_button').src='volume_control_button_down.jpg';
			}else{
				if(isXP|| isVista){
			document.getElementById('videoscreen').settings.mute=true;
			}else{

			}
			}
			muted=true;
		}
	}
}

function setVol(vol){
	if(movie!='' && pstat>0){
		//txt('setting volume '+vol+'for',movie);
		switch (media){
  		case 'real':
	  	document.getElementById(screenid).SetVolume(vol);
			break;
			case 'wm':
			if(!isFirefox){
				wmvol=-10000+((vol/100)*10000);
      	document.videoscreen.Volume=wmvol;
			}else{
				if(isXP|| isVista){
					document.getElementById('videoscreen').settings.volume=vol;
				}
			}
			break
  		case 'qt':
			vol2=Math.round(vol*256/100);
		  document.getElementById(screenid).SetVolume(vol2);
			break;
  		case 'flash':
			vol2=Math.round(vol/100);
		  //document.getElementById(screenid).SetVolume(vol2);
			break;
 		}
	}
}

function volctrl(){
}

function getVol(){
	txt('getting volume from',screenid);
	if(movie!=''){
		switch (media){
  		case 'real':
		  nv = document.getElementById(screenid).GetVolume();
		  break;
			case 'wm':
			if(!isFirefox){
				nv=Math.round((document.videoscreen.Volume+10000)/100);
			}else{
			if(isXP|| isVista){
					nv=Math.round(document.getElementById('videoscreen').settings.volume);
				}
			}
			break;
			case 'qt':
			nv=Math.round(document.getElementById(screenid).GetVolume()*100/256);
			break;
			case 'flash':
			nv=50;//Math.round(document.getElementById(screenid).GetVolume()*100/256);
			break;
 		}
		//alert(nv);
		return nv;
	}
}

function go_extplayer(extplayersize){
		if(movie!=''){
	//alert(extplayersize);

			var	desiredWidth=400;
			var desiredHeight=400;
			var left=(screen.width-desiredWidth-10)/2;
			var top=40;
			theurl='extplayer.php?url='+escape(movie)+'&size='+extplayersize;
  		settings='status=yes,resizable=yes,width='+desiredWidth+',height='+desiredHeight+',left='+left+',top='+top;
	 		aplayerWin=window.open(theurl,'aplayerWin',settings);
	}
}



function dpxminimise(){
	if(player_open){

		player_height=	document.getElementById('player').style.height;
		act_slide_window=	document.getElementById('activeslidewindow').style.visibility;
		txt_slide_window=	document.getElementById('textslidewindow').style.visibility;
		act_slide_list_window=	document.getElementById('activeslidelistwindow').style.visibility;
		for(var ii=0;ii<vis_array.length;ii++){
			if(document.getElementById(vis_array[ii])){
		 	document.getElementById(vis_array[ii]).style.visibility=	'hidden';
		 }
		}
		document.getElementById('player').style.height=	player_closed_height+'px';
		sec_top=	rpx(document.getElementById('sections').style.top);
		if(admin){
			if(document.getElementById('adminslidecontrol')){
					admin_slidecontrol_top=	rpx(document.getElementById('adminslidecontrol').style.top);
		 	document.getElementById('adminslidecontrol').style.top=	(admin_slidecontrol_top-vtravel)+'px';
		 	}
		 }
		str_top=	(sec_top-vtravel);
		document.getElementById('sections').style.top=	str_top+'px';
		for(var ii=0;ii<mov_array.length;ii++){
			if(document.getElementById(mov_array[ii])){
		 	movstat_array[ii]=	rpx(document.getElementById(mov_array[ii]).style.top);
		 	document.getElementById(mov_array[ii]).style.top=	(movstat_array[ii]-vtravel)+'px';
		 }
		}
		button_type('minimise','minimise','maximise','Maximise');
		document.getElementById('player').style.height=	player_closed_height+'px';
		player_open=	false;
	}else{
		strtop=sec_top;
		document.getElementById('sections').style.top=strtop+'px';
		if(admin){
			if(document.getElementById('adminslidecontrol')){
				document.getElementById('adminslidecontrol').style.top=admin_slidecontrol_top+'px';
		 	}
		 }
		document.getElementById('player').style.height=player_open_height+'px';
		for(var ii=0;ii<mov_array.length;ii++){
			if(document.getElementById(mov_array[ii])){
		 	document.getElementById(mov_array[ii]).style.top=movstat_array[ii]+'px';
		 }
		}
		for(var ii=0;ii<vis_array.length;ii++){
			if(document.getElementById(vis_array[ii])){
		 	document.getElementById(vis_array[ii]).style.visibility=	'visible';
		 }
		}
		document.getElementById('activeslidelistwindow').style.visibility=act_slide_list_window;
		document.getElementById('activeslidewindow').style.visibility=act_slide_window;
		document.getElementById('textslidewindow').style.visibility=txt_slide_window;
		button_type('minimise','maximise','minimise','Minimise');
		player_open=true;
	}
}

function gotoTime(ms){
		txt('seeking to',ms);
		switch (media) {
		case 'real':
 		document.getElementById(screenid).SetPosition(ms);
 		break;
		case 'wm':
  	secsfromms=(ms/1000);
		waitforwmp();
		break
		case 'qt':
		secsfromms=(ms/1000);
 		document.getElementById(screenid).SetTime(document.getElementById(screenid).GetTimeScale()*secsfromms);
		break;
		case 'flash':
		secsfromms=(ms/1000);
		flashsetpos(secsfromms);
 		//document.getElementById(screenid).SetTime(document.getElementById(screenid).GetTimeScale()*secsfromms);
		break;
	}
  //clearSlideSels();
}

function sgotoTime(){
		mss= parseInt(((ttx-videoslider_lh_end+videoslider_width)/videotrack_width)*fixed_dur);
		txt('seeking to',mss);
		switch (media) {
		case 'real':
 		document.getElementById(screenid).SetPosition(mss);
 		break;
		case 'wm':
  	secsfromms=(mss/1000);
  	waitforwmp();
		break
		case 'qt':
		secsfromms=(mss/1000);
 		document.getElementById(screenid).SetTime(document.getElementById(screenid).GetTimeScale()*secsfromms);
 		break;
		case 'flash':
		secsfromms=parseInt(mss/1000);
 		flashsetpos(secsfromms);
 		break;
	}
  //clearSlideSels();
}

function waitforwmp(){
	if(!isFirefox){
	if(document.videoscreen.currentPosition>0){
		document.videoscreen.currentPosition=secsfromms;
	}else{
		setTimeout('waitforwmp();',330);
	}
	}else{
		if(isXP|| isVista){
	if(document.getElementById('videoscreen').controls.currentPosition>0){
		document.getElementById('videoscreen').controls.currentPosition=secsfromms;
	}else{
		setTimeout('waitforwmp();',330);
	}

			}
		}

}

function slidelister(){
	slidelistready	=	true;
	txt('slidelistready',slidelistready);
	document.getElementById('activeslidewindow').style.visibility='visible';
}

function click_slide(dfg){
	pre_change_offset=(dfg=='auto')?1:0;
	if(current_slide!=-1){
		if(dfg!='auto'){
		big_slide=(big_slide)?false:true;
		}
		var	desiredWidth=50;
		var desiredHeight=50;
		var left=(screen.width-desiredWidth-10)/2;
		var top=40;
		var t_curr_slide=current_slide+pre_change_offset+0;
		theurl='big_slide.php?slide_id='+t_curr_slide+'&pres='+id+'&dpxuser='+dpxuser+'&cd='+cd;
  	settings='status=no,resizable=yes,width='+desiredWidth+',height='+desiredHeight+',left='+left+',top='+top;
		if(smediaWin){
		if(!smediaWin.closed){
			//alert(smediaWin.closed);
			smediaWin.location=theurl;
			}
			}else{
		smediaWin=window.open(theurl,'smediaWin',settings);
		}
		//document.smediaWin=smediaWin;
	 }

	}

function slideright () {
     if (!slidelistready) return;
     var gs = getPS(document.getElementById(screenid),media);
     if (gs == 3 || gs == 4) {
			current_slide=(current_slide==-1)?0:current_slide;
       if (slides.length <= (current_slide+1)) return;
       if ((current_slide+1) < 0) return;
       gotoTime(slides[current_slide+1].time);
     }
}

function slideleft () {
     if (!slidelistready) return;
     var gs = getPS(document.getElementById(screenid),media);
     if (gs == 3 || gs == 4) {
			 current_slide=(current_slide==-1)?0:current_slide;
			 if (slides.length <= (current_slide-1)) return;
       if ((current_slide-1) < 0) return;
       gotoTime(slides[current_slide-1].time);
     }
}

function clearSlideSels(){
	for (co = 0; co < slides.length; co++){
  	if (document.getElementById('cb_'+co) != false){
			document.getElementById('cb_'+co).className = 'ss_box';
		}
  }
}

function sendtofriend(){
	var undef;
	get_items_in_focus();
	if(presentation_in_focus!=undef){
			var	desiredWidth=410;
			var desiredHeight=160;
			var left=(screen.width-desiredWidth-10)/2;
			var top=400;
  		theurl='http://'+hostname+'/'+playerpath+'/sendtofriend_form.php?pres='+presentation_in_focus;
  		settings='status=no,resizable=yes,width='+desiredWidth+',height='+desiredHeight+',left='+left+',top='+top;
			stfWin=window.open(theurl,'stfWin',settings);
	}
}

function stf2(email_address,pres){
	presentation_in_focus=pres;
	if((email_address!=null) && email_address){
		message=dp.presentations[presentation_in_focus].title;
		var media1=(dp.presentations[presentation_in_focus].urlreal)?'real':'';
		var media2=(dp.presentations[presentation_in_focus].urlwm)?'wm':'';
		var media3=(dp.presentations[presentation_in_focus].urlqt)?'qt':'';
		var media4=(dp.presentations[presentation_in_focus].urlflash)?'flash':'';
		document.atcomm2.location='http://'+hostname+'/'+playerpath+'/sendtofriend.php?email_address='+email_address+'&pres='+presentation_in_focus+'&media='+media1+'&media2='+media2+'&media3='+media3+'&media4='+media4+'&message='+escape(message)+'&dpxuser='+dpxuser;
		if(stfWin){
		 	stfWin.close();
		}
	}
}
function set_player_skin(the_skin){
	if(the_skin=='vidpr_alt'){
	skin_elements=altskinlayout.split("&");
}else{
	skin_elements=skinlayout.split("&");
	}
	for(var i=1;i<skin_elements.length;i++){
		temp									=	skin_elements[i].split("=");
		temp2									=	temp[0].split("_");
		temp_extension				=	temp2[temp2.length-1];
		temp_ext							=	temp2[temp2.length-1];
		temp2[temp2.length-1]	=	'';
		temp3									=	'_'+temp2.join("_");
		temp3									=	temp3.substr(0,temp3.length-1)
		image_filename				=	temp3+'.'+temp_ext;
		div_id								=	temp2.join("");
		altskinobj[div_id]		=	temp[1]+','+image_filename;
	}
	sps(the_skin);
}

function sps(the_skin){
	player_div_array	=	document.getElementById('player').getElementsByTagName('div');
	message	=	'';
	for(var i=0;i<player_div_array.length;i++){
		subplayerdiv_id	=		player_div_array[i].id;
		message					+=	'id: '+subplayerdiv_id+' - ['+player_div_array[i].style.width+','+player_div_array[i].style.height+']'+"\n";
		if(altskinobj[subplayerdiv_id]!='' && typeof altskinobj[subplayerdiv_id]!='undefined'){

			if(document.getElementById(subplayerdiv_id)){
								change_element(subplayerdiv_id,subplayerdiv_id,the_skin);
				if(subplayerdiv_id=='activeslidewindow'){
						change_element(subplayerdiv_id,'activeslidelistwindow',the_skin);
						change_element(subplayerdiv_id,'textslidewindow',the_skin);
					}

			}
		}else{
			if((subplayerdiv_id!='activeslidelistwindow') && (subplayerdiv_id!='textslidewindow')){
		//		alert('hiding element with id:'+subplayerdiv_id+' , no match found in alternate skin ');
if(the_skin=='vidpr_alt'){
				document.getElementById(subplayerdiv_id).style.visibility	=	'hidden';
				 }else{
				 //	reveal hidden elements
				document.getElementById(subplayerdiv_id).style.visibility	=	'visible';
					}
			}
		}
	}
	//alert(message);
}

function change_element(subplayerdiv_id,directsubplayerdiv_id,the_skin){

				document.getElementById(directsubplayerdiv_id).style.left	=	rpx(altskinobj[subplayerdiv_id].split(",")[0]);
				document.getElementById(directsubplayerdiv_id).style.top	=	rpx(altskinobj[subplayerdiv_id].split(",")[1]);
				if(document.getElementById(directsubplayerdiv_id).firstChild && (document.getElementById(directsubplayerdiv_id).firstChild.tagName=='IMG')){
					document.getElementById(directsubplayerdiv_id).firstChild.src			=	'images_skin_'+the_skin+'/'+altskinobj[subplayerdiv_id].split(",")[5];
					document.getElementById(directsubplayerdiv_id).firstChild.width		=	rpx(altskinobj[subplayerdiv_id].split(",")[2]);
					document.getElementById(directsubplayerdiv_id).firstChild.height	=	rpx(altskinobj[subplayerdiv_id].split(",")[3]);
			 	}
			 	document.getElementById(directsubplayerdiv_id).style.width					=	rpx(altskinobj[subplayerdiv_id].split(",")[2]);
			 	document.getElementById(directsubplayerdiv_id).style.height					=	rpx(altskinobj[subplayerdiv_id].split(",")[3]);
			 	document.getElementById(directsubplayerdiv_id).style.zIndex					=	altskinobj[subplayerdiv_id].split(",")[4];
				if(subplayerdiv_id=='activevideowindow'){
					video_screen_width	=	rpx(altskinobj[subplayerdiv_id].split(",")[2]);
					video_screen_height	=	rpx(altskinobj[subplayerdiv_id].split(",")[3]);
				}
	}
