
        function JumpToIt(list) {
            var newPage = list.options[list.selectedIndex].value
            if (list.selectedIndex > 0) { location.href='/medications/' + newPage + '.html' }
        }

        function OpenImage(filename) {
            window.open('/img/' + filename,'newTable',
                        'width=500,height=500,toolbar=no,location=no,scrollbars=yes');
        }


        function OpenTable(newURL) {
            window.open('/table/' + newURL + '.html','newTable',
						'width=600,height=600,toolbar=no,location=no,scrollbars=yes');
        }

        function ParentLink(newURL) {
            location.href = '/page/' + newURL + '.html';
        }

        function printPage() {
             if (window.print) {
                window.print()
             } else {
                alert("Sorry, your browser doesn't support this feature.\n" +
                      "Please use your browser's print button");
             }
        }

        function glossWin(uniqa){
            glossarywindow = window.open("/glossary/" + uniqa + '.html',
                "glossarywindow", "WIDTH=350,HEIGHT=250,scrollbars");
            glossarywindow.focus();
        }

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}
//set up some variables
var now = new Date();
fixDate(now);
now.setTime(now.getTime() + 160 * 24 * 60 * 60 * 1000);

var visitor = getCookie("visitor");
//var visits = getCookie("bannerimg");

// if the cookie wasn't found, this is your first visit
//if (!visits) {
//  visits = 1; // the value for the new cookie
//} else {
  // increment the counter
//  visits = parseInt(visits) + 1;
//  if (visits > 10) visits = 1;
//}

//setCookie('bannerimg', visits, now,'/');

// if the cookie wasn't found, this is your first visit and you need to be tagged
if (!visitor) {
  // the value for the unique ID for the new user
  visitor = (String(now.getTime()) + String(Math.round(Math.random() * 10000)));  
}

setCookie('visitor', visitor, now,'/');
//alert("Visits: " + visits + "\n" + "Vistor: " + visitor);

var req;



function loadXMLDoc(url) 
{
    if (window.XMLHttpRequest) 
    {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url, false);
        req.send(null);
    } 
    else if (window.ActiveXObject) 
    {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) 
        {
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send();
        }
    }
}


// handle onreadystatechange event of req object
function processReqChange() 
{
    // only if req shows "loaded"
    if (req.readyState == 4) 
    {
        // only if "OK"
        if (req.status == 200) 
        {
			
         } 
         else 
         {
            alert("There was a problem retrieving the XML data:\n" + req.statusText);
         }
    }
}

/*	
----------------------------------------
// Functions to display the rotating ads
----------------------------------------
*/
function mkRandom(num)
{
   randnum = Math.floor(Math.random()*num);
   return randnum;   
}
var theRandNum = mkRandom(2);
//var theSideRandNum = mkRandom(4);

var theImg;
var theLink;
function createAdInfo(position, aNum)
{
   theImg = 'ad' + position + '_' + aNum + '.gif';

   switch(aNum)
   {
      case 0:
         theLink = 'shop.epilepsy.com';
      break;

      case 1:
/* OLD URL
         theLink = 'my.epilepsy.com';
*/
         theLink = 'www.epilepsy.com';
      break;

/* NOT NEEDED AT THIS TIME
      case 2:
         theLink = 'www.epilepsytdp.org';
      break;
*/

   }
   return theImg;
   return theLink;
}

// When calling this function, use either Top or Side
function drawAd(where)
{
   if(where == 'Side')
   {
      newRand = mkRandom(2);
      while(newRand == theRandNum)
      {
         newRand = mkRandom(2);
      }
      theRandNum = newRand;

   }

   createAdInfo(where, theRandNum);

   document.write('<a href="http://' + theLink + '" target="_blank">');
   document.write('<img src="/img/' + theImg + '" border="0" alt="" /></a>');
}

