                                  

function radio_value(el) {
  for (var i=0;i<el.length; i++) { 
	if (el[i].checked) { return el[i].value; }
  }
}
function on_vote(frm, frmlink) {
	var f0 = document.forms[frm.name];
	var a1=frmlink, a2=radio_value(f0.newchannel_survey), a3=f0.newchannel_own.value;
	window.newchannelfrm.location.href=frmlink+'&newchannel_survey='+a2+'&newchannel_own='+a3+'&surveyvote=1';
	_NCP.UserAnswer=a2; 
	setTimeout( "_NCP.ShowResults()", 2000 );
	return false;
}

function roundTo(inputNum, precision){
var guide = Math.pow(10, precision);
var inputnum = ( Math.round(inputNum * guide) / guide );
var numString = inputNum + "";
if ( numString.search(/\./) < 0 ) {
	numString += ".";	
	for ( var j =0; j<precision; j++ ) numString += "0";
}
var afterDecimal = numString.substring(numString.search(/\./) + 1);
if ( afterDecimal.length > precision ) {
	return numString.substring( 0, numString.search(/\./) + 1 + precision )
}
while (afterDecimal.length < precision) {
	afterDecimal += "0";
	numString += "0";
}
return (numString);
}

NewChannelResults.prototype.Parent = null;
NewChannelResults.prototype.Div = null;
NewChannelResults.prototype.IsActive=false;
NewChannelResults.prototype.Domain="";
NewChannelResults.prototype.classQuestion="";
NewChannelResults.prototype.classAnswer="";
NewChannelResults.prototype.classOwnAnswer="";
NewChannelResults.prototype.classVoteButton="";
NewChannelResults.prototype.classLinks="";
NewChannelResults.prototype.SurveyID="";
NewChannelResults.prototype.SurveyVotes="";
NewChannelResults.prototype.OtherVotes="";
NewChannelResults.prototype.OtherVotesPct=0;
NewChannelResults.prototype.UserAnswer=-1;
NewChannelResults.prototype.Question="";
NewChannelResults.prototype.AnswerIDs=new Array();
NewChannelResults.prototype.Answers=new Array();
NewChannelResults.prototype.AnswerVotes=new Array();
NewChannelResults.prototype.AnswerPct=new Array();
NewChannelResults.prototype.UserAnswers=new Array();

var _NCP = null;
function NewChannelResults(){
	this.Domain = "";
	this.SurveyID="5";
	this.SurveyVotes=2611;
	this.OtherVotes=27;
	this.OtherVotesPct=1.03;
	this.Question="Should sports nutrition products be regulated by the FDA?";
	this.Answers=new Array(3);
	this.AnswerIDs[0]=27; 	this.AnswerVotes[0]=650; 	this.AnswerPct[0]=24.89; this.Answers[0]="Yes";
	this.AnswerIDs[1]=28; 	this.AnswerVotes[1]=1595; 	this.AnswerPct[1]=61.09; this.Answers[1]="No";
	this.AnswerIDs[2]=29; 	this.AnswerVotes[2]=292; 	this.AnswerPct[2]=11.18; this.Answers[2]="Not Sure";
	this.UserAnswers=new Array(27);
this.UserAnswers[0]="Yes, I think certain products should be regulated, like prohormones";
this.UserAnswers[1]="No, Screw the FDA...look at how many food recalls there have  been...they are completely ineffective";
this.UserAnswers[2]="Not sure, I have never had any issue with the supplements I take";
this.UserAnswers[3]="No, its just going to raise prices!";
this.UserAnswers[4]="No, I dont need big brother telling me what to do with my body";
this.UserAnswers[5]="Yes, Should have been done 15 years ago!";
this.UserAnswers[6]="No, too much government as it is";
this.UserAnswers[7]="Not sure, I really dont know what to think.  If enough people were  getting hurt wouldnt they have done this already?";
this.UserAnswers[8]="No, I like to make my own decisions when it comes to the  supplements I purchase";
this.UserAnswers[9]="No, it will take too long for products to come out  ";
this.UserAnswers[10]="No, I dont think the products wil be as effective";
this.UserAnswers[11]="Yes, I dont trust most of these companies as far as I can throw them";
this.UserAnswers[12]="No, I dont want my results to suffer";
this.UserAnswers[13]="No, the FDA is most useless agency on the face of the earth";
this.UserAnswers[14]="No, companies are already liable for their products so its all good";
this.UserAnswers[15]="Yes, there are plenty of companies that I trust but there are so  many new companies its hard to keep up with what is quality and what  is not";
this.UserAnswers[16]="Not sure, I dont think it really matters either way, I would still  buy supplements";
this.UserAnswers[17]="No, it will hinder research and development";
this.UserAnswers[18]="Yes, I have teenagers in sports and I want to make sure they are safe";
this.UserAnswers[19]="No, bodybuilding has been a part of my life for over a decade and  I truly believe in the health and safety of everything I take.  It not  only improves my physique but also my well-being";
this.UserAnswers[20]="No, I believe in free market capitalism";
this.UserAnswers[21]="No, I dont believe in any of this hype about dangerous  supplements!  Everything I take is safe and effective which Im sure  would change if it was FDA regulated";
this.UserAnswers[22]="Not sure, I think it should be regulated case by case";
this.UserAnswers[23]="no";
this.UserAnswers[24]="Hi Joe.  Love, Suril";
this.UserAnswers[25]="All you people are idiots! Screw the FDA.Signed, Barry Bonds";
this.UserAnswers[26]="To a certain extent";
	this.IsActive=true;
	_NCP = this;
}
NewChannelResults.prototype.gid=function(id){
	var d=document; if(d.getElementById){return d.getElementById(id);}else if(d.all){return d.all[id];}else if(d.layers){return d.layers[id];}
	return null;
}
NewChannelResults.prototype.cl = function(cls) {
	if(cls=="")return "";return " class="+cls;
}
NewChannelResults.prototype.DisplayResults=function(parent) {
	var div = document.createElement("div");                     
	var o = "";

	o += "<b"+this.cl(this.classQuestion)+">" + this.Question + "</B>";
	for ( var i=0; i<this.AnswerIDs.length; i++ ) {
		var pct = parseInt( this.AnswerPct[i] );

		o += "<div style='margin-top:5px;'"+this.cl(this.classAnswer)+"><B>"+this.Answers[i]+"</B> &nbsp;"
		   + this.AnswerPct[i] + "%, <span style='font-size:9px;color:gray'>("+this.AnswerVotes[i]+" votes)</span>"
		   + "<table width=95% cellspacing=0 cellpadding=0 style='height:6px;border:1px #bcbcbc solid'><TR>";
		if ( pct > 0 ) o += "<TD width=" + parseInt(pct) + "% bgcolor=red style='font-size:4px;'>&nbsp;</TD>";
		if ( pct < 100 ) o += "<TD width=" + parseInt(100-pct) + "% bgcolor=white style='font-size:4px;'>&nbsp;</TD>";
		o += "</TR></TABLE>";
		   + "</div>\n";
	}
	if ( this.OtherVotes > 0 ) {
		pct = this.OtherVotesPct;
		o += "<div style='margin-top:5px;'"+this.cl(this.classAnswer)+"><B>Own Answer</B> &nbsp;"
		   + pct + "%, <span style='font-size:9px;color:gray'>("+this.OtherVotes+" votes)</span>"
		   + "<table width=95% cellspacing=0 cellpadding=0 style='height:6px;border:1px #bcbcbc solid'><TR>";
		if ( pct > 0 ) o += "<TD width=" + parseInt(pct) + "% bgcolor=red style='font-size:4px;'>&nbsp;</TD>";
		if ( pct < 100 ) o += "<TD width=" + parseInt(100-pct) + "% bgcolor=white style='font-size:4px;'>&nbsp;</TD>";
		o += "</TR></TABLE>";
		   + "</div>\n";
	}
	for ( var i=0; i<this.UserAnswers.length; i++ ) {
		o += "<div style='margin-top:5px;'"+this.cl(this.classOwnAnswer)+"><B>"+this.UserAnswers[i]+"</B></div>\n";
	}

	
	div.innerHTML = o; this.Div = div; this.Parent = parent;
	parent.appendChild( div );
}
