	function didAnswer(obj) {
		var lenght=obj.length;
		for(var x =0;x<lenght;x++){
			if(obj[x].checked){
				return true;
			}
		}
		return false;
	}
	
	function validateForm(formObj,lang){														
		if(!didAnswer(formObj.elements["answer"])){
			if(lang=="f"){
				alert("Vous n'avez pas répondu au sondage");
			}else{
				alert("You didn't answer the poll");
			}			
			return false;
		}else{
			return true;
		}		
	}
	
	function validateMultipleQ(formObj,lang){
		var msg;
		var valid=true;
		var amount=eval(formObj.amount.value);
		if(lang=="f"){							
			msg="Vous n'avez pas répondu à la question ";		
		} else {
			msg="You didn't answer question ";		
		}
		for(var x=1;(x<=amount);x++){				
			if(!didAnswer(formObj.elements["answer"+x])){
				if(valid){
					msg=msg+x;
				}else {
					msg=msg+","+x;
				}
				valid=false;
			}
		}
		if(!valid){
			alert(msg);			
		}
		return valid;
	}

	function submitMe(formObj,lang,width,height)
	{  
		if(validateForm(formObj,lang)){
		    popup = window.open("","results","toolbar=no,scrollbars=yes,width="+width+",height="+height+",resizable=yes");
		    formObj.target = 'results';
		    popup.document.close();
		    return true;
		 }else{
			 return false;
		 }
	}

	
	function submitNoValidation(formObj,width,height)
	{  		
		popup = window.open("","results","toolbar=no,scrollbars=yes,width="+width+",height="+height+",resizable=yes");
		formObj.target = 'results';
		popup.document.close();
		return true;
	}
	function viewResults(formObj,width,height)
	{  
		popup = window.open("","results","toolbar=no,scrollbars=yes,width="+width+",height="+height+",resizable=yes");
		formObj.target = 'results';
		popup.document.close();
		formObj.submit();
	}		
			
