	
	function rightPanel (videoObject,IDs,params) {
	 		this.messages=new Array();
	 		this.video=videoObject;
	 		this.IDs=IDs;
	 		this.selectedRow='';
	 		this.videoLength=0;
	 		this._hasChanged=false;
	 		this.mySelect=document.getElementById('selectFolder');
			this.messages['confirmerAbandon']='Loose all changes ?';
	 		this.messages['titreDefaut']='No title';
	 		this.formName='form1';
	 		this.mode='extrait';
	 		this.defaultTCIN='00:00:00:00';
	 		
	 		if (params['videoLength']) 		this.videoLength=params['videoLength'];
	 		if (params['selectPanier']) 	this.mySelect=document.getElementById(params['selectPanier']);
	 		if (params['msgConfirmAbandon']) this.messages['confirmerAbandon']=params['msgConfirmAbandon'];
	 		if (params['msgTitreDefaut']) this.messages['titreDefaut']=params['msgTitreDefaut'];
			if (params['formName']) 		this.formName=params['formName'];
			if (params['mode']) 		this.mode=params['mode'];
			if (params['defaultTCIN']) 		this.defaultTCIN=params['defaultTCIN'];


	}
	
	rightPanel.prototype.getTCOutFromVideo = function () {
		if (this.video) this.videoLength=this.video.GetCurrentSelectionEnd();
	}
	
	rightPanel.prototype.refreshContent = function () {

		if (this._hasChanged) 
			if (!confirm(this.messages['confirmerAbandon'])) return;			
			if (document.getElementById('zoneSaisie')) document.getElementById('zoneSaisie').innerHTML="<center><img src='design/images/wait30trans.gif'></center>";
			
			if (this.mode=='extrait') {
				if (!this.mySelect) return;
				idPanier=this.mySelect.options[this.mySelect.selectedIndex].value;
				return !sendData('GET','blank.php','xmlhttp=1&urlaction=processPanier&id_panier='+idPanier+'&commande=view&xsl=oraoweb_extrait&items='+this.IDs,'myPanel.getCart');	
			}
			if (this.mode=='sequence') {
				return !sendData('GET','blank.php','xmlhttp=1&urlaction=processSequence&id='+this.IDs+'&commande=view&xsl=oraoweb_sequence','myPanel.getCart');	
			}
			
			if (this.mode=='materiel') {
				return !sendData('GET','blank.php','xmlhttp=1&urlaction=processDocument&id='+this.IDs+'&commande=view&xsl=oraoweb_document','myPanel.getCart');	
			}
			
			
	}
	
	rightPanel.prototype.getCart = function (xml) {
		document.getElementById('zoneSaisie').innerHTML=xml;
	}
	
	rightPanel.prototype.hasChanged= function (row) {

		document.getElementById('barSave').src='design/images/ow_images/boutons/b_disquette_petit_anim.gif';
		row.style.border='1px solid #66FF66';
		this._hasChanged=true;
		
	}
	
	rightPanel.prototype.checkLine = function (row) {
		_tcin=getChildById(row,'tcin$');
		_tcout=getChildById(row,'tcout$');
		_titre=getChildById(row,'ext_titre$');
		
		if (_tcin.value=='' || _tcin.value<this.defaultTCIN ) {
			new Effect.Pulsate(_tcin);_tcin.value=this.defaultTCIN;}
		if (_tcout.value=='' || _tcout.value>this.videoLength || _tcout.value<_tcin.value) {
			new Effect.Pulsate(_tcout);_tcout.value=this.videoLength;}
		if (_titre.value.Trim()=='') {new Effect.Pulsate(_titre);_titre.value=this.messages['titreDefaut'];}
	}

	rightPanel.prototype.save =function () {
		document.getElementById('barSave').src='design/images/ow_images/boutons/b_disquette_petit.gif';
		document.forms[this.formName].submit();
		this._hasChanged=false;	
	}

	rightPanel.prototype.showResultInParent=function (elt) {
		//Gère le retour de la sauvegarde depuis l iframe / processPanier
		//Attention, on utilise une astuce pour contourner un bug FF
		//Explications : refreshContent va détruire et recréer l iframe depuis laquelle cette fonction est lancée
		//Or FF ne permet pas l appel d une fonction (a fortiori AJAX) depuis un object en cours de destruction
		//Donc on effectue un lancement indirect de la fonction via un "faux" timeout
			
		//alert(elt.innerHTML);
		showAlert(elt.innerHTML,'alertBox','',0,115); //affiche le résultat + décalage vertical pour afficher sous la vidéo

		
   		window.setTimeout(function () {myPanel.refreshContent();}, 0);
	}


	rightPanel.prototype.selectExtrait=function(thisrow) {
		if (this.selectedRow==thisrow) { //toggle selected/off
			this.selectExtrait('');
			return;
		} 
		this.selectedRow=thisrow;
		alldiv=document.getElementById('zoneSaisie').getElementsByTagName('div');
		for (i=0;i<alldiv.length;i++) { //raz styles
			if (alldiv[i].id.indexOf('row$')==0) alldiv[i].className='row_extrait';
			if (alldiv[i].id.indexOf('handle$')==0)  alldiv[i].className='ext_handler';
		}
		if (thisrow!='') { //highlight sur ligne sélectionnée
			_n=getChildById(thisrow,'action$');
			if (!_n || _n.value=='suppr') return; //on n active pas une ligne marquée pour suppr		
			thisrow.className='row_extrait_selected';
			_n=getChildById(thisrow,'handle$')
			if (_n) _n.className='ext_handler_selected';
			_n=getChildById(thisrow,'tcin$');
			if (_n) _tcin=_n.value;
			_n=getChildById(thisrow,'tcout$');
			if (_n) _tcout=_n.value;
			if (this.video) this.video.SetSelection(_tcin,_tcout);
			
			
		} else { //rewind au début
			if (this.video) {this.video.GoToBegSelection();this.video.UnSetSelection();}
			
		}
	}
	
	rightPanel.prototype.addExtrait= function() {	
	 	blankDiv=document.getElementById('row$blank');
	 	myNewRow=blankDiv.cloneNode(true);
	 	myNewRow.id='row$cloned'; //chgt id car il ne faut qu'un seul row$blank
	 	document.getElementById(this.formName).appendChild(myNewRow);
	 	myNewRow.style.display='block'; //on rend visible le clone
	 	
	 	if (this.video) TC=this.video.GetCurrentLongTimeCode(); else TC=this.defaultTCIN;
		_n=getChildById(myNewRow,'tcin$');
		if (_n) _n.value=TC;
		_n=getChildById(myNewRow,'tcout$');
		//videoLength est maj par le load video mais parfois il est à 0 car la video n'est pas chargée complètement
		if (this.videoLength==0 && this.video) //Video ok mais TC out=0 ? on retente de récup le tc out
			this.videoLength=this.video.GetCurrentSelectionEnd(); 
		if (_n) _n.value=(this.videoLength!=0?this.videoLength:TC);
		_n=getChildById(myNewRow,'ext_titre$');
		if (_n) _n.value=this.messages['titreDefaut'];		
		this.hasChanged(myNewRow);
	 	this.selectExtrait(myNewRow);
	 	return myNewRow;
	}
	
	rightPanel.prototype.removeExtrait = function(row) {	
		
		new Effect.Opacity(row,{from:1,to:0.4,duration:0.3});
		
		_n=getChildById(row,'trash$');
		if (_n) {
			_n.onclick=function(){myPanel.reactivateRow(row);};
			_n.src='design/images/ow_images/boutons/button_drop_restore.gif';
		}
		_n=getChildById(row,'action$');
		if (_n) _n.value='suppr';
		this.hasChanged(row);
		if (row==this.selectedRow) {this.selectExtrait('');}
		
	}
	
	rightPanel.prototype.reactivateRow=function(row) {
		
		new Effect.Opacity(row,{from:0.4,to:1,duration:0.3});
		
		_n=getChildById(row,'trash$');
		if (_n) {
			_n.onclick=function(){myPanel.removeExtrait(row);};
			_n.src='design/images/ow_images/boutons/button_drop.gif';
		}
		_n=getChildById(row,'action$');
		if (_n) _n.value='edit';
	}
	
	rightPanel.prototype.setTC=function (inout) {
		if (typeof(this.selectedRow)=='undefined' || this.selectedRow=='') return;
		if (this.video) 
		{
			TC=this.video.GetCurrentLongTimeCode();
			_n=getChildById(this.selectedRow,'tc'+inout+'$');
			if (_n) _n.value=TC;
		}
		this.hasChanged(this.selectedRow);

		_n=getChildById(this.selectedRow,'tcin$');
		if (_n) _tcin=_n.value;
		_n=getChildById(this.selectedRow,'tcout$');
		if (_n) _tcout=_n.value;
		
		if (this.video) this.video.SetSelection(_tcin,_tcout);
	}
	
	rightPanel.prototype.debug=function () {
		
	}
	
	
		
