function noChartImage() {
	document.getElementById("views").style.display="none";
	if(document.getElementById("research")){
		showTab("research");
	} else {
		showTab("respond");
	}
}

var currentIssue="";

function loadSpotlightOnIssuesPage(uid) {
currentIssue=uid;
if(uid.length==0){
return;
}

getChart(uid);


}

function loadSpotlight(uid){

if(browser.isIE5xMac){
alert("Dear Macintosh Internet Explorer user,\n\nWhile every effort has been made to ensure the Senator Brown web site is accessible to all browsers there are some areas that just couldn't be made to work in Internet Explorer for the Mac including a feature on this page. All content is still accessible to you, there are just some advanced features that will not work. Please take a moment to upgrade to a modern browser such as Apple's own Safari, Mozilla Firefox or for OS 9 users check out iCab. We apologize for any inconvenience.");
return;
}
currentIssue=uid;
if(uid.length==0){
return;
}
getIssueTitle(uid);
}
function getIssueTitle(uid){
params="uid="+uid;
cfcPath="/extensions/cfcs/com/creativengine/issue.cfc?method=getIssueByUID";
http("POST",cfcPath,writeIssueTitle,params);
}
function writeIssueTitle(obj){
if(document.getElementById("issueTitle")){
document.getElementById("issueTitle").innerHTML=obj.getField(0,"issue_title");
document.getElementById("issueSummary").innerHTML=obj.getField(0,"issue_summary");
image_path=obj.getField(0,"banner_image");
if(image_path!=null&&image_path!=""){
document.getElementById("issueImage").src=obj.getField(0,"banner_image");
document.getElementById("issueBannerContainer").style.display="";
}else{
document.getElementById("issueBannerContainer").style.display="none";
}
document.getElementById("factsHeader").innerHTML="Facts about "+obj.getField(0,"issue_title");
}
document.getElementById("issue_uid").value=currentIssue;
document.getElementById("issue_name").value=obj.getField(0,"issue_title");
getChart(obj.getField(0,"uid"));
}
function getChart(uid){
params="content_uid="+uid;
cfcPath="/extensions/cfcs/com/creativengine/your_views_data.cfc?method=getYourViewsAsWDDX";
//alert("calling get chart: " + cfcPath);
http("POST",cfcPath,writeChart,params);
}
function writeChart(obj){
var _98=site_webroot+"images/media/charts/"+currentIssue+"_chart.png";
if(obj.getRowCount()>0){
document.getElementById("graph").src=_98;
document.getElementById("views").style.display="block";
showTab("views");
}else{
noChartImage();
}
getFeedback(currentIssue);
}
function getFeedback(uid){
params="uid="+uid;
cfcPath="/extensions/cfcs/com/creativengine/feedback_data.cfc?method=getFeedbackForIssue";
http("POST",cfcPath,writeFeedback,params);
}
function writeFeedback(obj){
var _9b="";
if(obj.getRowCount()>0){
for(j=0;j<obj.getRowCount();j++){
_9b+="<blockquote><p>&quot;"+obj.getField(j,"comment")+"&quot;</p></blockquote>";
_9b+="<cite> - "+obj.getField(j,"name")+", "+obj.getField(j,"city")+", "+obj.getField(j,"state")+"</cite>";
}
document.getElementById("feedback").innerHTML=_9b;
document.getElementById("feedback").style.display="";
}else{
document.getElementById("feedback").style.display="none";
}
getKeyFacts(currentIssue);
}
function getKeyFacts(uid){
params="content_uid="+uid;
cfcPath="/extensions/cfcs/com/creativengine/key_facts_data.cfc?method=getKeyFactsAsWDDX";
http("POST",cfcPath,writeKeyFacts,params);
}
function writeKeyFacts(obj){
var _9e="";
if(obj.getRowCount()>0){

//for(j=0;j<obj.getRowCount();j++){ print all
for(j=0;j<3;j++){ //only print 3
_9e+="<li>"+obj.getField(j,"fact")+"</li>";
}
document.getElementById("keyFactsList").innerHTML=_9e;
document.getElementById("keyFacts").style.display="";
}else{
document.getElementById("keyFacts").style.display="none";
}
getSenatorsPositionLinks(currentIssue);
}
function getSenatorsPositionLinks(uid){
params="content_uid="+uid;
cfcPath="/extensions/cfcs/com/creativengine/senators_position_data.cfc?method=getSenatorsPositionAsWDDX";
http("POST",cfcPath,writeSenatorsPositionLinks,params);
}
function writeSenatorsPositionLinks(obj){
var _a1="";
_a1+="<li><a class='internal' href='"+site_webroot+"issues_and_agenda/issue.cfm?id="+currentIssue+"'>Read the Senator's full position on this Issue</a></li>";
if(obj.getField(0,"press_releases")==1){
_a1+="<li><a class='internal' href='"+site_webroot+"newsroom/press_releases.cfm?id="+currentIssue+"'>Press Releases about this Issue</a></li>";
}
if(obj.getField(0,"statements")==1){
_a1+="<li><a class='internal' href='"+site_webroot+"newsroom/statements.cfm?id="+currentIssue+"'>Floor Statements about this Issue</a></li>";
}
if(obj.getField(0,"speeches")==1){
_a1+="<li><a class='internal' href='"+site_webroot+"newsroom/speeches.cfm?id="+currentIssue+"' Senator's speeches on this Issue</a></li>";
}
document.getElementById("senatorsPosition").innerHTML=_a1;
document.getElementById("senatorsPosition").style.display="";
getRelatedNews(currentIssue);
}
function getRelatedNews(uid){
params="content_uid="+uid;
params+="&limit=3";
cfcPath="/extensions/cfcs/com/creativengine/news_data.cfc?method=getRelatedNewsAsWDDX";
http("POST",cfcPath,writeRelatedNews,params);
}
function writeRelatedNews(obj){
var _a4="";
if(obj.getRowCount()>0){
for(j=0;j<obj.getRowCount();j++){
_a4+="<li><a class='external' href='"+site_webroot+obj.getField(j,"local_url")+"'>"+obj.getField(j,"title")+"</a>&nbsp;<span class='source'>["+obj.getField(j,"source_name")+"]</span></li>";
}
document.getElementById("relatedNews").innerHTML=_a4;
document.getElementById("relatedNews").style.display="";
document.getElementById("relatedNewsHeader").style.display="";
}else{
document.getElementById("relatedNews").style.display="none";
document.getElementById("relatedNewsHeader").style.display="none";
}
}
function validateEmail(str){
var at="@";
var dot=".";
var lat=str.indexOf(at);
var _a9=str.length;
var _aa=str.indexOf(dot);
if(str.indexOf(at)==-1){
return false;
}
if(str.indexOf(at)==-1||str.indexOf(at)==0||str.indexOf(at)==_a9){
return false;
}
if(str.indexOf(dot)==-1||str.indexOf(dot)==0||str.indexOf(dot)==_a9){
return false;
}
if(str.indexOf(at,(lat+1))!=-1){
return false;
}
if(str.substring(lat-1,lat)==dot||str.substring(lat+1,lat+2)==dot){
return false;
}
if(str.indexOf(dot,(lat+2))==-1){
return false;
}
if(str.indexOf(" ")!=-1){
return false;
}
return true;
}
function sendFeedback(){
if(document.getElementById("name").value==""){
alert("you must enter your name to submit feed back");
document.getElementById("name").focus();
return;
}
if(document.getElementById("email").value==""){
alert("you must enter your email to submit feed back");
document.getElementById("email").focus();
return;
}
if(!validateEmail(document.getElementById("email").value)){
alert("you must enter a valid email address");
document.getElementById("email").focus();
return;
}
if(document.getElementById("zipCode").value==""){
alert("you must enter your zip code to submit feed back");
document.getElementById("zipCode").focus();
return;
}
if(document.getElementById("zipCode").length<5){
alert("you must enter an actual zip code to submit feed back");
document.getElementById("zipCode").focus();
return;
}
var _ab;
if(document.getElementById("opt1").checked==true){
_ab="I Agree";
}
if(document.getElementById("opt2").checked==true){
_ab="I Disagree";
}
params="name="+document.getElementById("name").value;
params+="&email="+document.getElementById("email").value;
params+="&zipCode="+document.getElementById("zipCode").value;
params+="&comments="+document.getElementById("comments").value;
params+="&position="+_ab;
params+="&agreeToPublish="+document.getElementById("agreeToPublish").value;
params+="&issue_uid="+document.getElementById("issue_uid").value;
params+="&issue_name="+document.getElementById("issue_name").value;
params+="&senders_ip=<cfoutput>#CGI.REMOTE_ADDR#</cfoutput>";
//alert(params);
cfcPath="/extensions/cfcs/com/creativengine/send_your_views.cfc?method=sendEmail";
http("POST",cfcPath,showFeedbackStatus,params);
}
function showFeedbackStatus(){
document.getElementById("feedbackSubmitted").style.display="";
document.getElementById("feedbackForm").style.display="none";
}