function utf8_encode ( str_data ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // *   example 1: utf8_encode('Kevin van Zonneveld');
    // *   returns 1: 'Kevin van Zonneveld'
 
    str_data = str_data.replace(/\r\n/g,"\n");
    var utftext = "";
 
    for (var n = 0; n < str_data.length; n++) {
        var c = str_data.charCodeAt(n);
        if (c < 128) {
            utftext += String.fromCharCode(c);
        } else if((c > 127) && (c < 2048)) {
            utftext += String.fromCharCode((c >> 6) | 192);
            utftext += String.fromCharCode((c & 63) | 128);
        } else {
            utftext += String.fromCharCode((c >> 12) | 224);
            utftext += String.fromCharCode(((c >> 6) & 63) | 128);
            utftext += String.fromCharCode((c & 63) | 128);
        }
    }
 
    return utftext;
}
function validateAnswers(f)
	{
		var msg="Please select an option to participate in the poll."
		var mCtr=0;
		var optionname = f;
			//for rdio and textboxes
			var o=document.getElementById(optionname).getElementsByTagName('input');
			var ctr=0;
			for(var j=0;j<o.length;j++)
			{
				//alert(p[j].type);
				if (o[j].type == "radio" || o[j].type == "checkbox")
				{
					if(o[j].checked)
					{

						ctr++;
							break;
						
					}
				}
			}
			
			
			if(ctr==0)
			{
				mCtr++; msg;
			}
		
		if(mCtr>0)
		{
			alert(trim(msg).substring(trim(msg).length-1,0));return false;
		}
		return true;
	}


function trim(str){
	return str.replace(/^\s+|\s+$/g,'');
}

function postquestion(){
	var postquestion = trim(document.postpoll.post_question.value);
	if((postquestion=='type your question here...') || (postquestion=='')){
		alert("Please enter your question.");
		document.postpoll.post_question.value="";
		document.postpoll.post_question.focus();
		return false;
	}else{
		return;
	}
}