function mlPager(source){
	document.getElementById('main').src = source;
}

function mlDiv(id){
	if (document.all[id].style.display =='none'){
//		alert ('chiuso');
		document.all[id].style.display ='inline';
	} else{
//		alert ('aperto')
		document.all[id].style.display ='none';
	}
}

function mlClose(tot){
//	alert (tot);
	tot++;
	for (i=1; i<=tot; i++){
		mnu = "menu" + i;
		if (document.all[mnu] != null){
			if (i<=tot){
				document.all[mnu].style.display ='none';
			}
		}
	}
}

function mlPdf(page, dimX, dimY){
	x=screen.availWidth / 2 - (dimX / 2);
	y=screen.availHeight / 2 - (dimY / 2);
	if (page == "prospetto") {
		window.open("http://www.panariagroup.it/ir/pdf/10306_PANARIA_IT.pdf",'Panariagroup','scrollbars=no,resizable=no,width='+dimX+',height='+dimY+',status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=0,screenX=0');
	}else {
		if (dimX == 800){
			window.open(page,'Panariagroup','scrollbars=yes,resizable=no,width='+dimX+',height='+dimY+',status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=0,screenX=0');
		} else {
			window.open(page,'Panariagroup','scrollbars=no,resizable=no,width='+dimX+',height='+dimY+',status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=0,screenX=0');
		}
	}
}

function mlPopUp(page, dimX, dimY){
	x=screen.availWidth / 2 - (dimX / 2);
	y=screen.availHeight / 2 - (dimY / 2);
	if (page == "prospetto") {
		window.open("http://www.panariagroup.it/ir/pdf/10306_PANARIA_IT.pdf",'Panariagroup','scrollbars=no,resizable=no,width='+dimX+',height='+dimY+',status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=0,screenX=0');
	}else {
		if (dimX == 800){
			window.open(page,'Panariagroup','scrollbars=yes,resizable=no,width='+dimX+',height='+dimY+',status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=0,screenX=0');
		} else {
			window.open(page,'Panariagroup','scrollbars=yes,resizable=no,width='+dimX+',height='+dimY+',status=no,location=no,toolbar=no, menubar=no,top='+y+',left='+x+',screenY=0,screenX=0');
		}
	}
}

function mlReload(){
	window.opener.location.reload();
	window.close();
}

function mlConfirm(pgSi){
	action=confirm('Sei sicuro di voler cancellare il Record?');
	if (action==true){
		mlPdf(pgSi, 500, 130);
//		location = pgSi;
	}
	if (action==false){
		alert('Cancellazione Abortita');
		window.location.reload();
	}
}

function mlFormCheck(form){
	var ffocus;
	var theForm = eval ("document." + form);
	var msgErr = "";
	if (!theForm.autor.checked) {
		msgErr = "Devi dare l'autorizzazione!";
	}
	if (theForm.email.value == "") {
		msgErr = "Per piacere inserire l'indirizzo e-mail";
		ffocus = eval("document." + form + ".email");
	}
	if (theForm.ruolo.value == "") {
		msgErr = "Per piacere inserire il ruolo all'interno dell'azienda";
		ffocus = eval("document." + form + ".ruolo");
	}
	if (theForm.azienda.value == ""){
		msgErr = "Per piacere inserire l'azienda";
		ffocus = eval("document." + form + ".azienda");
	}
	if (theForm.cognome.value == ""){
		msgErr = "Per piacere inserire il cognome";
		ffocus = eval("document." + form + ".cognome");
	}
	if (theForm.nome.value == ""){
		msgErr = "Per piacere inserire il nome";
		ffocus = eval("document." + form + ".nome");
	}
	if (msgErr == "") {
		document.mailing.submit();
	} else {
		alert (msgErr);
		ffocus.focus();
//		window.location = "http://www.panariagroup.it/contatti.asp?sez=1";
	}
}
