I have a webpage that includes a map of the U.S. and for each state I have a menu to different city websites for each state. What I would like to do is once a visitor clicks on one of the city links, a cookie is created so that when that user returns to my website, he is taken directly to the city he selected, not the home page again.

I have a script that I am working on but I am getting errors with it. I was hoping someone here could help me. I am not a developer and know very little about scripting, so any ideas or advice are helpful.

Here is the script in the HEAD section of my page:

Code:
<SCRIPT type='text/javascript'>
function setCookie(c_name, value, expiredays)
{
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie=c_name + "=" + escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function GetDocsInCity()
{
    var mylist = document.getElementById("myList");

    var myCity = mylist.values[mylist.selectedIndex].text;
 setCookie('myCity',myCity,365)

    var url = "http://fleabay.net/";
    document.location.href = url  + myCity;
}

</SCRIPT>
A sample of the HTML code looks like this:

HTML Code:
<UL id=mylist>
  <li value="ocala"><a onclick=GetDocsInCity()>Ocala</a></li>
  <li value="orlando"><a onclick=GetDocsInCity()>Orlando</a><li>
  <li value="miami"><a onclick=GetDocsInCity()>Miami</a></li>
  <li value="thevillages"><a onclick=GetDocsInCity()>The Villages</a></li>
</UL>
The page this is at is fleabay.net/index2.php

I actually have not set up all the cities yet, but I figured if I get this part figured out, I can set the rest of the cities just fine.

Thank You for your help.