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 = ''; var h_fd = '';
function svinit() { progressset=0; progresscall=0; pg_status=0; }
function mcprogress(srv,sid,lg) {
 if (h_fd != '') { document.getElementById('pgbar').innerHTML = '<center>FORMAT : '+h_fd+'</center>'; svinit(); return; }
 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(); document.getElementById("pgbar").innerHTML = '<center>'+pbar+'</center>'; }
 if (pg_status==2) { pbar = MSG['UPL_OVS']; svinit(); document.getElementById("pgbar").innerHTML = '<center>'+pbar+'</center>'; }
 if (pg_status==3) { pbar = MSG['UPL_OVL']; svinit(); document.getElementById("pgbar").innerHTML = '<center>'+pbar+'</center>'; }
 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 startupload(formu,lang,rec)
{
	var surl = '';
	var srv = getsv(formu);
	if (rec!='') { formu.sid.value =rec; surl = rec; srv = vserv2+'.media-convert.com'; } else {	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+"','"+lgdir(lang)+"')",2000);
	document.getElementById('pgbar').innerHTML='<center><img src="/images/progress.gif" border=0 alt=""></center>';
  document.getElementById('mc-option-wrapper').style.display='none';
	formu.submit();
}

function startupload_fd(formu,lang)
{
	var surl = '';
	var srv = getsv(formu);
	surl = rasid(); formu.sid.value = surl; 
	srv = 'w16.media-convert.com';
	formu.action = 'http://'+srv+'/cgi-bin/mcupload_fd.cgi?sid=' + surl +'&lg=' + lang + '&fd=fd' ;	
	setTimeout("mcprogress('"+srv+"','"+surl+"','"+lgdir(lang)+"')",4000);
	document.getElementById('pgbar').innerHTML='<center><img src="/images/progress.gif" border=0 alt=""></center>';
  document.getElementById('mc-option-wrapper').style.display='none';
	formu.submit();
}

function mc_menu(mode,elt) {
 var obj = document.getElementById(elt);
 if (mode==0) {	obj.style.visibility ="hidden"; } else {obj.style.visibility ="visible"; }
}

function mc_menu_bg(mode,elt) {
 var obj = document.getElementById(elt);
 if (elt=='d_home') { if (mode==1) { obj.style.background = "#6060e2"; } else { obj.style.background = "#A5C1FF"; }   return; }
 if (elt=='d0_services') { if (mode==1) { obj.style.background = "#FE6600"; } else { obj.style.background = "#A5C1FF"; }   return; }
 if (elt.substr(0,10)=='d_services') { if (mode==1) { obj.style.background = "#FE6600"; } else { obj.style.background = "#FE6600"; } return; }
}

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');

function mode_noconv(f) {
  filemode(f);
	obj = document.getElementById("mc-convertboard-file");
  obj.style.display = 'block';		
	obj = document.getElementById("homeinformat");
  obj.style.display = 'none';
	obj = document.getElementById("homeoutformat1");
  obj.style.display = 'none';
	obj = document.getElementById("homeoutformat2");
  obj.style.display = 'none';
	obj = document.getElementById("homeoptions");
	obj.innerHTML = '';	
  obj.style.display = 'block';
	obj = document.getElementById("vp");
  obj.style.display = 'none';		
	inputformat_other(f,1);	
}

function mode_conv(f) {
  filemode(f);
	obj = document.getElementById("mc-convertboard-file");
  obj.style.display = 'block';	
	obj = document.getElementById("homeinformat");
  obj.style.display = 'block';
	obj = document.getElementById("homeoutformat1");
  obj.style.display = 'block';
	obj = document.getElementById("homeoutformat2");
  obj.style.display = 'block';
	obj = document.getElementById("homeoptions");
	obj.innerHTML = '';
  obj.style.display = 'block';	
	obj = document.getElementById("vp");
  obj.style.display = 'block';	
	inputformat_other(f,1);
	inputformat_colors(f);
}

function inputformat_colors(f) {
				 var cl='mc-formatin-1';
				 var ch='mc-formatin-h';
				 var ft;
				 for (var i=0;i<f.format1.options.length;i++) {
						 ft = f.format1.options[i].text;
						 if (ft.substring(0,2)=='--') { if (cl=='mc-formatin-1') { cl='mc-formatin-2'; } else { cl='mc-formatin-1'; } f.format1.options[i].className=ch; }
				 		 else { f.format1.options[i].className=cl; }
				 }
				 return;
}

function inputformat_other(f,a) {
  var issel=false;
	var k = 0;
  var formats = new Array(f.format1.options.length);
	for (var i=0;i<f.format1.options.length;i++) {
	    if (f.format1.options[i].value!='999998') {
			formats[k] = new Array(2);
			formats[k][0] = f.format1.options[i].value;
			formats[k][1] = f.format1.options[i].text;
			k=k+1;
			}
  }
	if (a==0) {
	f.format1.options[0] = new Option(MSG['OTHER'],999998);
	for (var j=0;j<k;j++) {
	    if (formats[j][0]==0) { issel=true; } else { issel=false; }
			f.format1.options[j+1] = new Option(formats[j][1],formats[j][0],false,issel);
	}
	} else {
	for (var j=0;j<k;j++) {
			   if (formats[j][0]==0) { issel=true; } else { issel=false; }
				 f.format1.options[j] = new Option(formats[j][1],formats[j][0],false,issel);		
	}
	}
}

function mode_wapupload(f) {
  filemode(f);
	obj = document.getElementById("mc-convertboard-file");
  obj.style.display = 'block';	
	obj = document.getElementById("homeinformat");
  obj.style.display = 'block';
	obj = document.getElementById("homeoutformat1");
  obj.style.display = 'none';
	obj = document.getElementById("homeoutformat2");
  obj.style.display = 'none';
	obj = document.getElementById("homeoptions");
	obj.innerHTML = '';
  obj.style.display = 'none';	
	obj = document.getElementById("vp");
  obj.style.display = 'none';	
	inputformat_other(f,0);
	inputformat_colors(f);
}

function mode_urlcopy(f) {
	urlmode2(f);
	obj = document.getElementById("mc-convertboard-file");
  obj.style.display = 'none';	
	obj = document.getElementById("homeinformat");
  obj.style.display = 'none';
	obj = document.getElementById("homeoutformat1");
  obj.style.display = 'block';
	obj = document.getElementById("homeoutformat2");
  obj.style.display = 'block';
	obj = document.getElementById("homeoptions");
  obj.style.display = 'block';	
	obj = document.getElementById("vp");
  obj.style.display = 'none';	
	inputformat_other(f,1);
}

var mc_menu_service_idact = 1 ;
function mc_srvmenu_getobj(idnum) {
  if (idnum == 1) objname = "mc-service-mc" ;
  if (idnum == 2) objname = "mc-service-url" ;
  if (idnum == 3) objname = "mc-service-st" ;
  if (idnum == 4) objname = "mc-service-wsr" ;
  if (idnum == 5) objname = "mc-service-sfm" ;
	return document.getElementById(objname) ;
}

function mc_srvmenu_click(objclk,menuid,form) {
  var objname ;
	if ( objclk == null ) objclk = mc_srvmenu_getobj(menuid) ;
  if ( form == null ) form = document.getElementById("form1") ;
	obj = mc_srvmenu_getobj(mc_menu_service_idact) ;
  obj.style.background = '#6060e2' ;
  obj.style.color = '#FFFFFF' ;
  objclk.style.background = '#A5C1FF' ;
  objclk.style.color = '#000000' ;
  objclk.style.borderLeft = 'solid #800808 1px' ;
  objclk.style.borderTop = 'solid #800808 1px' ;
  objtitle = document.getElementById('mc-service-help');	
	if (menuid == 1) {
	  objtitle.innerHTML = MSG['MENU_LOCALCONV_TITLE'] ;
		form.mode.value = 0 ;
		mode_conv(form) ;
    filemode(form) ;
	}
	if (menuid == 2) {
		form.mode.value=0 ;
	  objtitle.innerHTML = MSG['MENU_URLCONV_TITLE'] ;
		mode_conv(form) ;
		urlmode2(form) ;
	}
	if (menuid == 3) {
		form.mode.value = 1 ;
	  objtitle.innerHTML = MSG['MENU_HOST_TITLE'] ;
		mode_noconv(form) ;
	  setoptions(form.format2,form.option1,form.format1,form,document) ;
	}
	if (menuid == 4) {
		form.mode.value = 2 ;
	  objtitle.innerHTML = MSG['MENU_URLCOPY_TITLE'] ;
		mode_urlcopy(form) ;
	}
	if (menuid == 5) {
	  objtitle.innerHTML = MSG['MENU_WAP_TITLE'] ;
		form.mode.value = 3 
		mode_wapupload(form);
	}
	mc_menu_service_idact = menuid ;		
}

function mc_srvmenu_mouse(obj,menuid,mode) {
  if (mc_menu_service_idact != menuid) {
		 if ( mode == 1 ) { // over
		 		obj.style.background = '#A5C1FF' ;
		 } else {
		 	  obj.style.background = '#6060e2' ;
	   }
	}
}

function getsv(form) {
 var sv = vservd;	
 if (form.mode.value==0) {
  if (form.format2.value>=5000 && form.format2.value<6000 ) { sv = vserv; if (form.format2.value!=5030) { sv = vserv4; } }
   if (form.format2.value<500) { sv = vserv3; }
 }
 if (form.format1.value==999997) { sv = vserv; }
 if (form.mode.value==1) { sv = vserv; }
 if (form.mode.value==2) { sv = 'w16'; }
 if (form.mode.value==3) { sv = vserv; }	
 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 lgdir(lg) {
var dir=lg;
if (lg=='fr') { dir='convertir'; }
if (lg=='de') { dir='konvertieren'; }
if (lg=='en') { dir='convert'; }
if (lg=='es') { dir='conversion'; }
if (lg=='it') { dir='conversione'; }
if (lg=='vi') { dir='chuyen'; }
if (lg=='nl') { dir='omzetten'; }
if (lg=='pt') { dir='converter'; }
if (lg=='sv') { dir='konverterar'; }
if (lg=='vi') { dir='chuyen'; }
if (lg=='ar') { dir='arab'; }
if (lg=='pt-br') { dir='conversor'; }
return dir;
}

function popUP(mypage)
{
        winprops = 'menubar=no,status=no,height=180,width=460,left=' + ((screen.width - 460) / 2) + ', top=' + ((screen.height - 180) / 2) + ',scrollbars=no,resizable=no,titlebar=no,toolbar=no';
  win = window.open(mypage, '', winprops)
        if (parseInt(navigator.appVersion) >= 4) {
                win.window.focus();
        }
}

function hp_startupload(formu,lang,rec)
{
	var surl = '';
	var srv = getsv(formu);
	if (rec!='') { formu.sid.value =rec; surl = rec; srv = vserv2; } else {	surl = rasid(); formu.sid.value = surl; }
	formu.action = 'http://'+srv+'/cgi-bin/mcupload2.cgi?sid=' + surl +'&lg=' + lang;
  formu.format1.disabled=false;	
  baseUrl = "http://"+srv+"/mcbar.php";
	sid = surl;
	iTotal = escape("-1");
	baseUrl += "?iTotal=" + iTotal;
	baseUrl += "&iRead=0";
	baseUrl += "&iStatus=1";
	baseUrl += "&sessionid=" + surl;
	baseUrl += "&srv=" + srv;
	baseUrl += "&lang=" + lang;
	popUP(baseUrl);
	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|ftp|mms|mmst|mmsh|rtsp):\/\/[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|ftp|mms|mmst|mmsh|rtsp):\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{2,5}/
 if (tomatch.test(chaine))
 {
 return true;
 }
 else
 {
 return false; 
}
}

function valconv(f) {
  if (f.rec.value==0) {
  if (mc_menu_service_idact == 1) {
		 if (f.fichier.value == '') { alert(MSG['JS_ERR_FIC']); return false; }	
	} else {
	 		if (checkurl2(f.urlin.value)==true) {} else { alert(MSG['JS_BADURL']); return false; }
	}}
	if (f.mode.value==0 && f.format1.value == 0) { alert(MSG['JS_ERR_F1']); return false; }
	if (f.mode.value==0 && f.format2.value == 0) { alert( MSG['JS_ERR_F2']); return false; }
	return true ;
}

function valconv1(f) {
	if (f.fichier.value == '') { alert(MSG['JS_ERR_FIC']); return false; }	
	return true ;
}

function valconv2(f) {
	if (checkurl(f.urlin.value)==true) {} else { alert(MSG['JS_BADURL']); return false; }
	return true ;
}

function valconv3(f) {
	if (f.format1.value == 0) { alert(MSG['JS_ERR_F1']); return false; }
	if (f.fichier.value == '') { alert(MSG['JS_ERR_FIC']); return false; }	
	return true ;
}

function valide(f) {
	if (f.mode.value==1) { return valconv1(f); } 
	if (f.mode.value==2) { return valconv2(f); } 
	if (f.mode.value==3) { return valconv3(f); } 
	return valconv(f);
}

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 ) {
	  var a1 = intypetb[extname][0];
  	formulaire.format1.selectedIndex = indexByName(formulaire.format1 ,intypetb[extname][a1]) ;
  	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);
		setvp(formulaire);
	}
return true ;
}

function setoptions(selformat,seloption,selformat1,formu,doc) {
  var affoptions = 0;
	objopt = document.getElementById("homeoptions");
	objopt.innerHTML='';
	var htmlopt = '';
  if ((selformat.value >= 5000 && selformat.value < 6000  && selformat1.value >=5000 && selformat1.value < 6000) || (selformat.value >=500 & selformat.value<5000) || (selformat.value>=6000 && selformat.value < 7000)) {	
		htmlopt += '<tr><td colspan=2>'+MSG['EMAIL']+'</td></tr><tr><td>E-Mail</td><td><input type=text size=32 name=email value=""></td></tr><tr><td colspan=2><hr/></td></tr>';
	}
	if (formu.rec.value == 0) {
		htmlopt += '<tr><td>'+MSG['RENAME']+'</td><td><input type=text size=24 name=renameto></td></tr>';
  }
	if (formu.mode.value == 0 || formu.mode.value == 2) {
if (selformat.value == 1 && selformat1.value < 500 ) {
    htmlopt += '<tr><td>MP3 encoding</td><td><select name=x_opt_s_mp3_method><option selected value=cbr>Constant Bitrate</option><option value=vbr>Variable Bitrate</option></select>&nbsp;<input size=4 type=text value="auto" name=x_opt_s_mp3_br> [32-256] kbits</td></tr>';
}			
if (selformat.value == 2 && selformat1.value < 500 ) {
    htmlopt += '<tr><td>OGG quality</td><td><input size=4 value="7" name=x_opt_s_ogg_q>[1-10]</td></tr>';
}			
if (selformat.value == 7 && selformat1.value < 500 ) {
    htmlopt += '<tr><td>AAC encoding</td><td><input size=4 type=text value="auto" name=x_opt_s_aac_br> [32-256] kbits</td></tr>';
}			
if ((selformat.value==199 || selformat.value == 30 || selformat.value == 31 || (selformat.value >= 33 && selformat.value<=41) || selformat.value == 4) && selformat1.value < 500 ) {
    htmlopt += '<tr><td>Audio Channels</td><td><select name=x_opt_s_pcm_ch><option value=2 selected>Stereo</option><option value=1>Mono</option></select></td></tr>';
    htmlopt += '<tr><td>Audio Sampling Rate</td><td><select name=x_opt_s_pcm_rate><option value=44100 selected>44100 Hz</option><option value=22050>22050 Hz</option><option value=16000>16000 Hz</option><option value=8000>8000 Hz</option></select></td></tr>';
}			
if ((selformat.value == 198 || selformat.value == 199|| selformat.value == 20 || selformat.value == 22 ) && selformat1.value < 500 ) {
    htmlopt += '<tr><td>Noise filter</td><td><select name=x_opt_s_noisefilter><option value=0 selected>Off</option><option value=1>On</option></select></td></tr>';
}			
if ((selformat.value == 199 ) && selformat1.value < 500 ) {
    htmlopt += '<tr><td>Bits per sample</td><td><select name=x_opt_s_smaf_bps><option value=8 selected>8</option><option value=16>16</option></select></td></tr>';
}			
if ((selformat.value == 20 ) && selformat1.value < 500 ) {
    htmlopt += '<tr><td>Bitrate</td><td><select name=x_opt_s_amr_br><option value=475>4.75 kbps</option><option value=515>5.15 kbps</option><option value=59>5.9 kbps</option><option value=67>6.7 kbps</option><option value=74>7.4 kbps</option><option selected value=795>7.95 kbps</option><option value=102>10.2 kbps</option><option value=122>12.2 kbps</option></select></td></tr>';
}			
if ((selformat.value == 22 ) && selformat1.value < 500 ) {
    htmlopt += '<tr><td>Bitrate</td><td><select name=x_opt_s_amr_br><option value=66>6.6 kbps</option><option value=885>8.85 kbps</option><option value=1265>12.65 kbps</option><option value=1585>15.85 kbps</option><option value=1825>18.25 kbps</option><option selected value=1985>19.85 kbps</option><option value=2305>23.05 kbps</option><option value=2385>23.85 kbps</option></select></td></tr>';
}			
if ((selformat.value == 32 ) && selformat1.value < 500 ) {
    htmlopt += '<tr><td>QCP quality</td><td><select name=x_opt_s_qcp_q><option value=VFR>Variable Full Rate</option><option value=FFR>Fixed Full Rate</option><option value=VHR>Variable Half Rate</option><option value=FHR>Fixed Half Rate</option></select></td></tr>';
}			
if (selformat1.value < 500) {
	htmlopt +='<tr><td>'+MSG['VOL']+'</td><td><select name=x_opt_s_volume><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 (formu.rec.value == 0 && mc_menu_service_idact != 2 && 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 == 1 || selformat.value == 8 || selformat.value==7 ) {
	  htmlopt +='<tr><td>'+MSG['ID_TAG']+' - '+MSG['ID_TITLE']+'</td><td><input type=text size=32 value="" name=x_opt_audiotag_title></td></tr>';	
	  htmlopt +='<tr><td>'+MSG['ID_TAG']+' - '+MSG['ID_ARTIST']+'</td><td><input type=text size=32 value="" name=x_opt_audiotag_artist></td></tr>';	
	  htmlopt +='<tr><td>'+MSG['ID_TAG']+' - '+MSG['ID_ALBUM']+'</td><td><input type=text size=32 value="" name=x_opt_audiotag_album></td></tr>';	
	  htmlopt +='<tr><td>'+MSG['ID_TAG']+' - '+MSG['ID_YEAR']+'</td><td><input type=text size=32 value="" name=x_opt_audiotag_year></td></tr>';	
	  htmlopt +='<tr><td>'+MSG['ID_TAG']+' - '+MSG['ID_TRACKNUM']+'</td><td><input type=text size=32 value="" name=x_opt_audiotag_track></td></tr>';	
	  htmlopt +='<tr><td>'+MSG['ID_TAG']+' - '+MSG['ID_COMMENT']+'</td><td><input type=text size=32 value="" name=x_opt_audiotag_comment></td></tr>';	
	} 		
if (selformat.value.substr(0,4) == '5100' && selformat1.value>1000 && selformat1.value<5000 ) {
		htmlopt +='<tr><td>'+MSG['ADD_NAV']+'</td><td><select name=x_opt_doc_swf_nav><option selected value="1">'+MSG['YES']+'</option><option value="">'+MSG['NO']+'</option></select></td></tr>';
	}	
if (selformat.value.substr(0,4) >= 5000 && selformat1.value>1000 && selformat1.value<5000 && selformat.value.substr(0,4) != 5100 ) {
		htmlopt +='<tr><td>'+MSG['FRAME_SEC']+'</td><td><select name=x_opt_doc_pdf_video_rate><option value="1">1 second</option><option value="0.5">2 seconds</option><option selected value="0.2">5 seconds</option><option value="0.1">10 seconds</option></select></td></tr>';
		htmlopt +='<tr><td>Video width</td><td><input name=x_opt_doc_pdf_video_taille_x type=text value=640></td></tr>';
		htmlopt +='<tr><td>Video height</td><td><input name=x_opt_doc_pdf_video_taille_y type=text value=480></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>';		  }
if (selformat.value >= 5000 && selformat.value < 6000 ) {
    if (formu.rec.value==0) {
	  htmlopt += '<tr><td>'+MSG['VNAT']+'</td><td><input type=file name=fichierat></td></tr>';
		}
		htmlopt += '<tr><td>'+MSG['VNAT_FILL']+'</td><td><select name=x_opt_v_audiotrack_fill><option value=loop>'+MSG['VNAT_FILL_LOOP']+'</option><option value=add>'+MSG['VNAT_FILL_ADD']+'</option></select></td></tr>';
		} 		
		
		
if (selformat.value >= 5000 && selformat.value < 6000 ) {
    htmlopt += '<tr><td colspan=2>&nbsp;<input type=checkbox name=x_opt_v_dispinfo value=1>&nbsp;Display input file properties</td></tr>';
}		
		
	}
	if (formu.mode.value == 1) {
	htmlopt += '<tr><td colspan=2>&nbsp;<input type=checkbox name=dozip value=1>&nbsp;'+MSG['DO_ZIP']+'</td></tr>';
	htmlopt += '<tr><td>&nbsp;<input type=checkbox name=setzippwd value=1>&nbsp;'+MSG['SET_ZIP_PWD']+'</td><td><input type=text size=8 name=passwd></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>';

}

var cmjcount = 0 ;
function checkcmjoin(cmj) {
	obj = document.getElementById("divcmjbt");
	obj2 =document.getElementById("divcmjoin");
	if (cmj.checked == false) {
		 obj.innerHTML = '';
		 cmjcount = 0;
		 obj2.innerHTML = '';
	} else {
		 cmjcount = 1;
     obj.innerHTML = '<input onclick=\'if (cmjcount<9) { cmjcount=cmjcount+1; }; addcmjfile(); \' type=button name=cmjbt1 value="+">&nbsp;<input onclick=\'if (cmjcount>1) { removecmjfile(); cmjcount=cmjcount-1; }\' type=button name=cmjbt2 value="-">';
		 for (i=1;i<10;i++ ) {		
				obj2.innerHTML += '<div id="divcmj'+i+'"><input size=96 type=file name=fichier'+i+'></div>';
     }
     for (i=2;i<10;i++ ) {		
        obj3 = document.getElementById("divcmj"+i);
        obj3.style.display = "none";
     }						
  }
}

function addcmjfile() {
   obj = document.getElementById("divcmj"+cmjcount);
   obj.style.display = "block";
}

function removecmjfile() {
   obj = document.getElementById("divcmj"+cmjcount);
   obj.style.display = "none";
}

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 ) {
	   mc_srvmenu_click(null,2,null) ;
		 form1.format1.disabled=true ;
		 printurlbox() ;
	}
	setoutput(form1.format1.value,form1.format2) ;
	setoptions(form1.format2,form1.option1,form1.format1,form1,document) ;
  setvp(form1) ;
}

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 < 6000 ) 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) ;
		settypeoutput2( csel2 , 'offoutimpress', vindex, 1016) ;
	}
	if (setoofin(csel2, vindex, 'offinmath' , 'mathlist' )) {
	settypeoutput2( csel2 , 'offoutmath', vindex, 2990) ;
	}
}

function printurlbox2(formu) {
  objfile = document.getElementById("homefile");
	size='58';
	if (formu.mode.value==-1 || formu.mode.value==-2) { size = '96'; }
	objfile.innerHTML='<input type="text" onBlur="checkurlext(form1,document)" name="urlin" value="http://" size='+size+' />';
}

function urlmode2(formu) 
{
	printurlbox2(formu) ;
	formu.format1.selectedIndex = indexByName(formu.format1,1012) ;
	setoutput(1012,formu.format2);
	setoptions(formu.format2,formu.option1,formu.format1,formu,document);
	obj = document.getElementById("vp");
  obj.style.display = 'none';			
}

function filechange(doc,form)
{
if (form.mode.value==0) { 
  testchamps2(form);
	setoptions(form.format2,form.option1,form.format1,form,doc);
  setvp(form);
}
if (form.mode.value==3) {
	 testchamps2(form);
}
}

function filemode(formu) 
{
  size = '45' ;
	if (formu.mode.value == -1) { size='96'; }
  objfile = document.getElementById("homefile");
	objfile.innerHTML='<input size='+size+' type=file name=fichier enctype="multipart/form-data" onChange="filechange(document,form1);" onblur="filechange(document,form1);" />';
	formu.format1.selectedIndex = 0 ;
  formu.format1.disabled=false ;
}

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

function setvp(formu) {
	if (formu.format2.value>=5000 && formu.format2.value<6000 && formu.format1.value>=5000 && formu.format1.value<6000) {
	  objv = document.getElementById("vp");
		objv.innerHTML = '<select onchange="changevp(this)" name=preset><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><option value=100>SONY ERICSON K750i</option><option value=101>SONY NWZ</option>';
		objv.innerHTML += '</select>';
  } else { objv = document.getElementById("vp"); objv.innerHTML = ''; }
}


