View Application (External Link) || Return to Results App

results.asp

/*
This page computes raw election data from the database and displays it graphically in bar graphs.  Each question from
the original survey is represented.  NOTE: this was the author's first exposure to VBScript.  Much of the code is 
redundant and unorganized, but the basic algorithm is simple: to compute the length of the bar, divide the particular count
by the total count and multiply by a scalar value.
*/

<%@ language="VBScript" %>

<%

// Open the database.
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "sodanoorg00_vote04"

// The first graph, displaying the results of the overall presidential race.
// First, the counts for each president are retrieved and percents are calculated.
set BushCount = conn.Execute("select count(PresID) as BC from PresidentResponse where PresidentID = 'Bush'") 
set KerryCount = conn.Execute("select count(PresID) as KC from PresidentResponse where PresidentID = 'Kerry'")
dim bushW, kerryW, max, total
max = 16
total = BushCount("BC") + KerryCount("KC")
bushW = (BushCount("BC") / total) * max
kerryW = (KerryCount("KC") / total) * max

// This function also computes a percentage given a whole and part, and was added later after the author
// gained more experience.
Function percentage(tot,part)
  dim x
  x = part / tot
  x = x * 100
  percentage = x
  Exit Function
End Function

%>

<html>
<head>

<style type="text/css">

body{ background:black; }

.repubBar{ position:absolute; left:0px; background:red; }

.democBar{ position:absolute; left:0px; background:blue; }

.caption{ position:absolute; top:21%; background:#eeeeee; border:1px solid black; padding:2px; }

.tab{ position:absolute; top:-25px; height:20px; background:#eeeeee; font-size:20px; font-weight:bold; border-right:1px solid black; border-left:1px solid black; border-top:1px solid black; border-bottom:1px solid #eeeeee; }

.redBar{ position:absolute; }

.blueBar{ position:absolute; }

div#mainGrafBox{ position:absolute; left:10%; top:228px; width:785px; height:141px; border:1px solid black; background:#bbbbbb; }

div#mainGraf{ position:absolute; left:10%; top:20; width:625px; height:101px; border:1px solid black; background:#eeeeee; }

div#BushCol{ position:absolute; left:10%; top:380px; height:1120px; width:387px; background:#bbbbbb; border:1px solid black; }

div#KerryCol{ position:absolute; left:499px; top:380px; height:1120px; width:387px; background:#bbbbbb; border:1px solid black; }

div#gradeGraf{ position:absolute; left:140px; top:488px; height:190px; width:700px; background:#eeeeee; border:1px solid black; text-align:center; }
  div#gradeHolder{ position:absolute; left:352px; top:20px; height:139px; width:1px; background:#000000; color:#eeeeee; }

div#hsGraf{ position:absolute; left:140px; top:728px; height:584px; width:700px; background:#eeeeee; border:1px solid black; text-align:center; }
  div#hsHolder{ position:absolute; left:352px; top:20px; height:529px; width:1px; background:#000000; color:#eeeeee; }

div#genderGraf{ position:absolute; left:140px; top:1365px; height:100px; width:700px; background:#eeeeee; border:1px solid black; text-align:center; }
  div#genderHolder{ position:absolute; left:352px; top:20px; height:49px; width:1px; background:#000000; color:#eeeeee; }

span.rCap{ position:relative; left:-34px; color:#bbbbbb; }
span.bCap{ position:relative; color:#bbbbbb; }

</style>

</head>
<body>

<h1 style="color:white; text-align:center;">Results</h1>

// The first graphs use the values calculated above in certain of the CSS width and left properties to correctly
// size the graphs.
<div id="mainGrafBox">
  <div id="mainGraf">

    <div id="BushBar" class="repubBar" style="top:7px; height:40px; width:<% Response.Write bushW %>cm;"><span class="caption" style="right:<% Response.Write bushW %>cm;">Bush</span><span></span><span style="position:absolute;left:<% Response.Write bushW %>cm;"><% Response.Write BushCount("BC") %> (<% Response.Write Round(((BushCount("BC") / total)*100)) %>%)</span></div>

    <div id="KerryBar" class="democBar" style="top:54px; height:40px; width:<% Response.Write kerryW %>cm;"><span class="caption" style="right:<% Response.Write kerryW %>cm;">Kerry</span><span style="position:absolute;left:<% Response.Write kerryW %>cm;"><% Response.Write KerryCount("KC") %> (<% Response.Write Round(((KerryCount("KC") / total)*100)) %>%)</span></div>

  </div>
</div>

<div id="BushCol">
<h1 style="color:red;text-align:center;">Bush<br /><% Response.Write BushCount("BC") %></h1><br />
</div>

<div id="KerryCol">
<h1 style="color:blue;text-align:center;">Kerry<br /><% Response.Write KerryCount("KC") %></h1>
</div> 

<%

// The code for the graphs that breakdown presidential votes by grade.
// Reused code for gathering the counts for each grade is stored in variables. 
dim p1, p2B, p2K
p1 = "select count(GradeID) as "
p2B = " from YearResponse where PresidentID = 'Bush' and GradeResponse = '"
p2K = " from YearResponse where PresidentID = 'Kerry' and GradeResponse = '"

set B8 = conn.Execute(p1 & "b8" & p2B & "8" & "'")
set B9 = conn.Execute(p1 & "b9" & p2B & "9" & "'")
set B10 = conn.Execute(p1 & "b10" & p2B & "10" & "'")
set B11 = conn.Execute(p1 & "b11" & p2B & "11" & "'")
set B12 = conn.Execute(p1 & "b12" & p2B & "12" & "'")

set K8 = conn.Execute(p1 & "k8" & p2K & "8" & "'")
set K9 = conn.Execute(p1 & "k9" & p2K & "9" & "'")
set K10 = conn.Execute(p1 & "k10" & p2K & "10" & "'")
set K11 = conn.Execute(p1 & "k11" & p2K & "11" & "'")
set K12 = conn.Execute(p1 & "k12" & p2K & "12" & "'")

// The totals are calculated to find percents.
dim tot8, tot9, tot10, tot11, tot12
tot8 = B8("b8") + K8("k8")
tot9 = B9("b9") + K9("k9")
tot10 = B10("b10") + K10("k10")
tot11 = B11("b11") + K11("k11")
tot12 = B12("b12") + K12("k12")

%>

/* The formula stays the same for this and the other two series of graphs:
   - For the length of the bar, the count is divided by a uniform scalar quantity to reduced it to the proper size.
     Then it is set to the CSS width property of the bar.
   - The parts and totals are submitted to the above "percentage" function and printed next to the bar.  
   - The description for the bars is placed in the blue bar, by far the roomier in every case.
*/
<div id="gradeGraf"><div class="tab" style="left:310px;">By Grade</div>
  <div id="gradeHolder" style="text-align:left;">

    <div id="red8" class="redBar" style="left:-<% Response.Write (B8("b8")/8) %>cm; top:0px; width:<% Response.Write (B8("b8")/8) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(tot8,B8("b8"))) %>%</span></div>
    <div id="red9" class="redBar" style="left:-<% Response.Write (B9("b9")/8) %>cm; top:30px; width:<% Response.Write (B9("b9")/8) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(tot9,B9("b9"))) %>%</span></div>
    <div id="red10" class="redBar" style="left:-<% Response.Write (B10("b10")/8) %>cm; top:60px; width:<% Response.Write (B10("b10")/8) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(tot10,B10("b10"))) %>%</span></div>
    <div id="red11" class="redBar" style="left:-<% Response.Write (B11("b11")/8) %>cm; top:90px; width:<% Response.Write (B11("b11")/8) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(tot11,B11("b11"))) %>%</span></div>
    <div id="red12" class="redBar" style="left:-<% Response.Write (B12("b12")/8) %>cm; top:120px; width:<% Response.Write (B12("b12")/8) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(tot12,B12("b12"))) %>%</span></div>

    <div id="blue8" class="blueBar" style="left:1px; top:0px; width:<% Response.Write (K8("k8")/8) %>cm; background:blue; height:14px;"><span>8th</span><span class="bCap" style="left:186px;"><%= Round(percentage(tot8,K8("k8"))) %>%</span></div>
    <div id="blue9" class="blueBar" style="left:1px; top:30px; width:<% Response.Write (K9("k9")/8) %>cm; background:blue; height:14px;"><span>9th</span><span class="bCap" style="left:290px;"><%= Round(percentage(tot9,K9("k9"))) %>%</span></div>
    <div id="blue10" class="blueBar" style="left:1px; top:60px; width:<% Response.Write (K10("k10")/8) %>cm; background:blue; height:14px;"><span>10th</span><span class="bCap" style="left:202px;"><%= Round(percentage(tot10,K10("k10"))) %>%</span></div>
    <div id="blue11" class="blueBar" style="left:1px; top:90px; width:<% Response.Write (K11("k11")/8) %>cm; background:blue; height:14px;"><span>11th</span><span class="bCap" style="left:154px;"><%= Round(percentage(tot11,K11("k11"))) %>%</span></div>
    <div id="blue12" class="blueBar" style="left:1px; top:120px; width:<% Response.Write (K12("k12")/8) %>cm; background:blue; height:14px;"><span>12th</span><span class="bCap" style="left:130px;"><%= Round(percentage(tot12,K12("k12"))) %>%</span></div>

  </div>
</div>

<%
dim w1, w2B, w2K
w1 = "select count(HomeSchoolID) as "
w2B = " from HoodResponse where PresidentID = 'Bush' and HomeSchoolResponse = '"
w2K = " from HoodResponse where PresidentID = 'Kerry' and HomeSchoolResponse = '"

set BAVON = conn.Execute(w1 & "bavon" & w2B & "Avondale" & "'")
set BCEDA = conn.Execute(w1 & "bceda" & w2B & "Cedar Grove" & "'")
set BCHAM = conn.Execute(w1 & "bcham" & w2B & "Chamblee" & "'")
set BCLAR = conn.Execute(w1 & "bclar" & w2B & "Clarkston" & "'")
set BCOLU = conn.Execute(w1 & "bcolu" & w2B & "Columbia" & "'")
set BCROS = conn.Execute(w1 & "bcros" & w2B & "Cross Keys" & "'")
set BDRUI = conn.Execute(w1 & "bdrui" & w2B & "Druid Hills" & "'")
set BDUNW = conn.Execute(w1 & "bdunw" & w2B & "Dunwoody" & "'")
set BLAKE = conn.Execute(w1 & "blake" & w2B & "Lakeside" & "'")
set BLITH = conn.Execute(w1 & "blith" & w2B & "Lithonia" & "'")
set BMLKJ = conn.Execute(w1 & "bmlkj" & w2B & "M.L.K., Jr." & "'")
set BMCNA = conn.Execute(w1 & "bmcna" & w2B & "McNair" & "'")
set BREDA = conn.Execute(w1 & "breda" & w2B & "Redan" & "'")
set BSOUT = conn.Execute(w1 & "bsout" & w2B & "Southwest DeKalb" & "'")
set BSTEP = conn.Execute(w1 & "bstep" & w2B & "Stephenson" & "'")
set BSTON = conn.Execute(w1 & "bston" & w2B & "Stone Mountain" & "'")
set BTOWE = conn.Execute(w1 & "btowe" & w2B & "Towers" & "'")
set BTUCK = conn.Execute(w1 & "btuck" & w2B & "Tucker" & "'")

set KAVON = conn.Execute(w1 & "kavon" & w2K & "Avondale" & "'")
set KCEDA = conn.Execute(w1 & "kceda" & w2K & "Cedar Grove" & "'")
set KCHAM = conn.Execute(w1 & "kcham" & w2K & "Chamblee" & "'")
set KCLAR = conn.Execute(w1 & "kclar" & w2K & "Clarkston" & "'")
set KCOLU = conn.Execute(w1 & "kcolu" & w2K & "Columbia" & "'")
set KCROS = conn.Execute(w1 & "kcros" & w2K & "Cross Keys" & "'")
set KDRUI = conn.Execute(w1 & "kdrui" & w2K & "Druid Hills" & "'")
set KDUNW = conn.Execute(w1 & "kdunw" & w2K & "Dunwoody" & "'")
set KLAKE = conn.Execute(w1 & "klake" & w2K & "Lakeside" & "'")
set KLITH = conn.Execute(w1 & "klith" & w2K & "Lithonia" & "'")
set KMLKJ = conn.Execute(w1 & "kmlkj" & w2K & "M.L.K., Jr." & "'")
set KMCNA = conn.Execute(w1 & "kmcna" & w2K & "McNair" & "'")
set KREDA = conn.Execute(w1 & "kreda" & w2K & "Redan" & "'")
set KSOUT = conn.Execute(w1 & "ksout" & w2K & "Southwest DeKalb" & "'")
set KSTEP = conn.Execute(w1 & "kstep" & w2K & "Stephenson" & "'")
set KSTON = conn.Execute(w1 & "kston" & w2K & "Stone Mountain" & "'")
set KTOWE = conn.Execute(w1 & "ktowe" & w2K & "Towers" & "'")
set KTUCK = conn.Execute(w1 & "ktuck" & w2K & "Tucker" & "'")

dim totAVON, totCEDA, totCHAM, totCLAR, totCOLU, totCROS, totDRUI, totDUNW, totLAKE, totLITH, totMLKJ, totMCNA, totREDA, totSOUT, totSTEP, totSTON, totTOWE, totTUCK
totAVON = BAVON("bavon") + KAVON("kavon")
totCEDA = BCEDA("bceda") + KCEDA("kceda")
totCHAM = BCHAM("bcham") + KCHAM("kcham")
totCLAR = BCLAR("bclar") + KCLAR("kclar")
totCOLU = BCOLU("bcolu") + KCOLU("kcolu")
totCROS = BCROS("bcros") + KCROS("kcros")
totDRUI = BDRUI("bdrui") + KDRUI("kdrui")
totDUNW = BDUNW("bdunw") + KDUNW("kdunw")
totLAKE = BLAKE("blake") + KLAKE("klake")
totLITH = BLITH("blith") + KLITH("klith")
totMLKJ = BMLKJ("bmlkj") + KMLKJ("kmlkj")
totMCNA = BMCNA("bmcna") + KMCNA("kmcna")
totREDA = BREDA("breda") + KREDA("kreda")
totSOUT = BSOUT("bsout") + KSOUT("ksout")
totSTEP = BSTEP("bstep") + KSTEP("kstep")
totSTON = BSTON("bston") + KSTON("kston")
totTOWE = BTOWE("btowe") + KTOWE("ktowe")
totTUCK = BTUCK("btuck") + KTUCK("ktuck")

%>

<div id="hsGraf"><div class="tab" style="left:285px;">By Home School</div>
  <div id="hsHolder" style="text-align:left;">

    <div id="redA" class="redBar" style="left:-<% Response.Write (BAVON("bavon")/3) %>cm; top:0px; width:<% Response.Write (BAVON("bavon")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totAVON,BAVON("bavon"))) %>%</span></div>
    <div id="redB" class="redBar" style="left:-<% Response.Write (BCEDA("bceda")/3) %>cm; top:30px; width:<% Response.Write (BCEDA("bceda")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totCEDA,BCEDA("bceda"))) %>%</span></div>
    <div id="redC" class="redBar" style="left:-<% Response.Write (BCHAM("bcham")/3) %>cm; top:60px; width:<% Response.Write (BCHAM("bcham")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totCHAM,BCHAM("bcham"))) %>%</span></div>
    <div id="redD" class="redBar" style="left:-<% Response.Write (BCLAR("bclar")/3) %>cm; top:90px; width:<% Response.Write (BCLAR("bclar")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totCLAR,BCLAR("bclar"))) %>%</span></div>
    <div id="redE" class="redBar" style="left:-<% Response.Write (BCOLU("bcolu")/3) %>cm; top:120px; width:<% Response.Write (BCOLU("bcolu")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totCOLU,BCOLU("bcolu"))) %>%</span></div>
    <div id="redF" class="redBar" style="left:-<% Response.Write (BCROS("bcros")/3) %>cm; top:150px; width:<% Response.Write (BCROS("bcros")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totCROS,BCROS("bcros"))) %>%</span></div>
    <div id="redG" class="redBar" style="left:-<% Response.Write (BDRUI("bdrui")/3) %>cm; top:180px; width:<% Response.Write (BDRUI("bdrui")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totDRUI,BDRUI("bdrui"))) %>%</span></div>
    <div id="redH" class="redBar" style="left:-<% Response.Write (BDUNW("bdunw")/3) %>cm; top:210px; width:<% Response.Write (BDUNW("bdunw")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totDUNW,BDUNW("bdunw"))) %>%</span></div>
    <div id="redI" class="redBar" style="left:-<% Response.Write (BLAKE("blake")/3) %>cm; top:240px; width:<% Response.Write (BLAKE("blake")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totLAKE,BLAKE("blake"))) %>%</span></div>
    <div id="redJ" class="redBar" style="left:-<% Response.Write (BLITH("blith")/3) %>cm; top:270px; width:<% Response.Write (BLITH("blith")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totLITH,BLITH("blith"))) %>%</span></div>
    <div id="redK" class="redBar" style="left:-<% Response.Write (BMLKJ("bmlkj")/3) %>cm; top:300px; width:<% Response.Write (BMLKJ("bmlkj")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totMLKJ,BMLKJ("bmlkj"))) %>%</span></div>
    <div id="redL" class="redBar" style="left:-<% Response.Write (BMCNA("bmcna")/3) %>cm; top:330px; width:<% Response.Write (BMCNA("bmcna")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totMCNA,BMCNA("bmcna"))) %>%</span></div>
    <div id="redM" class="redBar" style="left:-<% Response.Write (BREDA("breda")/3) %>cm; top:360px; width:<% Response.Write (BREDA("breda")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totREDA,BREDA("breda"))) %>%</span></div>
    <div id="redN" class="redBar" style="left:-<% Response.Write (BSOUT("bsout")/3) %>cm; top:390px; width:<% Response.Write (BSOUT("bsout")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totSOUT,BSOUT("bsout"))) %>%</span></div>
    <div id="redO" class="redBar" style="left:-<% Response.Write (BSTEP("bstep")/3) %>cm; top:420px; width:<% Response.Write (BSTEP("bstep")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totSTEP,BSTEP("bstep"))) %>%</span></div>
    <div id="redP" class="redBar" style="left:-<% Response.Write (BSTON("bston")/3) %>cm; top:450px; width:<% Response.Write (BSTON("bston")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totSTON,BSTON("bston"))) %>%</span></div>
    <div id="redQ" class="redBar" style="left:-<% Response.Write (BTOWE("btowe")/3) %>cm; top:480px; width:<% Response.Write (BTOWE("btowe")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totTOWE,BTOWE("btowe"))) %>%</span></div>
    <div id="redR" class="redBar" style="left:-<% Response.Write (BTUCK("btuck")/3) %>cm; top:510px; width:<% Response.Write (BTUCK("btuck")/3) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totTUCK,BTUCK("btuck"))) %>%</span></div>

    <div id="blueA" class="blueBar" style="left:1px; top:0px; width:<% Response.Write (KAVON("kavon")/3) %>cm; background:blue; height:14px;"><span>Avondale</span><span class="bCap" style="left:34px;"><%= Round(percentage(totAVON,KAVON("kavon"))) %>%</span></div>
    <div id="blueB" class="blueBar" style="left:1px; top:30px; width:<% Response.Write (KCEDA("kceda")/3) %>cm; background:blue; height:14px;"><span>Cedar Grove</span><span class="bCap" style="left:112px;"><%= Round(percentage(totCEDA,KCEDA("kceda"))) %>%</span></div>
    <div id="blueC" class="blueBar" style="left:1px; top:60px; width:<% Response.Write (KCHAM("kcham")/3) %>cm; background:blue; height:14px;"><span>Chamb.</span><span class="bCap" style="left:40px;"><%= Round(percentage(totCHAM,KCHAM("kcham"))) %>%</span></div>
    <div id="blueD" class="blueBar" style="left:1px; top:90px; width:<% Response.Write (KCLAR("kclar")/3) %>cm; background:blue; height:14px;"><span>Clarkston</span><span class="bCap" style="left:94px;"><%= Round(percentage(totCLAR,KCLAR("kclar"))) %>%</span></div>
    <div id="blueE" class="blueBar" style="left:1px; top:120px; width:<% Response.Write (KCOLU("kcolu")/3) %>cm; background:blue; height:14px;"><span>Colum.</span><span class="bCap" style="left:32px;"><%= Round(percentage(totCOLU,KCOLU("kcolu"))) %>%</span></div>
    <div id="blueF" class="blueBar" style="left:1px; top:150px; width:<% Response.Write (KCROS("kcros")/3) %>cm; background:blue; height:14px;"><span>CK</span><span class="bCap" style="left:40px;"><%= Round(percentage(totCROS,KCROS("kcros"))) %>%</span></div>
    <div id="blueG" class="blueBar" style="left:1px; top:180px; width:<% Response.Write (KDRUI("kdrui")/3) %>cm; background:blue; height:14px;"><span>Druid Hills</span><span class="bCap" style="left:154px;"><%= Round(percentage(totDRUI,KDRUI("kdrui"))) %>%</span></div>
    <div id="blueH" class="blueBar" style="left:1px; top:210px; width:<% Response.Write (KDUNW("kdunw")/3) %>cm; background:blue; height:14px;"><span>Dunw.</span><span class="bCap" style="left:34px;"><%= Round(percentage(totDUNW,KDUNW("kdunw"))) %>%</span></div>
    <div id="blueI" class="blueBar" style="left:1px; top:240px; width:<% Response.Write (KLAKE("klake")/3) %>cm; background:blue; height:14px;"><span>Lakeside</span><span class="bCap" style="left:262px;"><%= Round(percentage(totLAKE,KLAKE("klake"))) %>%</span></div>
    <div id="blueJ" class="blueBar" style="left:1px; top:270px; width:<% Response.Write (KLITH("klith")/3) %>cm; background:blue; height:14px;"><span>Lithonia</span><span class="bCap" style="left:170px;"><%= Round(percentage(totLITH,KLITH("klith"))) %>%</span></div>
    <div id="blueK" class="blueBar" style="left:1px; top:300px; width:<% Response.Write (KMLKJ("kmlkj")/3) %>cm; background:blue; height:14px;"><span>M.L.K., Jr.</span><span class="bCap" style="left:186px;"><%= Round(percentage(totMLKJ,KMLKJ("kmlkj"))) %>%</span></div>
    <div id="blueL" class="blueBar" style="left:1px; top:330px; width:<% Response.Write (KMCNA("kmcna")/3) %>cm; background:blue; height:14px;"><span>McNair</span><span class="bCap" style="left:40px;"><%= Round(percentage(totMCNA,KMCNA("kmcna"))) %>%</span></div>
    <div id="blueM" class="blueBar" style="left:1px; top:360px; width:<% Response.Write (KREDA("kreda")/3) %>cm; background:blue; height:14px;"><span>Redan</span><span class="bCap" style="left:204px;"><%= Round(percentage(totREDA,KREDA("kreda"))) %>%</span></div>
    <div id="blueN" class="blueBar" style="left:1px; top:390px; width:<% Response.Write (KSOUT("ksout")/3) %>cm; background:blue; height:14px;"><span>Southwest Dekalb</span><span class="bCap" style="left:120px;"><%= Round(percentage(totSOUT,KSOUT("ksout"))) %>%</span></div>
    <div id="blueO" class="blueBar" style="left:1px; top:420px; width:<% Response.Write (KSTEP("kstep")/3) %>cm; background:blue; height:14px;"><span>Stephenson</span><span class="bCap" style="left:210px;"><%= Round(percentage(totSTEP,KSTEP("kstep"))) %>%</span></div>
    <div id="blueP" class="blueBar" style="left:1px; top:450px; width:<% Response.Write (KSTON("kston")/3) %>cm; background:blue; height:14px;"><span>Stone Mountain</span><span class="bCap" style="left:74px;"><%= Round(percentage(totSTON,KSTON("kston"))) %>%</span></div>
    <div id="blueQ" class="blueBar" style="left:1px; top:480px; width:<% Response.Write (KTOWE("ktowe")/3) %>cm; background:blue; height:14px;"><span>Towers</span><span class="bCap" style="left:122px;"><%= Round(percentage(totTOWE,KTOWE("ktowe"))) %>%</span></div>
    <div id="blueR" class="blueBar" style="left:1px; top:510px; width:<% Response.Write (KTUCK("ktuck")/3) %>cm; background:blue; height:14px;"><span>Tucker</span><span class="bCap" style="left:100px;"><%= Round(percentage(totTUCK,KTUCK("ktuck"))) %>%</span></div>

       </div>
</div>

<%
dim j1, j2B, j2K
j1 = "select count(GenderID) as "
j2B = " from SexResponse where PresidentID = 'Bush' and GenderResponse = '"
j2K = " from SexResponse where PresidentID = 'Kerry' and GenderResponse = '"

set BMALE = conn.Execute(j1 & "bmale" & j2B & "male" & "'")
set BFALE = conn.Execute(j1 & "bfale" & j2B & "female" & "'")

set KMALE = conn.Execute(j1 & "kmale" & j2K & "male" & "'")
set KFALE = conn.Execute(j1 & "kfale" & j2K & "female" & "'")

dim totMALE, totFALE
totMALE = BMALE("bmale") + KMALE("kmale")
totFALE = BFALE("bfale") + KFALE("kfale")

%>

<div id="genderGraf"><div class="tab" style="left:305px;">By Gender</div>
  <div id="genderHolder" style="text-align:left;">

    <div id="redMale" class="redBar" style="left:-<% Response.Write (BMALE("bmale")/20) %>cm; top:0px; width:<% Response.Write (BMALE("bmale")/20) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totMALE,BMALE("bmale"))) %>%</span></div>
    <div id="redFemale" class="redBar" style="left:-<% Response.Write (BFALE("bfale")/20) %>cm; top:30px; width:<% Response.Write (BFALE("bfale")/20) %>cm; background:red; height:14px;"><span class="rCap"><%= Round(percentage(totFALE,BFALE("bfale"))) %>%</span></div>
    
    <div id="blueMale" class="blueBar" style="left:1px; top:0px; width:<% Response.Write (KMALE("kmale")/20) %>cm; background:blue; height:14px;"><span>male</span><span class="bCap" style="left:94px;"><%= Round(percentage(totMALE,KMALE("kmale"))) %>%</span></div>
    <div id="blueFemale" class="blueBar" style="left:1px; top:30px; width:<% Response.Write (KFALE("kfale")/20) %>cm; background:blue; height:14px;"><span>female</span><span class="bCap" style="left:274px;"><%= Round(percentage(totFALE,KFALE("kfale"))) %>%</span></div>
    
  </div>
</div>

<br><br>
</body>
</html>
<%
conn.Close
%>


View Application (External Link) || Return to Results App