	function ex_con (elm) {
		
		ob = document.getElementById(elm);
		
		if (ob.style.display=='none') {
			
				ob.style.display='block';
			
			
		} else {
				
			ob.style.display='none';			
				
		}
	
	}
	
	
	
	function add_image() {
		
		bierre1 = document.createElement("br");
		bierre2 = document.createElement("br");
		bierre3 = document.createElement("br");
		bierre4 = document.createElement("br");
		bierre5 = document.createElement("br");
		bierre6 = document.createElement("br");
		bierre7 = document.createElement("br");
		bierre8 = document.createElement("br");
		bierre9 = document.createElement("br");
	
		input = document.createElement("input");
  		input.setAttribute("type", "file");
  		input.setAttribute("name", 'gallery[]');
		
		input2 = document.createElement("textarea");
		input2.setAttribute("name", 'description_photo_it[]');
		input2.setAttribute("id", 'description_photo_it');
		input2.setAttribute("cols", '26');
		
		input3 = document.createElement("textarea");
		input3.setAttribute("name", 'description_photo_en[]');
		input3.setAttribute("id", 'description_photo_en');
		input3.setAttribute("cols", '26');
		
		/*input4 = document.createElement("textarea");
		input4.setAttribute("name", 'description_photo_fr[]');
		input4.setAttribute("id", 'description_photo_fr');
		input4.setAttribute("cols", '26');
		*/
		input5 = document.createElement("input");
		input5.setAttribute("type", "text");
		input5.setAttribute("name", 'priority_photo[]');
		input5.setAttribute("id", 'priority_photo');
		input5.setAttribute("size", '3');
		
		cont = document.createElement("div");
		cont.className='minibox';
		cont.appendChild(input);
		
		cont.appendChild(bierre1);
		
		var txt = document.createTextNode("Descrizione (Italiano)");
		cont.appendChild(txt);
		cont.appendChild(bierre2);
		cont.appendChild(input2);
		cont.appendChild(bierre3);		
		cont.appendChild(bierre4);	
		
		var txt2 = document.createTextNode("Descrizione (Inglese)");
		cont.appendChild(txt2);
		cont.appendChild(bierre5);	
		cont.appendChild(input3);
		cont.appendChild(bierre6);
		cont.appendChild(bierre7);	
		/*
		var txt3 = document.createTextNode("Descrizione (Francese)");
		cont.appendChild(txt3);
		cont.appendChild(bierre8);	
		cont.appendChild(input4);
		cont.appendChild(bierre9);	
		*/
		var txt4 = document.createTextNode("Priorità");
		
		cont.appendChild(input5);
		cont.appendChild(txt4);
		
		document.getElementById('block_one').appendChild(cont);
		++document.getElementById('n_up').value;
	
	}
	
	
	
	function add_email() {
		
		++document.getElementById('counter').value;
		var amnt = document.getElementById('counter').value;
		
		pi = document.createElement("p");
		testo = document.createTextNode("Indirizzo e-mail ");
		testo1 = document.createTextNode("Attivo? ");
		testo2 = document.createTextNode(" Si ");
		testo3 = document.createTextNode(" | No ");
		bierre = document.createElement("br");
		//testo6 = document.createTextNode(" Fra ");
	
		input = document.createElement("input");
		input.setAttribute("type", "text");
		input.setAttribute("id", 'email_addr');
		input.setAttribute("name", 'email_addr['+amnt+']');
		
		input2 = document.createElement("input");
		input2.setAttribute("type", "radio");
		input2.setAttribute("name", 'enabled['+amnt+']');
		input2.setAttribute("id", 'enabled');
		input2.setAttribute("value", 'y');
		input2.setAttribute("checked", 'checked');
		
		input3 = document.createElement("input");
		input3.setAttribute("type", "radio");
		input3.setAttribute("name", 'enabled['+amnt+']');
		input3.setAttribute("id", 'enabled');
		input3.setAttribute("value", 'n');
		
		
		/*
		input6 = document.createElement("input");
		input6.setAttribute("type", "radio");
		input6.setAttribute("name", 'language['+amnt+']');
		input6.setAttribute("id", 'language');
		input6.setAttribute("value", 'fr');
		*/
		
		
		pi.appendChild(testo);	
		pi.appendChild(input);
		pi.appendChild(bierre);
		pi.appendChild(testo1);
		pi.appendChild(testo2);
		pi.appendChild(input2);
		pi.appendChild(testo3);
		pi.appendChild(input3);
		//pi.appendChild(testo6);
		//pi.appendChild(input6);
				
		document.getElementById('block_one').appendChild(pi);		
			
	}
	
	function add_user() {
		
		++document.getElementById('counter').value;
		var amnt = document.getElementById('counter').value;
		
		pi = document.createElement("p");
		testo = document.createTextNode("Username ");
		testo1 = document.createTextNode("Password ");
		testo2 = document.createTextNode("Attivo? ");
		testo3 = document.createTextNode(" Si ");
		testo4 = document.createTextNode(" | No ");
		bierre = document.createElement("br");
		bierre2 = document.createElement("br");
	
		input = document.createElement("input");
		input.setAttribute("type", "text");
		input.setAttribute("id", 'cdm_usr');
		input.setAttribute("name", 'cdm_usr['+amnt+']');
		
		input2 = document.createElement("input");
		input2.setAttribute("type", "text");
		input2.setAttribute("id", 'cdm_pwd');
		input2.setAttribute("name", 'cdm_pwd['+amnt+']');
		
		input3 = document.createElement("input");
		input3.setAttribute("type", "radio");
		input3.setAttribute("name", 'enabled['+amnt+']');
		input3.setAttribute("id", 'enabled');
		input3.setAttribute("value", 'y');
		input3.setAttribute("checked", 'checked');
		
		input4 = document.createElement("input");
		input4.setAttribute("type", "radio");
		input4.setAttribute("name", 'enabled['+amnt+']');
		input4.setAttribute("id", 'enabled');
		input4.setAttribute("value", 'n');
		
		pi.appendChild(testo);	
		pi.appendChild(input);
		pi.appendChild(bierre);
		pi.appendChild(testo1);
		pi.appendChild(input2);
		pi.appendChild(bierre2);
		pi.appendChild(testo2);
		pi.appendChild(testo3);
		pi.appendChild(input3);
		pi.appendChild(testo4);
		pi.appendChild(input4);
				
		document.getElementById('block_one').appendChild(pi);		
			
	}
	
		
	function alertme(elm, dst){
		
		var who = document.getElementById(elm);
		var num = who.selectedIndex;
		var dest = document.getElementById(dst);
		
		var maid = document.getElementById('mac_id');
		var miid = document.getElementById('mic_id');
		
		var sop = '<select name="microcat" id="microcat" onchange="assignme(this)"><option value=""> --- selezionare --- </option>';
		var scl = '</select>';
		 
		switch (num){
			 
			 case 1:			 
			 
			 
			 dest.innerHTML = sop+"<option value=\"1\">1. RETTIFICATRICI</option><option value=\"2\">2. SMUSSATRICI</option><option value=\"3\">3. LUCIDATRICI</option>"+scl;
			 
			 maid.value = 1;
			 miid.value = 1;
			 
			 
			 break;
			 
			 
			 case 2:
			 
			 dest.innerHTML = sop+"<option value=\"4\">1. RISCALDATRICI PIEGATRICI</option><option value=\"5\">2. PIEGATRICI AUTOMATICHE</option><option value=\"6\">3. BANCHI DIMA</option>"+scl;
			 
			 maid.value = 2;
			 miid.value = 4;
			 
			 break;
			 
			 
			 case 3:
			 
			 dest.innerHTML = "";
			 
			 maid.value = 3;
			 miid.value = "";
			 
			 break;
			 
			 
			 case 4:
			 
			 dest.innerHTML = "";
			 
			 maid.value = 4;
			 miid.value = "";
			 
			 break;
			 
			 
			 case 5:
			 
			 dest.innerHTML = "";
			 
			 maid.value = 5;
			 miid.value = "";
			 
			 break;
			 
			  case 6:
			 
			 dest.innerHTML = "";
			 
			 maid.value = 6;
			 miid.value = "";
			 
			 break;		
			 
		}
		
	}	
	
	
	
	function assignme(elm){
		
		var num = elm.selectedIndex;		
		var miid = document.getElementById('mic_id');	 
		
		miid.value = elm.options[num].value;
	}
	
	
	
	function yes_no (elm, val){
		
		var obj = document.getElementById(elm);		
		obj.value = val;
		
	}
	
	
	function antispam() {
		
		var transitory = document.getElementById('transitory');
		var email_addr = document.getElementById('email_addr');
		
		var scode = "73b56210e26c1505e79b6584e1b8992a";
		
		transitory.value = scode+email_addr.value;
		
		if (transitory.value == scode+email_addr.value) {
			
			document.forms['nwform'].submit();
			
		}
		
	}
	
	function checkform_contact_it() {
		
		var transitory2 = document.getElementById('transitory2');
		var scode = "73b56210e26c1505e79b6584e1b8992a";
		
		var regex =/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;
		
		var name = document.getElementById('name');
		var surname = document.getElementById('surname');
		var company = document.getElementById('company');
		var phone = document.getElementById('phone');
		var email_address = document.getElementById('email_address');
		var address = document.getElementById('address');
		var country = document.getElementById('country');
		var product = document.getElementById('product');
		
		if (name.value == '') {
			
			alert ('"Nome" \350 un campo obbligatorio.');
			return false;
			
		}
		
		if (surname.value == '') {
			
			alert ('"Cognome" \350 un campo obbligatorio.');
			return false;
		}
		
		if (company.value == '') {
			
			alert ('"Societ\340" \350 un campo obbligatorio.');
			return false;
			
		}
		
		if (phone.value == '') {
			
			alert ('"Telefono" \350 un campo obbligatorio.');
			return false;
			
		}
		
		if (email_address.value == '') {
			
			alert ('"e-mail" \350 un campo obbligatorio.');
			return false;
			
		}
		
		if (!email_address.value.match(regex)) {
			
			alert ('Formato e-mail non valido.');
			return false;
			
		}		
		
		if (address.value == '') {
			
			alert ('"Indirizzo" \350 un campo obbligatorio.');
			return false;
			
		}
		
		if (country.value == '') {
			
			alert ('"Nazione" \350 un campo obbligatorio.');
			return false;
			
		}
		
		transitory2.value = scode+email_address.value+name.value;		
				
		if (transitory2.value == scode+email_address.value+name.value) {
			
			document.forms['cform'].submit();
			
		}
		
	}
	
	function checkform_contact_en() {
		
		var transitory2 = document.getElementById('transitory2');
		var scode = "73b56210e26c1505e79b6584e1b8992a";
		
		var regex =/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;
		
		var name = document.getElementById('name');
		var surname = document.getElementById('surname');
		var company = document.getElementById('company');
		var phone = document.getElementById('phone');
		var email_address = document.getElementById('email_address');
		var address = document.getElementById('address');
		var country = document.getElementById('country');
		var product = document.getElementById('product');
				
		if (name.value == '') {
			
			alert ('"Name" is required.');
			return false;
			
		}
		
		if (surname.value == '') {
			
			alert ('"Surname"  is required.');
			return false;
		}
		
		if (company.value == '') {
			
			alert ('"Company" is required.');
			return false;
			
		}
		
		if (phone.value == '') {
			
			alert ('"Phone" is required.');
			return false;
			
		}
		
		if (email_address.value == '') {
			
			alert ('"e-mail" is required.');
			return false;
			
		}
		
		if (!email_address.value.match(regex)) {
			
			alert ('Wrong e-mail format.');
			return false;
			
		}
		
		if (address.value == '') {
			
			alert ('"Address" is required.');
			return false;
			
		}
		
		if (country.value == '') {
			
			alert ('"Country" is required.');
			return false;
			
		}
		
				
		transitory2.value = scode+email_address.value+name.value;	
		
		if (transitory2.value == scode+email_address.value+name.value) {
			
			document.forms['cform'].submit();
			
		}
		
	}
	
	function checkform_contact_fr() {
		
		var transitory2 = document.getElementById('transitory2');
		var scode = "73b56210e26c1505e79b6584e1b8992a";
		
		var regex =/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;
		
		var name = document.getElementById('name');
		var surname = document.getElementById('surname');
		var company = document.getElementById('company');
		var phone = document.getElementById('phone');
		var email_address = document.getElementById('email_address');
		var product = document.getElementById('product');
		
		if (name.value == '') {
			
			alert ('"Nom" est obligatoire.');
			return false;
			
		}
		
		if (surname.value == '') {
			
			alert ('"Prenom" est obligatoire.');
			return false;
		}
		
		if (company.value == '') {
			
			alert ('"Compagnie" est obligatoire.');
			return false;
			
		}
		
		if (phone.value == '') {
			
			alert ('"Telephone" est obligatoire.');
			return false;
			
		}
		
		if (email_address.value == '') {
			
			alert ('"e-mail" est obligatoire.');
			return false;
			
		}
		
		if (!email_address.value.match(regex)) {
			
			alert ('Mauvais format de mail.');
			return false;
			
		}
		
		transitory2.value = scode+email_address.value+name.value;
		
		if (transitory2.value == scode+email_address.value+name.value) {
			
			document.forms['cform'].submit();
			
		}
		
	}
	
	
	
	function check_nwl_addr(lan){		
				
		var frm = document.forms['nwform'];
		var email_addr = document.getElementById('email_addr');
		var regex =/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;
		
		if (!email_addr.value.match(regex)) {
			
			switch(lan){
				
				case 'it':
				alert ('Formato e-mail non valido.');
				return false;
				
				case 'en':
				alert ('Wrong e-mail format.');
				return false;	
				
				/*
				case 'it':
				alert ('Mauvais format de mail.');
				return false;
				*/
				
			}
			
		}
		
		frm.submit();
		return true;
		
	}
	
	
	
	function validate_nwsl (val){
		
		var obj = document.getElementById('send_y_n');
		obj.value = val;				
		
	}
	
	function add_subgroup(gid, macid){
		
		var subgroup = document.getElementById(gid);
		
		var sg = document.createElement("div");
		sg.className = 'subgroup';
		
		
		var clear = document.createElement("div");
		clear.className = 'clear';
		
		var label = document.createTextNode('Sottogruppo "');
		var label2 = document.createTextNode('"');
		
		var input = document.createElement("input");
		input.setAttribute("type", "text");
		input.setAttribute("name", "nw_ng_mic_name[]");
		input.setAttribute("value", "");
		
		var input2 = document.createElement("input");		
		input2.setAttribute("type", "hidden");
		input2.setAttribute("name", "nw_ng_mac_id[]");
		input2.setAttribute("value", macid);
		
		
		
		
		sg.appendChild(label);
		sg.appendChild(input);
		sg.appendChild(label2);
		sg.appendChild(input2);
		
		
		subgroup.appendChild(sg);
		subgroup.appendChild(clear);	
		
	}
	
	
	
	function add_new_subgroup(gid){
		
		var subgroup = document.getElementById(gid);
		
		var sg = document.createElement("div");
		sg.className = 'subgroup';		
		
		var clear = document.createElement("div");
		clear.className = 'clear';
		
		var label = document.createTextNode('Sottogruppo "');
		var label2 = document.createTextNode('"');
		
		var input = document.createElement("input");
		input.setAttribute("type", "text");
		input.setAttribute("name", "ng_mic_name[]");
		input.setAttribute("value", "");	
		
		
		sg.appendChild(label);
		sg.appendChild(input);
		sg.appendChild(label2);
		
		
		subgroup.appendChild(sg);
		subgroup.appendChild(clear);	
		
	}

