|
"A comprehensive, collaborative elections resource."
|
SC US Senate - R Primary
|
Parents |
> United States > South Carolina > Senate Class II
|
Office | Senate |
Honorific | Senator - Abbr: Sen. |
Type | Republican Primary Election |
Filing Deadline | March 01, 2008 - 12:00pm Central |
Polls Open | June 10, 2008 - 07:00pm Central |
Polls Close | June 10, 2008 - 07:00pm Central |
Term Start | January 03, 2009 - 12:00pm |
Term End | January 03, 2015 - 12:00pm |
Contributor | SC-Conservative |
Last Modified | RBH July 12, 2020 01:40am |
Data Sources | [Link] |
Description |
|
|
| "+compare[map][i]['RDate']+" | \n";
offices[compare[map][i]['OfficeID']]=compare[map][i]['Office'];
}
$('#CompareOfficePopup').html(html+" \n");
$('#CompareOfficePopup').show();
$('#CompareOfficeChange').show();
}
function compareOfficesSelect(office,thedate) {
var msel=document.getElementById('ViewMap');
var map=msel.value;
map=parseInt(map.substr(1));
$('#CompareOfficePopup').hide();
$('#MapCompareOffice').val(office);
$('#MapCompareDate').val(thedate);
$('#CompareOfficeChange').val(offices[office]+' - '+thedate+' - Change');
if (officeload[map][office] == undefined) {
$.getJSON('https://www.ourcampaigns.com/ajax/OfficeSubDataJSON.php?OfficeID='+office+'&MapImageID='+map+'&PollDate='+encodeURIComponent(thedate), function(data){
for(var i in data['race']) {
var d=data['race'][i];
racesubs[map][d['RaceID']]=d;
}
officeload[map][office]=true;
viewMapChange();
redoMap(curView);
});
} else {
viewMapChange();
redoMap(curView);
}
}
function viewMapChange() {
var msel=document.getElementById('ViewMap');
var map=msel.value;
var newType=map.substr(0,1);
if (curType == 'V' || curType == 'P') {
//alert('Old GMap display none');
document.getElementById('map_canvas'+curView).style.display = 'none';
} else {
//alert('Old BMap display none');
if (document.getElementById('bitmap_holder'+curView)) { document.getElementById('bitmap_holder'+curView).style.display = 'none'; }
}
if (newType == 'V' || newType == 'P') {
map=parseInt(map.substr(1));
//console.log('newType:'+newType+' Map:'+map+' MPoly:'+mpoly[map]+' DoPoly:'+dopoly[map]);
if (demog[map] == undefined) {
$.getJSON('https://www.ourcampaigns.com/ajax/DemographicMapJSON.php?MapImageID='+map+'&TheDate='+encodeURIComponent('2008-06-10 19:00:00'), function(data){
demog[map]=data;
});
}
if (mpoly[map] == undefined) {
if (newType == 'V') {
mpoly[map]=new Array();
$.getJSON( "/geojson/MapImage"+map+".json", function( data ) {
mpoly[map]=data;
//viewMapChange();
leafletMap(map);
});
} else {
curType=newType;
mpoly[map]=new Array();
//console.log("/geojson/vtd/VTDml"+map+"--.json");
$.getJSON( "/geojson/vtd/VTDml"+map+"--.json", function( data ) {
mpoly[map]=data;
//viewMapChange();
leafletMap(map);
});
var headID = document.getElementById('DynamicJS');
var newScript2 = document.createElement('script');
newScript2.type = 'text/javascript';
newScript2.onload=function() { if (mpoly[map]) { redoMap(map); } }
newScript2.src = '/racevtdresults.php?RaceID=212760';
headID.appendChild(newScript2);
}
}
document.getElementById('map_canvas'+map).style.display = 'block';
curType=newType; curView=map;
} else {
map=parseInt(map.substr(1));
var bmh=document.getElementById('bitmap_holder'+map);
if (bmh) {
if (bmh.innerHTML == '') {
var locs=init_bitmap(map);
bmh.innerHTML='';
}
bmh.style.display = 'block';
curType=''; curView=map;
}
}
}
function init_bitmap(milk) {
var loc='';
var mtype=document.getElementById('WhichMap').value;
//var curve=parseInt(document.getElementById('MapCurve').value)/100;
var curve=parseInt($('#curveslider').slider( "option", "value" ))/100;
var maxmargin=0; var maxavotes=0;
for (i=1; i maxvotes) { secondvotes=maxvotes; maxvotes=v; wincolor=cancolor[canids[c]]; } else if (v > secondvotes) { secondvotes=v; }
}
}
if ((maxvotes-secondvotes) > maxmargin) { maxmargin=maxvotes-secondvotes; }
if (maxvotes > maxavotes) { maxavotes=maxvotes; }
}
}
if (mpoly[milk] != undefined) {
for (i=1; i maxvotes) { secondvotes=maxvotes; maxvotes=v; wincolor=cancolor[canids[c]]; } else if (v > secondvotes) { secondvotes=v; }
}
}
}
if (mtype == 'vs') {
var opacity=Math.pow((maxvotes-secondvotes)/maxmargin,curve);
} else if (mtype == 'vm') {
var opacity=Math.pow((maxvotes-secondvotes)/allvotes,curve);
} else if (mtype == 'vp') {
var opacity=Math.pow(maxvotes/allvotes,curve);
} else if (mtype == 'vt') {
wincolor='#000000';
var opacity=Math.pow(allvotes/maxavotes,curve);
} else if (mtype == 'vl') {
var mgn=((maxvotes-secondvotes)/allvotes) * 100;
if (mgn == 0) { var opacity=0; } else if (mgn maxchange) { maxchange=percent_change; wincolor=cancolor[canids[c]]; }
}
}
var opacity=Math.pow(maxchange,curve);
}
var ucolor=wincolor.toUpperCase();
var rcolor=255-Math.floor((255-parseInt(hexR[ucolor.substr(1,1)])*16+parseInt(hexR[ucolor.substr(2,1)]))*opacity);
var gcolor=255-Math.floor((255-parseInt(hexR[ucolor.substr(3,1)])*16+parseInt(hexR[ucolor.substr(4,1)]))*opacity);
var bcolor=255-Math.floor((255-parseInt(hexR[ucolor.substr(5,1)])*16+parseInt(hexR[ucolor.substr(6,1)]))*opacity);
var ocolor=hexA[Math.floor(rcolor/16)]+hexA[Math.floor(rcolor%16)]+hexA[Math.floor(gcolor/16)]+hexA[Math.floor(gcolor%16)]+hexA[Math.floor(bcolor/16)]+hexA[Math.floor(bcolor%16)];
loc+='&L'+mploc[milk][i]+'='+ocolor;
}
}
}
return loc;
}
function init_map(milk) {
var mtype=document.getElementById('WhichMap').value;
//var curve=parseInt(document.getElementById('MapCurve').value)/100;
var curve=parseInt($('#curveslider').slider( "option", "value" ))/100;
var sw = new google.maps.LatLng(mnlt[milk],mnlo[milk]);
var ne = new google.maps.LatLng(mxlt[milk],mxlo[milk]);
var mapb = new google.maps.LatLngBounds(sw,ne);
var myOptions = {
zoom: 8,
center: sw,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var mc=document.getElementById('map_canvas'+milk);
if (mc == null) {
var ni = document.getElementById('SubMaps');
var newcanvas = document.createElement('canvas');
newcanvas.setAttribute('id','map_canvas'+milk);
newcanvas.setAttribute('width','100%');
newcanvas.setAttribute('height','300px');
ni.appendChild(newcanvas);
mc=document.getElementById('map_canvas'+milk);
}
var map = new google.maps.Map(mc, myOptions);
myFitBounds(map,mapb);
//map.fitBounds(mapb);
dopoly[milk]=new Array;
var polyevt=new Array;
var maxmargin=0; var numpoly=0;
if (mpoly[milk] != undefined) {
for (i=0; i maxvotes) { secondvotes=maxvotes; maxvotes=v; wincolor=cancolor[canids[c]]; } else if (v > secondvotes) { secondvotes=v; }
}
if (maxvotes > 0) { numpoly++; }
if ((maxvotes-secondvotes) > maxmargin) { maxmargin=maxvotes-secondvotes; }
}
}
for (i=0; i maxvotes) { secondvotes=maxvotes; maxvotes=v; wincolor=cancolor[canids[c]]; } else if (v > secondvotes) { secondvotes=v; }
}
var opacity=Math.pow((maxvotes-secondvotes)/maxmargin,curve);
//alert(wincolor+" "+opacity+" "+maxvotes+" "+allvotes);
if (!turnover[mpcid[milk][i]]) { turnover[mpcid[milk][i]]='#000000'; }
var zindex=0; if (turnover[mpcid[milk][i]] != '#000000') { zindex=10; }
var sweight=1.5; if (curType == 'P') { sweight=0.1; }
if (opacity == 0) { opacity=0.1; wincolor='#ffffff'; }
dopoly[milk][i] = new google.maps.Polygon({
paths: mpoly[milk][i],
strokeColor: turnover[mpcid[milk][i]],
strokeOpacity: 0.9,
strokeWeight: sweight,
zIndex: zindex,
fillColor: wincolor,
fillOpacity: opacity
});
dopoly[milk][i].set('cid',mpcid[milk][i]);
google.maps.event.addListener(dopoly[milk][i], 'mouseover', function(event) {
putRaceInfo(event.latLng,this);
});
google.maps.event.addListener(dopoly[milk][i], 'mouseout', function(event) {
remRaceInfo(event.latLng,this);
});
google.maps.event.addListener(dopoly[milk][i], 'mousemove', function(event) {
moveRaceInfo(event.latLng,this);
});
google.maps.event.addListener(dopoly[milk][i], 'click', function(event) {
goRaceInfo(event.latLng,this);
});
dopoly[milk][i].setMap(map);
}
}
for(var c in canids) {
if (canlat[canids[c]] != null && canlon[canids[c]] != null && cancolor[canids[c]] != null && canname[canids[c]] != null) {
var myLatlng = new google.maps.LatLng(canlat[canids[c]],canlon[canids[c]]);
var myIcon = { path: "M-20,0a20,20 0 1,0 40,0a20,20 0 1,0 -40,0", fillColor: cancolor[canids[c]], fillOpacity: 1, anchor: new google.maps.Point(0, 0), strokeWeight: 1, scale: 0.5 }
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
icon: myIcon,
iconSize:[20,20],
iconAnchor:[10,20],
title: canname[canids[c]]
});
}
}
for (i=0; i maxvotes) { secondvotes=maxvotes; maxvotes=v; wincolor=cancolor[canids[c]]; } else if (v > secondvotes) { secondvotes=v; }
}
}
if ((maxvotes-secondvotes) > maxmargin) { maxmargin=maxvotes-secondvotes; }
if (maxvotes > maxavotes) { maxavotes=maxvotes; }
}
for (var i in geojsonLayer[milk]._layers) {
var cid=geojsonLayer[milk]._layers[i].feature.geometry.properties.cid;
var allvotes=0; var allvotesp=0; var maxvotes=0; var secondvotes=0; var maxchange=0; var wincolor='#ffffff';
//for (c=0; c maxvotes) { secondvotes=maxvotes; maxvotes=v; wincolor=cancolor[canids[c]]; } else if (v > secondvotes) { secondvotes=v; }
}
}
}
if (mtype == 'vs') {
var opacity=Math.pow((maxvotes-secondvotes)/maxmargin,curve);
//if (numpoly==1) { opacity=Math.pow((maxvotes-secondvotes)/allvotes,curve); }
//if (maxmargin == (maxvotes-secondvotes)) { opacity=0.5; }
} else if (mtype == 'bm') {
var bsize=(maxvotes-secondvotes)/maxavotes;
var bopacity=0.8;
var opacity=0;
} else if (mtype == 'bv') {
var bsize=allvotes/maxavotes;
var bopacity=Math.pow((maxvotes-secondvotes)/allvotes,curve);
//var bopacity=Math.pow((maxvotes-secondvotes)/maxmargin,curve);
var opacity=0;
} else if (mtype == 'vm') {
var opacity=Math.pow((maxvotes-secondvotes)/allvotes,curve);
} else if (mtype == 'vp') {
var opacity=Math.pow(maxvotes/allvotes,curve);
} else if (mtype == 'vx') {
var wincolorr=0; var wincolorg=0; var wincolorb=0;
for(var c in canids) {
if (document.getElementById('MpCn'+canids[c]).checked) {
var v=0;
if (canv[cid]) { v=canv[cid][canids[c]]; }
if (v == null) { v=0; }
if (cancolor[canids[c]] === undefined || cancolor[canids[c]] == '') { cancolor[canids[c]]='#888888'; }
var cpct=v/allvotes;
wincolorr+=parseInt(cancolor[canids[c]].substr(1,2),16)*cpct;
wincolorg+=parseInt(cancolor[canids[c]].substr(3,2),16)*cpct;
wincolorb+=parseInt(cancolor[canids[c]].substr(5,2),16)*cpct;
}
}
var wincolor='#'+toHex(Math.round(wincolorr))+toHex(Math.round(wincolorg))+toHex(Math.round(wincolorb));
var opacity=0.8;
} else if (mtype == 'vt') {
wincolor='#000000';
var opacity=Math.pow(allvotes/maxavotes,curve);
} else if (mtype == 'vl') {
var mgn=((maxvotes-secondvotes)/allvotes) * 100;
if (mgn == 0) { var opacity=0; } else if (mgn maxchange) { maxchange=percent_change; wincolor=cancolor[canids[c]]; }
}
}
var opacity=Math.pow(maxchange,curve);
} else if (mtype == 'vd') {
for(var c in canids) {
if (document.getElementById('MpCn'+canids[c]).checked) {
var v=0;
if (canv[cid]) { v=canv[cid][canids[c]]; }
if (v == null) { v=0; }
if (canp[cid]) { percent_change=((v/allvotes)-(canp[cid][canpty[canids[c]]]/allvotesp)); } else { percent_change=0; }
if (percent_change > maxchange) { maxchange=percent_change; wincolor=cancolor[canids[c]]; }
}
}
var opacity=Math.pow(maxchange,curve);
} else if (mtype == 'vc') {
for(var c in canids) {
if (document.getElementById('MpCn'+canids[c]).checked) {
var v=0;
if (canv[cid]) { v=canv[cid][canids[c]]; }
if (v == null) { v=0; }
var canold=0;
for(var key in racesubs[map]) {
if (racesubs[map][key]['Subs'][cid] !== undefined) {
for(var oc in racesubs[map][key]['Candidates']) {
if (racesubs[map][key]['Candidates'][oc]['PartyID'] == canpty[canids[c]]) { canold+=racesubs[map][key]['Subs'][cid][oc]; }
}
}
}
if (canold) { percent_change=((v/allvotes)-(canold/allvotesp)); } else { percent_change=0; }
if (percent_change > maxchange) { maxchange=percent_change; wincolor=cancolor[canids[c]]; }
}
}
var opacity=Math.pow(maxchange,curve);
} else if (mtype == 'vn') {
for(var c in canids) {
if (document.getElementById('MpCn'+canids[c]).checked) {
var v=0;
if (canv[cid]) { v=canv[cid][canids[c]]; }
if (v == null) { v=0; }
percent_change=((v/allvotes)-(canvotes[canids[c]]/racevotes));
if (percent_change > maxchange) { maxchange=percent_change; wincolor=cancolor[canids[c]]; }
}
}
var opacity=Math.pow(maxchange,curve);
} else if (mtype == 'dr') {
var demosel=document.getElementById('SelDemographic').value;
var demoval=demosel.split(': ');
wincolor='#000000';
opacity=Math.pow(parseInt(demog[milk][cid]['Demographics'][demoval[0]][demoval[1]])/parseInt(demog[milk][cid]['Demographics']['Population']['Population']),curve);
//console.log(opacity);
}
var sweight=0.5; if (curType == 'P') { sweight=0.1; }
if (mtype == 'bm' || mtype == 'bv') {
var radius=(Math.sqrt(bsize)/3.141529)*maxbubble[milk]*curve;
if (bubbles[milk][i] === undefined) {
if (!isNaN(geojsonLayer[milk]._layers[i].feature.geometry.properties.centroidlat)) {
var pcenter=L.latLng(geojsonLayer[milk]._layers[i].feature.geometry.properties.centroidlat, geojsonLayer[milk]._layers[i].feature.geometry.properties.centroidlon);
} else {
var pcenter=geojsonLayer[milk]._layers[i].getBounds().getCenter();
}
bubbles[milk][i]=L.circle(pcenter, { opacity:0, fillColor: wincolor, fillOpacity: bopacity, radius: radius, cid: cid }).addTo(leafmap[milk]);
//bubbles[milk][i].feature.geometry.properties.cid=cid;
bubbles[milk][i].on({ mouseover: putRaceInfo, mouseout: remRaceInfo, click: goRaceInfo });
} else {
bubbles[milk][i].setStyle({fillOpacity: bopacity});
bubbles[milk][i].setRadius(radius);
}
} else {
if (bubbles[milk] && bubbles[milk][i] !== undefined) {
bubbles[milk][i].setStyle({fillOpacity: 0});
}
if (opacity '+tcname+' | ';
var most=999999999999; var mostid=0;
var didcan=[];
var mtype=document.getElementById('WhichMap').value;
var milk=curView;
if (mtype == 'vn') {
var totalvotes=0;
for(var i in canv[cid]) {
if (document.getElementById('MpCn'+i).checked) {
totalvotes+=canv[cid][i];
}
}
for(var j in canv[cid]) {
if (document.getElementById('MpCn'+j) && document.getElementById('MpCn'+j).checked) {
var newmost=-100; var pct=0; var delta=0;
for(var i in canv[cid]) {
if (document.getElementById('MpCn'+i) && document.getElementById('MpCn'+i).checked) {
pct=Math.round((canv[cid][i]/totalvotes)*10000)/100;
delta=(Math.round((pct-(canvotes[i]/280861.000000*100))*100)/100);
if (didcan[i] != 'Y' && delta = newmost) { newmost=delta; mostid=i; }
}
}
most=newmost; didcan[mostid]='Y'; pct=Math.round((canv[cid][mostid]/totalvotes)*10000)/100;
delta=(Math.round((pct-(canvotes[mostid]/280861.000000*100))*100)/100);
contentString+=' | '+canname[mostid]+' | '+pct+'% | '+canv[cid][mostid]+' | ';
if (delta >= 0) { delta='+'+delta; } contentString+=''+delta+'% | ';
contentString+=' ';
}
}
} else if (mtype == 'vd') {
var totalvotes=0; allvotesp=0;
if (curType == 'P') { var tcan=canpv; } else { var tcan=canp; }
for(var i in canv[cid]) {
if (document.getElementById('MpCn'+i).checked) {
totalvotes+=canv[cid][i];
if (tcan[cid] && tcan[cid][canpty[i]]) { allvotesp+=tcan[cid][canpty[i]]; }
}
}
for(var j in canv[cid]) {
if (document.getElementById('MpCn'+j).checked) {
var newmost=-100; var pct=0; var delta=0;
for(var i in canv[cid]) {
if (document.getElementById('MpCn'+i).checked) {
pct=Math.round((canv[cid][i]/totalvotes)*10000)/100;
if (tcan[cid][canpty[i]]) {
delta=(Math.round((pct-(tcan[cid][canpty[i]]/allvotesp*100))*100)/100);
} else {
delta=pct;
}
//delta=(Math.round((pct-(canvotes[i]/280861.000000*100))*100)/100);
if (didcan[i] != 'Y' && delta = newmost) { newmost=delta; mostid=i; }
}
}
most=newmost; didcan[mostid]='Y';
pct=Math.round((canv[cid][mostid]/totalvotes)*10000)/100;
var pvotes=tcan[cid][canpty[mostid]];
var ppct=Math.round(pvotes/allvotesp*10000)/100;
if (typeof pvotes === 'undefined') { pvotes=0; ppct=0; }
if (tcan[cid][canpty[mostid]]) {
delta=(Math.round((pct-(pvotes/allvotesp*100))*100)/100);
} else {
delta=pct;
}
if (curType == 'P') { var tname=canname[canptyv[canpty[mostid]]]; } else { var tname=canname[canptyv[canpty[mostid]]]; }
if (typeof tname === 'undefined') { tname='n/a'; }
contentString+=' | '+canname[mostid]+' | '+pct+'% | '+canv[cid][mostid]+' | ';
contentString+=''+tname+' | ';
contentString+=''+ppct+'% | ';
contentString+=''+pvotes+' | ';
if (delta >= 0) { delta='+'+delta; } contentString+=''+delta+'% | ';
contentString+=' ';
}
}
} else if (mtype != 'dr') {
for(var j in canv[cid]) {
if (document.getElementById('MpCn'+j) && document.getElementById('MpCn'+j).checked) {
var newmost=0; var totalvotes=0;
for(var i in canv[cid]) {
if (document.getElementById('MpCn'+i) && document.getElementById('MpCn'+i).checked) {
totalvotes+=canv[cid][i];
if (didcan[i] != 'Y' && canv[cid][i] = newmost) { newmost=canv[cid][i]; mostid=i; }
}
}
most=newmost; didcan[mostid]='Y'; var pct=Math.round((canv[cid][mostid]/totalvotes)*10000)/100;
contentString+=' | '+canname[mostid]+' | '+pct+'% | '+canv[cid][mostid]+' | ';
contentString+=' ';
}
}
} else {
var demosel=document.getElementById('SelDemographic').value;
var demoval=demosel.split(': ');
var demopct=parseInt(demog[milk][cid]['Demographics'][demoval[0]][demoval[1]])/parseInt(demog[milk][cid]['Demographics']['Population']['Population'])*100;
contentString+=' | '+demosel+' | '+demopct.toFixed(2)+'% | ';
}
contentString+=' | ';
$('#MapLocDetails').html(contentString);
$('#MapLocDetails').show();
}
function remRaceInfo(e) {
$('#MapLocDetails').hide();
}
function goRaceInfo(e) {
if (e.target.feature !== undefined) {
var feature=e.target.feature;
var cid=feature.geometry.properties.cid;
} else {
var cid=e.target.options.cid;
}
if (raceid[cid] > 0) {
window.location='RaceDetail.html?RaceID='+raceid[cid];
} else if (curType == 'P') {
window.location='VotingDistrictEdit.html?VotingDistrictID='+cid;
} else {
window.location='ContainerDetail.html?ContainerID='+cid;
}
}
function infoWinKilled() {
infowindow=null;
}
function rollToMap(cid) {
for (m=0; m
|