function JSONscriptRequest(fullUrl) {
    this.fullUrl = fullUrl; 
    this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
    this.headLoc = document.getElementsByTagName("head").item(0);
    this.scriptId = 'JscriptId' + JSONscriptRequest.scriptCounter++;
}

JSONscriptRequest.scriptCounter = 1;

JSONscriptRequest.prototype.buildScriptTag = function () {

    this.scriptObj = document.createElement("script");
    
    this.scriptObj.setAttribute("type", "text/javascript");
    this.scriptObj.setAttribute("charset", "utf-8");
    this.scriptObj.setAttribute("src", this.fullUrl + this.noCacheIE);
    this.scriptObj.setAttribute("id", this.scriptId);
}
 
JSONscriptRequest.prototype.removeScriptTag = function () {
    this.headLoc.removeChild(this.scriptObj);  
}

JSONscriptRequest.prototype.addScriptTag = function () {
    this.headLoc.appendChild(this.scriptObj);
}

var outtypetb = new Array() ;
outtypetb[1]="MPEG-1/2 Audio Layer 3 (.mp3)";outtypetb[2]="Ogg Vorbis (.ogg)";outtypetb[3]="ASF Audio (.wma)";outtypetb[4]="WAVE form audio format (.wav)";outtypetb[6]="Free Lossless Audio Codec (.flac)";outtypetb[7]="Advanced Audio Coding (.aac)";outtypetb[8]="MPEG advanced audio coding (.mp4)";outtypetb[9]="Musepack (.mpc)";outtypetb[11]="3GP Music (.3gp)";outtypetb[15]="MPEG-4 advanced audio coding (.m4a)";outtypetb[20]="Adaptive Multi-Rate (.amr)";outtypetb[22]="Adaptive Multi-Rate WB (.awb)";outtypetb[30]="Sun Microsystems' audio format (.snd,.au)";outtypetb[31]="Audio Interchange File Format (.aiff)";outtypetb[32]="PureVoice File (.qcp)";outtypetb[33]="AMIGA 8bit sound file (.8svx)";outtypetb[34]="Audio Visual Research (.avr)";outtypetb[35]="AMIGA sound file (.maud)";outtypetb[36]="PSION sound file (.prc)";outtypetb[37]="IRCAM sound file (.sf)";outtypetb[38]="SoundTool (.sndt)";outtypetb[39]="Yamaha TXW sampler (.txw)";outtypetb[40]="Soundblaster file (.voc)";outtypetb[41]="PSION 8bit sound file (.wve)";outtypetb[198]="MMF/SMAF-2 (.mmf,.smaf)";outtypetb[199]="MMF/SMAF-3 poly+pcm (.mmf,.smaf)";outtypetb[200]="Midi (.mid,.midi)";outtypetb[201]="MIDI-0 (.mid,.midi)";outtypetb[202]="SP-MIDI (.mid,.midi)";outtypetb[204]="MMF/SMAF-1 (.mmf,.smaf)";outtypetb[206]="Qualcomm CMX 3.0 (.pmd)";outtypetb[210]="Motorola Ringtone (.mot)";outtypetb[211]="Sagem Ringtone (.sagem)";outtypetb[212]="Sagem Ringtone (.sagem21)";outtypetb[213]="Eericsson emelody (.emy)";outtypetb[214]="iMelody Ringtone Format (.imy)";outtypetb[215]="Extended Message format (.ems)";outtypetb[216]="Mobile Phone Ringtone (.rtx,.rtttl)";outtypetb[217]="Nokia Phone Ring Tone (.ott,.nokia)";outtypetb[218]="Nokia Phone Ring Tone (.noktxt)";outtypetb[5000]="Windows Media Video (.wmv)";outtypetb[5001]="3GP/3G2 Video (.3gp)";outtypetb[5002]="Audio Video Interleave (.avi)";outtypetb[5004]="Apple Quicktime (.mov)";outtypetb[5005]="MPEG 1 (.mpg)";outtypetb[5007]="MPEG-4 (.mp4)";outtypetb[5008]="Flash Video (.flv)";outtypetb[5014]="MPEG-2 (.mpg)";outtypetb[5015]="RealVideo (.rm)";outtypetb[5016]="Animated GIF (.gif)";outtypetb[5018]="DPG Video (.dpg)";outtypetb[5020]="AMV Video Format (.amv)";outtypetb[5021]="OGG video (.ogg)";outtypetb[5030]="IPOD/IPHONE MP4 Video (.mp4)";outtypetb[5031]="PLAYSTATION (PSP) MP4 Video (.mp4)";outtypetb[5100]="Flash SWF (.swf)";
var intypetb = new Array() ;
intypetb['3g2']=[1,5001];
intypetb['3gp']=[2,11,5001];
intypetb['8svx']=[1,33];
intypetb['aac']=[1,7];
intypetb['ac3']=[1,12];
intypetb['aiff']=[1,31];
intypetb['amr']=[1,20];
intypetb['amv']=[1,5020];
intypetb['ape']=[1,13];
intypetb['asf']=[2,3,5012];
intypetb['asx']=[1,5022];
intypetb['au']=[1,30];
intypetb['avi']=[1,5002];
intypetb['avr']=[1,34];
intypetb['awb']=[1,22];
intypetb['dpg']=[1,5018];
intypetb['dv']=[1,5011];
intypetb['emy']=[1,213];
intypetb['flac']=[1,6];
intypetb['fli']=[1,5010];
intypetb['flv']=[1,5008];
intypetb['gvi']=[1,5013];
intypetb['imy']=[1,214];
intypetb['it']=[1,52];
intypetb['kar']=[1,203];
intypetb['m4a']=[1,15];
intypetb['m4b']=[1,14];
intypetb['maud']=[1,35];
intypetb['mid']=[2,201,202];
intypetb['midi']=[2,201,202];
intypetb['mkv']=[1,5003];
intypetb['mmf']=[3,198,199,204];
intypetb['mod']=[1,50];
intypetb['mot']=[1,210];
intypetb['mov']=[1,5004];
intypetb['mp3']=[1,1];
intypetb['mp4']=[2,8,5007];
intypetb['mpc']=[1,9];
intypetb['mpg']=[2,5005,5014];
intypetb['nokia']=[1,217];
intypetb['noktxt']=[1,218];
intypetb['nsv']=[1,5017];
intypetb['ogg']=[2,2,5021];
intypetb['ogm']=[1,5006];
intypetb['ott']=[1,217];
intypetb['pmd']=[1,206];
intypetb['prc']=[1,36];
intypetb['qcp']=[1,32];
intypetb['ra']=[1,5];
intypetb['rm']=[2,5,5015];
intypetb['rpl']=[1,5019];
intypetb['rtttl']=[1,216];
intypetb['rtx']=[1,216];
intypetb['s3m']=[1,53];
intypetb['sagem']=[1,211];
intypetb['sagem21']=[1,212];
intypetb['sf']=[1,37];
intypetb['smaf']=[3,198,199,204];
intypetb['snd']=[1,30];
intypetb['sndt']=[1,38];
intypetb['swf']=[1,5100];
intypetb['txw']=[1,39];
intypetb['vob']=[1,5009];
intypetb['voc']=[1,40];
intypetb['vqf']=[1,10];
intypetb['wav']=[1,4];
intypetb['wma']=[1,3];
intypetb['wmv']=[1,5000];
intypetb['wve']=[1,41];
intypetb['xm']=[1,51];

var exttypetb = new Array() ;
exttypetb[100]=[1,2,3,4,6,7,8,9,11,15,20,22,30,31,32,33,34,35,36,37,38,39,40,41];
exttypetb[199]=[198,199];
exttypetb[200]=[200,201,202,204,206,210,211,212,213,214,215,216,216,217,217,218];
exttypetb[500]=[500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,516,517,518,519,520,521,522,523,524,525,526,528,529,530,531,533,534,535];
exttypetb[600]=[600,601,602];
exttypetb[4000]=[4000,4002,4003,4005,4006,4009,4010,4013,4028];
exttypetb[5000]=[5000,5001,5002,5004,5005,5007,5008,5014,5015,5016,5018,5020,5021,5030,5031,5100];

exttypetb['offoutwriter']=[1013,1014,1015,1016,1025,1029,1030,1400,1401,1402,1403,1410,1411,1412,1413,1414,1415] ;
exttypetb['offoutcalc']=[1013,1014,1016,2000,2001,2002,2006,2007,2200,2201,2202,2203,2204,2205,2206,2210,2211,2212,2213,2214,2215,2216,2217,2222,2223] ;
exttypetb['offoutdraw']=[500,501,502,504,505,506,520,526,601,631,632,634,1013,1014,1016] ;
exttypetb['offoutimpress']=[1013,1014,1016,3002,3003,3004,3005,3006,3007] ;
exttypetb['offoutmath']=[1016,2900,2902,2990,2991] ;
exttypetb['offinwriter']=[1000,1013,1014,1015,1018,1019,1025,1026,1027,1029,1031,1403] ;
exttypetb['offincalc']=[1013,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010] ;
exttypetb['offindraw']=[500,501,502,503,504,505,506,520,523,524,526,528,531,600,630,631,632,634] ;
exttypetb['offinimpress']=[633,3000,3001,3004,3005,3006,3007] ;
exttypetb['offinmath']=[2900,2901] ;



function changevp(s) {

	if (s.value==1) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5002);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
		formmc.option2.selectedIndex = indexByName(formmc.option2,128);
		formmc.v_acodec.selectedIndex = indexByName(formmc.v_acodec,1);
		formmc.option3.selectedIndex = indexByName(formmc.option3,'FMP4');
	}
	if (s.value==2) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5002);
		setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
		formmc.option2.selectedIndex = indexByName(formmc.option2,128);
		formmc.v_acodec.selectedIndex = indexByName(formmc.v_acodec,0);
		formmc.option3.selectedIndex = indexByName(formmc.option3,'MP42');
	}
	if (s.value==3) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5002);
		setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
		formmc.option2.selectedIndex = indexByName(formmc.option2,128);
		formmc.v_acodec.selectedIndex = indexByName(formmc.v_acodec,1);
		formmc.option3.selectedIndex = indexByName(formmc.option3,'DX50');
	}
	if (s.value==4) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5001);
		setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
		formmc.v_acodec.selectedIndex = indexByName(formmc.v_acodec,0);
		formmc.option2.selectedIndex = indexByName(formmc.option2,0);
		formmc.v_br.value = 112;
		formmc.taillex.selectedIndex = indexByName(formmc.taillex,1);
	}		
	if (s.value==5) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5001);
		setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
		formmc.v_acodec.selectedIndex = indexByName(formmc.v_acodec,1);
		formmc.option2.selectedIndex = indexByName(formmc.option2,1);
		formmc.v_br.value = 768;
		formmc.taillex.selectedIndex = indexByName(formmc.taillex,1);
	}			
	if (s.value==6) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5002);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
		formmc.option2.selectedIndex = indexByName(formmc.option2,64);
		formmc.v_acodec.selectedIndex = indexByName(formmc.v_acodec,1);
		formmc.option3.selectedIndex = indexByName(formmc.option3,'DIVX');
		formmc.v_fps.value=25;
		formmc.option1.value=256;
		formmc.taillex.value=288;
		formmc.tailley.value=208;
	}		
	if (s.value==7) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5002);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
		formmc.option2.selectedIndex = indexByName(formmc.option2,64);
		formmc.v_acodec.selectedIndex = indexByName(formmc.v_acodec,1);
		formmc.option3.selectedIndex = indexByName(formmc.option3,'DIVX');
		formmc.v_fps.value=25;
		formmc.option1.value=512;
		formmc.taillex.value=352;
		formmc.tailley.value=288;
	}		
	if (s.value==8 || s.value==20) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5030);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
	}			
	if (s.value==9) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5031);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
	}			
	if (s.value==10) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5020);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
	}			
	if (s.value==11) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5002);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
		formmc.option2.selectedIndex = indexByName(formmc.option2,128);
		formmc.v_acodec.selectedIndex = indexByName(formmc.v_acodec,2);
		formmc.option3.selectedIndex = indexByName(formmc.option3,'MJPG');
		formmc.option5.selectedIndex = indexByName(formmc.option5,1);
		formmc.taillex.value=640;
		formmc.tailley.value=480;	
		formmc.v_fps.value=25;			
	}
	if (s.value==12) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5007);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
		formmc.option2.selectedIndex = indexByName(formmc.option2,32);
		formmc.taillex.value=240;
		formmc.tailley.value=176;	
		formmc.v_fps.value=15;			
		formmc.option1.value=256;			
	}	
	if (s.value==13) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5002);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);
		formmc.option2.selectedIndex = indexByName(formmc.option2,64);
		formmc.v_acodec.selectedIndex = indexByName(formmc.v_acodec,1);
		formmc.option3.selectedIndex = indexByName(formmc.option3,'DIVX');
		formmc.taillex.value=320;
		formmc.tailley.value=240;	
		formmc.v_fps.value=15;					
		formmc.option1.value=224;			
	}	
	if (s.value==14) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5004);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);	
	}		
	if (s.value==15) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5007);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);	
		formmc.option2.selectedIndex = indexByName(formmc.option2,128);
		formmc.taillex.value=320;
		formmc.tailley.value=240;	
		formmc.v_fps.value=25;			
		formmc.option1.value=768;				
	}		
  if (s.value==16) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5014);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);	
		formmc.option3.selectedIndex = indexByName(formmc.option3,1);
	}	
  if (s.value==17) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5014);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);	
		formmc.option3.selectedIndex = indexByName(formmc.option3,2);
	}	
  if (s.value==18) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5014);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);	
		formmc.option3.selectedIndex = indexByName(formmc.option3,3);
	}	
  if (s.value==19) {
		formmc.format2.selectedIndex = indexByName(formmc.format2,5014);
	  setoptions(formmc.format2,formmc.option1,formmc.format1,formmc,document);	
		formmc.option3.selectedIndex = indexByName(formmc.option3,4);
	}	
}

function setvp(formu) {

	if (formu.format2.value>=5000 && formu.format2.value<6000) {
	  objvp = getObject("vp");
		objvp.innerHTML = '<select onchange="changevp(this)" name=preset class=texteOpt><option>No video preset</option><option value=1>LINUX DivX</option><option value=2>WINDOWS</option><option value=3>WINDOWS DivX</option><option value=14>MAC</option><option value=16>SVCD NTSC</option><option value=17>SVCD PAL</option><option value=18>DVD NTSC</option><option value=19>DVD PAL</option><option value=13>POCKET PC</option><option value=4>MOBILE phone - Basic</option><option value=5>MOBILE phone - Advanced</option><option value=6>NOKIA 770</option><option value=7>NOKIA N800</option><option value=8>iPOD</option><option value=20>iPHONE</option><option value=9>SONY PSP</option><option value=12>NINTENDO DS</option><option value=11>Wii</option><option value=10>MP4 player (S1MP3)</option><option value=15>ZUNE</option>';
		objvp.innerHTML += '</select>';
		
  } else { objvp.innerHTML = ''; }
}




function setintype(sel) { var t = new Array(); 
sel.options[0] = new Option('---- Movie ----','');
sel.options[1] = new Option('3GP/3G2 Video (.3g2,.3gp)','5001');
sel.options[2]= new Option('AMV Video Format (amv)','5020');
sel.options[3]= new Option('Apple Quicktime (mov)','5004');
sel.options[4]= new Option('ASF Video (asf)','5012');
sel.options[5]= new Option('Audio Video Interleave (avi)','5002');
sel.options[6]= new Option('Digital Video File (dv)','5011');
sel.options[7]= new Option('DPG Video (dpg)','5018');
sel.options[8]= new Option('DVD Video Object (vob)','5009');
sel.options[9]= new Option('Flash SWF (swf)','5100');
sel.options[10]= new Option('Flash Video (flv)','5008');
sel.options[11]= new Option('FLIC Animation (fli)','5010');
sel.options[12]= new Option('Google Video File (gvi)','5013');
sel.options[13]= new Option('Matroska (mkv)','5003');
sel.options[14]= new Option('MPEG 1 (mpg)','5005');
sel.options[15]= new Option('MPEG-2 (mpg)','5014');
sel.options[16]= new Option('MPEG-4 (mp4)','5007');
sel.options[17]= new Option('NSV (nsv)','5017');
sel.options[18]= new Option('OGG video (ogg)','5021');
sel.options[19]= new Option('Ogg Vorbis compressed video (ogm)','5006');
sel.options[20]= new Option('RealVideo (rm)','5015');
sel.options[21]= new Option('RPL video (rpl)','5019');
sel.options[22]= new Option('Video stream descriptor (asx)','5022');
sel.options[23]= new Option('Windows Media Video (wmv)','5000');
sel.options[24] = new Option('---- Sound ----','');
sel.options[25]= new Option('3GP Music (3gp)','11');
sel.options[26]= new Option('AC3 Audio File (ac3)','12');
sel.options[27]= new Option('Adaptive Multi-Rate (amr)','20');
sel.options[28]= new Option('Adaptive Multi-Rate WB (awb)','22');
sel.options[29]= new Option('Advanced Audio Coding (aac)','7');
sel.options[30]= new Option('AMIGA 8bit sound file (8svx)','33');
sel.options[31]= new Option('AMIGA sound file (maud)','35');
sel.options[32]= new Option('APE Monkey Audio (ape)','13');
sel.options[33] = new Option('ASF Audio (.asf,.wma)','3');
sel.options[34]= new Option('Audio Interchange File Format (aiff)','31');
sel.options[35]= new Option('Audio Visual Research (avr)','34');
sel.options[36]= new Option('FastTracker II module (xm)','51');
sel.options[37]= new Option('Free Lossless Audio Codec (flac)','6');
sel.options[38]= new Option('ImpulseTracker module (it)','52');
sel.options[39]= new Option('IRCAM sound file (sf)','37');
sel.options[40]= new Option('MPEG advanced audio coding (mp4)','8');
sel.options[41]= new Option('MPEG-1/2 Audio Layer 3 (mp3)','1');
sel.options[42]= new Option('MPEG-4 advanced audio coding (m4a)','15');
sel.options[43]= new Option('MPEG-4 advanced audio coding (m4b)','14');
sel.options[44]= new Option('Musepack (mpc)','9');
sel.options[45]= new Option('Ogg Vorbis (ogg)','2');
sel.options[46]= new Option('PSION 8bit sound file (wve)','41');
sel.options[47]= new Option('PSION sound file (prc)','36');
sel.options[48]= new Option('PureVoice File (qcp)','32');
sel.options[49] = new Option('RealAudio (.ra,.rm)','5');
sel.options[50]= new Option('ScreamTracker module (s3m)','53');
sel.options[51]= new Option('Soundblaster file (voc)','40');
sel.options[52]= new Option('SoundTool (sndt)','38');
sel.options[53]= new Option('Soundtracker module (mod)','50');
sel.options[54] = new Option('Sun Microsystems\' audio format (.au,.snd)','30');
sel.options[55]= new Option('TwinVQ (vqf)','10');
sel.options[56]= new Option('WAVE form audio format (wav)','4');
sel.options[57]= new Option('Yamaha TXW sampler (txw)','39');
sel.options[58] = new Option('---- Ringtone (PCM + Polyphonic) ----','');
sel.options[59] = new Option('MMF/SMAF-2 (.mmf,.smaf)','198');
sel.options[60] = new Option('MMF/SMAF-3 poly+pcm (.mmf,.smaf)','199');
sel.options[61] = new Option('---- Ringtone (Monophonic / Polyphonic) ----','');
sel.options[62]= new Option('Eericsson emelody (emy)','213');
sel.options[63]= new Option('iMelody Ringtone Format (imy)','214');
sel.options[64]= new Option('Midi karaoke (kar)','203');
sel.options[65] = new Option('MIDI-0 (.mid,.midi)','201');
sel.options[66] = new Option('MMF/SMAF-1 (.mmf,.smaf)','204');
sel.options[67]= new Option('Mobile Phone Ringtone (rtx)','216');
sel.options[68]= new Option('Motorola Ringtone (mot)','210');
sel.options[69]= new Option('Nokia Phone Ring Tone (nokia)','217');
sel.options[70]= new Option('Nokia Phone Ring Tone (noktxt)','218');
sel.options[71]= new Option('Nokia Phone Ring Tone (ott)','217');
sel.options[72]= new Option('Qualcomm CMX 3.0 (pmd)','206');
sel.options[73]= new Option('Ringtones text transfer language (rtttl)','216');
sel.options[74]= new Option('Sagem Ringtone (sagem)','211');
sel.options[75]= new Option('Sagem Ringtone (sagem21)','212');
sel.options[76] = new Option('SP-MIDI (.mid,.midi)','202');

 }
function setouttype(sel) { var t = new Array(); 
sel.options[0] = new Option('---- Movie ----','');
sel.options[1]= new Option('Animated GIF (gif)','5016');
sel.options[2]= new Option('3GP/3G2 Video (3gp)','5001');
sel.options[3]= new Option('AMV Video Format (amv)','5020');
sel.options[4]= new Option('Apple Quicktime (mov)','5004');
sel.options[5]= new Option('Audio Video Interleave (avi)','5002');
sel.options[6]= new Option('DPG Video (dpg)','5018');
sel.options[7]= new Option('Flash SWF (swf)','5100');
sel.options[8]= new Option('Flash Video (flv)','5008');
sel.options[9]= new Option('IPOD/IPHONE MP4 Video (mp4)','5030');
sel.options[10]= new Option('MPEG 1 (mpg)','5005');
sel.options[11]= new Option('MPEG-2 (mpg)','5014');
sel.options[12]= new Option('MPEG-4 (mp4)','5007');
sel.options[13]= new Option('OGG video (ogg)','5021');
sel.options[14]= new Option('PLAYSTATION (PSP) MP4 Video (mp4)','5031');
sel.options[15]= new Option('RealVideo (rm)','5015');
sel.options[16]= new Option('Windows Media Video (wmv)','5000');
sel.options[17] = new Option('---- Sound ----','');
sel.options[18]= new Option('3GP Music (3gp)','11');
sel.options[19]= new Option('Adaptive Multi-Rate (amr)','20');
sel.options[20]= new Option('Adaptive Multi-Rate WB (awb)','22');
sel.options[21]= new Option('Advanced Audio Coding (aac)','7');
sel.options[22]= new Option('AMIGA 8bit sound file (8svx)','33');
sel.options[23]= new Option('AMIGA sound file (maud)','35');
sel.options[24]= new Option('ASF Audio (wma)','3');
sel.options[25]= new Option('Audio Interchange File Format (aiff)','31');
sel.options[26]= new Option('Audio Visual Research (avr)','34');
sel.options[27]= new Option('Free Lossless Audio Codec (flac)','6');
sel.options[28]= new Option('IRCAM sound file (sf)','37');
sel.options[29]= new Option('MPEG advanced audio coding (mp4)','8');
sel.options[30]= new Option('MPEG-1/2 Audio Layer 3 (mp3)','1');
sel.options[31]= new Option('MPEG-4 advanced audio coding (m4a)','15');
sel.options[32]= new Option('Musepack (mpc)','9');
sel.options[33]= new Option('Ogg Vorbis (ogg)','2');
sel.options[34]= new Option('PSION 8bit sound file (wve)','41');
sel.options[35]= new Option('PSION sound file (prc)','36');
sel.options[36]= new Option('PureVoice File (qcp)','32');
sel.options[37]= new Option('Soundblaster file (voc)','40');
sel.options[38]= new Option('SoundTool (sndt)','38');
sel.options[39] = new Option('Sun Microsystems\' audio format (.au,.snd)','30');
sel.options[40]= new Option('WAVE form audio format (wav)','4');
sel.options[41]= new Option('Yamaha TXW sampler (txw)','39');
sel.options[42] = new Option('---- Ringtone (PCM + Polyphonic) ----','');
sel.options[43] = new Option('MMF/SMAF-2 (.mmf,.smaf)','198');
sel.options[44] = new Option('MMF/SMAF-3 poly+pcm (.mmf,.smaf)','199');
sel.options[45] = new Option('---- Ringtone (Monophonic / Polyphonic) ----','');
sel.options[46]= new Option('Eericsson emelody (emy)','213');
sel.options[47]= new Option('Extended Message format (ems)','215');
sel.options[48]= new Option('iMelody Ringtone Format (imy)','214');
sel.options[49] = new Option('Midi (.mid,.midi)','200');
sel.options[50] = new Option('MIDI-0 (.mid,.midi)','201');
sel.options[51] = new Option('MMF/SMAF-1 (.mmf,.smaf)','204');
sel.options[52]= new Option('Mobile Phone Ringtone (rtx)','216');
sel.options[53]= new Option('Motorola Ringtone (mot)','210');
sel.options[54]= new Option('Nokia Phone Ring Tone (nokia)','217');
sel.options[55]= new Option('Nokia Phone Ring Tone (noktxt)','218');
sel.options[56]= new Option('Nokia Phone Ring Tone (ott)','217');
sel.options[57]= new Option('Qualcomm CMX 3.0 (pmd)','206');
sel.options[58]= new Option('Ringtones text transfer language (rtttl)','216');
sel.options[59]= new Option('Sagem Ringtone (sagem)','211');
sel.options[60]= new Option('Sagem Ringtone (sagem21)','212');
sel.options[61] = new Option('SP-MIDI (.mid,.midi)','202');

 }
exttypetb[1000] = [1001,1002] ;
exttypetb[1001] = [1000] ;
exttypetb[1015] = [1016,1017] ;
exttypetb[1016] = [1000,1015,1017,5100] ;
exttypetb[1017] = [1016,505] ;
exttypetb[1018] = [1000,1016,1017] ;
exttypetb[2003] = [1016,1017] ;
exttypetb[6000] = [2200,2202,2204] ;
// exttypetb[3000] = [1016,1017] ;

exttypetb['writerlist'] = [1021,1022,1023,1024] ;
exttypetb['calclist'] = [2220,2221,2222,2223] ;
exttypetb['drawlist'] = [650,651,652,653] ;
exttypetb['impresslist'] = [3500,3501,3502,3503] ;
exttypetb['mathlist'] = [2990,2991] ;
exttypetb[500].push(632);
exttypetb[5000].push(1);
exttypetb[5000].push(4);
exttypetb[5000].push(7);
exttypetb[5000].push(500);
exttypetb[100].push(5000);
exttypetb['offoutimpress'].push('5100A1016');
outtypetb['5100A1016'] = 'SWF Flash Animation';
exttypetb['offoutimpress'].push('5000A1016');
outtypetb['5000A1016'] = 'WMV Windows Media Video';
exttypetb['offoutimpress'].push('5001A1016');
outtypetb['5001A1016'] = '3GP Video';
exttypetb['offoutimpress'].push('5004A1016');
outtypetb['5004A1016'] = 'MOV Quicktime Video';
exttypetb['offoutimpress'].push('5002A1016');
outtypetb['5002A1016'] = 'AVI Video';
outtypetb['5008A1016'] = 'FLV Video';
exttypetb['offoutimpress'].push('5008A1016');

var IE4 = document.all;
var NN7 = (!IE4 && document.getElementById);
var IE5 = (IE4 && navigator.userAgent.indexOf("Mac") == -1 && (navigator.userAgent.indexOf("MSIE 5") != -1 || navigator.userAgent.indexOf("MSIE 4") != -1));
if (IE4 && navigator.userAgent.indexOf("Opera") != -1) {
	NN7 = true;
	IE4 = false;
}
var safari = (navigator.userAgent.indexOf("Safari") != -1);

function getObject(obj) {
	return (IE4?document.all[obj]:document.getElementById(obj));
}

var progresscall = 0; var progressstart = 0; var progressset = 1; var pg_end = 0; var pg_status = 0; var pg_kb = 0; var pg_percent = 0; var sv_call = '';
function svinit() { progressset=0; progresscall=0; pg_status=0; }
function mcprogress(srv,sid,lg) {
 if (srv == sv_call) {} else { return; }
 progresscall=progresscall+1;
 var req  = 'http://'+srv+'/mcpjs.php?sessionid='+sid; 
 jreq = new JSONscriptRequest(req); 
 jreq.buildScriptTag(); 
 jreq.addScriptTag();
 var pbar = ''; 
 if (pg_kb>0) { progressstart = 1; }
 if (pg_status==1) { pbar = MSG['UPL_ERR']; svinit(); }
 if (pg_status==2) { pbar = MSG['UPL_OVL']; svinit(); }
 if (pg_status==3) { pbar = MSG['UPL_OVS']; svinit(); }
 if (pg_percent>0) { pg_percent=Math.round(pg_percent);
		 pbar = MSG['UPL_PG']+'<br/><table width=400px style="border: solid 1px #800808;text-align:center"><tr><td width=100% class=tdpgbar>'+pg_percent+' %</td></tr><tr><td width=100% align=left><table width='+pg_percent+'%><tr><td width=100% bgcolor="#FF0000" style="height:2px" ></td></tr></table></td></tr></table><br/>'+MSG['UPLOAD']+'<br>'; }
	if (pg_end==1) { progressset=0;	
		 pbar = '<table width=400px style="border: solid 1px #800808;text-align:center"><tr><td width=100% class=tdpgbar>100 %</td></tr><tr><td width=100% align=left><table width=100%><tr><td width=100% bgcolor="#FF0000" style="height:2px" ></td></tr></table></td></tr></table><a href="http://'+srv+'/'+lg+'/index.php?pg=envoi&sid='+sid+'">'+MSG['UPL_RDI']+'</a><br/>';	}
	if (progresscall>5 && progressstart==0) { pbar = MSG['UPL_SHS']; svinit(); }
	if (progressset==1) { setTimeout("mcprogress('"+srv+"','"+sid+"','"+lg+"')",5000); }
	if (pbar != '') {	 document.getElementById("pgbar").innerHTML = '<center>'+pbar+'</center>'; }
}
function rasid() { 
 var chars = "0123456789abcdefghiklmnopqrstuvwxyz";
 var ssid=''; 
 for (var i=0; i<26; i++) { var rnum = Math.floor(Math.random() * chars.length); ssid += chars.substring(rnum,rnum+1); }
 return ssid;
}
function p_startupload(formu,lang)
{
	var surl = '';
	var srv = getsv(formu);
	surl = rasid(); formu.sid.value = surl; 
	formu.action = 'http://'+srv+'/cgi-bin/mcupload_rd.cgi?sid=' + surl +'&lg=' + lang;
	formu.format1.disabled=false;	
	setTimeout("mcprogress('"+srv+"','"+surl+"','"+lang+"')",2000);
	document.getElementById('pgbar').innerHTML='<center><img src="http://media-convert.com/images/progress.gif" border=0 alt=""></center>';
	formu.submit();
}

function checkurl(chaine)
{
 var tomatch0= /\.(7z|3gp|aac|amr|amv|asf|avi|bmp|doc|dv|exe|js|flv|gif|ico|jpg|mid|midi|mkv|mmf|mov|mp4|mpc|mpg|pps|pdf|ps|psd|ra|ram|rm|qcp|tga|tar|tif|tgz|vob|wma|wmv|zip)[\s]*$/i
 if (tomatch0.test(chaine))
 {
 return false; 
 }
 var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{2,5}/
 if (tomatch.test(chaine))
 {
 return true;
 }
 else
 {
 return false; 
}
}

function checkurl2(chaine)
{

 var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{2,5}/
 if (tomatch.test(chaine))
 {
 return true;
 }
 else
 {
 return false; 
}
}

function indexByName(obj,valeur) {
	for (var i = 0 ; i < obj.options.length ; i++ ) {	
		if ( obj.options[i].value == valeur ) {
			return i;
		}
	}
	return 0;
}

function testchamps2(formulaire) {
  var fname ;
  var sel = 0 ;
  var extname ;
	var selbox = formulaire.format1 ;

  fname = formulaire.fichier.value ;
  extname = fname.substring( fname.lastIndexOf('.') + 1 , fname.length ).toLowerCase() ;
	if (typeof(intypetb[extname]) != 'undefined') {
  if ( intypetb[extname][0] > 0 ) {
  	formulaire.format1.selectedIndex = indexByName(formulaire.format1 ,intypetb[extname][1]) ;
  	if ( intypetb[extname][0] > 1 ) alert( MSG['MULTI-FORMAT'] ) ;
  	sel = 1 ;	
  }	
	}
  if (sel==1)	setoutput(formulaire.format1.value,formulaire.format2) ;
return true ;
}

function checkurlext(formulaire,doc) {
  var fname ;
  var sel = 0 ;
  var extname = '' ;
	var selbox = formulaire.format1 ;
  fname = formulaire.urlin.value ;
	if (extname!='') {} else {
  extname = fname.substring( fname.lastIndexOf('.') + 1 , fname.length ).toLowerCase() ;
	}
	if (typeof(intypetb[extname]) != 'undefined') {
  if ( intypetb[extname][0] > 0 ) {
  	formulaire.format1.selectedIndex = indexByName(formulaire.format1 ,intypetb[extname][1]) ;
  	if ( intypetb[extname][0] > 1 ) alert( MSG['MULTI-FORMAT'] ) ;
  	sel = 1 ;	
  }	
	}
  if (sel==1)	{
		setoutput(formulaire.format1.value,formulaire.format2) ;
	  setoptions(formulaire.format2,formulaire.option1,formulaire.format1,formulaire,doc);
	}
return true ;
}

function setoptions(selformat,seloption,selformat1,formu,doc) {
  var affoptions = 0;
	objopt = document.getElementById("homeoptions");
	objopt.innerHTML='';
	var htmlopt = '';
	if (selformat1.value >= 5000 && selformat1.value < 6000) {
	 		htmlopt += '<tr><td>&nbsp;<input type=checkbox onclick=\'checkcmjoin(this)\' name=cmjoin>&nbsp;<b>'+MSG['JS_MJ']+'</b></td><td><div id="divcmjbt"></div></td></tr><tr><td colspan=2><div id="divcmjoin"></div></td></tr>'; }	
	if (selformat.value == 5031 ) {
	  htmlopt +='<tr><td>'+MSG['FORMAT']+'</td><td><select name=option1><option value=0 default>320x240 4/3</option><option value=1>320x180 16/9</option></select></td></tr>';	} 		
	if (selformat.value == 5030) {
	  htmlopt +='<tr><td>'+MSG['FORMAT']+'</td><td><select name=option1><option value=0 default>H264 320x240 4/3 - 768kbit</option><option value=1 >H264 320x180 16/9 - 768kbit</option><option value=2 >MPEG4 480x480 - 2500kbit</option><option value=3 >H264 640x480 - (TV out)</option></select></td></tr>';			} 		
	if (selformat.value == 5016 ) {
	  htmlopt +='<tr><td>'+MSG['JS_RESIZE_TO']+' [16x16 > 640x480]</td><td><input size=3 type=text name=taillex>x<input size=3 type=text name=tailley></td></tr>';			 		
	  htmlopt +='<tr><td>Frames/second [1 > 15]</td><td><input type=text size=3 name=v_fps></td></tr>';	} 	
	if (selformat.value >= 5000 && selformat.value < 6000  && selformat.value != 5016 && selformat.value != 5031 && selformat.value != 5005 && selformat1.value != 1016) {
	  htmlopt +='<tr><td>'+MSG['FPS']+' [4 > 30]</td><td><input type=text size=3 name=v_fps></td></tr>' ; } 	
	if (selformat.value >= 5000 && selformat.value < 6000  && selformat1.value >=5000 && selformat1.value < 6000) {
		htmlopt +='<tr><td>'+MSG['JS_AMR_ALL']+' <input type=radio name=v_split value=0 checked> '+MSG['JS_AMR_SPLIT']+' <input type=radio name=v_split value=1></td><td><input type=text length=8 name=v_start value="00:00:00"> ==> <input type=text length=8 name=v_end value="00:00:00"> [HH:MM:SS]</td></tr>';	
		} 	
	if (selformat.value >= 5000 && selformat.value < 6000  && selformat1.value >=5000 && selformat1.value < 6000 && (selformat.value != 5016 && selformat.value != 5018)) {
		htmlopt +='<tr><td>Audio Sync. [-5000 > +5000ms]</td><td><input type=text value="0" name=v_shift></td></tr>';
		} 				
	if (((selformat.value >= 5000 && selformat.value < 6000) || selformat.value<500)  && selformat1.value >=5000 && selformat1.value < 6000 && (selformat.value != 5016 && selformat.value != 5018)) {
		htmlopt +='<tr><td>'+MSG['VOL']+'</td><td><select name=v_vol><option selected value=1>+0</option><option value=2>+1</option><option value=3>+2</option><option value=-2>-1</option><option value=-3>-2</option></select></td></tr>';
		} 				
	if (selformat.value == 500 && selformat1.value>=5000) {
	  htmlopt +='<tr><td>'+MSG['JS_RESIZE_TO']+' [96x96 > 948x576]</td><td><input size=3 type=text name=taillex>x<input size=3 type=text name=tailley></td></tr><tr><td>Frame position</td><td><input size=11 name=option1 value="00:00:00" type=text> (min:sec:csec)</td></tr>';			} 		
	if (selformat.value == 5001) {
	  htmlopt +='<tr><td>'+MSG['JS_AUDIO_CODEC']+'&nbsp;</td><td><select name=v_acodec><option value=0>AMR </option><option value=1>MP3</option><option selected value=2>AAC</option>&nbsp;</td></tr><tr><td>Channels</td><td><select name=option2><option value=0 default>MONO</option><option value=1>STEREO</option></select></td></tr><tr><td>Video '+MSG['JS_QUALITY']+' [48 > 768 kbps]</td><td><input type=text size=3 name=v_br></td></tr><tr><td>Format</td><td><select name=taillex><option value=1 selected>QCIF PAL 176x144</option><option value=2>SQCIF 128x96</option><option value=4>CIF PAL 352x288</option><option value=5>4CIF PAL 704x576</option></select></td></tr>';			} 	
	if (selformat.value == 5018) {
	  htmlopt +='<tr><td>'+MSG['JS_RESIZE_TO']+' </td><td><input size=3 type=text name=taillex>x<input size=3 type=text name=tailley></td></tr>';		} 		
	if (selformat.value == 5005 || selformat.value == 5020) {
	  htmlopt +='<tr><td>'+MSG['JS_RESIZE_TO']+' [96x96 > 948x576]</td><td><input size=3 type=text name=taillex>x<input size=3 type=text name=tailley></td></tr><tr><td>Audio '+MSG['JS_QUALITY']+'&nbsp;</td><td><select name=option2><option value=0 selected>default</option><option value=8>8</option><option value=16>16k</option><option value=24>24k</option><option value=32>32k</option><option value=48>48k</option><option value=64>64k</option><option value=80>80k</option><option value=96>96k</option><option value=112>112k</option><option value=128>128k</option></select></td></tr><tr><td>Video '+MSG['JS_QUALITY']+' [48 > 9999 kbps]</td><td><input value=default size=8 type=text name=option1></td></tr>';		} 		
	if ( selformat.value == 5008 || selformat.value == 5004 || selformat.value == 5007 || selformat.value == 5000 || selformat.value == 5014 || selformat.value == 5015 ) {
 if (selformat.value==5007) {
	  htmlopt +='<tr><td>'+MSG['JS_AUDIO_CODEC']+'&nbsp;</td><td><select name=v_acodec><option selected value=0>AAC </option><option value=1>AMR NB 12.2K</option>&nbsp;</td></tr>';		  
	  htmlopt +='<tr><td>Video Codec&nbsp;</td><td><select name=option5><option selected value=0>MPEG4</option><option value=1>H264 High Quality</option>&nbsp;</td></tr>';		  
}
 if (selformat.value==5014) {
		htmlopt += '<tr><td>Target</td><td><select name=option3><option value=0>no specific target</option><option value=1>SVCD NTSC</option><option value=2>SVCD PAL</option><option value=3>DVD NTSC</option><option value=4>DVD PAL</option></select></td></tr>';		}	
	  htmlopt +='<tr><td>'+MSG['JS_RESIZE_TO']+' [96x96 > 948x576]</td><td><input size=3 type=text name=taillex>x<input size=3 type=text name=tailley></td></tr><tr><td>Audio '+MSG['JS_QUALITY']+'&nbsp;</td><td><select name=option2><option value=0 selected>default</option><option value=8>8k</option><option value=16>16k</option><option value=24>24k</option><option value=32>32k</option><option value=48>48k</option><option value=64>64k</option><option value=80>80k</option><option value=96>96k</option><option value=112>112k</option><option value=128>128k</option></select></td></tr><tr><td>Video '+MSG['JS_QUALITY']+' [48 > 9999 kbps]</td><td><input value=default size=8 type=text name=option1></td></tr>';	} 			
	if (selformat.value == 5002 ) {
	  htmlopt +='<tr><td>'+MSG['JS_RESIZE_TO']+' [96x96 > 948x576]</td><td><input size=3 type=text name=taillex>x<input size=3 type=text name=tailley></td></tr><tr><td>Audio Codec</td><td><select name=option5 onchange="if (this.value==1) { form1.option2.disabled=true; } else { form1.option2.disabled=false; }"><option value=0  checked>MP3</option><option value=1>PCM</option></select></td></tr><tr><td>Audio '+MSG['JS_QUALITY']+'&nbsp;</td><td><select name=option2><option value=0  selected>default</option><option value=8>8k</option><option value=16>16k</option><option value=24>24k</option><option value=32>32k</option><option value=48>48k</option><option value=64>64k</option><option value=80>80k</option><option value=96>96k</option><option value=112>112k</option><option value=128>128k</option></select></td></tr><tr><td>Video '+MSG['JS_QUALITY']+' [48 to 9999 kbps]</td><td><input value=default size=8 type=text name=option1></td></tr><tr><td>Video Codec&nbsp;</td><td><select name=v_acodec><option value=0>MSMPEG4v2</option><option selected value=1>MPEG4</option><option value=2>MJPEG</option></select></td></tr><tr><td>FOURCC Header&nbsp;</td><td><select name=option3><option value=MP42>MP42</option><option selected value=DX50>DX50</option><option value=DIVX>DIVX</option><option value=FMP4>FMP4</option><option value=MJPG>MJPG</option></select></td></tr>';		} 		
	if (( selformat.value >= 500 && selformat.value < 600 ) && (selformat1.value >= 500 && selformat1.value < 600)) {
	  htmlopt +='<tr><td>'+MSG['LARGEUR']+'&nbsp;</td><td><input type=text size=7 name=taillex></td></tr><tr><td>'+MSG['HAUTEUR']+'&nbsp;</td><td><input type=text size=7 name=tailley></td></tr>';	} 
	if (( selformat.value == 500 || selformat.value == 504 ) && (selformat1.value < 5000)) {
	  htmlopt +='<tr><td>PNG '+MSG['JS_QUALITY']+'&nbsp;</td><td><select name=option1><option>default</option><option value=100>BEST</option><option value=30>3</option><option value=50>5</option><option value=70>7</option><option value=80>8</option><option value=90>9</option></select></td></tr>';	}
	if ( selformat.value == 502 ) {
	  htmlopt +='<tr><td>'+MSG['JS_COLORS']+'&nbsp;</td><td><select name=option1><option>default</option><option value=256>max</option><option value=2>2</option><option value=4>4</option><option value=8>8</option><option value=16>16</option><option value=32>32</option><option value=64>64</option><option value=128>128</option><option value=256>256</option></select></td></tr>';	}
	if ( selformat.value > 0 &&  selformat.value < 200 && selformat1.value < 500)  {
    htmlopt+='<tr><td colspan=2><input type=radio checked name=optsplit value=0>'+MSG['JS_AMR_ALL']+'&nbsp;<input type=radio name=optsplit value=2>'+MSG['JS_AMR_SPLIT']+'</td></tr>';	}		
	if (( selformat1.value == 1016 ) || ( selformat1.value == 2003 ) || ( selformat1.value == 1018 ) || ( selformat1.value == 1015 )) {
    htmlopt += '<tr><td>&nbsp;'+MSG['PASSWD']+'&nbsp;</td><td><input type=text size=12 name=passwd></td></tr>';	}							
	if (( selformat1.value == 1000 ) && ( selformat.value == 1001 ))	{
		 htmlopt += '<tr><td colspan=2><input type=radio checked name=cset value=0>'+MSG['JS_NO_CH_CONV']+'&nbsp;<input type=radio checked name=cset value=1>'+MSG['JS_CH_CONV']+'</td></tr>';
	}		
  if (selformat.value==11) {
	  htmlopt +='<tr><td>'+MSG['JS_AUDIO_CODEC']+'&nbsp;</td><td><select name=v_acodec><option selected value=1>AAC </option><option value=0>AMR NB</option>&nbsp;</td></tr>';		  }
	

	htmlopt += '<tr><td colspan=2>&nbsp;<input type=checkbox name=setmultipart value=1>&nbsp;'+MSG['SPLIT1']+' <input type=text size=5 value=5000 name=multipart> Kb  '+MSG['SPLIT2']+'</td></tr>' ;
	objopt.innerHTML='<table border=0 cellpadding=2 cellspacing=0 width=100%>'+htmlopt+'</table>';
}


function settypeoutput(ctrl,numtype) {
	var pos = ctrl.length ;
	var outype ;
	for (var cpt = 0 ; cpt < exttypetb[numtype].length ; cpt++, pos++) {
		 outype = exttypetb[numtype][cpt] ;
	   ctrl.options[pos] = new Option( outtypetb[outype] , outype ) ;
	}
}

function settypeoutput2(ctrl,numtype,vindex,format3) {
	var pos = ctrl.length ;
	var outype ;
	var deja ; 
	for (var cpt = 0 ; cpt < exttypetb[numtype].length ; cpt++) {
		 outype = exttypetb[numtype][cpt] ;
		 var so = outype+'';
		 var tso = so.split('A');
		 if (tso.length>1) {  }
		 deja = 0;
		 if (tso[0] == vindex) deja = 1;
		 for (var i = 0; i < ctrl.options.length; i++) {
			value2 = ctrl.options[i].value.split('A');
		 	if (value2[0] == tso[0]) { deja = 1; }
		 }
		 if (deja==0)
	   { ctrl.options[pos] = new Option( outtypetb[outype], outype+'A'+format3 ) ; pos++; }
	}
}

function setoofin(ctrl, vindex, intype, outlist) {
	var pos = ctrl.length ;
	var a = 0;
	for (var cpt = 0 ; cpt < exttypetb[intype].length ; cpt++) {
		 if ( exttypetb[intype][cpt] == vindex ) {
		 		for (var cof = 0 ; cof < exttypetb[outlist].length ; cof++, pos++ ) {
				    a = 1;
		 				var outype = exttypetb[outlist][cof] ;
	   				ctrl.options[pos] = new Option( outtypetb[outype], outype ) ;
				}
		 }
	}
	return a;
}

function format1change(form1,document) {
	if ( form1.format1.value == 1012 ) {
		 form1.inputmode[0].checked = true ;
		 form1.format1.disabled=true ;
		 printurlbox() ;
	}
	setoutput(form1.format1.value,form1.format2) ;
	setoptions(form1.format2,form1.option1,form1.format1,form1,document) ;
}

function format1change2(form1,document) {
	if ( form1.format1.value == 1012 ) {
		 form1.inputmode[0].checked = true ;
		 printurlbox() ;
	}
	setoutput(form1.format1.value,form1.format2) ;
	setoptions(form1.format2,form1.option1,form1.format1,form1,document) ;
}


function setoutput(vindex,csel2) {
					
	csel2.options.length = 0 ;
	if ( vindex < 200 ) { 
		settypeoutput( csel2 , 100 ) ;
		settypeoutput( csel2 , 199 ) ;
	}
	if ( vindex > 200 && vindex < 300 ) { 
	  settypeoutput( csel2 , 100 ) ;
		settypeoutput( csel2 , 199 ) ;
		settypeoutput( csel2 , 200 ) ;
	}
	if ( vindex >= 500 && vindex < 600 ) {
		settypeoutput( csel2 , 500 ) ;
	}
	if ( vindex >= 600 && vindex < 620  ) {
		settypeoutput( csel2 , 600 ) ;
		settypeoutput( csel2 , 500 ) ;
	}
	if ( vindex >= 1000 ) {
		 if ( exttypetb[vindex] ) settypeoutput( csel2 , vindex ) ;
	}
	if ( 	vindex == 1012 || vindex == 1013  ) settypeoutput( csel2 , 500 ) ;

	if ( vindex >= 4000 && vindex < 5000 ) {
		 settypeoutput( csel2 , 4000 ) ;
	}
	if ( vindex >= 5000 && vindex < 5090 ) settypeoutput( csel2 , 5000 ) ;

	if ( vindex > 1020 && vindex < 1025) settypeoutput( csel2 , 'offoutwriter' ) ;
	if ( vindex > 2219 && vindex < 2224) settypeoutput( csel2 , 'offoutcalc' ) ;
	if ( vindex > 649  && vindex < 654 ) settypeoutput( csel2 , 'offoutdraw' ) ;
	if ( vindex > 3499 && vindex < 3504) settypeoutput( csel2 , 'offoutimpress' ) ;
	if ( vindex > 2989 && vindex < 2992) settypeoutput( csel2 , 'offoutmath' ) ;
	
	if (setoofin(csel2, vindex, 'offinwriter' , 'writerlist' )) {	
	 	settypeoutput2( csel2 , 'offoutwriter', vindex, 1021) ;
	}
	if (setoofin(csel2, vindex, 'offincalc' , 'calclist' )) {
	 	settypeoutput2( csel2 , 'offoutcalc', vindex, 2220) ;
	}
	if (setoofin(csel2, vindex, 'offindraw' , 'drawlist' )) { 
		settypeoutput2( csel2 , 'offoutdraw', vindex, 650) ;
	}
	if (setoofin(csel2, vindex, 'offinimpress' , 'impresslist' )) {
		settypeoutput2( csel2 , 'offoutimpress', vindex, 3500) ;
	}
	if (setoofin(csel2, vindex, 'offinmath' , 'mathlist' )) {
	settypeoutput2( csel2 , 'offoutmath', vindex, 2990) ;
	}
}

function printurlbox2() {
  objfile = getObject("homefile");
	objfile.innerHTML='<input type="text" onChange="checkurlext(form1,document)" class=urlin name="urlin" value="http://" size=39 />';
}

function urlmode2(formu) 
{
	printurlbox2() ;
	formu.format1.selectedIndex=indexByName(formu.format1,1012) ;
	setoutput(1012,formu.format2);
	setoptions(formu.format2,formu.option1,formu.format1,formu,document);	
}

function filemode(formu) 
{
  objfile = getObject("homefile");
	objfile.innerHTML='<input onChange="testchamps2(document.form1);setoptions(form1.format2,form1.option1,form1.format1,form1,document)" class=btFile size=32 type=file name="fichier" enctype="multipart/form-data"/>';
	formu.format1.selectedIndex=0;
  formu.format1.disabled=false;

}

function getsv(form) {
	var sv = '';
	sv = vserv4;
	if (form.format1.value>=500 && form.format1.value<5000) { sv = vservd; }	
  var srvrnd = Math.floor(Math.random() * 9999);
  var reqsrv  = 'http://media-convert.com/js/srv.php?z='+srvrnd+'&ns='+sv; 
  sv=sv+'.media-convert.com'; 
  jreqsrv = new JSONscriptRequest(reqsrv); 
  jreqsrv.buildScriptTag(); 
  jreqsrv.addScriptTag();		
  sv_call = sv;
	return sv;
}

function p_valconv(formulaire) {
	fname = formulaire.fichier.value ;
	if (fname == '') { alert(MSG['JS_ERR_FIC']); return false; }	
	if (formulaire.format1.value == 0) { alert(MSG['JS_ERR_F1']); return false; }
	if (formulaire.format2.value == 0) { alert( MSG['JS_ERR_F2']); return false; }
	if (formulaire.accept.checked==true) {} else { alert( MSG['JS_ERR_F3']); return false; }
	return true ;
}

function p_valconv2(formulaire) {
	if (formulaire.fichier.value == '' && formulaire.inputmode.value==2) { alert(MSG['JS_ERR_FIC']); return false; }	
	if (formulaire.fichier.urlin == '' && formulaire.inputmode.value==1) { alert(MSG['JS_ERR_FIC']); return false; }	
	if (formulaire.format1.value == 0) { alert(MSG['JS_ERR_F1']); return false; }
	if (formulaire.format2.value == 0) { alert( MSG['JS_ERR_F2']); return false; }
	if (formulaire.accept.checked==true) {} else { alert( MSG['JS_ERR_F3']); return false; }
	return true ;
}

function p_init() {
  setintype(document.formmc.format1);
  setouttype(document.formmc.format2);	
}
