var timerID = null;
var showtimerID = null;
var timercount = 500;
var menuy=35;
var currentmenu=0;
var num_menu=5;

//All About My Teas
menu[20]={menunum: "2", entry: "History Of Tea", url: "history.php", color: 1};
menu[21]={menunum: "2", entry: "How Our Teas Are Made", url: "how.php", color: 1};
menu[22]={menunum: "2", entry: "Benefits Of Tea", url: "benefits.php", color: 1};
menu[23]={menunum: "2", entry: "Tea Health Benefits", url: "health_benefits.php", color: 1};
menu[24]={menunum: "2", entry: "Chinese Tea", url: "chinesetea.php", color: 1};
menu[25]={menunum: "2", entry: "What is Green Tea?", url: "greentea.php", color: 1};
menu[26]={menunum: "2", entry: "What is Oolong Tea?", url: "oolong.php", color: 1};
menu[27]={menunum: "2", entry: "What is White Tea?", url: "whitetea.php", color: 1};



//Tea Lifestyle
menu[30]={menunum: "3", entry: "Brewing Instructions", url: "brewing.php", color: 1};
menu[31]={menunum: "3", entry: "Tea Recipes", url: "recipes.php", color: 1};

//About Us
menu[40]={menunum: "4", entry: "Ethos", url: "ethos.php", color: 1};
menu[41]={menunum: "4", entry: "Contact Form", url: "contact.php", color: 1};

//Shopping Basket
menu[50]={menunum: "5", entry: "Checkout", url: "shopping_basket.php", color: 1};
menu[51]={menunum: "5", entry: "Shipping Policy", url: "shipping_policy.php", color: 1};
menu[52]={menunum: "5", entry: "Returns Policy", url: "returns_policy.php", color: 1};

function showmenu (target,v) {
//showtimerID=window.setTimeout("showmenu2('"+target+"',"+v+")",timercount);
showmenu2 (target,v);
//hide all selects

}//end of function

function showmenu2 (target,v) {
if (v!=currentmenu) {
for (i=1;i<=num_menu;i++) {
hidemenu('menu'+i);
}
}
currentmenu=v;
targetmenu=(document.getElementById) ?
document.getElementById(target).style : eval ("document."+target);
targetmenu.top=menuy+"px";
targetmenu.visibility="visible";
clearTimeout(timerID);  timerID = null;
}

function cancelmenu (target) {
clearTimeout(showtimerID);  showtimerID = null;
timerID=window.setTimeout("hidemenu('"+target+"')",timercount);
}

function hidemenu (target) {
targetmenu=(document.getElementById) ? document.getElementById(target).style : eval ("document."+target);
targetmenu.top=-2000;
targetmenu.visibility="hidden";
//show all selects

}//end of function

function createmenu(number,menuName,start,finish,left) {
//menu
document.write ('<div id="'+menuName+'" class="iMenu" style="left: '+left+'px;" ');
document.write ('onMouseover="showmenu(\''+menuName+'\','+number+');"');
document.write ('onMouseout="cancelmenu(\''+menuName+'\');">');
document.write ('<div class="iMenu2"><ul id="submenu">');
//menu options
var type;
for (i=start;i<=finish;i++) {
document.write ('<li><a href="'+menu[i].url+'">'+menu[i].entry+'</a></li>');
}
document.write ('</ul></div>');
document.write ('</div>');
}
