//class Player QT
//public
function PlayerQT(onChangeState,onCommand){
this.playerType="QT";
this.onChangeState=onChangeState;
this.onCommand=onCommand;
this.myState="null";
//this.myLastTime=-2;
this.myEndofclip=false;
this.myMediatrack=new Array();
this.myPlayer=null;
this.Starttime=0;
this.myURL="";
this.myCurrentindex=-1;
this.myTotalDuration=9595959;
this.myscheduleClip=null;
this.myFullscreen=false;
this.embedTag="<EMBED id='z_ID' name='z_ID' AUTOPLAY='z_AUTOPLAY' WIDTH='z_WIDTH' HEIGHT='z_HEIGHT' CONTROLLER='z_SHOWCONTROL' TARGET='myself' SRC='z_URL' type='video/quicktime' BGCOLOR='#000000' BORDER='0' PLUGINSPAGE='http://www.apple.com/quicktime/download/indext.html' ENABLEJAVASCRIPT='true' CACHE='true' postdomevents='true' scale='aspect'></EMBED>";
this.objectTag="<object classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab#version=7,2,1,0' width='z_WIDTH' height='z_HEIGHT' type='video/quicktime' id='z_ID' style='behavior:url(#qt_event_source);'>\n<param name='src' value='z_URL'/>\n<param name='AUTOPLAY' value='z_AUTOPLAY'/>\n<param name='CONTROLLER' value='z_SHOWCONTROL'/>\n<param name='enablejavascript' value='true'/>\n<param name='postdomevents' value='true'/>\n<param name='scale' value='aspect'/>\n</object><object id='qt_event_source' classid='clsid:CB927D12-4FF7-4a9e-A169-56E4B8A75598' codebase='http://www.apple.com/qtactivex/qtplugin.cab#version=7,2,1,0' ></object>\n";
}//end method

//public
PlayerQT.prototype.hook=function Player_hook(func){
this.onChangeState=func;
}//end function

//public
PlayerQT.prototype.init=function Player_init(q_URL,q_SSIZE,q_INSTREAM,q_CONTROL,q_ALLOWMENU,q_AUTOSTART,q_eventlist,q_STARTTIME){
this.myFormat="QT";
this.myTag=(WIN()&&(IE()||NS()||FX())?"OBJECT":"EMBED");
this.myURL=q_URL;
this.myDisplaysize=q_SSIZE;
this.mySevent=true;
this.myInstream=q_INSTREAM;
this.myAllowmenu=q_ALLOWMENU;
this.myScriptable=true;//until proven otherwise
this.myAutostart=q_AUTOSTART||FX();
this.myShowcontrols=q_CONTROL;
if(false && FX()){//Change to embed for Firefox
	this.myAutostart=true;
	this.myTag="EMBED";
}//end if
this.setMediatrack(q_eventlist);
this.setTime(q_STARTTIME);
this.setMyURL(q_STARTTIME);
}//end function

//private
var gHTML="nothing yet";
PlayerQT.prototype.playerHTML=function Player_playerHTML(){
var str;
if(IE()){
	str=this.objectTag;
}else{
	str=this.embedTag;
}//end if
str=replace(str,"z_ID",this.myPlayername);
str=replace(str,"z_URL",this.myURL);
str=replace(str,"z_AUTOPLAY",""+this.myAutostart);
str=replace(str,"z_HEIGHT",""+(parseInt(this.myContainer.style.height)));
str=replace(str,"z_WIDTH",""+parseInt(this.myContainer.style.width));
str=replace(str,"z_SHOWCONTROL",""+this.myShowcontrols);
gHTML=str;
return str;
}//end method

//public
PlayerQT.prototype.paint=function Player_paint(q_obj,q_OVERWRITE){
this.myContainer=q_obj;
this.myPlayername=q_obj.id+"img";
var q_WIDTH=parseInt(this.myContainer.style.width);
var q_HEIGHT=parseInt(this.myContainer.style.height);
this.myOverwrite=q_OVERWRITE;
if(q_OVERWRITE || !div(this.myPlayername)){
	this.myContainer.innerHTML=this.playerHTML();
	this.myPlayer=document.getElementById(this.myPlayername);
}else{
	this.myPlayer=document.getElementById(this.myPlayername);
}//end if
if(IE()){
	setTimeout("gPlayer.registerEvents()",1000);
}else{
	this.registerEvents();
}//end if
}//end function

//private
function myAddListener(obj, evt, handler, captures){ 
if(document.addEventListener){
	obj.addEventListener(evt, handler, captures); 
}else{ 
	obj.attachEvent('on' + evt, handler);//IE
}//end if
}//end function

PlayerQT.prototype.registerEvents=function Player_registerEvents(){
myAddListener(this.myPlayer, "qt_begin", eventQt_begin, false);
myAddListener(this.myPlayer, "qt_loadedmetadata", eventQt_loadedmetadata, false);
myAddListener(this.myPlayer, "qt_waiting", eventQt_waiting, false);
myAddListener(this.myPlayer, "qt_play", eventQt_play, false);
myAddListener(this.myPlayer, "qt_pause", eventQt_pause, false);
myAddListener(this.myPlayer, "qt_ended", eventQt_ended, false);
}//end function
function eventQt_begin(){gPlayer.setState("idle");}//end function
function eventQt_loadedmetadata(){gPlayer.setState("buffer");}//end function
function eventQt_waiting(){gPlayer.setState("buffer");}//end function
function eventQt_play(){gPlayer.setState("play");}//end function
function eventQt_pause(){gPlayer.setState("pause");}//end function
function eventQt_ended(){gPlayer.setState("stop");}//end function

//public
PlayerQT.prototype.dispose=function Player_dispose(){
if(!this.noPlayer()){
	this.stop();
	this.myPlayer=null;
	this.myContainer.innerHTML="";
}//end if
}//end function

//public
PlayerQT.prototype.initandpaint=function Player_paint(q_obj,q_URL,q_SSIZE,q_INSTREAM,q_CONTROL,q_ALLOWMENU,q_AUTOSTART,q_OVERWRITE){
this.init(q_URL,q_SSIZE,q_INSTREAM,q_CONTROL,q_ALLOWMENU,q_AUTOSTART,eventlist,0);
this.paint(q_obj,q_OVERWRITE);
return true;
}//end function

//public
PlayerQT.prototype.setPlayer=function Player_setPlayer(q_name,format){
//try{
this.myFormat=format;
this.myPlayer=document.getElementById(q_name);
this.myContainer=this.myPlayer.parentNode;
//}catch(errObj){
//}//end catch
}//end function

//public
PlayerQT.prototype.play=function Player_play(){
if(this.noPlayer()){
//experiment create embed tag when asking for play
	this.myAutostart=true;
	this.paint(div("video"),true);
}else{
	if(this.myPlayer.GetURL()){
	}else{
		this.myPlayer.SetURL(this.myURL);
	}//end if
	if(this.isPlayable()){
		this.myPlayer.Play();
		this.setState("play");
	}else{
		yellowmessage("Please wait while Quicktime downloads, then press play to start the movie","Quicktime Downloads Movie");
		this.updateState();
		throw "Quicktime is not ready to play";
	}//end if
}//end if
}//end function

//private
PlayerQT.prototype.isPlayable=function Player_isPlayable(){
try{
	return (this.myPlayer.GetPluginStatus()=="Playable" || this.myPlayer.GetPluginStatus()=="Complete");
}catch(errObj){
	return true;
}//end catch
}//end function

//private
PlayerQT.prototype.updateState=function Player_updateState(){
try{
	if(this.myPlayer.GetPluginStatus()=="Waiting"){
		this.myState="connect";
		setTimeout("gPlayer.updateState()",2000);
	}else if(this.myPlayer.GetPluginStatus()=="Loading"){
		this.myState="buffer";
		setTimeout("gPlayer.updateState()",2000);
	}else{
	}//end if
}catch(errObj){
}//end catch
}//end function

//public
PlayerQT.prototype.pause=function Player_pause(){
try{
	this.myPlayer.Stop();
	this.setState("pause");
}catch(errObj){
}//end catch
}//end function

//public
PlayerQT.prototype.stop=function Player_stop(){
try{
	this.myPlayer.Rewind();
	this.myPlayer.Stop();
	this.setState("stop");
}catch(errObj){
}//end catch
}//end function

//public
PlayerQT.prototype.up=function Player_volumeUp(){
try{
	var q_volume = this.myPlayer.GetVolume() + 25;
	if(q_volume > 255) q_volume=255;
	this.myPlayer.SetVolume(q_volume);
}catch(errObj){
}//end catch
}//end function

//public
PlayerQT.prototype.down=function Player_volumeDown(){
try{
	var q_volume = this.myPlayer.GetVolume() - 25;
	if(q_volume <0) q_volume=0;
	this.myPlayer.SetVolume(q_volume);
}catch(errObj){
}//end catch
}//end function

//public
PlayerQT.prototype.mute=function Player_mute(q_muted){
try{
	if(q_muted==false){
		this.myPlayer.SetVolume(128);
	}else{
		this.myPlayer.SetVolume(0);
	}//end if
}catch(errObj){
}//end catch
}//end function

//public
PlayerQT.prototype.updateEvent=function Player_updateEvent(){
if(!this.noPlayer()){
	if(this.isMulticlip()){
		if(this.isLastclip()){
			if(this.getTime()>this.myTotalDuration){
				logga("pause at end");
				gPlayer.pause();
			}//end if
		}else{
			var q_nextClipstart=this.myMediatrack[this.myCurrentindex+1].myClipstart;
			var q_clipTimeLeft=q_nextClipstart-this.getTime();
			if(q_clipTimeLeft<-0.1){//we passed a clip end
				logga("enter new clip");
				gPlayer.setTime(q_nextClipstart);
			}else if(q_clipTimeLeft<1.5){
				this.scheduleClip(q_nextClipstart,q_clipTimeLeft*1000-100);
			}//end if
		}//end if
	}else{
		if(this.getTime()>this.myTotalDuration){
			logga("pause at end");
			gPlayer.pause();
		}//end if
	}//end if
}//end if
}//end function

//public
PlayerQT.prototype.setTime=function Player_setTime(q_playtime){
this.unScheduleClip();
logga("setTime("+q_playtime+")");
if(this.noPlayer()){
	return this.setStarttime(q_playtime);
}else{
	if(this.isMulticlip()){
		return this.setMediatrackPos(q_playtime);
	}else{
		return this.setPos(q_playtime);
	}//end if
}//end if
}//end function

//public
PlayerQT.prototype.getTime=function Player_getTime(){
if(this.noPlayer()){
	return this.myStarttime;
}else{
	if(this.isMulticlip()){
		return this.getMediatrackPos();
	}else{
		return this.getPos();
	}//end if
}//end if
}//end function

//public
PlayerQT.prototype.getDuration=function Player_getDuration(){
if(this.isMulticlip()){
		return this.getMediatrackDuration();
}else{
		if(this.noPlayer()){
			return 0;
		}else{
			try{
				return this.myPlayer.GetDuration()/oMedia.GetTimeScale();
			}catch(errObj){
				return 0;
			}//end catch
		}//end if
}//end if
}//end function

//public
PlayerQT.prototype.getSrc=function Player_getSrc(){
if(this.myPlayer){
	var q_url=this.myPlayer.GetURL();
	if(q_url){
		return replace(q_url,"\\","/");
	}else{
		return this.myURL;
	}//end if
}else{
	return this.myURL;
}//end if
}//end function

//public
PlayerQT.prototype.setSrc=function Player_setSrc(src){
try{
	var cmp=src.replace("file://","");
	if(this.getSrc()!=cmp){
		this.myURL=cmp;
		if(this.myPlayer){
			return this.myPlayer.SetURL(this.myURL);
		}//end if
	}else{
		return false;
	}//end if
}catch(errObj){
	return false;
}//end catch
}//end function

var gSIZE="";
function frame(aname){
div(aname).style.borderWidth=1;
div(aname).style.borderColor="red";
div(aname).style.borderStyle="solid";
}//end function

//public
PlayerQT.prototype.setSize=function Player_setSize(width,height){
if(width=="full"){
	this.registerOriginalSize();
	//register new size in gResize
	var q_record=new Array("video","visible",0,0,div("master").offsetWidth,div("master").offsetHeight,null);
	gResize.setCoord("video",q_record);
	q_record=new Array("videoimg","visible",0,0,div("master").offsetWidth,div("master").offsetHeight,null);
	gResize.setCoord("videoimg",q_record);
	this.myContainer.style.zIndex=100;
	gSIZE=q_record[2]+","+q_record[2]+","+q_record[4]+","+q_record[5];
	gResize.resizeForm();
//	this.myContainer.style.left=div("master").offsetLeft;
//	this.myContainer.style.top=div("master").offsetTop;
//	this.myContainer.style.width=div("master").offsetWidth;
//	this.myContainer.style.height=div("master").offsetHeight;
//	this.setSize(div("master").offsetWidth,div("master").offsetHeight);


	this.myFullscreen=true;
}else if (width=="normal"){
	this.restoreOriginalSize();
}else if(isNumeric(width)){
	this.myPlayer.SetRectangle(gSIZE);
	this.myPlayer.style.width=width;
	this.myPlayer.style.height=height;
	gSIZE="0,0,"+width+","+(height-16);
}//end if
}//end function

//public
PlayerQT.prototype.setShowcontrols=function Player_setShowcontrols(q_show){
if(this.myPlayer){
	try{
		this.myPlayer.SetControllerVisible((q_show)?1:0);
		this.setSize("normal");
	}catch(errObj){
	}//end catch
}//end if
}//end function

//private
PlayerQT.prototype.registerOriginalSize=function Player_registerOriginalSize(){
if(this.originalWidth){
}else{
	this.originalLeft=this.myContainer.offsetLeft/div("master").offsetWidth;
	this.originalTop=this.myContainer.offsetTop/div("master").offsetHeight;
	this.originalWidth=this.myContainer.offsetWidth/div("master").offsetWidth;
	this.originalHeight=this.myContainer.offsetHeight/div("master").offsetHeight;
}//end if
}//end function


//private
PlayerQT.prototype.restoreOriginalSize=function Player_restoreOriginalSize(){
if(this.myFullscreen==true){
	var q_record=new Array("video","visible",this.originalLeft*div("master").offsetWidth,this.originalTop* div("master").offsetHeight,this.originalWidth*div("master").offsetWidth,this.originalHeight*div("master").offsetHeight,null);
	gResize.setCoord("video",q_record);
	var q_record=new Array("videoimg","visible",this.originalLeft*div("master").offsetWidth,this.originalTop* div("master").offsetHeight,this.originalWidth*div("master").offsetWidth,this.originalHeight*div("master").offsetHeight,null);	
gResize.setCoord("videoimg",q_record);
	this.myContainer.style.zIndex=100;
	this.setSize(this.originalWidth* div("master").offsetWidth,this.originalHeight*div("master").offsetHeight);
	gSIZE=q_record[2]+","+q_record[2]+","+q_record[4]+","+q_record[5];
	gResize.resizeForm();
//	this.myContainer.style.left=this.originalLeft* div("master").offsetWidth;
//	this.myContainer.style.top=this.originalTop* div("master").offsetHeight;
//	this.myContainer.style.width=this.originalWidth* div("master").offsetWidth;
//	this.myContainer.style.height=this.originalHeight* div("master").offsetHeight;
	this.myFullscreen=false;
}//end if
}//end function

//public
PlayerQT.prototype.canScript=function Player_canScript(){
if(this.myPlayer){
	if(this.myPlayer.controls){
		return true;
	}//end if
}//end if
return false;
}//end function

//public
PlayerQT.prototype.setState=function Player_setState(state){
logga("setState "+state);
if(("play,pause,stop,connect,buffer,idle,").indexOf(state+",")>-1){
	if(this.myState!=state){
		this.myState=state;
		this.onChangeState(this.myState);
	}//end if
}//end if
}//end function
//end class

//public
PlayerQT.prototype.setCmd=function Player_setCmd(q_cmd){
if(this.onCommand){
	this.onCommand(q_cmd,null,null);
}//end if
}//end function
//end class

//public
PlayerQT.prototype.getState=function Player_getState(){
try{
	this.updateState();
	if(this.myState){
		return this.myState;
	}else{
		return "null";
	}//end if
}catch(errObj){
	return "null";
}//end catch
}//end function

//public
PlayerQT.prototype.getBuffering=function Player_getBuffering(){
try{
	var q_v=this.myPlayer;
	if(this.myFormat=="WM"){
		return q_v.network.bufferingProgress;
	}else if(this.myFormat=="RM"){
		if (q_v.getBufferingTimeRemaining()+ q_v.getBufferingTimeElapsed()>0){
			return Math.floor(100*q_v.getBufferingTimeElapsed()/ (q_v.getBufferingTimeRemaining()+q_v.getBufferingTimeElapsed()));
		}else{
			return 100;
		}//end if
	}else{
		return 100;
	}//end if
}catch(errObj){
	return 0;
}//end catch
}//end function

//public
PlayerQT.prototype.getBandwidth=function Player_getBandwidth(){
if(this.myPlayer){
	if(this.myPlayer.network){
		if(this.myPlayer.network.sourceProtocol){
			if(this.myPlayer.network.sourceProtocol.toLowerCase()=="file"){
				return Math.floor(this.myPlayer.network.bitRate/1000);
			}else{
				return Math.floor(this.myPlayer.network.bandWidth/1000);
			}//end if
		}//end if
	}//end if
}//end if
return 0;
}//end function

//public
PlayerQT.prototype.getFramerate=function Player_getFramerate(){
if(this.myPlayer){
	if(this.myPlayer.network){
		return Math.floor(0.5+this.myPlayer.network.frameRate/100);
	}//end if
}//end if
return 0;
}//end function

//public
PlayerQT.prototype.getVersion=function Player_getVersion(){
return this.myPlayer.versionInfo;
}//end function

//public
PlayerQT.prototype.stateConstWM=function Player_stateConstWM(q_stateNum){
switch (q_stateNum){
case 0:return "idle";//Undefined
case 1:return "stop";//Stopped
case 2:return "pause";//Paused
case 3:return "play";//Playing
case 4:return "play";//ScanForward
case 5:return "play";//ScanReverse
case 6:return "buffer";//Buffering
case 7:return "connect";//Waiting
case 8:return "idle";//MediaEnded
case 9:return "connect";//Transitioning
case 10:return "idle";//Ready
case 11:return "connect";//Reconnecting
default:return "idle";
}//end switch
return "null";
}//end function

//public
PlayerQT.prototype.showCurrent=function showCurrent(){
if(this.isMulticlip()){
	var q_media=this.getCurrentMedia();
	if(q_media){
		return "Multiclip,["+this.myCurrentIndex+"],"+q_media.myClipstart+","+q_media.mySrc+","+q_media.myMarkin+","+q_media.myDuration;
	}else{
		return "Multiclip,no current media";
	}//end if
}else{
		return "Singleclip,"+this.myURL;
}//end if
}//end function

//public
PlayerQT.prototype.player2Sync=function Player_player2Sync(q_offset){
var q_obj=slideimg.document.getElementById("videoimg");
if(q_obj){
	var player2State=this.stateConstWM(q_obj.playState);
	if(this.getState()=="play" && player2State=="play"){
		if(Math.abs(this.player2Diff())>0.1){
			if(q_offset){
				q_obj.controls.currentPosition=this.getTime()+q_offset;
			}else{
				q_obj.controls.currentPosition=this.getTime()+0.1;
				setTimeout("gPlayer.player2Sync()",2000);
			}//end if
		}//end if
	}else{
		setTimeout("gPlayer.player2Sync()",5000);		
	}//end if
}//end if
}//end function
//---------------------------------------------------------------------------------------------------

//private
PlayerQT.prototype.setMyURL=function Player_setMyURL(q_STARTTIME){
this.myStarttime=q_STARTTIME;
this.myCurrentindex=this.getMediatrackIndex(this.myStarttime);
if(this.myURL==""&&this.myCurrentindex>-1){
	this.myURL=this.getCurrentMedia().mySrc;
}//end if
}//end function



//	html=html+"<EMBED id='"+q_name+"' name='"+q_name+"' AUTOPLAY='"+AUTOSTART+"' WIDTH='"+VIDEOWIDTH+"' HEIGHT='"+VIDEOHEIGHT+"' CONTROLLER='"+CONTROLLER+"' TARGET='myself' "+q_SRC+" type='video/quicktime' BGCOLOR='#000000' BORDER='0' PLUGINSPAGE='http://www.apple.com/quicktime/download/indext.html' ENABLEJAVASCRIPT='true' CACHE='true' postdomevents='true'></EMBED>";


//private
PlayerQT.prototype.noPlayer=function Player_noPlayer(){
try{
	if(this.myPlayer){
			if(this.myPlayer.GetQuickTimeVersion()){
	//		if(this.myPlayer.Play){
				return false;
			}//end if
	}//end if
	return true;
}catch(errObj){
	return true;
}//end if
}//end function

//private
PlayerQT.prototype.scheduleClip=function Player_scheduleClip(q_start,q_at){
if(this.myscheduleClip){
}else{
	logga("schedule new clip in "+q_at+"ms");
	this.myscheduleClip=setTimeout("gPlayer.setTime("+q_start+")",q_at);
}//end if
}//end function

//private
PlayerQT.prototype.unScheduleClip=function Player_unScheduleClip(){
if(this.myscheduleClip){
	clearTimeout(this.myscheduleClip);
	this.myscheduleClip=null;
}//end if
}//end function

//private
PlayerQT.prototype.isLastclip=function Player_isLastclip(){
return (this.myCurrentindex==this.myMediatrack.length-1);
}//end function

//private
PlayerQT.prototype.setStarttime=function Player_setStarttime(q_pos){
	this.myStarttime=q_pos;
	if(this.setMediatrackIndex(q_pos)>-1){
		this.myURL=this.getCurrentMedia().mySrc;
	}//end if
	return this.myStarttime;
}//end function

//private
PlayerQT.prototype.setPos=function Player_setPos(arg){
try{
		this.myPlayer.SetTime(arg*this.myPlayer.GetTimeScale());
//		logga("Setpos "+arg+" return curpos "+this.getPos());
		return arg;
}catch(errObj){
}//end catch
}//end function

//private
PlayerQT.prototype.getMediatrackIndex=function Player_getMediatrackIndex(q_pos){
var plist=this.myMediatrack;
for(var q_i=plist.length-1;q_i>=0;q_i--){
	if(q_pos>=plist[q_i].myClipstart && plist[q_i].myDuration==-1){
		return q_i;
	}else if(q_pos>=plist[q_i].myClipstart && q_pos<plist[q_i].myClipstart+plist[q_i].myDuration){
		return q_i;
	}//end if
}//next
return -1;
}//end function

//private
PlayerQT.prototype.time2pos=function Player_time2pos(q_time){
var q_i=this.getMediatrackIndex(q_time);
if(q_i>=0){
	var q_media=this.myMediatrack[q_i];
	return q_media.myMarkin+parseInt(q_time)-q_media.myClipstart;
}else{
	return 0;
}//end if
}//end function

//private
PlayerQT.prototype.setMediatrackIndex=function Player_setMediatrackIndex(q_pos){
var q_i=this.getMediatrackIndex(q_pos);
if(q_i>=0){
	this.myCurrentindex=q_i;
	return this.myCurrentindex;
}else{
	return -1;
}//end if
}//end function

//private
PlayerQT.prototype.getCurrentMedia=function Player_getCurrentMedia(){
	return this.myMediatrack[this.myCurrentindex];
}//end function

//private
PlayerQT.prototype.setMediatrackPos=function Player_setMediatrackPos(arg){
if(this.setMediatrackIndex(arg)>-1){
	q_media=this.getCurrentMedia();
	if(!this.isIdentical(q_media)){
		this.myPlayer.setSrc(q_media.mySrc);
	}//end if
	this.setPos(q_media.myMarkin+parseInt(arg)-q_media.myClipstart);
	return this.getPos(); //this.myPlayer.controls.currentPosition-q_media.myMarkin+q_media.myClipstart;
}else{
	return -1;
}//end if
}//end function

//private
PlayerQT.prototype.getPos=function Player_getPos(){
try{
	return (this.myPlayer.GetTime()/this.myPlayer.GetTimeScale());
}catch(errObj){
	return -1;
}//end if
}//end function

//private
PlayerQT.prototype.getMediatrackPos=function Player_getMediatrackPos(){
var q_i=this.myCurrentindex;
if(q_i>=0){
	q_media=this.getCurrentMedia();
	if(this.isIdentical(q_media)){
		return this.getPos()-q_media.myMarkin+q_media.myClipstart;
	}else{
		return -1;
	}//end if
}else{
	return -1;
}//end if
}//end function

//private
PlayerQT.prototype.isValidpos=function Player_isValidpos(q_pos){
if(q_pos>=0 && this.getDuration()==-1){//duration undefined - time is presumably within the clip
	return true;
}else if(q_pos>=0 && q_pos <= this.getDuration()){
	return true;
}else{
	return false;
}//end if
}//end function

//private
PlayerQT.prototype.getAsxMarkin=function Player_getAsxMarkin(){
var q_m=this.myPlayer.controls.currentItem;
if(q_m.getItemInfo("StartTime")>"0"){
	return parseInt(q_m.getItemInfo("StartTime"));
}else{
	return 0;
}//end if 
}//end function

//private
PlayerQT.prototype.getAsxDuration=function Player_getAsxDuration(){
if(this.myPlayer.controls){
	var plist=this.myPlayer.currentPlaylist;
	if(plist){
		var q_dur=0;
		for(var q_i=0;q_i<plist.count;q_i++){
			q_dur=q_dur+plist.item(q_i).duration;
		}//next
	}//end if
	return q_dur;
}else{
	return 0;
}//end if
}//end function

//private
PlayerQT.prototype.getMediatrackDuration=function Player_getMediatrackDuration(){
var plist=this.myMediatrack;
var q_dur=0;
for(var q_i=0;q_i<plist.length;q_i++){
	q_dur=q_dur+plist[q_i].myDuration;
}//next
return q_dur;
}//end function

//private
PlayerQT.prototype.verifyMediatrackDuration=function Player_verifyMediatrackDuration(){
var plist=this.myMediatrack;
var q_verified=true;
for(var q_i=0;q_i<plist.length;q_i++){
	q_verified=q_verified && isEqualDuration(plist[q_i].myDuration,this.getRealDuration(q_i));
}//next
return q_verified;
}//end function

//private
function isEqualDuration(a,b){
return almostEqual(a,b);
}//end function

//private
PlayerQT.prototype.fixMediatrackDuration=function Player_fixMediatrackDuration(){
var plist=this.myMediatrack;
for(var q_i=0;q_i<plist.length;q_i++){
	plist[q_i].myDuration=this.getRealDuration(q_i);
}//next
return true;
}//end function

//private
PlayerQT.prototype.getRealDuration=function Player_getRealDuration(q_i){
var plist=this.myMediatrack;
if(q_i<plist.length-1){
	return plist[q_i+1].myClipstart-plist[q_i].myClipstart;
}else{
	return this.myTotalDuration-plist[q_i].myClipstart;
}//end if
}//end function

//private
PlayerQT.prototype.player2Diff=function Player_player2Diff(){
var q_obj=slideimg.document.getElementById("videoimg");
if(q_obj){
	return q_obj.controls.currentPosition-this.getTime();
}else{
	retunr -1;
}//end if
}//end function

//private
PlayerQT.prototype.player2Tune=function Player_player2Tune(q_offset){
var q_obj=slideimg.document.getElementById("videoimg");
if(q_obj){
//	if(Math.abs(this.player2Diff)<1){
	if(this.player2Diff()<0){
		gPlayer.pause();
		var q_pausetime=this.player2Diff()*1000;
		setTimeout("gPlayer.play()",q_pausetime-q_offset);
	}//end if
}//end if
}//end function

//private
PlayerQT.prototype.isMulticlip=function Player_isMulticlip(){
if(this.myMediatrack.length>1){
	return true;
}else if(this.myMediatrack[0]){
	return (this.myMediatrack[0].myMarkin>0);
}else{
	return false;
}//end if
}//end function

//private
PlayerQT.prototype.setMediatrack=function Player_setMediatrack(q_ev){
this.myMediatrack=new Array();
for (q_i=0;q_i<q_ev.length;q_i++){
if(isVideocmd(q_ev[q_i][1])){
	var v=js2array(q_ev[q_i][1]);
	this.myMediatrack[this.myMediatrack.length]=new Mediatrackitem(v[1],v[2],v[3],q_ev[q_i][0]);
}else if(startswith(q_ev[q_i][1],"eventlist_endmark(")){
	this.myTotalDuration=parseInt(q_ev[q_i][0]);
}//end if
}//next
}//end function

//private
PlayerQT.prototype.isIdentical=function Player_isIdentical(q_media){
return (this.getSrc().toLowerCase()==replace(q_media.mySrc.toLowerCase(),"file://",""));
}//end function

//end class




