// WineCountry.com
// Main Menu JavaScript
/***********************************************
* Ver $ 1.0 $
* - To change the actual menu look and feel, refer to "menu_vertDrop_std.css"
***********************************************/


/***********************************************
* AnyLink Drop Down Menu- <A9> Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/


//menu 1 Travel
var menu1=new Array()
menu1[1]='<a href="http://www.winecountry.com/lodging/">Lodging</a>'
menu1[2]='<a href="http://www.winecountry.com/wineries/">Wineries</a>'
menu1[3]='<a href="http://www.winecountry.com/thingstodo/spas/">Spas &amp; Resorts</a>'
menu1[4]='<a href="http://www.winecountry.com/eventplanning/meetings.html">Meeting &amp; Event Planning</a>'
menu1[5]='<a href="http://www.winecountry.com/freestuff/freestuff.html">Discounts &amp; Promotions</a>'
menu1[7]='<a href="http://www.winecountry.com/articles/">Articles</a>'
menu1[8]='<a href="http://www.winecountry.com/forms/news.html">Newsletters</a>'
menu1[9]='<a href="http://www.winecountry.com/maps/">Maps</a>'
menu1[10]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'
menu1[11]='<a href="http://discover.winecountry.com/travel/">Travel Blog</a>'
menu1[12]='<a href="http://www.winecountry.com/cgi-bin/ubb/Ultimate.cgi">Message Boards</a>'



//menu 2 Food & Wine
var menu2=new Array()
menu2[0]='<a href="http://www.winecountry.com/about/food/">Food &amp; Dining</a>'
menu2[1]='<a href="http://www.winecountry.com/reviews-and-news/">Reviews and News</a>'
menu2[2]='<a href="http://www.winecountry.com/thingstodo/dining/">Restaurants</a>'
menu2[3]='<a href="http://www.winecountry.com/wineries/">Wineries</a>'
menu2[4]='<a href="http://discover.winecountry.com/food/">Food Blog</a>'
menu2[5]='<a href="http://discover.winecountry.com/wine/">Wine Blog</a>'
menu2[6]='<a href="http://www.winecountry.com/articles/">Articles</a>'
menu2[7]='<a href="http://www.winecountry.com/forms/news.html">Newsletter</a>'
menu2[8]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'
menu2[9]='<a href="http://www.winecountry.com/cgi-bin/ubb/Ultimate.cgi">Message Board</a>'



//menu 3 Things To Do
var menu3=new Array()
menu3[0]='<a href="http://www.winecountry.com/thingstodo/">By Region</a>'
menu3[1]='<a href="http://www.goldcountry.winecountry.com/thingstodo/">Gold Country, CA</a>'
menu3[2]='<a href="http://www.livermore.winecountry.com/thingstodo/">Livermore / Tri-Valley, CA</a>'
menu3[3]='<a href="http://www.lodi.winecountry.com/thingstodo/">Lodi, CA</a>'
menu3[4]='<a href="http://www.mendocino.winecountry.com/thingstodo/">Mendocino County, CA</a>'
menu3[5]='<a href="http://www.monterey.winecountry.com/thingstodo/">Monterey County, CA</a>'
menu3[6]='<a href="http://www.napavalley.winecountry.com/thingstodo/">Napa Valley, CA</a>'
menu3[7]='<a href="http://www.oregon.winecountry.com/thingstodo/">Oregon</a>'
menu3[8]='<a href="http://www.sanluisobispo.winecountry.com/thingstodo/">San Luis Obispo County, CA</a>'
menu3[9]='<a href="http://www.santabarbara.winecountry.com/thingstodo/">Santa Barbara County, CA</a>'
menu3[10]='<a href="http://www.santacruz.winecountry.com/thingstodo/">Santa Cruz Mountains, CA</a>'
menu3[11]='<a href="http://www.sonoma.winecountry.com/thingstodo/">Sonoma County, CA</a>'
menu3[12]='<a href="http://www.temecula.winecountry.com/thingstodo/">Temecula, CA</a>'
menu3[13]='<a href="http://www.virginia.winecountry.com/thingstodo/">Virginia</a>'
menu3[14]='<a href="http://www.yakimavalley.winecountry.com/thingstodo/">Yakima Valley, WA</a>'
menu3[15]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'
menu3[16]='<a href="http://www.winecountry.com/cgi-bin/ubb/Ultimate.cgi">Message Boards</a>'



//menu 4 Events
var menu4=new Array()
menu4[1]='<a href="http://www.winecountry.com/events.html">Calendar</a>'
menu4[2]='<a href="http://www.winecountry.com/eventplanning/meetings.html">Meeting &amp; Event Planning</a>'
menu4[3]='<a href="http://www.winecountry.com/events/submitEvents/">Enter Your Events</a>'
menu4[4]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'



//menu 5 Wine Regions
var menu5=new Array()
menu5[0]='<a href="http://www.goldcountry.winecountry.com/">Gold Country, CA</a>'
menu5[1]='<a href="http://www.livermore.winecountry.com/">Livermore / Tri-Valley, CA</a>'
menu5[2]='<a href="http://www.lodi.winecountry.com/">Lodi, CA</a>'
menu5[3]='<a href="http://www.mendocino.winecountry.com/">Mendocino County, CA</a>'
menu5[4]='<a href="http://www.monterey.winecountry.com/">Monterey County, CA</a>'
menu5[5]='<a href="http://www.napavalley.winecountry.com/">Napa Valley, CA</a>'
menu5[6]='<a href="http://www.oregon.winecountry.com/">Oregon</a>'
menu5[7]='<a href="http://www.sanluisobispo.winecountry.com/">San Luis Obispo County, CA</a>'
menu5[8]='<a href="http://www.santabarbara.winecountry.com/">Santa Barbara County, CA</a>'
menu5[9]='<a href="http://www.santacruz.winecountry.com/">Santa Cruz Mountains, CA</a>'
menu5[10]='<a href="http://www.sonoma.winecountry.com/">Sonoma County, CA</a>'
menu5[11]='<a href="http://www.temecula.winecountry.com/">Temecula, CA</a>'
menu5[12]='<a href="http://www.virginia.winecountry.com/">Virginia</a>'
menu5[13]='<a href="http://www.yakimavalley.winecountry.com/">Yakima Valley, WA</a>'
menu5[14]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'



//menu 6 Connect
var menu6=new Array()
menu6[0]='<a href="http://www.winecountry.com/cgi-bin/ubb/Ultimate.cgi">Message Boards</a>'
menu6[1]='<a href="http://www.winecountry.com/blogs/">Blogs</a>'
menu6[2]='<a href="http://download.winecountry.com/feeds/">RSS Feeds</a>'
menu6[3]='<a href="http://www.winecountry.com/maps/">Maps</a>'
menu6[4]='<a href="http://www.winecountry.com/forms/news.html/">Newsletter</a>'
menu6[5]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'



//menu 7 Shopping
var menu7=new Array()
menu7[0]='<a href="http://www.winecountry.com/shopping/">Shop By Region</a>'
menu7[3]='<a href="http://discover.winecountry.com/wine/2011/11/wine-samplers-for-the-holidays.html">Holiday Wine Gifts</a>'
menu7[4]='<a href="http://winecountry.com/breathe/">Breathe Wine Passport</a>'
menu7[7]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'



//menu 8 Weddings
var menu8=new Array()
menu8[0]='<a href="http://www.goldcountry.winecountry.com/eventplanning/weddings.html">Gold Country, CA</a>'
menu8[1]='<a href="http://www.livermore.winecountry.com/eventplanning/weddings.html">Livermore / Tri-Valley, CA</a>'
menu8[2]='<a href="http://www.lodi.winecountry.com/eventplanning/weddings.html">Lodi, CA</a>'
menu8[3]='<a href="http://www.mendocino.winecountry.com/eventplanning/weddings.html">Mendocino County, CA</a>'
menu8[4]='<a href="http://www.monterey.winecountry.com/eventplanning/weddings.html">Monterey County, CA</a>'
menu8[5]='<a href="http://www.napavalley.winecountry.com/eventplanning/weddings.html">Napa Valley, CA</a>'
menu8[6]='<a href="http://www.sanluisobispo.winecountry.com/eventplanning/weddings.html">San Luis Obispo County, CA</a>'
menu8[7]='<a href="http://www.santabarbara.winecountry.com/eventplanning/weddings.html">Santa Barbara County, CA</a>'
menu8[8]='<a href="http://www.santacruz.winecountry.com/eventplanning/weddings.html">Santa Cruz Mountains, CA</a>'
menu8[9]='<a href="http://www.sonoma.winecountry.com/eventplanning/weddings.html">Sonoma County, CA</a>'
menu8[10]='<a href="http://www.temecula.winecountry.com/eventplanning/weddings.html">Temecula, CA</a>'
menu8[11]='<a href="http://www.virginia.winecountry.com/eventplanning/weddings.html">Virginia</a>'
menu8[12]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'



//menu 9 Real Estate
var menu9=new Array()
menu9[0]='<a href="http://www.mendocino.winecountry.com/realestate/">Mendocino County, CA</a>'
menu9[1]='<a href="http://www.monterey.winecountry.com/realestate/">Monterey County, CA</a>'
menu9[2]='<a href="http://www.napavalley.winecountry.com/realestate/">Napa Valley, CA</a>'
menu9[3]='<a href="http://www.sanluisobispo.winecountry.com/realestate/">San Luis Obispo County, CA</a>'
menu9[4]='<a href="http://www.santabarbara.winecountry.com/realestate/">Santa Barbara County, CA</a>'
menu9[5]='<a href="http://www.santacruz.winecountry.com/realestate/">Santa Cruz Mountains, CA</a>'
menu9[6]='<a href="http://www.sonoma.winecountry.com/realestate/">Sonoma County, CA</a>'
menu9[7]='<a href="http://www.temecula.winecountry.com/realestate/">Temecula, CA</a>'
menu9[8]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'



//menu 10 Newsletters
var menu10=new Array()
menu10[0]='<a href="http://www.winecountry.com/forms/news.html">Sign Up Today!</a>'
menu10[1]='<a href="http://www.winecountry.com/newsletters/current/newsletter.html" target="_blank">Current Newsletter</a>'
menu10[2]='<a href="http://www.winecountry.com/newsletters/index.html" target="_blank">Past Newsletters</a>'
menu10[3]='<a href="http://www.winecountry.com/travel-planner/index.html">Travel Planner</a>'


var menuwidth='165px' //default menu width
var menubgcolor='#034d66'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?


/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return true
else return false
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu


