// 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- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="http://www.winecountry.com/lodging/">Lodging</a>'
menu1[1]='<a href="http://www.winecountry.com/thingstodo/spas/">Spas &amp; Resorts</a>'
menu1[3]='<a href="http://www.winecountry.com/eventplanning/meetings.html">Meeting &amp; Event Planning</a>'
menu1[4]='<a href="http://www.winecountry.com/freestuff/freestuff.html">Discounts &amp; Promotions</a>'
menu1[5]='<a href="http://www.winecountry.com/exclusive-experiences/">Exclusive Experiences</a>'
menu1[6]='<a href="http://www.winecountry.com/articles/">Articles</a>'
menu1[7]='<a href="http://www.winecountry.com/photogallery/winecountry/">Photo Gallery</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>'
menu2[10]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'


//Contents for menu 2, and so on
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 &amp; 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="/recipes/">Recipes</a>'
menu2[7]='<a href="http://www.winecountry.com/articles/">Articles</a>'
menu2[8]='<a href="http://www.winecountry.com/forms/news.html">Newsletter</a>'
menu2[9]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'

//Contents for menu 3, and so on
var menu3=new Array()
menu3[0]='<a href="http://www.winecountry.com/thingstodo/">By Region</a>'
menu3[1]='<a href="http://www.lodi.winecountry.com/thingstodo/">Lodi</a>'
menu3[2]='<a href="http://www.mendocino.winecountry.com/thingstodo/">Mendocino</a>'
menu3[3]='<a href="http://www.monterey.winecountry.com/thingstodo/">Monterey</a>'
menu3[4]='<a href="http://www.napavalley.winecountry.com/thingstodo/">Napa Valley</a>'
menu3[5]='<a href="http://www.oregon.winecountry.com/thingstodo/">Oregon</a>'
menu3[6]='<a href="http://www.sanluisobispo.winecountry.com/thingstodo/">SLO / Paso Robles</a>'
menu3[7]='<a href="http://www.santabarbara.winecountry.com/thingstodo/">Santa Barbara</a>'
menu3[8]='<a href="http://www.santacruz.winecountry.com/thingstodo/">Santa Cruz</a>'
menu3[9]='<a href="http://www.sonoma.winecountry.com/thingstodo/">Sonoma</a>'
menu3[10]='<a href="http://www.temecula.winecountry.com/thingstodo/">Temecula</a>'
menu3[11]='<a href="http://www.virginia.winecountry.com/thingstodo/">Virginia</a>'
menu3[12]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'

//Contents for menu 4, and so on
var menu4=new Array()
menu4[0]='<a href="http://www.winecountry.com/events.html">Calendar</a>'
menu4[1]='<a href="http://www.winecountry.com/eventplanning/meetings.html">Meeting &amp; Event Planning</a>'
menu4[2]='<a href="http://www.winecountry.com/events/submitEvents/">Enter Your Events</a>'
menu4[3]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'

//Contents for menu 5, and so on
var menu5=new Array()
menu5[0]='<a href="http://goldcountry.winecountry.com/">Gold Country</a>'
menu5[1]='<a href="http://livermore.winecountry.com/">Livermore/Tri-Valley</a>'
menu5[2]='<a href="http://lodi.winecountry.com/">Lodi</a>'
menu5[3]='<a href="http://monterey.winecountry.com/">Monterey</a>'
menu5[4]='<a href="http://mendocino.winecountry.com/">Mendocino</a>'
menu5[5]='<a href="http://napavalley.winecountry.com/">Napa Valley</a>'
menu5[6]='<a href="http://sanluisobispo.winecountry.com/">SLO / Paso Robles</a>'
menu5[7]='<a href="http://santabarbara.winecountry.com/">Santa Barbara</a>'
menu5[8]='<a href="http://santacruz.winecountry.com/">Santa Cruz</a>'
menu5[9]='<a href="http://sonoma.winecountry.com/">Sonoma</a>'
menu5[10]='<a href="http://temecula.winecountry.com/">Temecula</a>'
menu5[11]='<a href="http://oregon.winecountry.com/">Oregon</a>'
menu5[12]='<a href="http://virginia.winecountry.com/">Virginia</a>'
menu5[13]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'

//Contents for menu 6, and so on
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/index.html">Blogs</a>'
menu6[2]='<a href="http://download.winecountry.com/feeds/">RSS Feeds</a>'
menu6[3]='<a href="http://www.winecountry.com/photogallery/winecountry/">Photo Gallery</a>'
menu6[4]='<a href="http://www.winecountry.com/maps/">Maps</a>'
menu6[5]='<a href="http://www.winecountry.com/forms/news.html">Newsletter</a>'
menu6[6]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'

//Contents for menu 7, and so on
var menu7=new Array()
menu7[0]='<a href="http://www.winecountry.com/shopping/">Shop By Region</a>'
menu7[1]='<a href="http://www.valleyandvine.com/">Shop Valley and Vine</a>'
menu7[2]='<a href="http://www.mywinesdirect.com/" target="_blank">Wine and Gift Baskets</a>'
menu7[3]='<a href="https://commerce.winecountry.com/display/ee/">Exclusive Experiences</a>'
menu7[4]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'

//Contents for menu 9, and so on
var menu8=new Array()
menu8[0]='<a href="http://napavalley.winecountry.com/eventplanning/weddings.html">Napa Valley</a>'
menu8[1]='<a href="http://sonoma.winecountry.com/eventplanning/weddings.html">Sonoma</a>'
menu8[2]='<a href="http://goldcountry.winecountry.com/eventplanning/weddings.html">Gold Country</a>'
menu8[3]='<a href="http://lodi.winecountry.com/eventplanning/weddings.html">Lodi</a>'
menu8[4]='<a href="http://monterey.winecountry.com/eventplanning/weddings.html">Monterey</a>'
menu8[5]='<a href="http://mendocino.winecountry.com/eventplanning/weddings.html">Mendocino</a>'
menu8[6]='<a href="http://sanluisobispo.winecountry.com/eventplanning/weddings.html">SLO / Paso Robles</a>'
menu8[7]='<a href="http://santabarbara.winecountry.com/eventplanning/weddings.html">Santa Barbara</a>'
menu8[8]='<a href="http://santacruz.winecountry.com/eventplanning/weddings.html">Santa Cruz</a>'
menu8[9]='<a href="http://temecula.winecountry.com/eventplanning/weddings.html">Temecula</a>'
menu8[10]='<a href="http://oregon.winecountry.com/eventplanning/weddings.html">Oregon</a>'
menu8[11]='<a href="http://virginia.winecountry.com/eventplanning/weddings.html">Virginia</a>'
menu8[12]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'

//Contents for menu 10, and so on
var menu9=new Array()
menu9[0]='<a href="http://monterey.winecountry.com/realestate/">Monterey</a>'
menu9[1]='<a href="http://mendocino.winecountry.com/realestate/">Mendocino</a>'
menu9[2]='<a href="http://napavalley.winecountry.com/realestate/">Napa Valley</a>'
menu9[3]='<a href="http://sanluisobispo.winecountry.com/realestate/">SLO / Paso Robles</a>'
menu9[4]='<a href="http://santabarbara.winecountry.com/realestate/">Santa Barbara</a>'
menu9[5]='<a href="http://santacruz.winecountry.com/realestate/">Santa Cruz</a>'
menu9[6]='<a href="http://sonoma.winecountry.com/realestate/">Sonoma</a>'
menu9[7]='<a href="http://www.winecountry.com/travel-planner/">Travel Planner</a>'

//Contents for menu 11, and so on
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/">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
