<!-- 
// **********************************************************************************************
//
// file			: ui.js
// Author		: Giovambattista Fazioli (e-lementi.com)
// Web			: http://e-lementi.com
// E-mail		: info (at) e-lementi (dot) (com)
// Created		: 09/08/2006 13.34
// Modified		: 05/12/2006 15.42
//
// Copyright (C) 2002-2006 e-lementi
//
// DESCRIPTION
//	user interface
//
// **********************************************************************************************


// Oggetto gestore user interface
var $_scoUI = {
	__release: "1.9",
	
	// global property one time for edit online
	editCallback:"",
	editParams:"",
	editUndo:"",
	editContent:"",
	
	__scoOver: true,
	__lastFind: "",
	__keyPressDelay:false,

	// degradable search
	doDegradable: function(i,f,v) {
		i.f = f; i.v = v;
		i.onkeyup = function(e) {
			switch(e.which) {
				case 9:
				case 16:
					break;
				case 27:
					this.value="";
					if ($_scoUI.__keyPressDelay) window.clearTimeout($_scoUI.__keyPressDelay);
					$_scoUI.__keyPressDelay = window.setTimeout( this.f, 800, this.v );
					break;				
				default:
					if ($_scoUI.__keyPressDelay) window.clearTimeout($_scoUI.__keyPressDelay);
					var s  = this.value;
					if( s != $_scoUI.__lastFind) {
						$_scoUI.__lastFind = s;
						$_scoUI.__keyPressDelay = window.setTimeout( this.f, 800, this.v );
					}
					break;
			}
		};
	},
	// TO DO
	clearDegradable: function(i,f,v) {
		if (this.__keyPressDelay) window.clearTimeout(this.__keyPressDelay);
		// uso due nextSibling in quanto dopo l'immagine c'è uno spazio testo (quindi un nodo #text)
		var s = i.previousSibling.previousSibling.value = "";
		this.__lastFind = s;
		this.__keyPressDelay = window.setTimeout( f, 800, v );
	}, 
	
	// TO DO
	isPopUp: function () {
		return( !($G("scoBExtra").style.display == "" || $G("scoBExtra").style.display == "none") );
	},
	//  Mostra / Nasconde, il pannello popup sotto la navigazione principale. Si preoccupa anche di
	//	eseguire un reset dello scroll del browser
	// INPUTS
	//	s	- true, false
	//	c	- content
	//	cb	- callback when animate effect is over 
	popUp: function(s) {
		$G("scoBExtra").style.display = "block";
		if(arguments.length>1 && s) { 
			$G("scoBExtra").innerHTML = arguments[1];
			$G("scoBExtra").childNodes[0].style.marginTop="-1024px";
			if ( window.pageYOffset > 80  )	window.scrollTo(0,0); 
		}
		var os = $G("scoBExtra").childNodes[0].style;
		var ss = $G("scoBExtra").childNodes[0].offsetHeight;
		var t = new Tween(os,'marginTop',Tween.regularEaseOut,s?-ss:0,s?0:-ss,1,'px');
		t.callBack = undefined;
		if(!s && arguments.length > 2 ) t.callBack=arguments[2];
		if(!s) t.onMotionFinished = function() { $G("scoBExtra").style.display="none";if(this.callBack != undefined) this.callBack(); }
		if(s && arguments.length > 2 ) t.onMotionFinished=arguments[2];
		t.start();
	},
	
	// rende un elemento editabile on-line
	// e		- elemento da rendere editabile
	// arg[1]	- Nome della funzione js da chiamare dopo l'edit con successo
	// arg[2]	- Array di parametri utili
	// arg[3]	- Massimo numero di caratteri nell'input
	edit: function(e) {
		this.editUndo = e.parentNode.innerHTML;
		this.editContent = e.innerHTML;
		if(e.nextSibling != undefined) {
			if(e.nextSibling.id == "cscoEditableBuffer") {
				this.editContent = e.nextSibling.innerHTML;
			}
		}
		//
		this.editCallback = arguments[1];
		this.editParams = arguments[2];
		//
		var mx = (arguments[3] != "" && arguments[3] > 0)?'maxlength="'+arguments[3]+'"':"";
		e.parentNode.innerHTML = '<input "'+mx+'" style="width:99%;" size="32" id="jscoEdit" type="text" value="'+this.editContent.getHTML()+'" />';
		$G("jscoEdit").onmouseover = function() { _onListViewEvent('stopover'); }
		$G("jscoEdit").onmouseout = function() { _onListViewEvent('startover'); }
		$G("jscoEdit").onblur = function() {$_scoUI.commitEdit(this);}
		$G("jscoEdit").onkeyup = function(e) { 
			switch(e.which) {
				case 13:
					$G("jscoEdit").onblur = function() {}
					$G("jscoEdit").onkeyup = function() {}
					$_scoUI.commitEdit(this);
					_onListViewEvent('startover');
					break;
				case 27:
					this.parentNode.innerHTML = $_scoUI.editUndo;
					_onListViewEvent('startover');
					break;
			}
		}
		$G("jscoEdit").focus();	
	},
	
	// chiude una sessione di edit
	commitEdit: function(e) {
		e.parentNode.innerHTML = this.editUndo; // reset
		if( e.value != this.editContent ) {
			var s = "var r = "+this.editCallback+"(\""+e.value.addslashed()+"\");";
			eval(s);
			if(r) return; 
		}
	},
	
	// to do
	showModal: function(s) {
		var m = $G("jscoModal");
		if(s) { m.innerHTML = arguments[1]; m.style.display="block"; m.childNodes[0].style.marginTop="32px"; }
		else  { m.style.display="none"; m.innerHTML=""; }
	},
	
	// Restituisce un puntatore ad una Window
	getWindow: function(n) { return ( new CSCO_UI_WINDOW( $G("jscoBWindow_"+n) ) ); },
	
	// restituisce un puntatore ad un ListIcon
	getListIcon: function(n) { return ( new CSCO_UI_LISTICON( $G("scoBIconListView_"+n) ) ); },
	
	// restituisce un puntatore ad un ListView
	getListView: function(n) { if( $G("scoBListView_"+n) != null ) return ( new CSCO_UI_LISTVIEW( $G("scoBListView_"+n) ) ); },
	
	// restituisce un puntatore ad una ToolBar
	getToolBar: function(n) {if( $G("scoBToolBar_"+n) != null ) return ( new CSCO_UI_TOOLBAR( $G("scoBToolBar_"+n) ) ); else return(null); },
	
	// restituisce un puntatore ad una SplitBar
	getSplitBar: function(n) { return ( new CSCO_UI_SPLIT( $G("scoBSplit_"+n) ) ); },

	// restituisce un puntatore ad una SplitBar
	getTabStrip: function(n) { return ( new CSCO_UI_TABSTRIP( $G("jscoTabStrip_"+n) ) ); }

};

// to do
function CSCO_UI_PANEL ( n ) {
	this.name 			= n;
	this.content		= arguments[1]||"";
	this.width			= "";		
	this.className		= arguments[2]||"std";
	this.popUp			= false;
	this.style			= "";
	//
	// Prepara le parti HTML, come l'header, il corpo e il footer
	this._prepare = function() {
		var foo = '<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
				'<tr>'+
				'<td class="'+this.className+'left"><div class="'+this.className+'left"></div></td>'+
				'<td class="'+this.className+'content"><div class="'+this.className+'content"></div></td>'+
				'<td class="'+this.className+'right"><div class="'+this.className+'right"></div></td>'+
				'</tr>'+
				'</table>';
		this.strHeader	= 	'<div id="scoBPanel_'+this.name+'" class="scoBPanel" style="'+( (this.width != "")?'width:'+this.width+'px;':"" )+this.style+'">'+
								( (!this.popUp)?
								('<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
								'<tr>'+
								'<td><div class="'+this.className+'topleft"></div></td>'+
								'<td class="'+this.className+'top"><div class="'+this.className+'top"></div></td>'+
								'<td><div class="'+this.className+'topright"></div></td>'+
								'</tr>'+
								'</table>'):foo);
		this.strFooter	= '<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
								'<tr>'+
								'<td><div class="'+this.className+'bottomleft"></div></td>'+
								'<td class="'+this.className+'bottom"></td>'+
								'<td><div class="'+this.className+'bottomright"></div></td>'+
								'</tr>'+
								'</table>'+
								'</div>';
	}
	//
	this.getHTML = function () {
		var c = arguments[0]||"";
		this._prepare();
		this.content = (c != "")?c:this.content;

		var out = '<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
			'<tr>'+
			'<td class="'+this.className+'left"></td>'+
			'<td class="'+this.className+'content">'+
			'<div class="'+this.className+'content">'+
			this.content+
			'</div>'+
			'</td>'+
			'<td class="'+this.className+'right"></td>'+
			'</tr>'+
			'</table>';
			
		return( this.strHeader+out+this.strFooter );					
	}
}

// Questa classe è un parallelo di quella in PHP. Essa permette di manipolare un oggetto CSCO_UI_TABSTRIP
function CSCO_UI_TABSTRIP ( e ) {
	this.name = e.id.substr( ("jscoTabStrip_").length );
	this.e = e;
	// to do
	this.selectByIndex = function(i) {}
	//
	this.selectByName = function(n) { _onTabStrip( $G("jscoTS_"+n) ); }
}


// TO DO
function _onTabStrip(t) {
	if( arguments.length > 1 ) {
		var evt = "onBeforeClick";
		var n   = t.id.substr(7); // drop jscoTS_
		var e = "var res = "+arguments[1]+"('"+n+"','"+evt+"');";
		eval(e);
		if(!res) return(false);
	}
	// t is a <A> tag...
	var tr = t.parentNode.parentNode;
	// imposto tutti quelli di mezzo
	for(var i = 1; i < tr.childNodes.length-2; i++ ) {
		var td = tr.childNodes[i];
		var el = td.childNodes[0];
		//
		switch( el.tagName ) {
			case "DIV":
				el.className = "tabMiddleOffOff";
				break;
			case "A":
				td.className = "tabStripeOff";
				break;	
		}
	}
	var td = t.parentNode;
	td.previousSibling.childNodes[0].className = "tabMiddleOffOn";
	td.nextSibling.childNodes[0].className = "tabMiddleOnOff";
	// imposto il primo
	tr.childNodes[0].childNodes[0].className = ( tr.childNodes[1].childNodes[0] === t )?"tabLeftFirstOn":"tabLeftFirstOff";
	// imposto l'ultimo
	var last = Number( (tr.childNodes.length-2) );
	tr.childNodes[last].childNodes[0].className = ( tr.childNodes[last-1].childNodes[0] === t )?"tabRightLastOn":"tabRightLastOff";
	//
	t.parentNode.className = "tabStripeOn";
	// sezione contenuti
	// questo è il div che dev'essere reso visible
	var mc	= $G( "jscoTSC_"+t.id ); // master container dei contenuti
	var d = mc.parentNode;
	for (var i = 0; i < d.childNodes.length; i++) {
		d.childNodes[i].className = "tabStripContentHidden";
	}
	mc.className = "tabStripContent";
	var to = new OpacityTween(mc,Tween.regularEaseOut, 0, 100, 1);
	to.t = t; to.args = arguments;
	to.onMotionFinished = function() {
		if( this.args.length > 1 ) {
			var evt = "onAfterClick";
			var n   = this.t.id.substr(7); // drop jscoTS_
			var e = "var res = "+this.args[1]+"('"+n+"','"+evt+"');";
			eval(e);
		}
	}
	to.start();	
}

// Questa classe è un parallelo di quella in PHP. Essa permette di manipolare un oggetto CSCO_UI_WINDOW
function CSCO_UI_WINDOW ( e ) {
	this.name = e.id.substr( ("jscoBWindow_").length );
	this.e = e;
	//
	this.setTitle = function( nt) {
		var start = this.e;
		while( start.nodeName.toLowerCase() != "tr" ) start = start.childNodes[0];
		start.childNodes[1].innerHTML = '<h1 title="'+nt+'">'+nt+'</h1>';
	}
	//
	this.toolBar = function(s) { this.e.childNodes[1].style.display = s?"":"none"; }
}
// Gestore eventi Window e callback
function _onWindowEvent(eh,evt) {
	switch (evt) {
		// arguments[2] - Window name
		// arguments[3] - this pointer span icon
		case "hide":
			var o = $G( "scoWindowTableBody_"+arguments[2] ), os = o.style;
			if(o._busy) return;
			o._busy=true;
			
			if(o.offsetHeight == 0) {
				var end = scoGetCookie("window_"+arguments[2]+"_h"), start = 0;
				os.display="";
			} else {
				var end = 0, start = o.offsetHeight;
				scoSetCookie("window_"+arguments[2]+"_h", start);
			}
			arguments[3].className = (arguments[3].className=="plus")?"minus":"plus";
			scoSetCookie("window_"+arguments[2]+"_cookie", arguments[3].className);
			//
			var t = new Tween(os,'height',Tween.bounceEaseOut,start,end,1,'px');
			t.onMotionFinished = function() { o._busy=false;if(end!=0) os.height=""; }
			t.start();
			
			break;
		case "onclose":
			if(eh!="") eval(eh+"(\'"+evt+"\',\'"+arguments[2]+"\');");
			break;	
		case "help":
			var h = new _scoHttpRequest();
			h.send(evt);
			break;	
	}
}
// Questa classe è un parallelo di quella in PHP. Essa permette di manipolare un oggetto CSCO_UI_LISTICON
function CSCO_UI_LISTICON ( e ) {
	this.name = e.id.substr( ("scoBIconListView_").length );
	this.e = e;
	this.ids = new Array();
	
	//	Restituisce un array con gli ID degli elementi selezionati
	this.getSelectedIDs = function() {
		var l = this.e;
		for(var i=0; i < l.childNodes.length; i++) {
			if( l.childNodes[i].className == "scoBIcon" ) {
				if( l.childNodes[i].childNodes[1].className == "selected" ) {
					this.ids.push( l.childNodes[i].id.substr( ("scoBIcon_").length ) );
				}
			}
		}
		return( this.ids );
	}
	//	Restituisce il numero di figli dell'elemento principale
	this.count	= function() { return( this.e.childNodes.length ); }
	// seleziona tutto
	this.selectAll = function() {
		for(var i=0; i < this.e.childNodes.length; i++) {
			if( this.e.childNodes[i].className == "scoBIcon" ) {
				this.e.childNodes[i].childNodes[1].className = "selected";
			}			
		}
	}
	
}
// Gestore eventi ListIcon e callback
function _onListIconEvent(e) {
	switch (e) {
		case "onclick":
			$G(arguments[1]).childNodes[1].className = ($G(arguments[1]).childNodes[1].className=="normal")?"selected":"normal";
			break;
		case "dblclick":
			document.location = arguments[1];
			break;
	}
}

// Questa classe è un parallelo di quella in PHP. Essa permette di manipolare un oggetto CSCO_UI_LISTVIEW
function CSCO_UI_LISTVIEW( e ) {
	this.name	= e.id.substr( ("scoBListView_").length );
	this.e 		= e;
	this.ids	= new Array();
	this.trs	= new Array();
	this.items	= new Array();
	//
	this.table	= this.e.childNodes[0];
	//
	//	Restituisce un array con gli ID degli elementi selezionati
	this.getSelectedIDs = function() {
		// find tr selected
		var childs = this.table.childNodes[0];
		// skip 1 for column
		for(var i=1; i < childs.childNodes.length; i++) {
			if( childs.childNodes[i].className == "lvSelectItem" ) {
				this.ids.push( childs.childNodes[i].id.substr( ("scoRowListView_").length ) );
			}
		}
		return( this.ids );
	}
	//
	this.getSelectedItems = function( column ) {
		var trs 	= this.getSelectedRows();
		for(var i=0; i < trs.length; i++ ) {
			//alert( trs[i].childNodes[ column ].childNodes[0].innerHTML );
			this.items.push( trs[i].childNodes[ column ].childNodes[0].innerHTML );
		}
		return( this.items );	
	}
	//
	this.getSelectedRows = function() {
		// find tr selected
		var childs = this.table.childNodes[0];
		// skip 1 for column
		for(var i=1; i < childs.childNodes.length; i++) {
			if( childs.childNodes[i].className == "lvSelectItem" ) {
				this.trs.push( childs.childNodes[i] );
			}
		}
		return( this.trs );
	}
	//
	this.getItem = function( row, column ) {
		var rrow = new Number(row+1);
		return( this.table.childNodes[ (rrow) ].childNodes[column].innerHTML );
	}
	//
	this.getItemByRow = function( tr, column ) {
		return( tr.childNodes[column].innerHTML );
	}
	//	Seleziona tutti gli elementi di un ListView. Per tutti gli elementi si intende quelli
	//	visualizzati a video e non quelli paginati.
	this.selectAll = function() {
		// find tr selected
		var childs = this.table.childNodes[0];
		// skip 1 for column
		for(var i=1; i < childs.childNodes.length; i++) {
			childs.childNodes[i].className = "lvSelectItem";
			childs.childNodes[i]._scoSelected = true;
		}
		this.refresh();
	}
	//	Aggiorna lo stato di un ListView e la sua status bar.
	this.refresh = function() {
		var childs = this.table.childNodes[0];
		var tot = 0;
		for(var i=1; i < childs.childNodes.length; i++) {
			if( childs.childNodes[i].className == "lvSelectItem" ) {
				tot++;
			}
		}
		//
		$G( "scoFooterListView_"+this.name ).innerHTML = ", Selezionati: "+tot;
	}
}
// Gestore eventi ListView e callback
function _onListViewEvent(evt) {
	switch (evt) {
		case "onmouseover":
			if(!$_scoUI.__scoOver) return;
			//if(arguments[1].className!="lvSelectItem") arguments[1]._scoClassName = arguments[1].className;
			arguments[1].className = (arguments[1].className!="lvSelectItem")?"lvOverItem":"lvSelectItem";
			break;
		case "onmouseout":
			if(!$_scoUI.__scoOver) return;
			arguments[1].className = (arguments[1].className!="lvSelectItem")?"scoRowListView":"lvSelectItem";
			break;	
		case "onclick":
			if(!$_scoUI.__scoOver) return;
			arguments[1].className = (arguments[1].className!="lvSelectItem")?"lvSelectItem":"scoRowListView";
			$_scoUI.getListView( arguments[2] ).refresh();
			break;
		case "stopover":
			$_scoUI.__scoOver = false;
			break;	
		case "startover":
			$_scoUI.__scoOver = true;
			break;	
	}
}

// Questa classe è un parallelo di quella in PHP. Essa permette di manipolare un oggetto CSCO_UI_TOOLBAR
function CSCO_UI_TOOLBAR( e ) {
	this.name		= e.id.substr( ("scoBToolBar_").length );
	this.e			= e;
	//
	this.popUp = function ( s ) {
		var popup = $G("scoBToolBarPopup_"+this.name);
		if(!s && popup.childNodes[0] == undefined ) return(false);
		//
		if( arguments.length > 1 && s ) {
			popup.style.display="block";
			popup.innerHTML = arguments[1];
			popup.childNodes[0].style.marginTop="-1024px";
		}
		var os = popup.childNodes[0].style;
		var ss = popup.childNodes[0].offsetHeight;
		var t = new Tween(os,'marginTop',Tween.regularEaseOut,s?-ss:0,s?0:-ss,1,'px');
		t.callBack = undefined;
		if(!s && arguments.length>2) t.callBack = arguments[2];
		if(!s && popup.style.display != "none") t.onMotionFinished = function() { popup.style.display="none";popup.innerHTML="";if(this.callBack != undefined) this.callBack(); };
		if(!s && popup.style.display == "none") if(t.callBack != undefined) t.callBack();
		t.start();
	}
	//
	this.getPopupContent = function () {
		var popup = $G("scoBToolBarPopup_"+this.name);
		return( popup.innerHTML );
	}
	//
	this.saveContent = function( buffers, name ) {
		var tmpArray = new Array(name, $G("scoBToolBarPopup_"+this.name).innerHTML );
		// verifico se ho già memorizzato un buffer con il nome "name"
		for(var i=0; i< buffers.length; i++) {
			if( buffers[i][0] == name ) {
				buffers[i] = tmpArray;
				return;
			}	
		}
		buffers.push( tmpArray );
	}
	//
	this.getContent = function( buffers, name ) {
		for(var i=0; i< buffers.length; i++) {
			if( buffers[i][0] == name ) {
				return( buffers[i][1] );
			}
		}
		return('');
	}
	//
}

// Questa classe è un parallelo di quella in PHP. Essa permette di manipolare un oggetto CSCO_UI_SPLIT
function CSCO_UI_SPLIT( e ) {
	this.name	= e.id.substr( ("scoBSplit_").length );
	this.e	= e;
}
// Gestore eventi SplitBar e callback
function _onSplitBarEvent(evt) {
	switch (evt) {
		case "onclick":
			var o = arguments[2].parentNode.parentNode.childNodes[0].childNodes[0], os = o.style;
			
			if(o._busy) return;
			o._busy=true;
			if(o.offsetWidth == 0) {
				arguments[2].src="css/split/splitopenv.png";
				var end = scoGetCookie("split_"+arguments[1]+"_w"), start = 0;
			} else {
				arguments[2].src="css/split/splitclosev.png";
				var end = 0, start = o.offsetWidth;
				scoSetCookie("split_"+arguments[1]+"_w", start);
			}
			scoSetCookie("window_"+arguments[1]+"_cookie", arguments[2].className);
			//
			var t = new Tween(os,'width',Tween.regularEaseOut,start,end,1,'px');
			t.onMotionFinished = function() { o._busy=false; }
			t.start();			
			break;
	}
}

/*
** Drag & Drop Class
*/
var oDD = {
	__release: "1.1",
	
	_moz: (window.Event?true:false),
	obj: "",
	dgo: "",
	oto: "",
	mac: "",
	js:  "",
	clo: "",
	drp: new Array(),

	absPos: function(e) {
		var _x = e.offsetLeft;
		var _y = e.offsetTop;
		var p = e;
		while( (p = p.offsetParent) != undefined ) { _x+=p.offsetLeft; _y+=p.offsetTop;}
		return({x:_x,y:_y});
	},
	
	// to do 
	drop: function(d) {
		oDD.oto = d;
		d.style.border="2px dotted #333";
		d.scrollIntoView();
	},
	
	ckDrop: function(x,y) {
		var drp = oDD.drp;
		for(var i=0;i<drp.length;i++) {
			var a = oDD.absPos(drp[i]);
			if(x > a.x && x < (a.x+drp[i].offsetWidth) && y > a.y-oDD.mac.scrollTop && y < (a.y-oDD.mac.scrollTop+drp[i].offsetHeight)  ) {
				if(drp[i].id != oDD.obj.id) {oDD.drop( drp[i] ); break;}
			}
			if(oDD.oto!="")	{oDD.oto.style.border="2px solid #fff"; oDD.oto="";}
		}
	},
	
	// to do
	drag: function(e,t,mc,d,js) {
		oDD.js = js;
		var mac = oDD.mac = $G(mc);
		//		
		var o = oDD.obj = $G(t);
		//var a = o.absPos();
		var a = oDD.absPos(o);
		var x = a.x-oDD.mac.scrollLeft;
		var y = a.y-oDD.mac.scrollTop;
		//
		o.style.position="absolute";
		o.style["opacity"] = .5;
		o.style.filter = "alpha(opacity=50)";
		//
		oDD.dgo = d;
		//
		o.style.left = x+"px"; 
		o.style.top = y+"px";
		//
		d.down	= true;
		d.sx	= (oDD._moz)?e.pageX-oDD.mac.scrollLeft:window.event.clientX + document.body.scrollLeft;
		d.sy	= (oDD._moz)?e.pageY-oDD.mac.scrollTop:window.event.clientY + document.body.scrollTop;
		//
		oDD.clo = o.previousSibling;
		oDD.clo.style.display="block";
		//
		for(var i=0;i<mac.childNodes.length;i++) {
			if(mac.childNodes[i].className == "scoBIcon" && mac.childNodes[i].id != oDD.obj.id) oDD.drp.push(mac.childNodes[i]);
		}		
		//
		d.onmouseup = function(e) {
			var o = oDD.obj;
			this.down=false;
			if(oDD.oto!="")	{ 
				delete document.onmouseup;
				oDD.oto.style.border="2px solid #fff";
				o.style.position=""; 
				var e = oDD.js+"('"+oDD.obj.id+"','"+oDD.oto.id+"')";
				//alert("ok "+oDD.oto.id+" - "+oDD.obj.id);
				eval(e);
			} else {
				o.style.position=""; 
				o.style["opacity"] = "";
				o.style.filter = "alpha(opacity=100)";
			}
			oDD.clo.style.display="none";
			oDD.oto = "";
		};
		//
		document.onmouseup = function(e) {oDD.dgo.onmouseup(e)};
		//
		document.onmousemove = function(e) {
			var o = oDD.obj;
			var d = oDD.dgo;
			if( !oDD._moz ) {
				if(d.down) {
					var x = o.style.left;
					var y = o.style.top;
					x = new Number(x.substr(0,x.indexOf("px")));
					y = new Number(y.substr(0,y.indexOf("px")));
					o.style.left = x + (window.event.clientX + document.body.scrollLeft) - d.sx; //+"px";
					o.style.top = y + (window.event.clientY + document.body.scrollTop) - d.sy; //+"px";
				}
			} else {
				if(d.down) {
					var x = o.style.left;
					var y = o.style.top;
					x = new Number(x.substr(0,x.indexOf("px")));
					y = new Number(y.substr(0,y.indexOf("px")));
					o.style.left = x +  e.pageX - d.sx - oDD.mac.scrollLeft + "px";
					o.style.top  = y +  e.pageY - d.sy - oDD.mac.scrollTop + "px";
					oDD.ckDrop(e.pageX,e.pageY);
				}
			}
			d.sx = (oDD._moz)?e.pageX-oDD.mac.scrollLeft:window.event.clientX + document.body.scrollLeft;
			d.sy = (oDD._moz)?e.pageY-oDD.mac.scrollTop:window.event.clientY + document.body.scrollTop;
		}
	}
};

// debug
function watchDog(s) { var d = $G("jscoDebug");d.style.display="block";d.innerHTML += '<textarea rows="30" cols="30">'+s+'</textarea>'; }	

// patch quicktime
// TO DO
function iQT(f,w,h) {
	document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="'+w+'" height="'+h+'">');
	document.write('<param name="src" value="'+f+'">');
	document.write('<param name="controller" value="true">');
	document.write('<param name="target" value="myself">');
	document.write('<param name="type" value="video/quicktime">');
	document.write('<embed src="'+f+'" pluginspage="http://www.apple.com/quicktime/download/" controller="true" target="myself" type="video/quicktime" width="'+w+'" height="'+h+'">');
	document.write('</object>');
}

//-->