function codeout(what) {
	document.write(what);
}
function myVideo(tipo, filename, videofolder, root, width, height, bgcolor, clicktext, transparency) {
if(filename=='' || tipo=='') {
	return;
}
this._filename = filename;
this._type     = tipo;

this._width    = (width)? width : '400';
this._widthn   = this._width;
this._width    = "width:"+this._width+"px;"

this._height   = (height)? height : '323';
this._heightn  = this._height;
this._height   = "height:"+this._height+"px;"

this._root     = (root)?root:'/';
this._folder   = (videofolder)?videofolder:'asset/documenti/';
this._bgcolor  = (bgcolor)?bgcolor:'#ffffff';
this._clicktxt = (clicktext)?clicktext:'Click per iniziare';
this._transp   = (transparency)?transparency:'transparent';

var codegen = new VideoCode(this);

return codegen.codice;
}

function VideoCode(params) {
var cod = '';

	if(params._type == 'wmv') {
		cod='<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" style="#width##height#">'
		cod+='<param name="URL" value="#folder##code#" />'
		cod+='<param name="autoStart" value="0">'
		cod+='<param name="width" value="#widthn#">'
		cod+='<param name="height" value="#heightn#">'
		cod+='<param name="bgcolor" value="#bgcolor#">'
		cod+='<param name="uiMode" value="full">'
		cod+='<param name="enableContextMenu" value="true">'
		cod+='<embed src="#folder##code#" autoStart="0" uiMode="full" enableContextMenu="true" bgcolor="#bgcolor#" style="#width##height#" width="#widthn#" height="#heightn#" type="application/x-mplayer2"/></embed>'
		cod+='</object>'
		/*cod+='<param name="ShowControls" value="1">'
		cod+='<param name="uimode" value="full">'
		cod+='<param name="stretchToFit" value="True">'*/
		//uimode="full" stretchToFit="True" type="application/x-mplayer2" 
		//showdisplay="1" showtracker="1" videoborder3d="1" showstatusbar="1" ShowControls="1" 
	}
	else if(params._type =='flv') {	//nil
		cod='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" style="#width##height#" title="Fondazione Montagna Sicura" flashvars="autostart=false">'
		cod+='<param name="movie" value="#root#flash/jw_allvideos_player.swf?autostart=false&file=#folder##code#&clicktext=#clicktext#" />'
		cod+='<param name="quality" value="high" />'
		cod+='<param name="wmode" value="#transparency#" />'
		cod+='<param name="bgcolor" value="#bgcolor#">'
		cod+='<param name="flashvars" value="autostart=false">'
		cod+='<embed src="#root#flash/jw_allvideos_player.swf?autostart=false&file=#folder##code#&clicktext=#clicktext#" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="#transparency#" bgcolor="#bgcolor#" style="#width##height#" flashvars="autostart=false"></embed>'
		cod+='</object>'
	}
	else if(params._type == 'mov') {	//mov
		cod='<object codebase="http://www.apple.com/qtactivex/qtplugin.cab" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" style="#width##height#">'
		cod+='<param name="src" value="#folder##code#" />'
		cod+='<param name="controller" value="True" />'
		cod+='<param name="cache" value="False" />'
		cod+='<param name="autoplay" value="False" />'
		cod+='<param name="kioskmode" value="False" />'
		cod+='<param name="scale" value="tofit" />'
		cod+='<embed src="#folder##code#" pluginspage="http://www.apple.com/quicktime/download/" scale="tofit" kioskmode="False" qtsrc="#folder##code#" cache="False" style="#width##height#" controller="True" type="video/quicktime" autoplay="False" />'
		cod+='</object>'
	}
	else if(params._type == 'mp4') {	//mp4
		cod='<object codebase="http://www.apple.com/qtactivex/qtplugin.cab" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" style="#width##height#">'
		cod+='<param name="src" value="#folder##code#" />'
		cod+='<param name="controller" value="True" />'
		cod+='<param name="cache" value="False" />'
		cod+='<param name="autoplay" value="False" />'
		cod+='<param name="kioskmode" value="False" />'
		cod+='<param name="scale" value="tofit" />'
		cod+='<embed src="#folder##code#" pluginspage="http://www.apple.com/quicktime/download/" scale="tofit" kioskmode="False" qtsrc="#folder##code#" cache="False" style="#width##height#" controller="True" type="video/quicktime" autoplay="False" /></object>'
	}
	else if(params._type == 'ytube') {	//youtube
		cod='<object style="#width##height#">'
		cod+='<param name="movie" value="http://www.youtube.com/v/#code#" />'
		cod+='<param name="wmode" value="transparent" />'
		cod+='<embed src="http://www.youtube.com/v/#code#"  wmode="transparent" style="#width##height#">'	//type="application/x-shockwave-flash" 
		cod+='</embed>'
		cod+='</object>'
	}
	
	cod = cod.replace(/#width#/gi,params._width);
	cod = cod.replace(/#height#/gi,params._height);
	cod = cod.replace(/#widthn#/gi,params._widthn);
	cod = cod.replace(/#heightn#/gi,params._heightn);
	cod = cod.replace(/#root#/gi,params._root);
	cod = cod.replace(/#folder#/gi,params._folder);
	cod = cod.replace(/#bgcolor#/gi,params._bgcolor);
	cod = cod.replace(/#clicktext#/gi,params._clicktxt);
	cod = cod.replace(/#transparency#/gi,params._transp);
	cod = cod.replace(/#code#/gi,params._filename);

this.codice = cod;
}


/*
function myVideos() {
	this._dati = new Array();
	this._count = 0;
}
private function myVideos.prototype.add = function(code) { 
this._dati[this._dati.length] = code;
this._count++;
};
private function myVideos.prototype.find = function(tipo) {
	return this._dati[tipo]
}
*/

/*
width='400';
height='323';
rootsito = '/fondms/';
folder = '/fondms/asset/documenti';
bgcolor = '#FFFFFF';
clicktext = 'Click per vedere il video';
ytubecode = '';
transparency='transparent';

var exjs = '';
//flv
exjs='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" style="$width$$height$" title="AllVideos Player" flashvars="autostart=false">'
exjs+='<param name="movie" value="$rootsito$jw_allvideos_player.swf?autostart=false&file=$folder$***code***.flv&clicktext=$clicktext$" />'
exjs+='<param name="quality" value="high" />'
exjs+='<param name="wmode" value="$transparency$" />'
exjs+='<param name="bgcolor" value="$bgcolor$">'
exjs+='<param name="flashvars" value="autostart=false">'
exjs+='<embed src="$rootsito$jw_allvideos_player.swf?autostart=false&file=$folder$***code***.flv&clicktext=$clicktext$" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="$transparency$" bgcolor="$bgcolor$" style="$width$$height$" flashvars="autostart=true"></embed>'
exjs+='</object>'

//wmv
<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" style="$width$$height$">
<param name="URL" value="$folder$***code***.wmv" />
<param name="ShowControls" value="1">
<param name="autoStart" value="0">
<embed src="$folder$***code***.wmv" style="$width$$height$" autoStart="0" type="application/x-mplayer2"/></embed>
</object>

//mov
<object codebase="http://www.apple.com/qtactivex/qtplugin.cab" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" style="$width$$height$">
<param name="src" value="$folder$***code***.mov" />
<param name="controller" value="True" />
<param name="cache" value="False" />
<param name="autoplay" value="False" />
<param name="kioskmode" value="False" />
<param name="scale" value="tofit" />
<embed src="$folder$***code***.mov" pluginspage="http://www.apple.com/quicktime/download/" scale="tofit" kioskmode="False" qtsrc="$folder$***code***.mov" cache="False" style="$width$$height$" controller="True" type="video/quicktime" autoplay="False" />
</object>

//mp4
<object codebase="http://www.apple.com/qtactivex/qtplugin.cab" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" style="".$width." ".$height."">
<param name="src" value="$folder$***code***.mp4" />
<param name="controller" value="True" />
<param name="cache" value="False" />
<param name="autoplay" value="False" />
<param name="kioskmode" value="False" />
<param name="scale" value="tofit" />
<embed src="$folder$***code***.mp4" pluginspage="http://www.apple.com/quicktime/download/" scale="tofit" kioskmode="False" qtsrc="$folder$***code***.mov" cache="False" style="$width$$height$" controller="True" type="video/quicktime" autoplay="False" /></object>

//youtube
<object style="$width$$height$">
<param name="movie" value="http://www.youtube.com/v/***code***" />
<param name="wmode" value="transparent" />
<embed src="http://www.youtube.com/v/***code***"  wmode="transparent" type="application/x-shockwave-flash" style="$width$$height$">
</embed>
</object>
*/
