function popUP(mypage)
{
	winprops = 'menubar=no,status=no,height=180,width=350,left=' + ((screen.width - 350) / 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 getsv(form) {

	var sv = '';
	sv = vserv; 
	return sv;

}

function p_init(lang) {
	var chars = "0123456789abcdefghiklmnopqrstuvwxyz";
	var string_length = 26;
	var randomstring = '';
	var srv = getsv(document.formmc)+'.media-convert.com';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	document.formmc.sid.value = randomstring;
	document.formmc.action = 'http://'+srv+'/cgi-bin/mcupload2.cgi?sid=' + randomstring +'&lg=' + lang;
	
  setintype(document.formmc.format1);
  setouttype(document.formmc.format2);	
}

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_startupload(formulaire)
{
  var srv = getsv(formulaire)+'.media-convert.com';
	baseUrl = 'http://'+srv+'/mcbar.php';
	sid = formulaire.sid.value;
	iTotal = escape("-1");
	baseUrl += "?iTotal=" + iTotal;
	baseUrl += "&iRead=0";
	baseUrl += "&iStatus=1";
	baseUrl += "&sessionid=" + sid;
	popUP(baseUrl);
	formulaire.submit();
}