	function checkOrder(msgKo){
		var payment=getCheckedValue(document.mainForm.pagamento);
		if(payment==""){
			alert(msgKo);
			return false;
		}else{
			return true;
		}
			
	}

	function message(msg){
		alert(msg);
		return false;
	}
	function passwordRequest(emailFieldId){
		emailField=xGetElementById(emailFieldId);
		if(check_email(emailField.value)){
			tmpWin=window.open('send_password.php?email=' + emailField.value,'','width=1 height=1');
			//alert('La password è stata inviata all\'indirizzo richiesto.');
			tmpWin.close();
			alert('La password è stata inviata all\'indirizzo e-mail specificato');
		}else{
			alert('Inserisci il tuo indirizzo e-mail nel campo Username');
		}
	}
	
	function getCheckedValue(radioObj) {
		if(!radioObj)
			return "";
		var radioLength = radioObj.length;
		if(radioLength == undefined)
			if(radioObj.checked)
				return radioObj.value;
			else
				return "";
		for(var i = 0; i < radioLength; i++) {
			if(radioObj[i].checked) {
				return radioObj[i].value;
			}
		}
		return "";
	}
	
	function check_email(e){
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		return (filter.test(e));
	}


	function trim(inputString) {
	   // Removes leading and trailing spaces from the passed string. Also removes
	   // consecutive spaces and replaces it with one space. If something besides
	   // a string is passed in (null, custom object, etc.) then return the input.
	   if (typeof inputString != "string") { return inputString; }
	   var retValue = inputString;
	   var ch = retValue.substring(0, 1);
	   while (ch == " ") { // Check for spaces at the beginning of the string
	      retValue = retValue.substring(1, retValue.length);
	      ch = retValue.substring(0, 1);
	   }
	   ch = retValue.substring(retValue.length-1, retValue.length);
	   while (ch == " ") { // Check for spaces at the end of the string
	      retValue = retValue.substring(0, retValue.length-1);
	      ch = retValue.substring(retValue.length-1, retValue.length);
	   }
	   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
	      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
	   }
	   return retValue; // Return the trimmed string back to the user
	} // Ends the "trim" function		

	function check_data(){
		var name=document.info_form.nome_cognome.value;
		var email=document.info_form.email.value;
		var servizio=document.info_form.servizio.value;
		if(!servizio||(trim(servizio)=='')){
			alert('Il campo "Servizio Richiesto" è obbligatorio');
			return false;
		}
		if(!name||(trim(name)=='')){
			alert('Il campo "Nome" è obbligatorio');
			return false;
		}
		if(!check_email(email)){
			alert('Il campo "Email" è obbligatorio');
			return false;
		}
	}
	
	function hideSellerDetail(){
		xDisplay('seller_detail','none');
	}
	
	function showSellerDetail(){
		xDisplay('seller_detail','block');
	}
