####################################
#CONNECT TO THE DATABASE and grab related images to this spiral
#================================
$sql ="SELECT key,vwdescription,drumnumber,sideofcolumn from traj where drumnumber ~'^$numonly,'";
$sql2 = "SELECT map from trajmap where spiral=\'$cartnum\'";
$conn = Pg::connectdb("dbname=trajan");
#execute the query
Pg::doQuery($conn, $sql, \@ary);
Pg::doQuery($conn, $sql2, \@ary2);
#================================
#build the links for these images
for $i(0..@ary){
#build spiral and panel refs
#strip spaces
$sideofcolumn=$ary[$i][3];
$sideofcolumn=~s/ //g;
if ($sideofcolumn eq "1-2"){ $apanel="a-b";}
if ($sideofcolumn eq "2-3"){ $apanel="b-c";}
if ($sideofcolumn eq "3-4"){ $apanel="c-d";}
if ($sideofcolumn eq "1-4"){ $apanel="a-d";}
#now set abcd
if ($sideofcolumn eq "1"){ $apanel="a";}
if ($sideofcolumn eq "2"){ $apanel="b";}
if ($sideofcolumn eq "3"){ $apanel="c";}
if ($sideofcolumn eq "4"){ $apanel="d";}
@assocspirals=split ",", $ary[$i][2];
############
#this works well comment out for now until image maps are done
#if ($ary[$i][2]) {
#$dbimages.="