/* soundbite_playlist.module javascript */
/* Requires prototype.js to be defined -- either by spajax.module or another one */
function embed_soundbite(nid,name,clip_in,clip_out) {
	var element = document.getElementById('embed_soundbite__'+nid);
	new Ajax.Updater('embed_soundbite_'+nid,
         '../../../../embed_soundbite/'+name+'/'+clip_in+'/'+clip_out+'/'+nid,
        {
            method: 'get'
          });
/* soundbite/tag/6/1 == '../../ajax_vote/'+content_id+'/'+value+'/'+tag, */
}

//gLoading = '<p id="indicator" style="display:none;margin-top:0px;">' +
// 		'<img alt="Indicator" src="http://www.echochambermovie.com/modules/playlist/images/indicator.gif" /> Loading...' +
//		'</p>';

/* soundbite_playlist.module javascript */
/* Requires prototype.js to be defined -- either by spajax.module or another one */
function play_soundbites(path,multiple_flag) {
	var element = document.getElementById('play_soundbites');
	new Ajax.Updater('play_soundbites',
         '../../../../'+path+multiple_flag+'embed=1',
        {method: 'get'});
        
}

/* soundbite_playlist.module javascript */
/* Requires prototype.js to be defined -- either by spajax.module or another one */
function embed_playlist(nid) {
	var element = document.getElementById('embed_playlist__'+nid);
	new Ajax.Updater('embed_playlist_'+nid,
         '../../../../embed_playlist/'+nid,
        {
            method: 'get'
          });
/* soundbite/tag/6/1 == '../../ajax_vote/'+content_id+'/'+value+'/'+tag, */
}

/* soundbite_playlist.module javascript */
/* Requires prototype.js to be defined -- either by spajax.module or another one */
/* Script to dynamically display the interview sources to be extended to ABC, CBS & NBC*/
function show_sources(source) {
	var element = document.getElementById('show_interviewees');
	new Ajax.Updater('show_interviewees',
         '../../../../show_source/'+source,
        {
            method: 'get'
          });
}

/* soundbite_playlist.module javascript */
/* Requires prototype.js to be defined -- either by spajax.module or another one */
/* Script to dynamically display the interview sources to be extended to ABC, CBS & NBC*/
function order_icon(order) {
	var element = document.getElementById('sort_icon');
	new Ajax.Updater('sort_icon',
         '../../../../show_source/'+order,
        {
            method: 'get'
          });
}

function show_coll_block_new(){
	if($('blx_collection_new_name').style.display == 'block') {
		$('blx_collection_new_name').style.display = 'none';
	} else {
		$('blx_collection_new_name').style.display = 'block';
		$('blx_collection_rename').style.display = 'none';
	}	
	$('edit-blx_collection_new_name').focus();
}

function show_coll_block_rename(){
	if($('blx_collection_rename').style.display == 'block') {
		$('blx_collection_rename').style.display = 'none';
	} else {
		$('blx_collection_rename').style.display = 'block';
		$('blx_collection_new_name').style.display = 'none';
	}	
	$('edit-blx_collection_rename').focus();
}

/* SOCIAL TAXONOMY SCRIPTS */
/* Dabble.com script from lt3.js */
/*
function delete_tag(item, tname, nid, tid, uid){
  // alert("nid:"+nid+", tid:"+tid+", uid:"+uid);
  //var msg = "Delete your tag "+tname+" from this object?";
  // if (confirm(msg)){
  // delete the tag from the db
  URL = 'delete_tag/'+nid+'/'+tid+'/'+uid;
  loadUrlInFrame(URL );
  // give visual feedback it's been deleted
  // use this line to hide it, the one below to strike it through
  //document.getElementById(item).style.visibility="hidden";
  document.getElementById(item).style.textDecoration="line-through";
  // if we're striking through, hide the X which lets you delete it
  document.getElementById(item+'x').style.visibility="hidden";
  // Strike Through the tag under All Tags as well
  document.getElementById(item+'a').style.textDecoration="line-through";
  return false;
  //} else {
  //alert ('You said no!');
  //   return false;
  //}
}

function add_tag(nid) {
  // new_tags
  // tag_status
  var newtags = $F('newtags');
  var theNewTags = $('your_taglist');
	var pars = encodeURIComponent(newtags);
	//alert(pars);
	new Ajax.Updater('your_taglist',
		 'add_tags/' + nid + '/'+pars,
		{
			method: 'get',
			parameters: pars
		  });
    // make the newtags field the focus
  var tagfield = $('newtags');
  tagfield.value = '';
  tagfield.select();
}

function submit_tags(evt, nid){
  evt = (evt) ? evt : event;
  var charCode = (evt.charCode) ? evt.charCode :
  ((evt.which) ? evt.which : evt.keyCode);
  if (charCode == 13 || charCode == 3) {
    add_tag(nid);
    return false;
  }
}
*/

//  +---------------------------------------------------------------------------+
//  | The Virtual Cutter
//  +---------------------------------------------------------------------------+
//  | Filename: quicktime.js
//  | Version: 4.0.3
//  | Date created: 01/10/2001
//  | Date last revision: 10/12/2005
//  +---------------------------------------------------------------------------+
//  | Purpose: JavaScript module for the Quicktime Player
//  +---------------------------------------------------------------------------+
//  | Copyright (c) 2005: AndrŽ Rosendaal, University of Groningen, Netherlands
//  | e-mail: a.j.m.rosendaal@rug.nl
//  +---------------------------------------------------------------------------+
//  | This program is free software; you can redistribute it and/or
//  | modify it under the terms of the GNU General Public License
//  | as published by the Free Software Foundation; either version 2
//  | of the License, or (at your option) any later version.
//  | 
//  | This program is distributed in the hope that it will be useful,
//  | but WITHOUT ANY WARRANTY; without even the implied warranty of
//  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  | GNU General Public License for more details.
//  | 
//  | You should have received a copy of the GNU General Public License
//  | along with this program; if not, write to the Free Software
//  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//  |
//  | More information: http://www.gnu.org/licenses/licenses.html
//  +---------------------------------------------------------------------------+

// COMMENT OUT 060616 0210p
//    var mark_start = new Image(); 
//    mark_start.src = "http://video.surfnet.nl/virtualcutter/images/en/mark_start_emphasis.gif"; 
//    var mark_start_on = new Image(); 
//    mark_start_on.src = "http://video.surfnet.nl/virtualcutter/images/en/mark_start_emphasis_on.gif"; 
//
//    var mark_end = new Image(); 
//    mark_end.src = "http://video.surfnet.nl/virtualcutter/images/en/mark_end_emphasis.gif"; 
//    var mark_end_on = new Image(); 
//    mark_end_on.src = "http://video.surfnet.nl/virtualcutter/images/en/mark_end_emphasis_on.gif";
//
//    PLAYERTYPE = 'quicktime';
//    URLBase = 'http://video.surfnet.nl/virtualcutter/play/play.php/';
//    FORCEPLAYER = "force_qt.mov";
//
//    function PlaylistPlayerType() {
//      return 'quicktime';
//    }
//
//    function GetURL () {
//      return "http://blip.tv/file/get/Kentbye-EchoChamberProjectSocialChange736.mov";
//    }
//    PLAYERVERSION = "4.0.5";
// COMMENT OUT 060616 0210p

// GetPosition
// Request the current position in the stream
function GetPosition () {
//  window.onerror=PositionErrorHandler
  vPos = document.QTPlayer.GetTime()
//  vPos = document.QTPlayer.GetTimeBaseTime()
//  alert(vPos+' '+document.QTPlayer.GetTimeScale());
  k=1000;
  currentposition=vPos*(k/document.QTPlayer.GetTimeScale())
  window.onerror=defaultErrorHandler
//  currentframe = Math.round(vPos/20)+6993;
//  alert(vPos+' '+currentposition+ ' ' + currentframe);
  return Math.round(currentposition)
}

// GetFrame
// Convert the current position to the Current Frame
function GetFrame(StartingFrame) {
//  alert(document.QTPlayer.GetTimeScale())
	window.onerror=PositionErrorHandler
  vPos = document.QTPlayer.GetTime()
  k=1000;
  currentposition=vPos*(k/document.QTPlayer.GetTimeScale())
//  vPos = document.QTPlayer.GetTimeBaseTime()
//  alert(document.QTPlayer.GetTime()+' '+document.QTPlayer.GetTimeScale());
//  k=1000;
//  currentposition=vPos*(k/document.QTPlayer.GetTimeScale())
//  currentframe = Math.round(vPos/20)+StartingFrame;
  currentframe = Math.round((currentposition/1000)*29.97)+StartingFrame;
  window.onerror=defaultErrorHandler
//  alert(vPos+' '+currentposition+ ' ' + currentframe);
  return currentframe;
}


// ShowStartTime
// Show the marked start time in the proper DIV object
function ShowStartTime (formname,element_in) {
	LayerWrite('StartFieldDIV',null,"<DIV class = fsizetime>" + ConvertMSecs(vStartPosition) + " | " + vStartFrame +" frames</DIV>")// Write Start Frame Time into the Submit form
	document.forms[formname].elements[element_in].value = vStartFrame;
//	document.forms[formname].elements["edit[field_clip_in_0][0]"].value = vStartFrame;
//	document.forms[formname].elements["edit[clipin]"].value = vStartFrame;
}

// ShowEndTime
// Show the marked end time in the proper DIV object
function ShowEndTime (formname,element_out) {
  LayerWrite('EndFieldDIV',null,"<DIV class = fsizetime>" + ConvertMSecs(vEndPosition) + " | " + vEndFrame + " frames</DIV>")
	document.forms[formname].elements[element_out].value = vEndFrame;
//  document.forms[formname].elements["edit[field_clip_out_0][0]"].value = vEndFrame;
//  document.forms[formname].elements["edit[clipout]"].value = vEndFrame;
}

// JumpTo
// Play from a specific position in the stream -- either beginning or end
// Position (millisec)
function JumpTo(Position) {
//	window.onerror=JumpErrorHandler	
	document.QTPlayer.Stop()
	Position = (Position*document.QTPlayer.GetTimeScale())/1000
  document.QTPlayer.SetTime(Position)
  window.onerror=defaultErrorHandler
}

function Rewind() {
	window.onerror=JumpErrorHandler	
	document.QTPlayer.Rewind()
  window.onerror=defaultErrorHandler
}

function Play() {
	window.onerror=JumpErrorHandler	
	document.QTPlayer.Play()
  window.onerror=defaultErrorHandler
}

function Stop() {
	window.onerror=JumpErrorHandler	
	document.QTPlayer.Stop()
  window.onerror=defaultErrorHandler
}

// PlayFrom
// Play from a specific position in the stream -- either beginning or end
// Position (millisec)
// CONVERT Position = Position * 600/1000
// 6.668 sec = 6668 msec -> 4000.8 QT scale
function PlayFrom(Position) {
	window.onerror=JumpErrorHandler	
	Position = (Position*document.QTPlayer.GetTimeScale())/1000
	document.QTPlayer.Stop()
  // Make sure to reset any previous EndTime that has been set
	document.QTPlayer.SetEndTime(document.QTPlayer.GetDuration())
  document.QTPlayer.SetTime(Position)
  document.QTPlayer.Play()
  window.onerror=defaultErrorHandler
}

// Clip
// Play from the beginning to end position of the clip
// Position (msec)
// EndPosition (msec)
function Clip(Position, EndPosition) {
//	alert(Position+' '+EndPosition)
	window.onerror=JumpErrorHandler	
  	ClipDuration = EndPosition - Position + 1000
		Position = (Position*document.QTPlayer.GetTimeScale())/1000
		EndPosition = (EndPosition*document.QTPlayer.GetTimeScale())/1000
		document.QTPlayer.Stop()
  	document.QTPlayer.SetTime(Position)
  	document.QTPlayer.SetEndTime(EndPosition)
  	document.QTPlayer.Play()
  	window.setTimeout('ResetEnd()',ClipDuration)
  	window.onerror=defaultErrorHandler
}

function ResetEnd() {
	document.QTPlayer.Stop()
	document.QTPlayer.SetEndTime(document.QTPlayer.GetDuration())
}

function initialize(clipin,clipout) {
  vEndPosition = Math.round(((clipout-clipin)/29.97)*1000);
  vEndFrame = clipout;
}

function initialize_position(clipin,clipout) {
  vStartPosition = Math.round(((clipin)/29.97)*1000);
	vEndPosition = Math.round(((clipout)/29.97)*1000);
  vStartFrame = clipout;
	vEndFrame = clipout;
//	document.QTPlayer.Stop();
//	Position = (vStartPosition*document.QTPlayer.GetTimeScale())/1000;
//  document.QTPlayer.SetStartTime(Position);
}



// COMMENT OUT 060616 0205p
//// SaveCutOut
//// Call to PLAY.PHP to save the clip as a metafile
//function SaveCutOut() {
//  return URLBase + 
//         "?url=" + GetURL() + "&start=" + vStartPosition/1000 + 
//         "&end=" + vEndPosition/1000 + "&player=quicktime&saveas=" + STR_PLAYCLIP + "&version=" + PLAYERVERSION
//}	
// COMMENT OUT 060616 0205p

// COMMENT OUT 060616 0206p
//// ShowHyperlink
//// Generates HTML code for creating a hyperlink to play the clip
//function ShowHyperlink(filename, start, end, link) {
//  if (filename == null) {
//    filename = GetURL()
//  }
//  if (start == null) {
//    start = vStartPosition/1000
//  }
//  if (end == null) {
//    end = vEndPosition/1000
//  }
//  if (link == null) {
//    link = Anchor()
//  }
//  return "<a href = " + URLBase + FORCEPLAYER +"?url=" + filename + "&player=quicktime&start=" + start + "&end=" + end + "&version=" + PLAYERVERSION + ">" + link + "</a>"
//}
// COMMENT OUT 060616 0206p

// COMMENT OUT 060616 0208p
//// ShowURL
//// returns the URL to play the clip
//function ShowURL() {
//
//  return URLBase + FORCEPLAYER + "?url=" + GetURL() + "&player=quicktime&start=" + vStartPosition/1000 + "&end=" + vEndPosition/1000 + "&version=" + PLAYERVERSION 
//}
// COMMENT OUT 060616 0208p

// COMMENT OUT 060616 0209p
//// ShowInternal
//// Returns HTML code for creating a hyperlink to play the clip that is displayed (not interpreted as HTML) by the browser
//function ShowInternal() {
//  return '&lt;a href = "' + URLBase + FORCEPLAYER + "?url=" + GetURL() + "&player=quicktime&start=" + vStartPosition/1000 + "&end=" + vEndPosition/1000+ "&version=" + PLAYERVERSION + '"&gt;' + Anchor() + '&lt;/a&gt;'
//}
// COMMENT OUT 060616 0209p

//  +---------------------------------------------------------------------------+
//  | The Virtual Cutter
//  +---------------------------------------------------------------------------+
//  | Filename: virtualcutter.js
//  | Version: 4.0.4
//  | Date created: 01/10/2001
//  | Date last revision: 23/03/2006
//  +---------------------------------------------------------------------------+
//  | Purpose: Shared JavaScript module.
//  | Contains functions for DHTML, communication with players, etc.
//  +---------------------------------------------------------------------------+
//  | Copyright (c) 2005: AndrŽ Rosendaal, University of Groningen, Netherlands
//  | e-mail: a.j.m.rosendaal@rug.nl
//  +---------------------------------------------------------------------------+
//  | This program is free software; you can redistribute it and/or
//  | modify it under the terms of the GNU General Public License
//  | as published by the Free Software Foundation; either version 2
//  | of the License, or (at your option) any later version.
//  | 
//  | This program is distributed in the hope that it will be useful,
//  | but WITHOUT ANY WARRANTY; without even the implied warranty of
//  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  | GNU General Public License for more details.
//  | 
//  | You should have received a copy of the GNU General Public License
//  | along with this program; if not, write to the Free Software
//  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//  |
//  | More information: http://www.gnu.org/licenses/licenses.html
//  +---------------------------------------------------------------------------+
//  | Version history:
//  | - 4.0.4: Added parameters to metadata-editor call in OpenMetadataEditor 
//  +---------------------------------------------------------------------------+
  
  var vStartPosition, vEndPosition
  var vStartFrame, vEndFrame
  var pos_play_part, pos_save_part
  
  vStartPosition = 0;
  vEndPosition = 0;

  ns4 = (document.layers)? true:false
  ie4 = (document.all)? true:false
  dom = (document.getElementById)? true:false
  
  // LayerWrite
  // Write text to a DHTML-object
  // id      : id of the object
  // nestref : ???
  // text    : text that has to written to the object
  function LayerWrite(id,nestref,text) {
	if (ns4) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
		lyr.open()
		lyr.write(text)
		lyr.close()
	}
	else {
	  if (ie4) {
	    document.all[id].innerHTML = text
	  } else {
	      // 'innerHTML' is not part of DOM, but is supported by IE and Netscape 6
	      if (dom) {
	        document.getElementById([id]).innerHTML = text
	      } else {
	        alert (STR_NO_DHTML_SUPPORT)
	      }
	  } 
	}    
  }
 
  // ConvertMSecs
  // Converts time in milliseconds to text. Format: "xx min. xx.yy sec."
  // length: time in milliseconds
  function ConvertMSecs(length) {
    var vTime, vMin, vSec
    // Round first, because otherwise problems occur, e.g. 
  	// 1 min. 4.1 sec becomes 64099.999999999. Javascript bug?
  	length = Math.round(length)
  	
  	vTime = length/1000
  	vMin = Math.floor(vTime/60)
  	vSec = Math.floor(vTime % 60)
  	if (vMin < 10) {
  	  vMin = "0" + vMin
  	}  
  	if (vSec < 10) {
  	  vSec = "0" + vSec
  	}  
  	vMsec = (length % 1000)
  	if (vMsec < 10) {
  	  vMsec = "00" + vMsec
  	}  
  	else {  	
    	  if (vMsec < 100) {
  	    vMsec = "0" + vMsec
  	  }
  	}
  
  return  vMin + ":" + vSec + "." +  vMsec
//  	return  vMin + " min. " + vSec + "." +  vMsec + " sec."
  }
  
  // UpdateHREF
  // Adjust the 'href' value of the hyperlink for playing and saving the clip.
  // IE can do that if you use the 'name' parameter of the <a> tag, but to support Netscape 4,
  // the order number of the link wa sestablished first. For Netscape 6 the 'name'paramter could 
  // also be used, but only in a loop. Therefore, for NS6 the function also uses the order number.
  // link_name : name of the hyperlink
  // new_href  : new value of the href parameter
// COMMENT OUT 060619 1128 a
//  function UpdateHREF (link_name, new_href) {
//    
//  	if (ie4) {
//    	  document.links(link_name).href=new_href
//    	} else {
////          if (ns4) {
//      	    switch (link_name) {
//      	      // hyperlink voor afspelen uitsnede
//      	      case 'play_part_ref': 
//      	        document.links[pos_play_part].href = new_href
//      	        break
//      	      // hyperlink voor opslaan uitsnede
//      	      case 'save_part_ref': 
//      	        document.links[pos_save_part].href = new_href
//      	        break
//      	    }
////      	  } else {
////       	    for (i=0;i<document.links.length;i++) {
////              if (document.links[i].name.indexOf(link_name) >= 0 ) {
////                document.links[link_name].href=new_href
////              }  
////            }    
////          }
//        }  
//    }
// COMMENT OUT 060619 1128 a

  
  // UpdateAfterMarksHaveChanged
  // Perform steps after the user has modified the clip settings
// COMMENT OUT 060619 1130 a
//  function UpdateAfterMarksHaveChanged () {
//    	
//    	// display an icon (scissors) to indicate visualy that the clip was changed
////    	document.playlist_icon.src = "./images/cutout_changed.jpg"
//    	
//    	// Adjust href-value of the buttons the play and save the clip.
//    	UpdateLinkForPlayback ()
//    	UpdateLinkForSave () 
//  } 
// COMMENT OUT 060619 1130 a

  
//  COMMENT OUT 060616 0221p
//  // InitPositionOfDynamicLinks
//  // A tric to get the oreder number of a hyperlink in Netscape
//  // The name of the link cannot be used when its href value is to be changed.
//  function InitPositionOfDynamicLinks () {
//
//    pos_play_part = 9999;
//
//    for(num=0;num<document.links.length;num++) {
//    if (document.links[num].href.indexOf("play_part") != -1) {
//      pos_play_part = num;
//      num = 5000;
//      }
//    }  
//    pos_save_part = 9998;
//    for(num=0;num<document.links.length;num++) {
//      if (document.links[num].href.indexOf("save_part") != -1) {
//        pos_save_part = num;
//        num = 5000;
//      }
//    }
//  }  
//  COMMENT OUT 060616 0221p
 	
  // UpdateLinkForPlayback
  // Update the value of href for the button to play the current clip  
// COMMENT OUT 060619 1129 a
//  function UpdateLinkForPlayback () {
//  	
//  	UpdateHREF ('play_part_ref', ShowURL() )
//  }
// COMMENT OUT 060619 1129 a

  // UpdateLinkForSave
  // Update the value of href for the button to save the current clip  
  // For this, an empty hyperlink in edit_item.php was added
// COMMENT OUT 060619 1130.5 a
//  function UpdateLinkForSave () {
//    	
//        UpdateHREF ('save_part_ref', SaveCutOut() )
//
//  }	
// COMMENT OUT 060619 1130.5 a

  
  // defaultErrorHandler
  // Restore the default JavaScript error handler
  function defaultErrorHandler() {
    return false
  }
  
  // PositionErrorHandler
  // Display a custom JavaScript error if the current position of the player could not be retrieved from the plugin
  // e.g. if it does not support JavaScript
  function PositionErrorHandler(desc,page,line,chr)  {
    alert(STR_CURRENT_POSITION_NOT_READ)
    window.onerror=defaultErrorHandler
    return true
  }
  
  <!-- JumpErrorHandler: Toon custom foutmelding als niet vanaf de gemarkeerde --> 
  <!-- positie afgespeeld kan worden tgv. een JavaScript fout			-->
  <!-- (i.h.a. als de speler geen JavaScript ondersteunt)  				-->		 
  
  // JumpErrorHandler
  // Display a custom JavaScript error if the currentposition of the player could not be set
  // e.g. because it does not support JavaScript
  function JumpErrorHandler(desc,page,line,chr)  {
//    alert(STR_CURRENT_POSITION_NOT_SET)
  	alert('STR_CURRENT_POSITION_NOT_SET')
    window.onerror=defaultErrorHandler
    return true
  }

//  COMMENT OUT 060616 0227p
//  // GetInputByHand
//  // Ask for manual input of the start or end point
//  // Time    : current start or end point in milliseconds
//  // Message : text of the prompt
//  function GetInputByHand (Time, Message) {
//    a = prompt (Message, ConvertMSecs(Time))
//    if (a == null) {
//      // "Cancel"
//      return -1
//    } else {  
//      a = a.split(" ")
//      mm = Math.abs(parseInt(a[0]))
//      ss = Math.abs(parseFloat(a[2]))
//      if (isNaN((mm)) | isNaN(ss)) {
//        alert(STR_WRONG_TIME_FORMAT)
//        return -1
//      } else {
//        return (mm*60 + ss) * 1000
//      }
//    }
//  }  
//  COMMENT OUT 060616 0227p

// COMMENT OUT 060616 0228p
//  // GetStartByHand
//  // User wants to enter start point manually
//  function GetStartByHand () {
//    OldStartPosition = vStartPosition	
//    GetStartTime("ByHand")
//    // COMMENT OUT 060616 1132a
////    if (OldStartPosition != vStartPosition) {
////      UpdateAfterMarksHaveChanged ()
////    }
//    // COMMENT OUT 060616 1132a
//  }
// COMMENT OUT 060616 0228p

// COMMENT OUT 060616 0229p
//  // GetEndByHand
//  // User wants to enter end point manually
//  function GetEndByHand () {
//    OldEndPosition = vEndPosition	
//    GetEndTime("ByHand")
//// COMMENT OUT 060616 1210p
////    if (OldEndPosition != vEndPosition) {
////      UpdateAfterMarksHaveChanged ()
////    }
//// COMMENT OUT 060616 1210p
//  }
// COMMENT OUT 060616 0229p

  // GetStartTime
  // Get the start point, either by reading the current position of the player or
  // by opening an input window
  // Mode : "ByHand" for manual input, else NULL
//  function GetStartTime (Mode) {
  function GetStartTime(StartingFrame,formname,element_in,element_out) {
    var NewPosition
    OldPosition = vStartPosition	
    OldFrame = vStartFrame
// COMMENT OUT 060616 0259p
//    if (Mode == "ByHand") {
//      NewPosition = GetInputByHand (vStartPosition, STR_ENTER_START_TIME)	
//      if (NewPosition == -1) {
//      	<!-- input not recognized -->
//      	return -1
//      } else {
//        vStartPosition = NewPosition
//      }
//    } else {
        vStartPosition = GetPosition ()
        vStartFrame = GetFrame(StartingFrame)        
//    } 
// COMMENT OUT 060616 0259p
     
    if (vStartPosition > vEndPosition) {
      vEndPosition = vStartPosition
      vEndFrame = vStartFrame
      ShowEndTime(formname,element_out)
    }
// COMMENT OUT 060616 1212p
//    if (OldPosition != NewPosition) {
//      UpdateAfterMarksHaveChanged ()
//    }
// COMMENT OUT 060616 1212p
    <!-- Display start Time -->
    ShowStartTime(formname,element_in)
  }
  
  // GetEndTime
  // Get the end point, either by reading the current position of the player or
  // by opening an input window
  // Mode : "ByHand" for manual input, else NULL
  //  function GetEndTime(Mode) {
  function GetEndTime(StartingFrame,formname,element_in,element_out) {
  	var NewPosition
  	OldPosition = vStartPosition	
    OldFrame = vStartFrame
// COMMENT OUT 060616 0300p
//    if (Mode == "ByHand") {
//      NewPosition = GetInputByHand (vEndPosition, STR_ENTER_END_TIME)
//      if (NewPosition == -1) {
//      	<!-- input not recognized -->
//      	return -1
//      } else {
//        vEndPosition = NewPosition
//      }  
//    } else {	
        vEndPosition = GetPosition ()
        vEndFrame = GetFrame(StartingFrame)
//    } 
// COMMENT OUT 060616 0300p
    if (vStartPosition > vEndPosition) {
      vStartPosition = vEndPosition
      vStartFrame = vEndFrame
      ShowStartTime(formname,element_in)
    }  
// COMMENT OUT 060616 1213p
//    if (OldPosition != NewPosition) {
//      UpdateAfterMarksHaveChanged ()
//    }
// COMMENT OUT 060616 1213p

    <!-- Display end Time -->
    ShowEndTime(formname,element_out)
  }

//  COMMENT OUT 060616 0224p
//  // Anchor
//  // returns the txt of the hyperlink (the anchor), either default or set by user.
//  function Anchor () {
//    if (TITLE == '') {
//      return DEFAULT_ANCHOR
//    } else {
//      return TITLE	
//    }  	  	
//  }	
//  COMMENT OUT 060616 0224p

// COMMENT OUT 060616 0302p
//  // ShowCurrentSelection
//  // Display current start and end time
//  // start  : start time in milliseconds
//  // end    : end time in milliseconds
//  function ShowCurrentSelection (start, end) {
//    vStartPosition = start*1000
//    vEndPosition = end*1000
//    ShowStartTime()
//    ShowEndTime()
//  }	  
// COMMENT OUT 060616 0302p

  // DecreaseStartTime
  // Decrease the starttime by 0.1 sec
  function DecreaseStartTime () {
    vStartPosition = Math.max (0, vStartPosition - 100)
    UpdateAfterMarksHaveChanged ()
    ShowStartTime()
  }
  
  // IncreaseStartTime
  // Increase the starttime by 0.1 sec
  function IncreaseStartTime () {
    vStartPosition = vStartPosition + 100
    UpdateAfterMarksHaveChanged ()
    ShowStartTime()
    if (vStartPosition > vEndPosition) {
      vEndPosition = vStartPosition
      ShowEndTime()
    }
  }
  
  // DecreaseEndTime
  // Decrease the endtime by 0.1 sec
  function DecreaseEndTime () {
    vEndPosition = Math.max (0, vEndPosition - 100)
    UpdateAfterMarksHaveChanged ()
    if (vStartPosition > vEndPosition) {
      vStartPosition = vEndPosition
      ShowStartTime()
    }
    ShowEndTime()
  }

  // IncreaseEndTime
  // Increase the endtime by 0.1 sec
  function IncreaseEndTime () {
    vEndPosition = vEndPosition + 100
    UpdateAfterMarksHaveChanged ()
    ShowEndTime()
  }
  
  // mod
  // modulo function
  function mod(divisee,base) {
  	// Created 1997 by Brian Risk.  http://members.aol.com/brianrisk
  	return Math.round(divisee - (Math.floor(divisee/base)*base));
  }
  
// COMMENT OUT 060616 0621p
//  // GetPlaylistCount
//  // returns the number of items in the playlist
//  function GetPlaylistCount () {
//      return count($playlist);
//    }
// COMMENT OUT 060616 0621p

// COMMENT OUT 060616 0622p
//  // OpenWindow
//  // Open a secondary window without buttonbar
//  // URL: url that is to be displayed in the window
//  function OpenWindow(URL) {
//   vWidth = 700;
//   vHeight = 550; 
//   vOptions = 'resizable,status,scrollbars,width=' + vWidth + ',height=' + vHeight + ',left=100,top=50'
//   popupWin = window.open(URL, 'second', vOptions)
//  }
// COMMENT OUT 060616 0622p

// COMMENT OUT 060616 0623p
//  // GenerateOutput
//  // Open the window that contains the different flavours of the clip
//  function GenerateOutput() {
//    OpenWindow("./generate_output.php?player="+ PLAYERTYPE + "&lang=" + LANG + "&url=" + GetURL() + 
//        "&assettype=" + ASSETTYPE + "&start=" + vStartPosition + "&end=" + vEndPosition + _SID +
//        "&cur_title=" + document.mainform.item_title.value)
//  }
// COMMENT OUT 060616 0623p

// COMMENT OUT 060616 0624p
//  // OpenMetadataEditor
//  // Open the webpage that contains the input form for entering the clip to an audiovisual database/CMS.
//  // Parameters are added to the call to the URL, because ideally this would point to a script that collects the parameters
//  // and re-creates the url to playback the clip, so users do not have to copy-and-paste them. 
//  // Obviously, this would be CMS-specific.
//  // type : if set to 'no_param', no parameters are added to the url. This is the case of OpenMetadataEditor
//  //        is called from the playlist, because adding parameters only has meaning for a single clip.
//  function OpenMetadataEditor (type) {
//    
//      if (METADATA_EDITOR == "") {
//        // No address defined in virtualcutter.ini, thus option not supported on the current server
//        var editor=window.open('','name','height=300,width=300');
//        editor.document.write('<html><head><title>Metadata</title>');
//        editor.document.write('<style type="text/css">');
//        editor.document.write('<!--');
//        editor.document.write('p {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }');
//        editor.document.write('-->');
//        editor.document.write('</style>');
//        editor.document.write('</head><body>');
//        editor.document.write('<p>' + STR_NO_METADATA_EDITOR + '</p>');
//        editor.document.write('<p><a href="javascript:self.close()">' + STR_CLOSE_WINDOW + '</a></p>');
//        editor.document.write('</body></html>');
//        editor.document.close();
//      } else {	
//      	if (type == 'no_param') {
//      		OpenWindow (METADATA_EDITOR + "?lang=" + LANG )
//      	} else {	
//          OpenWindow (METADATA_EDITOR + "?url=" + GetURL() + 
//          "&player=" + PLAYERTYPE + "&version=" + PLAYERVERSION + "&start=" + vStartPosition + "&end=" + vEndPosition + 
//          "&script=" + escape(URLBase) + "&title=" + escape(document.mainform.item_title.value) + "&lang=" + LANG )
//        }  
//      }  
//  }
// COMMENT OUT 060616 0624p

// COMMENT OUT 060616 0625p
//  // NextAsset
//  // Open the input screen
//  // parlist  : list of parameters
//  function NextAsset(parlist) {
//    _href = "./select_file.php"
//    if (parlist != "") {
//       //parlist is at least the SID
//       _href = _href + "?" + parlist
//    } 
//    parent.location.href = _href
//  } 
//  
//  // GetDocumentLocation
//  // Return the url of the current webpage
//  function GetDocumentLocation() {
//    	
//    return document.location
//  }
//    
//  // DoNothing
//  // Dummy function. Used to prevent an unexpected action if the user presses the Enter key
//  // when the focus is on an input field. Is set as form action parameter. 
//  // 
//  function DoNothing () {
//  }
//  
//  // ValidateNumber
//  // Checks if an object contains a number
//  // objectname : name of form lement
//  // message    : error message if not a number
//  function ValidateNumber (objectname, message) {
//    TestVar = isNumberString (objectname.value)
//    if (TestVar != 1) {
//      alert (message);
//    }  
//    return TestVar  
//  }
//  
//  // isNumberString
//  // Checks if alle characters in a string are digits
//  // Instring  : string that is to be checked
//  function isNumberString (InString)  {
//  	if(InString.length==0) return (false);
//  	var RefString="1234567890";
//  	for (Count=0; Count < InString.length; Count++)  {
//  		TempChar= InString.substring (Count, Count+1);
//  		if (RefString.indexOf (TempChar, 0)==-1)  
//  			return (false);
//  	}
//  	return (true);
//  }
//  
//  // getImageDir
//  // returns the language specific directory with images
//  // Lang     : selected language
//  // StartDir : parent directory of language specific directory
//  function getImageDir(Lang, StartDir) {
//        return "./" + StartDir + "images/" + Lang + "/"
//  }
// COMMENT OUT 060616 0625p