[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 855
  • Last Modified:

Javascript and MySQL

Hi,
  I have built an image map of the United States for our company to use so users can search for projects by State. Right now I have the JavaScript set up so if you hover over a particular state, it displays the state name. What I want to do is to search our MySQL database and grab the number of jobs for each state so when the user hovers over the state, besides the name of the state, it will say something like "5 Jobs Found in Nebraska", and so on.

  I know how to write the SQL to get the data from the database, but I am not sure what to do after that as far as adding it to the JavaScript events that I have already written. I have included the code for the image map and the JavaScript events that handle it.

  If someone could give me some insight on how to do this, it would be greatly appreciated. Let me know if anymore info is needed.

Thanks,

T Bryan

Here is what I have so far:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Medefis Search By State</title>
<script type="text/javascript" src="/js/overlib.js"></script>
</head>
<body>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<div align="center">
<img src="/images/usa_jobs.jpg" alt="" usemap="#usa_jobs" style="border-style:none" />
</div>
<div>
<map id="usa_jobs" name="usa_jobs">
<area shape="poly" alt="" coords="81,40,80,45,79,50,78,54,74,54,67,53,62,52,57,52,53,52,55,52,51,52,46,51,38,51,36,48,35,43,31,39,31,33,31,19,42,25,42,32,45,32,47,16,53,17,58,18,64,19,70,21,75,23,79,24,85,25,83,34" href="javascript:void(0);" title="" onMouseOver="return overlib('Washington');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="81,60,75,69,73,71,73,74,73,78,69,97,59,96,52,94,48,93,43,91,38,89,33,88,25,87,14,85,14,74,19,66,22,60,24,55,27,48,28,41,32,42,35,45,35,49,37,51,45,51,52,52,59,53,65,53,70,54,77,56" href="javascript:void(0);" title="" onMouseOver="return overlib('Oregon');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="42,104,41,107,40,112,39,116,37,124,74,179,68,198,47,196,46,188,23,168,14,136,14,122,11,118,11,113,12,108,12,105,10,101,12,98,14,94,15,90,15,86,20,87,25,88,27,88,32,89,35,90,44,93,44,96,44,98,43,102" href="javascript:void(0);" title="" onMouseOver="return overlib('California');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="87,123,86,128,85,133,84,137,78,163,74,163,72,172,62,158,57,151,53,144,50,139,48,136,46,133,44,130,39,124,40,121,41,117,41,113,43,109,43,104,45,96,47,94,60,97,64,98,68,99,74,100,83,102,91,104,90,113,88,118" href="javascript:void(0);" title="" onMouseOver="return overlib('Nevada');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="101,70,102,73,106,77,118,79,114,104,104,104,97,102,90,101,86,100,79,99,70,97,71,89,73,82,73,77,73,72,75,69,76,68,78,67,78,66,80,64,82,59,79,56,86,25,91,26,91,42,97,53,96,64,101,65,101,68,101,69" href="javascript:void(0);" title="" onMouseOver="return overlib('Idaho');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="176,50,175,59,173,81,162,79,149,78,144,77,135,76,131,75,127,74,121,74,119,79,107,77,102,70,102,65,97,63,99,54,93,44,91,36,92,26,109,29,116,31,122,31,126,32,129,33,134,34,139,34,144,35,151,35,160,37,175,38" href="javascript:void(0);" title="" onMouseOver="return overlib('Montana');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="171,83,171,95,169,104,169,113,168,122,152,121,143,120,136,119,130,118,124,117,116,115,117,106,117,99,118,93,118,89,118,86,119,84,120,80,122,77,125,76,130,77,132,77,133,77,136,78,138,78,141,78,145,79,148,79,154,80,161,80" href="javascript:void(0);" title="" onMouseOver="return overlib('Wyoming');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="227,58,228,72,208,72,198,71,194,71,191,70,187,71,184,70,183,71,181,70,179,70,176,70,175,65,176,63,176,61,176,59,175,57,176,57,176,55,176,52,177,50,177,39,181,39,185,39,187,40,191,40,196,41,205,41,224,42,224,51" href="javascript:void(0);" title="" onMouseOver="return overlib('North Dakota');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="230,89,230,95,229,108,221,107,212,104,207,103,204,103,200,103,198,104,196,103,194,102,190,102,183,101,173,101,172,95,173,88,174,84,174,80,175,72,186,73,191,73,196,73,199,73,202,73,208,73,212,73,216,73,221,73,228,73,230,82" href="javascript:void(0);" title="" onMouseOver="return overlib('South Dakota');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="234,122,236,131,238,137,226,136,215,136,210,136,204,136,200,136,197,135,193,135,186,135,187,129,186,125,183,124,171,122,171,115,171,110,172,103,177,103,184,103,190,103,193,104,195,103,198,105,200,104,204,105,207,105,211,105,230,109,232,114" href="javascript:void(0);" title="" onMouseOver="return overlib('Nebraska');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="127,133,126,138,125,143,126,146,125,149,124,161,116,160,109,159,105,158,100,158,94,157,83,155,83,148,85,141,86,135,87,130,88,126,89,122,89,117,91,113,93,105,99,105,107,106,114,107,115,117,117,118,120,118,124,120,128,121,128,129" href="javascript:void(0);" title="" onMouseOver="return overlib('Utah');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="184,141,183,148,183,154,183,166,171,166,165,166,158,166,153,165,149,165,146,164,141,164,136,163,126,161,126,153,127,146,127,142,127,138,128,134,129,129,130,121,135,121,143,121,148,122,151,122,155,123,159,123,166,123,173,125,184,126,185,136" href="javascript:void(0);" title="" onMouseOver="return overlib('Colarado');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="121,182,120,187,119,192,118,202,117,209,115,222,104,220,95,218,88,214,83,211,79,208,74,206,69,201,71,191,73,187,74,183,75,180,73,176,73,172,75,164,79,164,82,156,88,157,93,158,98,158,104,160,109,160,123,163,123,170,122,177" href="javascript:void(0);" title="" onMouseOver="return overlib('Arizona');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="172,180,172,187,171,196,171,204,169,220,157,219,147,218,137,219,123,219,123,223,116,223,120,201,121,194,121,189,121,185,122,182,122,179,124,176,124,173,124,170,125,164,130,163,136,164,141,165,139,165,145,165,150,166,157,167,174,168,174,173" href="javascript:void(0);" title="" onMouseOver="return overlib('New Mexico');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="244,146,245,152,245,161,245,169,232,168,226,169,221,169,215,168,211,168,208,167,204,167,198,167,191,167,184,166,184,155,184,149,185,144,186,137,191,136,199,137,204,137,207,137,211,137,213,137,215,137,218,137,222,137,226,138,233,138,240,140" href="javascript:void(0);" title="" onMouseOver="return overlib('Kansas');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="246,182,247,188,248,197,247,205,236,203,231,203,223,203,217,201,214,199,212,199,208,199,205,197,201,196,200,188,200,185,200,181,199,175,176,173,175,167,191,168,204,169,210,169,213,169,216,169,219,170,222,169,228,170,232,170,244,171,246,177" href="javascript:void(0);" title="" onMouseOver="return overlib('Oklahoma');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="253,227,256,234,253,246,244,252,230,260,219,274,222,288,209,285,203,278,191,253,182,245,172,245,166,252,156,245,154,235,140,220,170,222,172,214,172,205,173,190,175,174,197,176,199,197,211,200,217,202,221,204,230,205,241,205,250,208,251,219" href="javascript:void(0);" title="" onMouseOver="return overlib('Texas');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="260,66,261,69,258,72,257,76,260,88,270,95,271,99,257,99,250,99,242,99,231,99,231,80,228,75,230,70,229,67,229,65,229,62,228,57,225,50,226,42,234,41,241,38,244,44,249,45,253,45,258,47,270,49,279,51,268,57,262,63" href="javascript:void(0);" title="" onMouseOver="return overlib('Minnesota');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="279,114,279,119,275,121,272,129,264,130,260,130,256,130,253,130,250,131,246,130,241,130,237,130,236,123,234,119,233,117,233,114,231,111,231,107,231,100,240,100,244,100,248,100,250,100,253,100,256,100,259,100,264,100,270,100,272,106,275,109" href="javascript:void(0);" title="" onMouseOver="return overlib('Iowa');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="296,86,301,80,297,93,296,98,297,107,292,109,287,109,281,109,277,109,273,105,271,96,271,94,269,92,266,90,264,88,261,87,260,86,259,77,260,73,263,66,270,64,273,65,277,67,280,69,283,69,287,70,291,72,294,74,296,79,295,82" href="javascript:void(0);" title="" onMouseOver="return overlib('Wisconsin');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="302,128,302,131,303,136,304,147,300,159,296,165,291,166,282,154,283,151,282,148,279,147,277,144,275,141,272,136,272,131,274,128,274,126,276,122,279,121,281,119,283,117,279,111,286,109,291,110,297,109,300,114,301,118,301,120,302,123,302,126" href="javascript:void(0);" title="" onMouseOver="return overlib('Illinois');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="289,173,288,179,284,179,285,174,279,173,272,174,268,174,264,174,260,174,254,174,247,174,247,170,247,165,246,162,247,158,246,155,246,152,246,148,242,141,238,132,246,131,252,131,258,131,262,131,270,132,271,138,276,144,281,149,281,155,292,169" href="javascript:void(0);" title="" onMouseOver="return overlib('Missouri');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="281,193,279,197,277,201,276,204,276,211,270,211,266,211,262,212,258,212,252,212,251,206,249,205,249,203,248,200,249,197,249,195,249,192,248,189,248,186,247,181,248,176,255,175,260,175,263,175,266,175,283,175,283,178,287,180,285,185,283,190" href="javascript:void(0);" title="" onMouseOver="return overlib('Arkansas');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="290,233,290,238,285,241,291,244,297,243,294,248,299,252,291,249,289,251,283,252,273,245,270,245,269,249,257,246,255,243,256,232,254,226,252,222,251,218,251,213,257,213,262,212,263,212,265,212,267,212,269,212,276,212,280,219,275,226,274,233" href="javascript:void(0);" title="" onMouseOver="return overlib('Louisiana');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="323,66,310,69,306,71,302,72,299,75,298,77,297,78,294,72,292,71,292,71,291,71,290,70,290,70,289,69,287,70,285,69,281,68,278,65,281,62,286,60,294,55,290,60,295,62,300,64,303,63,308,62,311,63,315,60,316,63,321,64" href="javascript:void(0);" title="" onMouseOver="return overlib('Michigan');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="334,87,338,92,338,104,335,105,334,112,327,113,322,113,320,113,317,113,313,113,309,113,311,109,311,105,311,102,310,100,310,98,309,97,309,94,308,91,309,83,311,80,314,80,316,75,318,71,325,73,329,76,330,82,326,88,327,92,329,93" href="javascript:void(0);" title="" onMouseOver="return overlib('Michigan');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="325,127,325,130,326,134,326,140,325,145,321,146,319,152,314,154,312,155,302,156,304,150,304,144,304,141,304,137,304,133,304,129,303,126,303,122,303,118,307,116,310,114,313,114,314,114,317,114,322,114,323,117,323,120,324,122,325,125,325,126" href="javascript:void(0);" title="" onMouseOver="return overlib('Indiana');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="358,131,355,133,353,135,350,138,347,141,346,145,342,144,338,144,335,144,332,143,329,140,327,138,326,135,326,133,326,131,326,128,325,125,324,121,324,118,324,114,329,114,333,113,336,114,338,114,340,115,344,114,356,108,358,117,359,121,358,127" href="javascript:void(0);" title="" onMouseOver="return overlib('Ohio');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="376,245,379,248,380,250,381,255,387,265,388,281,383,284,365,268,363,257,359,258,360,248,358,246,346,237,341,237,336,242,329,237,323,235,315,237,313,231,321,230,331,229,335,230,337,232,360,231,363,227,367,228,369,233,370,236,372,240,373,243" href="javascript:void(0);" title="" onMouseOver="return overlib('Florida');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="302,214,302,217,302,219,303,222,303,227,304,238,292,238,292,233,289,233,286,232,282,232,275,232,276,226,281,219,280,216,279,212,280,213,278,211,277,207,277,204,279,200,282,195,284,190,290,189,302,189,302,197,302,200,302,204,302,207,302,211" href="javascript:void(0);" title="" onMouseOver="return overlib('Mississippi');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="334,213,333,216,332,219,335,229,326,229,323,229,319,230,315,230,312,231,312,238,309,233,305,237,304,228,303,219,303,215,303,212,303,210,303,207,303,200,302,197,303,195,303,189,311,187,316,187,323,187,325,191,327,198,329,202,330,207,331,210" href="javascript:void(0);" title="" onMouseOver="return overlib('Alabama');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="367,210,369,214,368,218,366,222,367,227,362,227,360,230,356,230,352,230,349,230,338,232,336,230,334,224,333,219,334,212,331,207,328,199,326,193,325,187,331,186,339,186,344,185,349,191,353,195,356,198,358,199,360,201,362,202,363,203,365,206" href="javascript:void(0);" title="" onMouseOver="return overlib('Georgia');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="387,189,383,194,383,198,380,200,378,203,375,205,372,208,369,213,365,206,364,204,362,202,360,200,357,197,354,194,350,191,347,187,346,185,350,182,354,180,359,180,364,181,365,181,367,182,367,182,370,182,371,182,373,181,376,181,379,183,383,186" href="javascript:void(0);" title="" onMouseOver="return overlib('South Carolina');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="400,177,397,179,394,182,393,186,391,188,388,189,384,186,381,184,379,182,374,181,370,182,359,180,352,180,345,184,333,186,336,181,356,165,362,164,367,163,372,163,376,162,383,161,403,158,405,159,400,164,408,164,407,168,401,169,402,174,404,175" href="javascript:void(0);" title="" onMouseOver="return overlib('North Carolina');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="351,170,342,176,336,180,333,185,326,186,324,186,321,186,318,186,317,186,315,186,309,187,303,188,294,188,284,189,288,180,290,174,299,173,306,172,310,170,311,170,313,170,316,170,316,170,318,170,319,170,322,170,328,168,337,168,344,167,354,166" href="javascript:void(0);" title="" onMouseOver="return overlib('Tennessee');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="351,156,348,160,343,164,340,167,336,168,334,168,332,168,331,168,329,168,326,168,318,170,310,170,301,172,292,173,292,167,298,163,302,157,314,155,319,152,321,150,321,147,325,146,327,140,330,143,333,145,336,145,339,145,343,146,345,147,346,150" href="javascript:void(0);" title="" onMouseOver="return overlib('Kentucky');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="399,152,402,153,404,156,400,158,394,159,391,159,386,159,383,160,381,160,377,161,370,163,363,163,354,165,341,166,351,158,355,158,362,155,366,153,368,146,370,142,372,142,377,135,378,132,382,133,385,133,389,135,388,138,389,141,395,142,399,145" href="javascript:void(0);" title="" onMouseOver="return overlib('Virginia');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="378,132,376,135,374,139,370,142,368,146,366,152,363,154,360,155,358,156,354,157,351,155,349,152,347,149,346,146,347,144,348,142,350,140,351,139,352,138,353,137,354,136,355,135,360,130,357,133,363,130,368,130,370,133,375,130,381,129,383,131" href="javascript:void(0);" title="" onMouseOver="return overlib('West Virginia');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="402,120,398,122,394,123,390,124,385,124,383,125,380,125,378,125,374,127,370,127,366,129,361,129,359,127,360,122,359,118,358,113,357,107,360,104,363,105,367,105,370,104,372,103,374,102,379,102,383,101,389,100,396,99,401,105,400,113,403,117" href="javascript:void(0);" title="" onMouseOver="return overlib('Pennsylvania');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="409,85,410,89,410,93,411,98,412,104,410,105,402,103,396,98,378,101,365,104,361,103,367,98,367,94,367,90,371,88,375,88,380,88,385,84,386,81,385,77,387,74,389,70,392,67,395,65,400,64,404,64,404,68,405,72,407,78,409,82" href="javascript:void(0);" title="" onMouseOver="return overlib('New York');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="395,141,390,140,389,137,390,134,387,132,382,132,383,130,379,129,379,129,376,129,374,130,370,132,369,131,368,129,370,127,386,125,397,123,399,127,400,131,401,134,405,136,407,139,404,141,399,137,398,133,396,129,394,130,394,132,394,136" href="javascript:void(0);" title="" onMouseOver="return overlib('Maryland');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="412,118,411,115,411,117,411,118,411,119,412,119,411,121,410,123,409,126,408,130,406,128,403,126,402,122,403,119,404,117,404,117,404,117,403,115,401,111,402,107,403,105,406,105,408,106,409,112,411,115,411,115,411,116,413,119,412,117,411,117" href="javascript:void(0);" title="" onMouseOver="return overlib('New Jersey');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="446,49,449,50,450,54,446,57,443,59,441,62,439,63,437,66,434,68,430,70,429,79,425,70,423,64,420,57,423,53,424,50,423,46,423,42,423,40,424,37,425,34,428,31,430,32,434,29,437,31,439,35,441,39,442,43,443,45,446,46" href="javascript:void(0);" title="" onMouseOver="return overlib('Maine');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="426,75,426,74,427,77,428,79,428,81,427,82,425,83,423,84,421,84,419,85,416,85,415,80,415,78,415,76,415,73,416,74,416,75,415,70,416,68,417,65,418,63,417,56,420,57,422,63,423,67,425,72,425,73,426,74,426,73,426,75" href="javascript:void(0);" title="" onMouseOver="return overlib('New Hampshire');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="417,60,414,60,417,60,417,64,415,73,415,78,416,86,411,87,410,80,407,76,406,70,405,68,406,69,405,67,406,66,406,68,406,66,406,66,405,65,405,65,406,65,406,63,411,62,408,62,409,62,412,61,414,60,414,60,417,60,417,61" href="javascript:void(0);" title="" onMouseOver="return overlib('Vermont');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="436,93,432,94,427,91,419,92,411,93,410,88,421,84,421,84,419,86,410,88,410,91,411,93,426,91,422,92,411,92,410,88,414,87,424,84,424,84,428,82,425,83,425,83,430,83,423,83,421,84,429,82,430,84,432,89,434,91,438,91" href="javascript:void(0);" title="" onMouseOver="return overlib('Massachusetts');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="419,101,412,104,426,97,426,97,412,105,412,93,417,93,411,94,412,104,412,96,412,97,412,104,412,104,413,93,413,104,412,98,413,93,414,94,416,93,419,92,425,92,421,92,420,92,416,93,415,93,420,92,425,92,426,97,422,99,424,98" href="javascript:void(0);" title="" onMouseOver="return overlib('Connecticut');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="425,94,425,93,425,92,425,96,426,98,429,96,430,95,431,94,429,93,427,92,425,91,425,92" href="javascript:void(0);" title="" onMouseOver="return overlib('Rhode Island');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="409,106,411,105,417,104,420,102,422,102,423,102,425,102,426,104,422,105,421,106,420,107,418,108,417,109,415,110,414,110,411,112,410,111,409,109" href="javascript:void(0);" title="" onMouseOver="return overlib('New York');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="405,131,403,129,402,126,401,124,401,121,398,123,399,125,399,126,400,128,400,130,401,132,402,134,403,134,405,136,406,137,407,140,408,140,408,136,408,133,406,131,405,130" href="javascript:void(0);" title="" onMouseOver="return overlib('Delaware');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="134,325,130,319,127,310,117,301,102,301,50,335,76,305,68,305,60,291,62,285,71,281,71,275,65,277,58,274,55,269,60,266,65,268,72,266,56,258,65,250,73,245,82,243,97,247,110,248,115,251,116,296,123,298,129,300,139,317,140,325" href="javascript:void(0);" title="" onMouseOver="return overlib('Alaska');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="327,311,313,303,297,296,286,293,274,289,266,291,264,294,264,298,271,295,278,296,294,306,310,311,315,317,325,327,328,335,332,339,337,336,345,331,339,322" href="javascript:void(0);" title="" onMouseOver="return overlib('Hawaii');" onMouseOut="return nd();" />
<area shape="default" nohref="nohref" alt="" />
</map>
</div>
</body>
</html>
0
jahmekyat
Asked:
jahmekyat
  • 18
  • 13
1 Solution
 
apparitionCommented:
You have to load the data in your Javascript. You can do this a number of different ways but I would recommend using an array
so your function should do the following


First you have to create the array of States and jobs
<script>
   var jobs_in_states = new Array()
<%
       write PHP Query to get data using SQL
       Start looping through data
%>
 
  jobs_in_states["<%=Statename%>"]="<%=%>";
<%
     End Loop
%>
function overlib(state) {
   var Jobs = jobs_in_states[state]
   //put code to display number of jobs
}
</script>

This is the basic idea we can focus on each individual section as you have more questions and figure out how to integrate with your existing code
0
 
jahmekyatAuthor Commented:
Hi apparition,
Thank you for your response. I was not able to respond your answer earlier because of a prior engagement.
What you have given me looks pretty good. I will start to implement this into my existing code and we can go from there. I will start working on this this afternoon and get back to you with my questions.
Thanks again,

T Bryan
0
 
jahmekyatAuthor Commented:
Hi apparition,
I am trying to add what you have given me into my code and there is one problem. I am coding in CGI, Perl, and not PHP.
Is there anyway that you could modify what you have given me for CGI?
That would help me out greatly. I have my SQL ready to go as far as putting the data into an array.

Thanks for your help,
T Bryan
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
apparitionCommented:
/usr/local/bin/perl

use CGI;
use DBI;

$query = new CGI;

use CGI::Carp qw(fatalsToBrowser);

print "Content-type: text/html\n\n";

#Print Top HTML
print << EOF
<HTML>
<HEAD>
<script>
   var jobs_in_states = new Array()
EOF
$dbh = DBI->connect("dbi:mysql:mydatabase","demo","")
      or die("Couldn't connect");

$query->import_names('R');

$sth = $dbh->prepare("ENTER YOU QUERY HERE")
      or die("Couldn't prepare");
$sth->execute($R::place);


if($sth->rows == 0)
{
        print "No information for " . $R::place;
}
else
{
        while( $resptr =  $sth->fetchrow_hashref() )
        {
                print "jobs_in_states[\"" . $resptr->{"StateName"}. "\"] = \"" . $resptr->{"jobs"} . "\"";
        }
       
}
#Print rest of the HTML
print << EOF2
function overlib(state) {
   var Jobs = jobs_in_states[state]
   //put code to display number of jobs
}
</script>
...Rest of your HTML goes here
EOF2

$dbh->disconnect;
0
 
jahmekyatAuthor Commented:
Hi apparition,
Thanks for getting back to me so quickly. My site already has the connection set up for the DB for all the scripts.
So I should be able to just execute my SQl.
Can you look at this and let me know how it looks? This is my subroutine for the job display html. Does this look alright? This is where I am at:

sub sform {

print << EOF
<HTML>
<HEAD>
<script>
   var jobs_in_states = new Array()
EOF

$sth = $db->d_value("SELECT count(*), hosp_state FROM Projects GROUP BY hosp_state");


if($sth->rows == 0)
{
        print "No information for " . $R::place;
}
else
{
        while( $resptr =  $sth->fetchrow_hashref() )
        {
                print "jobs_in_states[\"" . $resptr->{"StateName"}. "\"] = \"" . $resptr->{"jobs"} . "\"";
        }

}
#Print rest of the HTML
print << EOF2
function overlib(state) {
   var Jobs = jobs_in_states[state]
   //put code to display number of jobs
}
</script>
...Rest of your HTML goes here
EOF2

$dbh->disconnect;



   $sform = qq[
        <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Medefis Search By State</title>
<script type="text/javascript" src="/js/overlib.js"></script>
</head>
<body>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<div align="center">
<img src="/images/usa_jobs.jpg" alt="" usemap="#usa_jobs" style="border-style:none" />
</div>
<div>
<map id="usa_jobs" name="usa_jobs">
<area shape="poly" alt="" coords="81,40,80,45,79,50,78,54,74,54,67,53,62,52,57,52,53,52,55,52,51,52,46,51,38,51,36,48,35,43,31,39,31,33,31,19,42,25,42,32,45,32,47,16,53,17,58,18,64,19,70,21,75,23,79,24,85,25,83,34" href="javascript:void(0);" title="" onMouseOver="return overlib('Washington');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="81,60,75,69,73,71,73,74,73,78,69,97,59,96,52,94,48,93,43,91,38,89,33,88,25,87,14,85,14,74,19,66,22,60,24,55,27,48,28,41,32,42,35,45,35,49,37,51,45,51,52,52,59,53,65,53,70,54,77,56" href="javascript:void(0);" title="" onMouseOver="return overlib('Oregon');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="42,104,41,107,40,112,39,116,37,124,74,179,68,198,47,196,46,188,23,168,14,136,14,122,11,118,11,113,12,108,12,105,10,101,12,98,14,94,15,90,15,86,20,87,25,88,27,88,32,89,35,90,44,93,44,96,44,98,43,102" href="javascript:void(0);" title="" onMouseOver="return overlib('California');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="87,123,86,128,85,133,84,137,78,163,74,163,72,172,62,158,57,151,53,144,50,139,48,136,46,133,44,130,39,124,40,121,41,117,41,113,43,109,43,104,45,96,47,94,60,97,64,98,68,99,74,100,83,102,91,104,90,113,88,118" href="javascript:void(0);" title="" onMouseOver="return overlib('Nevada');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="101,70,102,73,106,77,118,79,114,104,104,104,97,102,90,101,86,100,79,99,70,97,71,89,73,82,73,77,73,72,75,69,76,68,78,67,78,66,80,64,82,59,79,56,86,25,91,26,91,42,97,53,96,64,101,65,101,68,101,69" href="javascript:void(0);" title="" onMouseOver="return overlib('Idaho');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="176,50,175,59,173,81,162,79,149,78,144,77,135,76,131,75,127,74,121,74,119,79,107,77,102,70,102,65,97,63,99,54,93,44,91,36,92,26,109,29,116,31,122,31,126,32,129,33,134,34,139,34,144,35,151,35,160,37,175,38" href="javascript:void(0);" title="" onMouseOver="return overlib('Montana');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="171,83,171,95,169,104,169,113,168,122,152,121,143,120,136,119,130,118,124,117,116,115,117,106,117,99,118,93,118,89,118,86,119,84,120,80,122,77,125,76,130,77,132,77,133,77,136,78,138,78,141,78,145,79,148,79,154,80,161,80" href="javascript:void(0);" title="" onMouseOver="return overlib('Wyoming');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="227,58,228,72,208,72,198,71,194,71,191,70,187,71,184,70,183,71,181,70,179,70,176,70,175,65,176,63,176,61,176,59,175,57,176,57,176,55,176,52,177,50,177,39,181,39,185,39,187,40,191,40,196,41,205,41,224,42,224,51" href="javascript:void(0);" title="" onMouseOver="return overlib('North Dakota');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="230,89,230,95,229,108,221,107,212,104,207,103,204,103,200,103,198,104,196,103,194,102,190,102,183,101,173,101,172,95,173,88,174,84,174,80,175,72,186,73,191,73,196,73,199,73,202,73,208,73,212,73,216,73,221,73,228,73,230,82" href="javascript:void(0);" title="" onMouseOver="return overlib('South Dakota');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="234,122,236,131,238,137,226,136,215,136,210,136,204,136,200,136,197,135,193,135,186,135,187,129,186,125,183,124,171,122,171,115,171,110,172,103,177,103,184,103,190,103,193,104,195,103,198,105,200,104,204,105,207,105,211,105,230,109,232,114" href="javascript:void(0);" title="" onMouseOver="return overlib('Nebraska');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="127,133,126,138,125,143,126,146,125,149,124,161,116,160,109,159,105,158,100,158,94,157,83,155,83,148,85,141,86,135,87,130,88,126,89,122,89,117,91,113,93,105,99,105,107,106,114,107,115,117,117,118,120,118,124,120,128,121,128,129" href="javascript:void(0);" title="" onMouseOver="return overlib('Utah');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="184,141,183,148,183,154,183,166,171,166,165,166,158,166,153,165,149,165,146,164,141,164,136,163,126,161,126,153,127,146,127,142,127,138,128,134,129,129,130,121,135,121,143,121,148,122,151,122,155,123,159,123,166,123,173,125,184,126,185,136" href="javascript:void(0);" title="" onMouseOver="return overlib('Colarado');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="121,182,120,187,119,192,118,202,117,209,115,222,104,220,95,218,88,214,83,211,79,208,74,206,69,201,71,191,73,187,74,183,75,180,73,176,73,172,75,164,79,164,82,156,88,157,93,158,98,158,104,160,109,160,123,163,123,170,122,177" href="javascript:void(0);" title="" onMouseOver="return overlib('Arizona');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="172,180,172,187,171,196,171,204,169,220,157,219,147,218,137,219,123,219,123,223,116,223,120,201,121,194,121,189,121,185,122,182,122,179,124,176,124,173,124,170,125,164,130,163,136,164,141,165,139,165,145,165,150,166,157,167,174,168,174,173" href="javascript:void(0);" title="" onMouseOver="return overlib('New Mexico');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="244,146,245,152,245,161,245,169,232,168,226,169,221,169,215,168,211,168,208,167,204,167,198,167,191,167,184,166,184,155,184,149,185,144,186,137,191,136,199,137,204,137,207,137,211,137,213,137,215,137,218,137,222,137,226,138,233,138,240,140" href="javascript:void(0);" title="" onMouseOver="return overlib('Kansas');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="246,182,247,188,248,197,247,205,236,203,231,203,223,203,217,201,214,199,212,199,208,199,205,197,201,196,200,188,200,185,200,181,199,175,176,173,175,167,191,168,204,169,210,169,213,169,216,169,219,170,222,169,228,170,232,170,244,171,246,177" href="javascript:void(0);" title="" onMouseOver="return overlib('Oklahoma');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="253,227,256,234,253,246,244,252,230,260,219,274,222,288,209,285,203,278,191,253,182,245,172,245,166,252,156,245,154,235,140,220,170,222,172,214,172,205,173,190,175,174,197,176,199,197,211,200,217,202,221,204,230,205,241,205,250,208,251,219" href="javascript:void(0);" title="" onMouseOver="return overlib('Texas');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="260,66,261,69,258,72,257,76,260,88,270,95,271,99,257,99,250,99,242,99,231,99,231,80,228,75,230,70,229,67,229,65,229,62,228,57,225,50,226,42,234,41,241,38,244,44,249,45,253,45,258,47,270,49,279,51,268,57,262,63" href="javascript:void(0);" title="" onMouseOver="return overlib('Minnesota');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="279,114,279,119,275,121,272,129,264,130,260,130,256,130,253,130,250,131,246,130,241,130,237,130,236,123,234,119,233,117,233,114,231,111,231,107,231,100,240,100,244,100,248,100,250,100,253,100,256,100,259,100,264,100,270,100,272,106,275,109" href="javascript:void(0);" title="" onMouseOver="return overlib('Iowa');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="296,86,301,80,297,93,296,98,297,107,292,109,287,109,281,109,277,109,273,105,271,96,271,94,269,92,266,90,264,88,261,87,260,86,259,77,260,73,263,66,270,64,273,65,277,67,280,69,283,69,287,70,291,72,294,74,296,79,295,82" href="javascript:void(0);" title="" onMouseOver="return overlib('Wisconsin');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="302,128,302,131,303,136,304,147,300,159,296,165,291,166,282,154,283,151,282,148,279,147,277,144,275,141,272,136,272,131,274,128,274,126,276,122,279,121,281,119,283,117,279,111,286,109,291,110,297,109,300,114,301,118,301,120,302,123,302,126" href="javascript:void(0);" title="" onMouseOver="return overlib('Illinois');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="289,173,288,179,284,179,285,174,279,173,272,174,268,174,264,174,260,174,254,174,247,174,247,170,247,165,246,162,247,158,246,155,246,152,246,148,242,141,238,132,246,131,252,131,258,131,262,131,270,132,271,138,276,144,281,149,281,155,292,169" href="javascript:void(0);" title="" onMouseOver="return overlib('Missouri');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="281,193,279,197,277,201,276,204,276,211,270,211,266,211,262,212,258,212,252,212,251,206,249,205,249,203,248,200,249,197,249,195,249,192,248,189,248,186,247,181,248,176,255,175,260,175,263,175,266,175,283,175,283,178,287,180,285,185,283,190" href="javascript:void(0);" title="" onMouseOver="return overlib('Arkansas');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="290,233,290,238,285,241,291,244,297,243,294,248,299,252,291,249,289,251,283,252,273,245,270,245,269,249,257,246,255,243,256,232,254,226,252,222,251,218,251,213,257,213,262,212,263,212,265,212,267,212,269,212,276,212,280,219,275,226,274,233" href="javascript:void(0);" title="" onMouseOver="return overlib('Louisiana');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="323,66,310,69,306,71,302,72,299,75,298,77,297,78,294,72,292,71,292,71,291,71,290,70,290,70,289,69,287,70,285,69,281,68,278,65,281,62,286,60,294,55,290,60,295,62,300,64,303,63,308,62,311,63,315,60,316,63,321,64" href="javascript:void(0);" title="" onMouseOver="return overlib('Michigan');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="334,87,338,92,338,104,335,105,334,112,327,113,322,113,320,113,317,113,313,113,309,113,311,109,311,105,311,102,310,100,310,98,309,97,309,94,308,91,309,83,311,80,314,80,316,75,318,71,325,73,329,76,330,82,326,88,327,92,329,93" href="javascript:void(0);" title="" onMouseOver="return overlib('Michigan');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="325,127,325,130,326,134,326,140,325,145,321,146,319,152,314,154,312,155,302,156,304,150,304,144,304,141,304,137,304,133,304,129,303,126,303,122,303,118,307,116,310,114,313,114,314,114,317,114,322,114,323,117,323,120,324,122,325,125,325,126" href="javascript:void(0);" title="" onMouseOver="return overlib('Indiana');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="358,131,355,133,353,135,350,138,347,141,346,145,342,144,338,144,335,144,332,143,329,140,327,138,326,135,326,133,326,131,326,128,325,125,324,121,324,118,324,114,329,114,333,113,336,114,338,114,340,115,344,114,356,108,358,117,359,121,358,127" href="javascript:void(0);" title="" onMouseOver="return overlib('Ohio');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="376,245,379,248,380,250,381,255,387,265,388,281,383,284,365,268,363,257,359,258,360,248,358,246,346,237,341,237,336,242,329,237,323,235,315,237,313,231,321,230,331,229,335,230,337,232,360,231,363,227,367,228,369,233,370,236,372,240,373,243" href="javascript:void(0);" title="" onMouseOver="return overlib('Florida');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="302,214,302,217,302,219,303,222,303,227,304,238,292,238,292,233,289,233,286,232,282,232,275,232,276,226,281,219,280,216,279,212,280,213,278,211,277,207,277,204,279,200,282,195,284,190,290,189,302,189,302,197,302,200,302,204,302,207,302,211" href="javascript:void(0);" title="" onMouseOver="return overlib('Mississippi');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="334,213,333,216,332,219,335,229,326,229,323,229,319,230,315,230,312,231,312,238,309,233,305,237,304,228,303,219,303,215,303,212,303,210,303,207,303,200,302,197,303,195,303,189,311,187,316,187,323,187,325,191,327,198,329,202,330,207,331,210" href="javascript:void(0);" title="" onMouseOver="return overlib('Alabama');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="367,210,369,214,368,218,366,222,367,227,362,227,360,230,356,230,352,230,349,230,338,232,336,230,334,224,333,219,334,212,331,207,328,199,326,193,325,187,331,186,339,186,344,185,349,191,353,195,356,198,358,199,360,201,362,202,363,203,365,206" href="javascript:void(0);" title="" onMouseOver="return overlib('Georgia');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="387,189,383,194,383,198,380,200,378,203,375,205,372,208,369,213,365,206,364,204,362,202,360,200,357,197,354,194,350,191,347,187,346,185,350,182,354,180,359,180,364,181,365,181,367,182,367,182,370,182,371,182,373,181,376,181,379,183,383,186" href="javascript:void(0);" title="" onMouseOver="return overlib('South Carolina');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="400,177,397,179,394,182,393,186,391,188,388,189,384,186,381,184,379,182,374,181,370,182,359,180,352,180,345,184,333,186,336,181,356,165,362,164,367,163,372,163,376,162,383,161,403,158,405,159,400,164,408,164,407,168,401,169,402,174,404,175" href="javascript:void(0);" title="" onMouseOver="return overlib('North Carolina');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="351,170,342,176,336,180,333,185,326,186,324,186,321,186,318,186,317,186,315,186,309,187,303,188,294,188,284,189,288,180,290,174,299,173,306,172,310,170,311,170,313,170,316,170,316,170,318,170,319,170,322,170,328,168,337,168,344,167,354,166" href="javascript:void(0);" title="" onMouseOver="return overlib('Tennessee');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="351,156,348,160,343,164,340,167,336,168,334,168,332,168,331,168,329,168,326,168,318,170,310,170,301,172,292,173,292,167,298,163,302,157,314,155,319,152,321,150,321,147,325,146,327,140,330,143,333,145,336,145,339,145,343,146,345,147,346,150" href="javascript:void(0);" title="" onMouseOver="return overlib('Kentucky');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="399,152,402,153,404,156,400,158,394,159,391,159,386,159,383,160,381,160,377,161,370,163,363,163,354,165,341,166,351,158,355,158,362,155,366,153,368,146,370,142,372,142,377,135,378,132,382,133,385,133,389,135,388,138,389,141,395,142,399,145" href="javascript:void(0);" title="" onMouseOver="return overlib('Virginia');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="378,132,376,135,374,139,370,142,368,146,366,152,363,154,360,155,358,156,354,157,351,155,349,152,347,149,346,146,347,144,348,142,350,140,351,139,352,138,353,137,354,136,355,135,360,130,357,133,363,130,368,130,370,133,375,130,381,129,383,131" href="javascript:void(0);" title="" onMouseOver="return overlib('West Virginia');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="402,120,398,122,394,123,390,124,385,124,383,125,380,125,378,125,374,127,370,127,366,129,361,129,359,127,360,122,359,118,358,113,357,107,360,104,363,105,367,105,370,104,372,103,374,102,379,102,383,101,389,100,396,99,401,105,400,113,403,117" href="javascript:void(0);" title="" onMouseOver="return overlib('Pennsylvania');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="409,85,410,89,410,93,411,98,412,104,410,105,402,103,396,98,378,101,365,104,361,103,367,98,367,94,367,90,371,88,375,88,380,88,385,84,386,81,385,77,387,74,389,70,392,67,395,65,400,64,404,64,404,68,405,72,407,78,409,82" href="javascript:void(0);" title="" onMouseOver="return overlib('New York');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="395,141,390,140,389,137,390,134,387,132,382,132,383,130,379,129,379,129,376,129,374,130,370,132,369,131,368,129,370,127,386,125,397,123,399,127,400,131,401,134,405,136,407,139,404,141,399,137,398,133,396,129,394,130,394,132,394,136" href="javascript:void(0);" title="" onMouseOver="return overlib('Maryland');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="412,118,411,115,411,117,411,118,411,119,412,119,411,121,410,123,409,126,408,130,406,128,403,126,402,122,403,119,404,117,404,117,404,117,403,115,401,111,402,107,403,105,406,105,408,106,409,112,411,115,411,115,411,116,413,119,412,117,411,117" href="javascript:void(0);" title="" onMouseOver="return overlib('New Jersey');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="446,49,449,50,450,54,446,57,443,59,441,62,439,63,437,66,434,68,430,70,429,79,425,70,423,64,420,57,423,53,424,50,423,46,423,42,423,40,424,37,425,34,428,31,430,32,434,29,437,31,439,35,441,39,442,43,443,45,446,46" href="javascript:void(0);" title="" onMouseOver="return overlib('Maine');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="426,75,426,74,427,77,428,79,428,81,427,82,425,83,423,84,421,84,419,85,416,85,415,80,415,78,415,76,415,73,416,74,416,75,415,70,416,68,417,65,418,63,417,56,420,57,422,63,423,67,425,72,425,73,426,74,426,73,426,75" href="javascript:void(0);" title="" onMouseOver="return overlib('New Hampshire');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="417,60,414,60,417,60,417,64,415,73,415,78,416,86,411,87,410,80,407,76,406,70,405,68,406,69,405,67,406,66,406,68,406,66,406,66,405,65,405,65,406,65,406,63,411,62,408,62,409,62,412,61,414,60,414,60,417,60,417,61" href="javascript:void(0);" title="" onMouseOver="return overlib('Vermont');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="436,93,432,94,427,91,419,92,411,93,410,88,421,84,421,84,419,86,410,88,410,91,411,93,426,91,422,92,411,92,410,88,414,87,424,84,424,84,428,82,425,83,425,83,430,83,423,83,421,84,429,82,430,84,432,89,434,91,438,91" href="javascript:void(0);" title="" onMouseOver="return overlib('Massachusetts');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="419,101,412,104,426,97,426,97,412,105,412,93,417,93,411,94,412,104,412,96,412,97,412,104,412,104,413,93,413,104,412,98,413,93,414,94,416,93,419,92,425,92,421,92,420,92,416,93,415,93,420,92,425,92,426,97,422,99,424,98" href="javascript:void(0);" title="" onMouseOver="return overlib('Connecticut');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="425,94,425,93,425,92,425,96,426,98,429,96,430,95,431,94,429,93,427,92,425,91,425,92" href="javascript:void(0);" title="" onMouseOver="return overlib('Rhode Island');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="409,106,411,105,417,104,420,102,422,102,423,102,425,102,426,104,422,105,421,106,420,107,418,108,417,109,415,110,414,110,411,112,410,111,409,109" href="javascript:void(0);" title="" onMouseOver="return overlib('New York');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="405,131,403,129,402,126,401,124,401,121,398,123,399,125,399,126,400,128,400,130,401,132,402,134,403,134,405,136,406,137,407,140,408,140,408,136,408,133,406,131,405,130" href="javascript:void(0);" title="" onMouseOver="return overlib('Delaware');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="134,325,130,319,127,310,117,301,102,301,50,335,76,305,68,305,60,291,62,285,71,281,71,275,65,277,58,274,55,269,60,266,65,268,72,266,56,258,65,250,73,245,82,243,97,247,110,248,115,251,116,296,123,298,129,300,139,317,140,325" href="javascript:void(0);" title="" onMouseOver="return overlib('Alaska');" onMouseOut="return nd();" />
<area shape="poly" alt="" coords="327,311,313,303,297,296,286,293,274,289,266,291,264,294,264,298,271,295,278,296,294,306,310,311,315,317,325,327,328,335,332,339,337,336,345,331,339,322" href="javascript:void(0);" title="" onMouseOver="return overlib('Hawaii');" onMouseOut="return nd();" />
<area shape="default" nohref="nohref" alt="" />
</map>
</div>
</body>
</html>
      ];
}
0
 
apparitionCommented:
Give it a shot you'll probably get errors the first time but we can review the errors as they come up.

I will be going offline for the rest of the day should be back in 12-15 hours. I'll check it out then.
0
 
jahmekyatAuthor Commented:
Hi apparition,
What is the best way for me to debug my cgi when I am running things?
Also, what I need to work on now is getting the data information into the array and them printing out the results so I can make sure it is getting populated correctly.
I do have a question, how do I take my SQl results and put the two fields of data into the array?

sub sform {

print << EOF
<HTML>
<HEAD>
<script>
   var jobs_in_states = new Array()
EOF

$sth = $db->d_value("SELECT count(*), hosp_state FROM Projects GROUP BY hosp_state");


if($sth->rows == 0)
{
        print "No information for " . $R::place;
}
else
{
        while( $resptr =  $sth->fetchrow_hashref() )
        {
                print "jobs_in_states[\"" . $resptr->{"StateName"}. "\"] = \"" . $resptr->{"jobs"} . "\"";
        }

}
#Print rest of the HTML
print << EOF2
function overlib(state) {
   var Jobs = jobs_in_states[state]
   //put code to display number of jobs
}
</script>
...Rest of your HTML goes here
EOF2

$dbh->disconnect;
0
 
jahmekyatAuthor Commented:
Hi apparition,
I think that I am getting somewhere. I am grabbing my state and number of projects
from my database and populating them into the JavaScript array. Here is where I'm at with the code:

sub sform {
 print qq[
<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd>
<html>
<head>
<title>Medefis</title>
<meta http-equiv=content-type content=text/html; charset=iso-8859-1>
<link rel=stylesheet href=/css/site.css type=text/css>
<script src=/js/global.js language=JavaScript1.2 type=text/javascript>
var jobs_in_states = new Array()
 ];

 my @paths = $global::db->d_structure("SELECT count(*) AS Projects, hosp_state AS State FROM projects where status = '' GROUP BY hosp_state");
        foreach my $path ( @paths ) {
                print "jobs_in_states[\"" . $path->{"State"}. "\"] = \"" . $path->{"Projects"} . "\"";
        }

print qq[
function overlib(state) {
   var Jobs = jobs_in_states[state]
  }
</script>
</head>
<body>
Rest of HTML

Here is what my view source is showing. You can see the states and the number of projects in the array:

<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd>
<html>
<head>
<title>Medefis</title>
<meta http-equiv=content-type content=text/html; charset=iso-8859-1>
<link rel=stylesheet href=/css/site.css type=text/css>
<script src=/js/global.js language=JavaScript1.2 type=text/javascript>
var jobs_in_states = new Array()
 jobs_in_states["AZ"] = "2"jobs_in_states["CA"] = "1"jobs_in_states["CO"] = "17"jobs_in_states["HI"] = "1"jobs_in_states["IA"] = "3"jobs_in_states["IN"] = "3"jobs_in_states["KS"] = "1"jobs_in_states["MA"] = "1"jobs_in_states["MN"] = "3"jobs_in_states["MO"] = "1"jobs_in_states["MT"] = "3"jobs_in_states["NC"] = "3"jobs_in_states["NE"] = "2"jobs_in_states["NM"] = "5"jobs_in_states["NY"] = "2"jobs_in_states["OH"] = "12"jobs_in_states["OR"] = "3"jobs_in_states["TN"] = "2"jobs_in_states["UT"] = "1"jobs_in_states["VT"] = "1"jobs_in_states["WA"] = "5"jobs_in_states["WY"] = "1"
function overlib(state) {
   var Jobs = jobs_in_states[state]
  }
</script>
</head>
<body>
Rest of HTML

What I need help with now is getting the state names and values into my image map, so when the user hovers over the state,
it will show them how many jobs are listed for that particular state.
Let me know if you need anything else. Thanks again for all of your help!

T Bryan

0
 
jahmekyatAuthor Commented:
Hi apparition,
Are you there to help me anymore? I haven't heard anything from you for a couple of days.
I guess I will repost my question and see if someone else can help me out with this.

Anyways, if you get this soon, please reply.

Thanks,

T Bryan
0
 
apparitionCommented:
Sorry jahmekyat , I was busy the last couple of days and did not have a chance to look at your posts. Give me a few minutes and
I will try to help you out.

0
 
jahmekyatAuthor Commented:
Thank you so much!!
0
 
apparitionCommented:
You need to change your CGI a little bit other wise you might be getting javascript errors:

change the following line:
  print "jobs_in_states[\"" . $path->{"State"}. "\"] = \"" . $path->{"Projects"} . "\"" + "\n";

Now to display jobs add this HTML to the page:
<form name="disp">
Jobs in State <input type="text" name="jobs" readonly>
</form>

Change the Javascripts to the following:

function overlib(state) {
   document.disp.jobs.value = jobs_in_states[state]
 }
function nd(){
    document.disp.jobs.value = ""
}

0
 
apparitionCommented:
One more thing make sure your image map is calling the function properly.
Make sure the values passed in your call match the state name in your array that was loaded from
the database.

So you must call it like this:
onMouseOver="return overlib('NY);"  

NOT
onMouseOver="return overlib('New York');"
0
 
jahmekyatAuthor Commented:
Hi apparition,
Thanks for the help. When I changed out the print function, it is not populating the JS array anymore.
Here is the View Source:

<script src="/js/overlib.js" language="JavaScript1.2" type=text/javascript>
var jobs_in_states = new Array()
 00000000000000000000000000000000000000
function overlib(state) {
   document.disp.jobs.value = jobs_in_states[state]
 }
function nd(){
    document.disp.jobs.value = ""
}

If I put the old one back it populates again Any ideas?
Also, I probably should of told you this when we started, but the two javascript functions I am using
function overlib and function nd are part of a larger JS file that I am using for the events. I probably should of let you see these. So when I run this, I think that it is using the referenced one instaed of the one that we put in the page. If I remove the reference to the larger one, something is missing from the two that you created. Can we add the ones that you did to the larger one? I am not sure how to do it. I have included it below.

//\/////
//\  overLIB 4.17 - You may not remove or change this notice.
//\  Copyright Erik Bosrup 1998-2004. All rights reserved.
//\
//\  Contributors are listed on the homepage.
//\  This file might be old, always check for the latest version at:
//\  http://www.bosrup.com/web/overlib/
//\
//\  Please read the license agreement (available through the link above)
//\  before using overLIB. Direct any licensing questions to erik@bosrup.com.
//\
//\  Do not sell this as your own work or remove this copyright notice.
//\  For full details on copying or changing this script please read the
//\  license agreement at the link above. Please give credit on sites that
//\  use overLIB and submit changes of the script so other people can use
//\  them as well.
//   $Revision: 1.112 $                $Date: 2005/03/08 19:22:53 $
//\/////
//\mini

////////
// PRE-INIT
// Ignore these lines, configuration is below.
////////
var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1; var pmt=''; var pms = new Array(); var olInfo = new Info('4.17', 1);
var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3; var FCHAIN=4;
var olHideForm=0;  // parameter for hiding SELECT and ActiveX elements in IE5.5+
var olHautoFlag = 0;  // flags for over-riding VAUTO and HAUTO if corresponding
var olVautoFlag = 0;  // positioning commands are used on the command line
registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass');

////////
// DEFAULT CONFIGURATION
// Settings you want everywhere are set here. All of this can also be
// changed on your html page or through an overLIB call.
////////
if (typeof ol_fgcolor=='undefined') var ol_fgcolor="#CCCCFF";
if (typeof ol_bgcolor=='undefined') var ol_bgcolor="#333399";
if (typeof ol_textcolor=='undefined') var ol_textcolor="#000000";
if (typeof ol_capcolor=='undefined') var ol_capcolor="#FFFFFF";
if (typeof ol_closecolor=='undefined') var ol_closecolor="#9999FF";
if (typeof ol_textfont=='undefined') var ol_textfont="Verdana,Arial,Helvetica";
if (typeof ol_captionfont=='undefined') var ol_captionfont="Verdana,Arial,Helvetica";
if (typeof ol_closefont=='undefined') var ol_closefont="Verdana,Arial,Helvetica";
if (typeof ol_textsize=='undefined') var ol_textsize="1";
if (typeof ol_captionsize=='undefined') var ol_captionsize="1";
if (typeof ol_closesize=='undefined') var ol_closesize="1";
if (typeof ol_width=='undefined') var ol_width="200";
if (typeof ol_border=='undefined') var ol_border="1";
if (typeof ol_cellpad=='undefined') var ol_cellpad=2;
if (typeof ol_offsetx=='undefined') var ol_offsetx=10;
if (typeof ol_offsety=='undefined') var ol_offsety=10;
if (typeof ol_text=='undefined') var ol_text="Default Text";
if (typeof ol_cap=='undefined') var ol_cap="";
if (typeof ol_sticky=='undefined') var ol_sticky=0;
if (typeof ol_background=='undefined') var ol_background="";
if (typeof ol_close=='undefined') var ol_close="Close";
if (typeof ol_hpos=='undefined') var ol_hpos=RIGHT;
if (typeof ol_status=='undefined') var ol_status="";
if (typeof ol_autostatus=='undefined') var ol_autostatus=0;
if (typeof ol_height=='undefined') var ol_height=-1;
if (typeof ol_snapx=='undefined') var ol_snapx=0;
if (typeof ol_snapy=='undefined') var ol_snapy=0;
if (typeof ol_fixx=='undefined') var ol_fixx=-1;
if (typeof ol_fixy=='undefined') var ol_fixy=-1;
if (typeof ol_relx=='undefined') var ol_relx=null;
if (typeof ol_rely=='undefined') var ol_rely=null;
if (typeof ol_fgbackground=='undefined') var ol_fgbackground="";
if (typeof ol_bgbackground=='undefined') var ol_bgbackground="";
if (typeof ol_padxl=='undefined') var ol_padxl=1;
if (typeof ol_padxr=='undefined') var ol_padxr=1;
if (typeof ol_padyt=='undefined') var ol_padyt=1;
if (typeof ol_padyb=='undefined') var ol_padyb=1;
if (typeof ol_fullhtml=='undefined') var ol_fullhtml=0;
if (typeof ol_vpos=='undefined') var ol_vpos=BELOW;
if (typeof ol_aboveheight=='undefined') var ol_aboveheight=0;
if (typeof ol_capicon=='undefined') var ol_capicon="";
if (typeof ol_frame=='undefined') var ol_frame=self;
if (typeof ol_timeout=='undefined') var ol_timeout=0;
if (typeof ol_function=='undefined') var ol_function=null;
if (typeof ol_delay=='undefined') var ol_delay=0;
if (typeof ol_hauto=='undefined') var ol_hauto=0;
if (typeof ol_vauto=='undefined') var ol_vauto=0;
if (typeof ol_closeclick=='undefined') var ol_closeclick=0;
if (typeof ol_wrap=='undefined') var ol_wrap=0;
if (typeof ol_followmouse=='undefined') var ol_followmouse=1;
if (typeof ol_mouseoff=='undefined') var ol_mouseoff=0;
if (typeof ol_closetitle=='undefined') var ol_closetitle='Close';
if (typeof ol_compatmode=='undefined') var ol_compatmode=0;
if (typeof ol_css=='undefined') var ol_css=CSSOFF;
if (typeof ol_fgclass=='undefined') var ol_fgclass="";
if (typeof ol_bgclass=='undefined') var ol_bgclass="";
if (typeof ol_textfontclass=='undefined') var ol_textfontclass="";
if (typeof ol_captionfontclass=='undefined') var ol_captionfontclass="";
if (typeof ol_closefontclass=='undefined') var ol_closefontclass="";

////////
// ARRAY CONFIGURATION
////////

// You can use these arrays to store popup text here instead of in the html.
if (typeof ol_texts=='undefined') var ol_texts = new Array("Text 0", "Text 1");
if (typeof ol_caps=='undefined') var ol_caps = new Array("Caption 0", "Caption 1");

////////
// END OF CONFIGURATION
// Don't change anything below this line, all configuration is above.
////////





////////
// INIT
////////
// Runtime variables init. Don't change for config!
var o3_text="";
var o3_cap="";
var o3_sticky=0;
var o3_background="";
var o3_close="Close";
var o3_hpos=RIGHT;
var o3_offsetx=2;
var o3_offsety=2;
var o3_fgcolor="";
var o3_bgcolor="";
var o3_textcolor="";
var o3_capcolor="";
var o3_closecolor="";
var o3_width=100;
var o3_border=1;
var o3_cellpad=2;
var o3_status="";
var o3_autostatus=0;
var o3_height=-1;
var o3_snapx=0;
var o3_snapy=0;
var o3_fixx=-1;
var o3_fixy=-1;
var o3_relx=null;
var o3_rely=null;
var o3_fgbackground="";
var o3_bgbackground="";
var o3_padxl=0;
var o3_padxr=0;
var o3_padyt=0;
var o3_padyb=0;
var o3_fullhtml=0;
var o3_vpos=BELOW;
var o3_aboveheight=0;
var o3_capicon="";
var o3_textfont="Verdana,Arial,Helvetica";
var o3_captionfont="Verdana,Arial,Helvetica";
var o3_closefont="Verdana,Arial,Helvetica";
var o3_textsize="1";
var o3_captionsize="1";
var o3_closesize="1";
var o3_frame=self;
var o3_timeout=0;
var o3_timerid=0;
var o3_allowmove=0;
var o3_function=null;
var o3_delay=0;
var o3_delayid=0;
var o3_hauto=0;
var o3_vauto=0;
var o3_closeclick=0;
var o3_wrap=0;
var o3_followmouse=1;
var o3_mouseoff=0;
var o3_closetitle='';
var o3_compatmode=0;
var o3_css=CSSOFF;
var o3_fgclass="";
var o3_bgclass="";
var o3_textfontclass="";
var o3_captionfontclass="";
var o3_closefontclass="";

// Display state variables
var o3_x = 0;
var o3_y = 0;
var o3_showingsticky = 0;
var o3_removecounter = 0;

// Our layer
var over = null;
var fnRef, hoveringSwitch = false;
var olHideDelay;

// Decide browser version
var isMac = (navigator.userAgent.indexOf("Mac") != -1);
var olOp = (navigator.userAgent.toLowerCase().indexOf('opera') > -1 && document.createTextNode);  // Opera 7
var olNs4 = (navigator.appName=='Netscape' && parseInt(navigator.appVersion) == 4);
var olNs6 = (document.getElementById) ? true : false;
var olKq = (olNs6 && /konqueror/i.test(navigator.userAgent));
var olIe4 = (document.all) ? true : false;
var olIe5 = false;
var olIe55 = false; // Added additional variable to identify IE5.5+
var docRoot = 'document.body';

// Resize fix for NS4.x to keep track of layer
if (olNs4) {
      var oW = window.innerWidth;
      var oH = window.innerHeight;
      window.onresize = function() { if (oW != window.innerWidth || oH != window.innerHeight) location.reload(); }
}

// Microsoft Stupidity Check(tm).
if (olIe4) {
      var agent = navigator.userAgent;
      if (/MSIE/.test(agent)) {
            var versNum = parseFloat(agent.match(/MSIE[ ](\d\.\d+)\.*/i)[1]);
            if (versNum >= 5){
                  olIe5=true;
                  olIe55=(versNum>=5.5&&!olOp) ? true : false;
                  if (olNs6) olNs6=false;
            }
      }
      if (olNs6) olIe4 = false;
}

// Check for compatability mode.
if (document.compatMode && document.compatMode == 'CSS1Compat') {
      docRoot= ((olIe4 && !olOp) ? 'document.documentElement' : docRoot);
}

// Add window onload handlers to indicate when all modules have been loaded
// For Netscape 6+ and Mozilla, uses addEventListener method on the window object
// For IE it uses the attachEvent method of the window object and for Netscape 4.x
// it sets the window.onload handler to the OLonload_handler function for Bubbling
if(window.addEventListener) window.addEventListener("load",OLonLoad_handler,false);
else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler);

// Capture events, alt. diffuses the overlib function.
var olCheckMouseCapture = true;
if ((olNs4 || olNs6 || olIe4)) {
      olMouseCapture();
} else {
      overlib = no_overlib;
      nd = no_overlib;
      ver3fix = true;
}


////////
// PUBLIC FUNCTIONS
////////

// overlib(arg0,...,argN)
// Loads parameters into global runtime variables.
function overlib() {
      if (!olLoaded || isExclusive(overlib.arguments)) return true;
      if (olCheckMouseCapture) olMouseCapture();
      if (over) {
            over = (typeof over.id != 'string') ? o3_frame.document.all['overDiv'] : over;
            cClick();
      }

      // Load defaults to runtime.
  olHideDelay=0;
      o3_text=ol_text;
      o3_cap=ol_cap;
      o3_sticky=ol_sticky;
      o3_background=ol_background;
      o3_close=ol_close;
      o3_hpos=ol_hpos;
      o3_offsetx=ol_offsetx;
      o3_offsety=ol_offsety;
      o3_fgcolor=ol_fgcolor;
      o3_bgcolor=ol_bgcolor;
      o3_textcolor=ol_textcolor;
      o3_capcolor=ol_capcolor;
      o3_closecolor=ol_closecolor;
      o3_width=ol_width;
      o3_border=ol_border;
      o3_cellpad=ol_cellpad;
      o3_status=ol_status;
      o3_autostatus=ol_autostatus;
      o3_height=ol_height;
      o3_snapx=ol_snapx;
      o3_snapy=ol_snapy;
      o3_fixx=ol_fixx;
      o3_fixy=ol_fixy;
      o3_relx=ol_relx;
      o3_rely=ol_rely;
      o3_fgbackground=ol_fgbackground;
      o3_bgbackground=ol_bgbackground;
      o3_padxl=ol_padxl;
      o3_padxr=ol_padxr;
      o3_padyt=ol_padyt;
      o3_padyb=ol_padyb;
      o3_fullhtml=ol_fullhtml;
      o3_vpos=ol_vpos;
      o3_aboveheight=ol_aboveheight;
      o3_capicon=ol_capicon;
      o3_textfont=ol_textfont;
      o3_captionfont=ol_captionfont;
      o3_closefont=ol_closefont;
      o3_textsize=ol_textsize;
      o3_captionsize=ol_captionsize;
      o3_closesize=ol_closesize;
      o3_timeout=ol_timeout;
      o3_function=ol_function;
      o3_delay=ol_delay;
      o3_hauto=ol_hauto;
      o3_vauto=ol_vauto;
      o3_closeclick=ol_closeclick;
      o3_wrap=ol_wrap;      
      o3_followmouse=ol_followmouse;
      o3_mouseoff=ol_mouseoff;
      o3_closetitle=ol_closetitle;
      o3_css=ol_css;
      o3_compatmode=ol_compatmode;
      o3_fgclass=ol_fgclass;
      o3_bgclass=ol_bgclass;
      o3_textfontclass=ol_textfontclass;
      o3_captionfontclass=ol_captionfontclass;
      o3_closefontclass=ol_closefontclass;
      
      setRunTimeVariables();
      
      fnRef = '';
      
      // Special for frame support, over must be reset...
      o3_frame = ol_frame;
      
      if(!(over=createDivContainer())) return false;

      parseTokens('o3_', overlib.arguments);
      if (!postParseChecks()) return false;

      if (o3_delay == 0) {
            return runHook("olMain", FREPLACE);
       } else {
            o3_delayid = setTimeout("runHook('olMain', FREPLACE)", o3_delay);
            return false;
      }
}

// Clears popups if appropriate
function nd(time) {
      if (olLoaded && !isExclusive()) {
            hideDelay(time);  // delay popup close if time specified

            if (o3_removecounter >= 1) { o3_showingsticky = 0 };
            
            if (o3_showingsticky == 0) {
                  o3_allowmove = 0;
                  if (over != null && o3_timerid == 0) runHook("hideObject", FREPLACE, over);
            } else {
                  o3_removecounter++;
            }
      }
      
      return true;
}

// The Close onMouseOver function for stickies
function cClick() {
      if (olLoaded) {
            runHook("hideObject", FREPLACE, over);
            o3_showingsticky = 0;      
      }      
      return false;
}

// Method for setting page specific defaults.
function overlib_pagedefaults() {
      parseTokens('ol_', overlib_pagedefaults.arguments);
}


////////
// OVERLIB MAIN FUNCTION
////////

// This function decides what it is we want to display and how we want it done.
function olMain() {
      var layerhtml, styleType;
       runHook("olMain", FBEFORE);
       
      if (o3_background!="" || o3_fullhtml) {
            // Use background instead of box.
            layerhtml = runHook('ol_content_background', FALTERNATE, o3_css, o3_text, o3_background, o3_fullhtml);
      } else {
            // They want a popup box.
            styleType = (pms[o3_css-1-pmStart] == "cssoff" || pms[o3_css-1-pmStart] == "cssclass");

            // Prepare popup background
            if (o3_fgbackground != "") o3_fgbackground = "background=\""+o3_fgbackground+"\"";
            if (o3_bgbackground != "") o3_bgbackground = (styleType ? "background=\""+o3_bgbackground+"\"" : o3_bgbackground);

            // Prepare popup colors
            if (o3_fgcolor != "") o3_fgcolor = (styleType ? "bgcolor=\""+o3_fgcolor+"\"" : o3_fgcolor);
            if (o3_bgcolor != "") o3_bgcolor = (styleType ? "bgcolor=\""+o3_bgcolor+"\"" : o3_bgcolor);

            // Prepare popup height
            if (o3_height > 0) o3_height = (styleType ? "height=\""+o3_height+"\"" : o3_height);
            else o3_height = "";

            // Decide which kinda box.
            if (o3_cap=="") {
                  // Plain
                  layerhtml = runHook('ol_content_simple', FALTERNATE, o3_css, o3_text);
            } else {
                  // With caption
                  if (o3_sticky) {
                        // Show close text
                        layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, o3_close);
                  } else {
                        // No close text
                        layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, "");
                  }
            }
      }      

      // We want it to stick!
      if (o3_sticky) {
            if (o3_timerid > 0) {
                  clearTimeout(o3_timerid);
                  o3_timerid = 0;
            }
            o3_showingsticky = 1;
            o3_removecounter = 0;
      }

      // Created a separate routine to generate the popup to make it easier
      // to implement a plugin capability
      if (!runHook("createPopup", FREPLACE, layerhtml)) return false;

      // Prepare status bar
      if (o3_autostatus > 0) {
            o3_status = o3_text;
            if (o3_autostatus > 1) o3_status = o3_cap;
      }

      // When placing the layer the first time, even stickies may be moved.
      o3_allowmove = 0;

      // Initiate a timer for timeout
      if (o3_timeout > 0) {          
            if (o3_timerid > 0) clearTimeout(o3_timerid);
            o3_timerid = setTimeout("cClick()", o3_timeout);
      }

      // Show layer
      runHook("disp", FREPLACE, o3_status);
      runHook("olMain", FAFTER);

      return (olOp && event && event.type == 'mouseover' && !o3_status) ? '' : (o3_status != '');
}

////////
// LAYER GENERATION FUNCTIONS
////////
// These functions just handle popup content with tags that should adhere to the W3C standards specification.

// Makes simple table without caption
function ol_content_simple(text) {
      txt='<table width="'+o3_width+ '" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="' + o3_cellpad + '" cellspacing="0" '+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' class="'+o3_textfontclass+'">' : '>')+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'</td></tr></table></td></tr></table>';

      set_background("");
      return txt;
}

// Makes table with caption and optional close link
function ol_content_caption(text,title,close) {
      var nameId;
      closing="";
      closeevent="onmouseover";
      if (o3_closeclick==1) closeevent= (o3_closetitle ? "title='" + o3_closetitle +"'" : "") + " onclick";
      if (o3_capicon!="") {
            nameId=' hspace=\"5\"'+' align=\"middle\" alt=\"\"';
            if (typeof o3_dragimg!='undefined'&&o3_dragimg) nameId=' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"';
            o3_capicon='<img src=\"'+o3_capicon+'\"'+nameId+' />';
      }

      if (close != "")
            closing='<td '+(!o3_compatmode && o3_closefontclass ? 'class="'+o3_closefontclass : 'align="RIGHT')+'"><a href="javascript:return '+fnRef+'cClick();"'+((o3_compatmode && o3_closefontclass) ? ' class="' + o3_closefontclass + '" ' : ' ')+closeevent+'="return '+fnRef+'cClick();">'+(o3_closefontclass ? '' : wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : wrapStr(1,o3_closesize,'close'))+'</a></td>';
      txt='<table width="'+o3_width+ '" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_bgbackground+' '+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td'+(o3_captionfontclass ? ' class="'+o3_captionfontclass+'">' : '>')+(o3_captionfontclass ? '' : '<b>'+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass ? '' : wrapStr(1,o3_captionsize)+'</b>')+'</td>'+closing+'</tr></table><table width="100%" border="0" cellpadding="' + o3_cellpad + '" cellspacing="0" '+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' class="'+o3_textfontclass+'">' :'>')+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize)) + '</td></tr></table></td></tr></table>';

      set_background("");
      return txt;
}

// Sets the background picture,padding and lots more. :)
function ol_content_background(text,picture,hasfullhtml) {
      if (hasfullhtml) {
            txt=text;
      } else {
            txt='<table width="'+o3_width+'" border="0" cellpadding="0" cellspacing="0" height="'+o3_height+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'+o3_padxl+'"></td><td valign="TOP" width="'+(o3_width-o3_padxl-o3_padxr)+(o3_textfontclass ? '" class="'+o3_textfontclass : '')+'">'+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'+o3_padyb+'"></td></tr></table>';
      }

      set_background(picture);
      return txt;
}

// Loads a picture into the div.
function set_background(pic) {
      if (pic == "") {
            if (olNs4) {
                  over.background.src = null;
            } else if (over.style) {
                  over.style.backgroundImage = "none";
            }
      } else {
            if (olNs4) {
                  over.background.src = pic;
            } else if (over.style) {
                  over.style.width=o3_width + 'px';
                  over.style.backgroundImage = "url("+pic+")";
            }
      }
}

////////
// HANDLING FUNCTIONS
////////
var olShowId=-1;

// Displays the popup
function disp(statustext) {
      runHook("disp", FBEFORE);
      
      if (o3_allowmove == 0) {
            runHook("placeLayer", FREPLACE);
            (olNs6&&olShowId<0) ? olShowId=setTimeout("runHook('showObject', FREPLACE, over)", 1) : runHook("showObject", FREPLACE, over);
            o3_allowmove = (o3_sticky || o3_followmouse==0) ? 0 : 1;
      }
      
      runHook("disp", FAFTER);

      if (statustext != "") self.status = statustext;
}

// Creates the actual popup structure
function createPopup(lyrContent){
      runHook("createPopup", FBEFORE);
      
      if (o3_wrap) {
            var wd,ww,theObj = (olNs4 ? over : over.style);
            theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + (!olNs4 ? 'px' : 0);
            layerWrite(lyrContent);
            wd = (olNs4 ? over.clip.width : over.offsetWidth);
            if (wd > (ww=windowWidth())) {
                  lyrContent=lyrContent.replace(/\&nbsp;/g, ' ');
                  o3_width=ww;
                  o3_wrap=0;
            }
      }

      layerWrite(lyrContent);
      
      // Have to set o3_width for placeLayer() routine if o3_wrap is turned on
      if (o3_wrap) o3_width=(olNs4 ? over.clip.width : over.offsetWidth);
      
      runHook("createPopup", FAFTER, lyrContent);

      return true;
}

// Decides where we want the popup.
function placeLayer() {
      var placeX, placeY, widthFix = 0;
      
      // HORIZONTAL PLACEMENT, re-arranged to work in Safari
      if (o3_frame.innerWidth) widthFix=18;
      iwidth = windowWidth();

      // Horizontal scroll offset
      winoffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollLeft') : o3_frame.pageXOffset;

      placeX = runHook('horizontalPlacement',FCHAIN,iwidth,winoffset,widthFix);

      // VERTICAL PLACEMENT, re-arranged to work in Safari
      if (o3_frame.innerHeight) {
            iheight=o3_frame.innerHeight;
      } else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientHeight=='number'")&&eval('o3_frame.'+docRoot+'.clientHeight')) {
            iheight=eval('o3_frame.'+docRoot+'.clientHeight');
      }                  

      // Vertical scroll offset
      scrolloffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollTop') : o3_frame.pageYOffset;
      placeY = runHook('verticalPlacement',FCHAIN,iheight,scrolloffset);

      // Actually move the object.
      repositionTo(over, placeX, placeY);
}

// Moves the layer
function olMouseMove(e) {
      var e = (e) ? e : event;

      if (e.pageX) {
            o3_x = e.pageX;
            o3_y = e.pageY;
      } else if (e.clientX) {
            o3_x = eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft');
            o3_y = eval('e.clientY+o3_frame.'+docRoot+'.scrollTop');
      }
      
      if (o3_allowmove == 1) runHook("placeLayer", FREPLACE);

      // MouseOut handler
      if (hoveringSwitch && !olNs4 && runHook("cursorOff", FREPLACE)) {
            (olHideDelay ? hideDelay(olHideDelay) : cClick());
            hoveringSwitch = !hoveringSwitch;
      }
}

// Fake function for 3.0 users.
function no_overlib() { return ver3fix; }

// Capture the mouse and chain other scripts.
function olMouseCapture() {
      capExtent = document;
      var fN, str = '', l, k, f, wMv, sS, mseHandler = olMouseMove;
      var re = /function[ ]*(\w*)\(/;
      
      wMv = (!olIe4 && window.onmousemove);
      if (document.onmousemove || wMv) {
            if (wMv) capExtent = window;
            f = capExtent.onmousemove.toString();
            fN = f.match(re);
            if (fN == null) {
                  str = f+'(e); ';
            } else if (fN[1] == 'anonymous' || fN[1] == 'olMouseMove' || (wMv && fN[1] == 'onmousemove')) {
                  if (!olOp && wMv) {
                        l = f.indexOf('{')+1;
                        k = f.lastIndexOf('}');
                        sS = f.substring(l,k);
                        if ((l = sS.indexOf('(')) != -1) {
                              sS = sS.substring(0,l).replace(/^\s+/,'').replace(/\s+$/,'');
                              if (eval("typeof " + sS + " == 'undefined'")) window.onmousemove = null;
                              else str = sS + '(e);';
                        }
                  }
                  if (!str) {
                        olCheckMouseCapture = false;
                        return;
                  }
            } else {
                  if (fN[1]) str = fN[1]+'(e); ';
                  else {
                        l = f.indexOf('{')+1;
                        k = f.lastIndexOf('}');
                        str = f.substring(l,k) + '\n';
                  }
            }
            str += 'olMouseMove(e); ';
            mseHandler = new Function('e', str);
      }

      capExtent.onmousemove = mseHandler;
      if (olNs4) capExtent.captureEvents(Event.MOUSEMOVE);
}

////////
// PARSING FUNCTIONS
////////

// Does the actual command parsing.
function parseTokens(pf, ar) {
      // What the next argument is expected to be.
      var v, mode=-1, par = (pf != 'ol_');      
      var fnMark = (par && !ar.length ? 1 : 0);

      for (i = 0; i < ar.length; i++) {
            if (mode < 0) {
                  // Arg is maintext,unless its a number between pmStart and pmUpper
                  // then its a command.
                  if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) {
                        fnMark = (par ? 1 : 0);
                        i--;   // backup one so that the next block can parse it
                  } else {
                        switch(pf) {
                              case 'ol_':
                                    ol_text = ar[i].toString();
                                    break;
                              default:
                                    o3_text=ar[i].toString();  
                        }
                  }
                  mode = 0;
            } else {
                  // Note: NS4 doesn't like switch cases with vars.
                  if (ar[i] >= pmCount || ar[i]==DONOTHING) { continue; }
                  if (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[++i]+'].toString()'); continue; }
                  if (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[++i]+'].toString()'); continue; }
                  if (ar[i]==STICKY) { if (pf!='ol_') eval(pf+'sticky=1'); continue; }
                  if (ar[i]==BACKGROUND) { eval(pf+'background="'+ar[++i]+'"'); continue; }
                  if (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); continue; }
                  if (ar[i]==CAPTION) { eval(pf+"cap='"+escSglQuote(ar[++i])+"'"); continue; }
                  if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { eval(pf+'hpos='+ar[i]); if(pf!='ol_') olHautoFlag=1; continue; }
                  if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); continue; }
                  if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); continue; }
                  if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[++i]+'"'); continue; }
                  if (ar[i]==BGCOLOR) { eval(pf+'bgcolor="'+ar[++i]+'"'); continue; }
                  if (ar[i]==TEXTCOLOR) { eval(pf+'textcolor="'+ar[++i]+'"'); continue; }
                  if (ar[i]==CAPCOLOR) { eval(pf+'capcolor="'+ar[++i]+'"'); continue; }
                  if (ar[i]==CLOSECOLOR) { eval(pf+'closecolor="'+ar[++i]+'"'); continue; }
                  if (ar[i]==WIDTH) { eval(pf+'width='+ar[++i]); continue; }
                  if (ar[i]==BORDER) { eval(pf+'border='+ar[++i]); continue; }
                  if (ar[i]==CELLPAD) { i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad')); continue; }
                  if (ar[i]==STATUS) { eval(pf+"status='"+escSglQuote(ar[++i])+"'"); continue; }
                  if (ar[i]==AUTOSTATUS) { eval(pf +'autostatus=('+pf+'autostatus == 1) ? 0 : 1'); continue; }
                  if (ar[i]==AUTOSTATUSCAP) { eval(pf +'autostatus=('+pf+'autostatus == 2) ? 0 : 2'); continue; }
                  if (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[++i]); continue; } // Same param again.
                  if (ar[i]==CLOSETEXT) { eval(pf+"close='"+escSglQuote(ar[++i])+"'"); continue; }
                  if (ar[i]==SNAPX) { eval(pf+'snapx='+ar[++i]); continue; }
                  if (ar[i]==SNAPY) { eval(pf+'snapy='+ar[++i]); continue; }
                  if (ar[i]==FIXX) { eval(pf+'fixx='+ar[++i]); continue; }
                  if (ar[i]==FIXY) { eval(pf+'fixy='+ar[++i]); continue; }
                  if (ar[i]==RELX) { eval(pf+'relx='+ar[++i]); continue; }
                  if (ar[i]==RELY) { eval(pf+'rely='+ar[++i]); continue; }
                  if (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground="'+ar[++i]+'"'); continue; }
                  if (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground="'+ar[++i]+'"'); continue; }
                  if (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); eval(pf+'padxr='+ar[++i]); continue; }
                  if (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); eval(pf+'padyb='+ar[++i]); continue; }
                  if (ar[i]==FULLHTML) { if (pf!='ol_') eval(pf+'fullhtml=1'); continue; }
                  if (ar[i]==BELOW || ar[i]==ABOVE) { eval(pf+'vpos='+ar[i]); if (pf!='ol_') olVautoFlag=1; continue; }
                  if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[++i]+'"'); continue; }
                  if (ar[i]==TEXTFONT) { eval(pf+"textfont='"+escSglQuote(ar[++i])+"'"); continue; }
                  if (ar[i]==CAPTIONFONT) { eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'"); continue; }
                  if (ar[i]==CLOSEFONT) { eval(pf+"closefont='"+escSglQuote(ar[++i])+"'"); continue; }
                  if (ar[i]==TEXTSIZE) { eval(pf+'textsize="'+ar[++i]+'"'); continue; }
                  if (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize="'+ar[++i]+'"'); continue; }
                  if (ar[i]==CLOSESIZE) { eval(pf+'closesize="'+ar[++i]+'"'); continue; }
                  if (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[++i]); continue; }
                  if (ar[i]==FUNCTION) { if (pf=='ol_') { if (typeof ar[i+1]!='number') { v=ar[++i]; ol_function=(typeof v=='function' ? v : null); }} else {fnMark = 0; v = null; if (typeof ar[i+1]!='number') v = ar[++i];  opt_FUNCTION(v); } continue; }
                  if (ar[i]==DELAY) { eval(pf+'delay='+ar[++i]); continue; }
                  if (ar[i]==HAUTO) { eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0'); continue; }
                  if (ar[i]==VAUTO) { eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0'); continue; }
                  if (ar[i]==CLOSECLICK) { eval(pf +'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; }
                  if (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 : 0'); continue; }
                  if (ar[i]==FOLLOWMOUSE) { eval(pf +'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; }
                  if (ar[i]==MOUSEOFF) { eval(pf +'mouseoff=('+pf+'mouseoff==0) ? 1 : 0'); v=ar[i+1]; if (pf != 'ol_' && eval(pf+'mouseoff') && typeof v == 'number' && (v < pmStart || v > pmUpper)) olHideDelay=ar[++i]; continue; }
                  if (ar[i]==CLOSETITLE) { eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'"); continue; }
                  if (ar[i]==CSSOFF||ar[i]==CSSCLASS) { eval(pf+'css='+ar[i]); continue; }
                  if (ar[i]==COMPATMODE) { eval(pf+'compatmode=('+pf+'compatmode==0) ? 1 : 0'); continue; }
                  if (ar[i]==FGCLASS) { eval(pf+'fgclass="'+ar[++i]+'"'); continue; }
                  if (ar[i]==BGCLASS) { eval(pf+'bgclass="'+ar[++i]+'"'); continue; }
                  if (ar[i]==TEXTFONTCLASS) { eval(pf+'textfontclass="'+ar[++i]+'"'); continue; }
                  if (ar[i]==CAPTIONFONTCLASS) { eval(pf+'captionfontclass="'+ar[++i]+'"'); continue; }
                  if (ar[i]==CLOSEFONTCLASS) { eval(pf+'closefontclass="'+ar[++i]+'"'); continue; }
                  i = parseCmdLine(pf, i, ar);
            }
      }

      if (fnMark && o3_function) o3_text = o3_function();
      
      if ((pf == 'o3_') && o3_wrap) {
            o3_width = 0;
            
            var tReg=/<.*\n*>/ig;
            if (!tReg.test(o3_text)) o3_text = o3_text.replace(/[ ]+/g, '&nbsp;');
            if (!tReg.test(o3_cap))o3_cap = o3_cap.replace(/[ ]+/g, '&nbsp;');
      }
      if ((pf == 'o3_') && o3_sticky) {
            if (!o3_close && (o3_frame != ol_frame)) o3_close = ol_close;
            if (o3_mouseoff && (o3_frame == ol_frame)) opt_NOCLOSE(' ');
      }
}


////////
// LAYER FUNCTIONS
////////

// Writes to a layer
function layerWrite(txt) {
      txt += "\n";
      if (olNs4) {
            var lyr = o3_frame.document.layers['overDiv'].document
            lyr.write(txt)
            lyr.close()
      } else if (typeof over.innerHTML != 'undefined') {
            if (olIe5 && isMac) over.innerHTML = '';
            over.innerHTML = txt;
      } else {
            range = o3_frame.document.createRange();
            range.setStartAfter(over);
            domfrag = range.createContextualFragment(txt);
            
            while (over.hasChildNodes()) {
                  over.removeChild(over.lastChild);
            }
            
            over.appendChild(domfrag);
      }
}

// Make an object visible
function showObject(obj) {
      runHook("showObject", FBEFORE);

      var theObj=(olNs4 ? obj : obj.style);
      theObj.visibility = 'visible';

      runHook("showObject", FAFTER);
}

// Hides an object
function hideObject(obj) {
      runHook("hideObject", FBEFORE);

      var theObj=(olNs4 ? obj : obj.style);
      if (olNs6 && olShowId>0) { clearTimeout(olShowId); olShowId=0; }
      theObj.visibility = 'hidden';
      theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + (!olNs4 ? 'px' : 0);

      if (o3_timerid > 0) clearTimeout(o3_timerid);
      if (o3_delayid > 0) clearTimeout(o3_delayid);

      o3_timerid = 0;
      o3_delayid = 0;
      self.status = "";

      if (obj.onmouseout || obj.onmouseover) {
            if (olNs4) obj.releaseEvents(Event.MOUSEOUT || Event.MOUSEOVER);
            obj.onmouseout = obj.onmouseover = null;
      }

      runHook("hideObject", FAFTER);
}

// Move a layer
function repositionTo(obj, xL, yL) {
      var theObj=(olNs4 ? obj : obj.style);
      theObj.left = xL + (!olNs4 ? 'px' : 0);
      theObj.top = yL + (!olNs4 ? 'px' : 0);
}

// Check position of cursor relative to overDiv DIVision; mouseOut function
function cursorOff() {
      var left = parseInt(over.style.left);
      var top = parseInt(over.style.top);
      var right = left + (over.offsetWidth >= parseInt(o3_width) ? over.offsetWidth : parseInt(o3_width));
      var bottom = top + (over.offsetHeight >= o3_aboveheight ? over.offsetHeight : o3_aboveheight);

      if (o3_x < left || o3_x > right || o3_y < top || o3_y > bottom) return true;

      return false;
}


////////
// COMMAND FUNCTIONS
////////

// Calls callme or the default function.
function opt_FUNCTION(callme) {
      o3_text = (callme ? (typeof callme=='string' ? (/.+\(.*\)/.test(callme) ? eval(callme) : callme) : callme()) : (o3_function ? o3_function() : 'No Function'));

      return 0;
}

// Handle hovering
function opt_NOCLOSE(unused) {
      if (!unused) o3_close = "";

      if (olNs4) {
            over.captureEvents(Event.MOUSEOUT || Event.MOUSEOVER);
            over.onmouseover = function () { if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid = 0; } }
            over.onmouseout = function (e) { if (olHideDelay) hideDelay(olHideDelay); else cClick(e); }
      } else {
            over.onmouseover = function () {hoveringSwitch = true; if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid =0; } }
      }

      return 0;
}

// Function to scan command line arguments for multiples
function opt_MULTIPLEARGS(i, args, parameter) {
  var k=i, re, pV, str='';

  for(k=i; k<args.length; k++) {
            if(typeof args[k] == 'number' && args[k]>pmStart) break;
            str += args[k] + ',';
      }
      if (str) str = str.substring(0,--str.length);

      k--;  // reduce by one so the for loop this is in works correctly
      pV=(olNs4 && /cellpad/i.test(parameter)) ? str.split(',')[0] : str;
      eval(parameter + '="' + pV + '"');

      return k;
}

// Remove &nbsp; in texts when done.
function nbspCleanup() {
      if (o3_wrap) {
            o3_text = o3_text.replace(/\&nbsp;/g, ' ');
            o3_cap = o3_cap.replace(/\&nbsp;/g, ' ');
      }
}

// Escape embedded single quotes in text strings
function escSglQuote(str) {
  return str.toString().replace(/'/g,"\\'");
}

// Onload handler for window onload event
function OLonLoad_handler(e) {
      var re = /\w+\(.*\)[;\s]+/g, olre = /overlib\(|nd\(|cClick\(/, fn, l, i;

      if(!olLoaded) olLoaded=1;

  // Remove it for Gecko based browsers
      if(window.removeEventListener && e.eventPhase == 3) window.removeEventListener("load",OLonLoad_handler,false);
      else if(window.detachEvent) { // and for IE and Opera 4.x but execute calls to overlib, nd, or cClick()
            window.detachEvent("onload",OLonLoad_handler);
            var fN = document.body.getAttribute('onload');
            if (fN) {
                  fN=fN.toString().match(re);
                  if (fN && fN.length) {
                        for (i=0; i<fN.length; i++) {
                              if (/anonymous/.test(fN[i])) continue;
                              while((l=fN[i].search(/\)[;\s]+/)) != -1) {
                                    fn=fN[i].substring(0,l+1);
                                    fN[i] = fN[i].substring(l+2);
                                    if (olre.test(fn)) eval(fn);
                              }
                        }
                  }
            }
      }
}

// Wraps strings in Layer Generation Functions with the correct tags
//    endWrap true(if end tag) or false if start tag
//    fontSizeStr - font size string such as '1' or '10px'
//    whichString is being wrapped -- 'text', 'caption', or 'close'
function wrapStr(endWrap,fontSizeStr,whichString) {
      var fontStr, fontColor, isClose=((whichString=='close') ? 1 : 0), hasDims=/[%\-a-z]+$/.test(fontSizeStr);
      fontSizeStr = (olNs4) ? (!hasDims ? fontSizeStr : '1') : fontSizeStr;
      if (endWrap) return (hasDims&&!olNs4) ? (isClose ? '</span>' : '</div>') : '</font>';
      else {
            fontStr='o3_'+whichString+'font';
            fontColor='o3_'+((whichString=='caption')? 'cap' : whichString)+'color';
            return (hasDims&&!olNs4) ? (isClose ? '<span style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">' : '<div style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">') : '<font face="'+eval(fontStr)+'" color="'+eval(fontColor)+'" size="'+(parseInt(fontSizeStr)>7 ? '7' : fontSizeStr)+'">';
      }
}

// Quotes Multi word font names; needed for CSS Standards adherence in font-family
function quoteMultiNameFonts(theFont) {
      var v, pM=theFont.split(',');
      for (var i=0; i<pM.length; i++) {
            v=pM[i];
            v=v.replace(/^\s+/,'').replace(/\s+$/,'');
            if(/\s/.test(v) && !/['"]/.test(v)) {
                  v="\'"+v+"\'";
                  pM[i]=v;
            }
      }
      return pM.join();
}

// dummy function which will be overridden
function isExclusive(args) {
      return false;
}

// function will delay close by time milliseconds
function hideDelay(time) {
      if (time&&!o3_delay) {
            if (o3_timerid > 0) clearTimeout(o3_timerid);

            o3_timerid=setTimeout("cClick()",(o3_timeout=time));
      }
}

// Was originally in the placeLayer() routine; separated out for future ease
function horizontalPlacement(browserWidth, horizontalScrollAmount, widthFix) {
      var placeX, iwidth=browserWidth, winoffset=horizontalScrollAmount;
      var parsedWidth = parseInt(o3_width);

      if (o3_fixx > -1 || o3_relx != null) {
            // Fixed position
            placeX=(o3_relx != null ? ( o3_relx < 0 ? winoffset +o3_relx+ iwidth - parsedWidth - widthFix : winoffset+o3_relx) : o3_fixx);
      } else {  
            // If HAUTO, decide what to use.
            if (o3_hauto == 1) {
                  if ((o3_x - winoffset) > (iwidth / 2)) {
                        o3_hpos = LEFT;
                  } else {
                        o3_hpos = RIGHT;
                  }
            }              

            // From mouse
            if (o3_hpos == CENTER) { // Center
                  placeX = o3_x+o3_offsetx-(parsedWidth/2);

                  if (placeX < winoffset) placeX = winoffset;
            }

            if (o3_hpos == RIGHT) { // Right
                  placeX = o3_x+o3_offsetx;

                  if ((placeX+parsedWidth) > (winoffset+iwidth - widthFix)) {
                        placeX = iwidth+winoffset - parsedWidth - widthFix;
                        if (placeX < 0) placeX = 0;
                  }
            }
            if (o3_hpos == LEFT) { // Left
                  placeX = o3_x-o3_offsetx-parsedWidth;
                  if (placeX < winoffset) placeX = winoffset;
            }        

            // Snapping!
            if (o3_snapx > 1) {
                  var snapping = placeX % o3_snapx;

                  if (o3_hpos == LEFT) {
                        placeX = placeX - (o3_snapx+snapping);
                  } else {
                        // CENTER and RIGHT
                        placeX = placeX+(o3_snapx - snapping);
                  }

                  if (placeX < winoffset) placeX = winoffset;
            }
      }      

      return placeX;
}

// was originally in the placeLayer() routine; separated out for future ease
function verticalPlacement(browserHeight,verticalScrollAmount) {
      var placeY, iheight=browserHeight, scrolloffset=verticalScrollAmount;
      var parsedHeight=(o3_aboveheight ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight));

      if (o3_fixy > -1 || o3_rely != null) {
            // Fixed position
            placeY=(o3_rely != null ? (o3_rely < 0 ? scrolloffset+o3_rely+iheight - parsedHeight : scrolloffset+o3_rely) : o3_fixy);
      } else {
            // If VAUTO, decide what to use.
            if (o3_vauto == 1) {
                  if ((o3_y - scrolloffset) > (iheight / 2) && o3_vpos == BELOW && (o3_y + parsedHeight + o3_offsety - (scrolloffset + iheight) > 0)) {
                        o3_vpos = ABOVE;
                  } else if (o3_vpos == ABOVE && (o3_y - (parsedHeight + o3_offsety) - scrolloffset < 0)) {
                        o3_vpos = BELOW;
                  }
            }

            // From mouse
            if (o3_vpos == ABOVE) {
                  if (o3_aboveheight == 0) o3_aboveheight = parsedHeight;

                  placeY = o3_y - (o3_aboveheight+o3_offsety);
                  if (placeY < scrolloffset) placeY = scrolloffset;
            } else {
                  // BELOW
                  placeY = o3_y+o3_offsety;
            }

            // Snapping!
            if (o3_snapy > 1) {
                  var snapping = placeY % o3_snapy;                    

                  if (o3_aboveheight > 0 && o3_vpos == ABOVE) {
                        placeY = placeY - (o3_snapy+snapping);
                  } else {
                        placeY = placeY+(o3_snapy - snapping);
                  }                   

                  if (placeY < scrolloffset) placeY = scrolloffset;
            }
      }

      return placeY;
}

// checks positioning flags
function checkPositionFlags() {
      if (olHautoFlag) olHautoFlag = o3_hauto=0;
      if (olVautoFlag) olVautoFlag = o3_vauto=0;
      return true;
}

// get Browser window width
function windowWidth() {
      var w;
      if (o3_frame.innerWidth) w=o3_frame.innerWidth;
      else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientWidth=='number'")&&eval('o3_frame.'+docRoot+'.clientWidth'))
            w=eval('o3_frame.'+docRoot+'.clientWidth');
      return w;                  
}

// create the div container for popup content if it doesn't exist
function createDivContainer(id,frm,zValue) {
      id = (id || 'overDiv'), frm = (frm || o3_frame), zValue = (zValue || 1000);
      var objRef, divContainer = layerReference(id);

      if (divContainer == null) {
            if (olNs4) {
                  divContainer = frm.document.layers[id] = new Layer(window.innerWidth, frm);
                  objRef = divContainer;
            } else {
                  var body = (olIe4 ? frm.document.all.tags('BODY')[0] : frm.document.getElementsByTagName("BODY")[0]);
                  if (olIe4&&!document.getElementById) {
                        body.insertAdjacentHTML("beforeEnd",'<div id="'+id+'"></div>');
                        divContainer=layerReference(id);
                  } else {
                        divContainer = frm.document.createElement("DIV");
                        divContainer.id = id;
                        body.appendChild(divContainer);
                  }
                  objRef = divContainer.style;
            }

            with (objRef) {
                  position = 'absolute';
                  visibility = 'hidden';
                  top = left = -10000 + (!olNs4) ? 'px' : 0;
                  zIndex = zValue;
            }
      }

      return divContainer;
}

// get reference to a layer with ID=id
function layerReference(id) {
      return (olNs4 ? o3_frame.document.layers[id] : (document.all ? o3_frame.document.all[id] : o3_frame.document.getElementById(id)));
}
////////
//  PLUGIN ACTIVATION FUNCTIONS
////////

// Runs plugin functions to set runtime variables.
function setRunTimeVariables(){
      if (typeof runTime != 'undefined' && runTime.length) {
            for (var k = 0; k < runTime.length; k++) {
                  runTime[k]();
            }
      }
}

// Runs plugin functions to parse commands.
function parseCmdLine(pf, i, args) {
      if (typeof cmdLine != 'undefined' && cmdLine.length) {
            for (var k = 0; k < cmdLine.length; k++) {
                  var j = cmdLine[k](pf, i, args);
                  if (j >- 1) {
                        i = j;
                        break;
                  }
            }
      }

      return i;
}

// Runs plugin functions to do things after parse.
function postParseChecks(){
      if (typeof postParse != 'undefined' && postParse.length) {
            for (var k = 0; k < postParse.length; k++) {
                  if (postParse[k]()) continue;
                  return false;  // end now since have an error
            }
      }
      return true;
}


////////
//  PLUGIN REGISTRATION FUNCTIONS
////////

// Registers commands and creates constants.
function registerCommands(cmdStr) {
      if (typeof cmdStr!='string') return;

      var pM = cmdStr.split(',');
      pms = pms.concat(pM);

      for (var i = 0; i< pM.length; i++) {
            eval(pM[i].toUpperCase()+'='+pmCount++);
      }
}

// Registers no-parameter commands
function registerNoParameterCommands(cmdStr) {
      if (!cmdStr && typeof cmdStr!='string') return;
      pmt=(!pmt) ? cmdStr : pmt + ',' + cmdStr;
}

// Register a function to hook at a certain point.
function registerHook(fnHookTo, fnRef, hookType, optPm) {
      var hookPt, last = typeof optPm;
      
      if (fnHookTo == 'plgIn'||fnHookTo == 'postParse') return;
      if (typeof hookPts == 'undefined') hookPts = new Array();
      if (typeof hookPts[fnHookTo] == 'undefined') hookPts[fnHookTo] = new FunctionReference();

      hookPt = hookPts[fnHookTo];

      if (hookType != null) {
            if (hookType == FREPLACE) {
                  hookPt.ovload = fnRef;  // replace normal overlib routine
                  if (fnHookTo.indexOf('ol_content_') > -1) hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef;

            } else if (hookType == FBEFORE || hookType == FAFTER) {
                  var hookPt=(hookType == 1 ? hookPt.before : hookPt.after);

                  if (typeof fnRef == 'object') {
                        hookPt = hookPt.concat(fnRef);
                  } else {
                        hookPt[hookPt.length++] = fnRef;
                  }

                  if (optPm) hookPt = reOrder(hookPt, fnRef, optPm);

            } else if (hookType == FALTERNATE) {
                  if (last=='number') hookPt.alt[pms[optPm-1-pmStart]] = fnRef;
            } else if (hookType == FCHAIN) {
                  hookPt = hookPt.chain;
                  if (typeof fnRef=='object') hookPt=hookPt.concat(fnRef); // add other functions
                  else hookPt[hookPt.length++]=fnRef;
            }

            return;
      }
}

// Register a function that will set runtime variables.
function registerRunTimeFunction(fn) {
      if (isFunction(fn)) {
            if (typeof runTime == 'undefined') runTime = new Array();
            if (typeof fn == 'object') {
                  runTime = runTime.concat(fn);
            } else {
                  runTime[runTime.length++] = fn;
            }
      }
}

// Register a function that will handle command parsing.
function registerCmdLineFunction(fn){
      if (isFunction(fn)) {
            if (typeof cmdLine == 'undefined') cmdLine = new Array();
            if (typeof fn == 'object') {
                  cmdLine = cmdLine.concat(fn);
            } else {
                  cmdLine[cmdLine.length++] = fn;
            }
      }
}

// Register a function that does things after command parsing.
function registerPostParseFunction(fn){
      if (isFunction(fn)) {
            if (typeof postParse == 'undefined') postParse = new Array();
            if (typeof fn == 'object') {
                  postParse = postParse.concat(fn);
            } else {
                  postParse[postParse.length++] = fn;
            }
      }
}

////////
//  PLUGIN REGISTRATION FUNCTIONS
////////

// Runs any hooks registered.
function runHook(fnHookTo, hookType) {
      var l = hookPts[fnHookTo], k, rtnVal, optPm, arS, ar = runHook.arguments;

      if (hookType == FREPLACE) {
            arS = argToString(ar, 2);

            if (typeof l == 'undefined' || !(l = l.ovload)) return eval(fnHookTo+'('+arS+')');
            else return eval('l('+arS+')');

      } else if (hookType == FBEFORE || hookType == FAFTER) {
            if (typeof l == 'undefined') return;
            l=(hookType == 1 ? l.before : l.after);

            if (!l.length) return;

            arS = argToString(ar, 2);
            for (var k = 0; k < l.length; k++) eval('l[k]('+arS+')');

      } else if (hookType == FALTERNATE) {
            optPm = ar[2];
            arS = argToString(ar, 3);

            if (typeof l == 'undefined' || (l = l.alt[pms[optPm-1-pmStart]]) == 'undefined') {
                  return eval(fnHookTo+'('+arS+')');
            } else {
                  return eval('l('+arS+')');
            }
      } else if (hookType == FCHAIN) {
            arS=argToString(ar,2);
            l=l.chain;

            for (k=l.length; k > 0; k--) if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0)) return rtnVal;
      }
}

////////
//  UTILITY FUNCTIONS
////////

// Checks if something is a function.
function isFunction(fnRef) {
      var rtn = true;

      if (typeof fnRef == 'object') {
            for (var i = 0; i < fnRef.length; i++) {
                  if (typeof fnRef[i]=='function') continue;
                  rtn = false;
                  break;
            }
      } else if (typeof fnRef != 'function') {
            rtn = false;
      }
      
      return rtn;
}

// Converts an array into an argument string for use in eval.
function argToString(array, strtInd, argName) {
      var jS = strtInd, aS = '', ar = array;
      argName=(argName ? argName : 'ar');
      
      if (ar.length > jS) {
            for (var k = jS; k < ar.length; k++) aS += argName+'['+k+'], ';
            aS = aS.substring(0, aS.length-2);
      }
      
      return aS;
}

// Places a hook in the correct position in a hook point.
function reOrder(hookPt, fnRef, order) {
      if (!order || typeof order == 'undefined' || typeof order == 'number') return;
      
      var newPt = new Array(), match;

      if (typeof order=='function') {
            if (typeof fnRef=='object') {
                  newPt = newPt.concat(fnRef);
            } else {
                  newPt[newPt.length++]=fnRef;
            }
            
            for (var i = 0; i < hookPt.length; i++) {
                  match = false;
                  if (typeof fnRef == 'function' && hookPt[i] == fnRef) {
                        continue;
                  } else {
                        for(var j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) {
                              match = true;
                              break;
                        }
                  }
                  if (!match) newPt[newPt.length++] = hookPt[i];
            }

            newPt[newPt.length++] = order;

      } else if (typeof order == 'object') {
            if (typeof fnRef == 'object') {
                  newPt = newPt.concat(fnRef);
            } else {
                  newPt[newPt.length++] = fnRef;
            }
            
            for (var j = 0; j < hookPt.length; j++) {
                  match = false;
                  if (typeof fnRef == 'function' && hookPt[j] == fnRef) {
                        continue;
                  } else {
                        for (var i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) {
                              match = true;
                              break;
                        }
                  }
                  if (!match) newPt[newPt.length++]=hookPt[j];
            }

            for (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
            newPt.length = 0;
            
            for (var j = 0; j < hookPt.length; j++) {
                  match = false;
                  for (var i = 0; i < order.length; i++) {
                        if (hookPt[j] == order[i]) {
                              match = true;
                              break;
                        }
                  }
                  if (!match) newPt[newPt.length++] = hookPt[j];
            }
            newPt = newPt.concat(order);
      }

      for(i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];

      return hookPt;
}

////////
// OBJECT CONSTRUCTORS
////////

// Object for handling hooks.
function FunctionReference() {
      this.ovload = null;
      this.before = new Array();
      this.after = new Array();
      this.alt = new Array();
      this.chain = new Array();
}

// Object for simple access to the overLIB version used.
// Examples: simpleversion:351 major:3 minor:5 revision:1
function Info(version, prerelease) {
      this.version = version;
      this.prerelease = prerelease;

      this.simpleversion = Math.round(this.version*100);
      this.major = parseInt(this.simpleversion / 100);
      this.minor = parseInt(this.simpleversion / 10) - this.major * 10;
      this.revision = parseInt(this.simpleversion) - this.major * 100 - this.minor * 10;
      this.meets = meets;
}

// checks for Core Version required
function meets(reqdVersion) {
      return (!reqdVersion) ? false : this.simpleversion >= Math.round(100*parseFloat(reqdVersion));
}


////////
// STANDARD REGISTRATIONS
////////
registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSOFF);
registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSOFF);
registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSOFF);
registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSCLASS);
registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSCLASS);
registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSCLASS);
registerPostParseFunction(checkPositionFlags);
registerHook("hideObject", nbspCleanup, FAFTER);
registerHook("horizontalPlacement", horizontalPlacement, FCHAIN);
registerHook("verticalPlacement", verticalPlacement, FCHAIN);
if (olNs4||(olIe5&&isMac)||olKq) olLoaded=1;
registerNoParameterCommands('sticky,autostatus,autostatuscap,fullhtml,hauto,vauto,closeclick,wrap,followmouse,mouseoff,compatmode');


This message is getting pretty big now. I feel like we are real close to getting this done though.

BTW here is a link to the page I am working on:

http://www.medefis.com/cgi-bin/medefis/search2.cgi

Thanks,

jahmekyat
0
 
apparitionCommented:
ok my mistake change the printi funtion to the following:
print "jobs_in_states[\"" . $path->{"State"}. "\"] = \"" . $path->{"Projects"} . "\"" . "\n";

I used "+" instead of "." (Sorry I'm primarily a Java Programmer, havent done perl in years so got the syntax mixed up)

ok now for the Javascript. Get rid of the Javascript I created and add

document.disp.jobs.value = jobs_in_states[state]
to the bottom of the large overlib function
and add document.disp.jobs.value = "" to the bottom of the large nd funtion

I going to be gone for a couple of hours so dont panic try these and we'll take it from there.
0
 
jahmekyatAuthor Commented:
Sounds good,
Thanks!!
0
 
jahmekyatAuthor Commented:
Hi,
I made all of the changes that you did and the JS array is populating again. Thanks. I just say the text box that I put on the site and I would guess that it was for showing what jobs were in the state when it is hovered over. Actually, if you go to the page, the way that I wanted them to display from my original post, is when they hover over the state, it displays the amount of jobs over the state. Right now the way the hover event works is that it says the state name. If you chek it out, I think that you will know what I mean. So when you hover the particular state, it syas the state name and the amount of jobs in that state, etc. Does that make sense?
Thanks again. I should of been more clear in my description. Sorry for the confusion.

jahmekyat
0
 
apparitionCommented:
I cant access the site.....it asks me for a password
0
 
jahmekyatAuthor Commented:
Do you have another email that I can send it to? Or, are we allowed to do that?
0
 
apparitionCommented:
ok you might try this in your image map call the overlib function like this
onmouseover = "overlib('New York ' + 'Jobs : '  + jobs_in_states['NY'])"

you can get rid of the HTML form
0
 
jahmekyatAuthor Commented:
logon with u = test p = test  and check healthcare provider and then go to the link. It is now saying that jobs_in_states is undifined
0
 
jahmekyatAuthor Commented:
Sorry,
Try This Again:

logon with u = test1 p = test1  and check healthcare provider and then go to the link. It is now saying that jobs_in_states is undifined
0
 
jahmekyatAuthor Commented:
I figured out what the problem was.
It is now displaying the Number of jobs in the Hover event.
I might have some more questions. If not, I will wrap it up shortly.
Thanks again,

jahmekyat
0
 
apparitionCommented:
How far along are you ?
0
 
jahmekyatAuthor Commented:
Hi,

Try going to this link to see the page:

http://www.medefis.com/cgi-bin/medefis/search2.cgi

Let me know if it works.
What I need to do now, if there are no jobs in a particular state, instead of it saying undifined,
I just need it to say that there are no jobs available at this time.
Thanks,

jahmekyat
0
 
apparitionCommented:
ok make this change

onmouseover = "overlib('New York ' + availableJobs('NY') )"

and then add this function:

function  availableJobs(state){
     return "Jobs: " + (jobs_in_states[state] == null ? "None available at this time" : jobs_in_states[state] )
}
0
 
jahmekyatAuthor Commented:
Were you able to see the web page?
0
 
apparitionCommented:
yah it looks really good.....good job
0
 
jahmekyatAuthor Commented:
I haven't done anything with the design of the page, I still have a lot more to do, I was just waiting to get the coding done.
I want to tell you that you have been absolutly awesome with this issue and I am lucky that I got you.
I hope when I post new issues, I get you as my expert.
0
 
apparitionCommented:
Glad to help. I thought the problem you were having was an interesting one and it was fun solving it with you.
0
 
jahmekyatAuthor Commented:
It looks good! I don't know if I can think of anything else
that I need to add at this time. I really need to work on the design of the page
and what happens after they click the state so they can pull up the jobs in that state.
I already have that part done and just need to tie in the new page to the existing job display page.
The reason that I am doing this now is that we are growing so fast and our project display page is
getting to the point that jobs are starting to get lost because the page is so long. That is only with about
75-100 positions at a time. We are expecting to be up to around 500-750 at a time in the next 6 months
and thought it would be easier for the users to start at the state level and then drill down from there.

Thanks again for all of your help!

jahmekyat
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 18
  • 13
Tackle projects and never again get stuck behind a technical roadblock.
Join Now