/*
*/
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

//When select new year
function onYearChange(){
	var sl = document.getElementById("selYear");
	var opV = sl.options[sl.selectedIndex].value;
	var localURL = "awards.html#"+opV;
	window.location.href = localURL;
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		home_over = newImage("images/home_over.gif");
		wine_over = newImage("images/wine_over.gif");
		vineyards_over = newImage("images/vineyards_over.gif");
		casa_over = newImage("images/casa_over.gif");
		gardens_over = newImage("images/gardens_over.gif");
		recipes_over = newImage("images/recipes_over.gif");
		book_over = newImage("images/book_over.gif");
		preloadFlag = true;
	}
}

function openPop(url)
{
   aPopUp=
window.open(url,'card','toolbar=no,menubar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,copyhistory=no,width=670,height=550,left=100,top=100')
   self.acardWin = aPopUp
}

function openRecipe(url)
{
   aPopUp=
window.open(url,'card','toolbar=no,menubar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=670,height=550,left=100,top=100')
   self.acardWin = aPopUp
}

function site_menu_open()
{  site_menu_canceltimer();
   site_menu_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function site_menu_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function site_menu_timer()
{  closetimer = window.setTimeout(site_menu_close, timeout);}

function site_menu_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

document.onclick = site_menu_close;

function site_menu_build(){
    var _html = '';
    _html = _html+'<ul id="site_menu" style="z-index:1" > <li><a href="index.html" style="width:68px" >Home<img src="images/menu_splite.png" width="20" height="15" border="0" style="margin-left:3px;" /></a></li> <li ><a href="#" style="width:176px">Amici della Rusticana<img src="images/menu_splite.png" width="20" height="15" border="0"  style="margin-left:3px;" /></a> ';
    _html = _html+' <ul> <li><a href="amici.html">Membership</a></li>   </ul> ';
    _html = _html+' </li> <li><a href="#" style="width:158px">Wine and Olive Oil<img src="images/menu_splite.png" width="20" height="15" border="0"  style="margin-left:3px;" /></a> <ul> <li><a href="vineyards.html">The Vineyards</a></li> ';
    _html = _html+' <li><a href="wine.html">The Wine</a></li>  ';   
    _html = _html+'              <li><a href="orchards.html">The Orchards</a></li> ';
   _html = _html+'               <li><a href="oliveoil.html">The Olive Oil</a></li> ';
   _html = _html+'           </ul> ';
    _html = _html+'      </li> ';
    _html = _html+'      <li><a href="#" style="width:102px">The Ranch<img src="images/menu_splite.png" width="20" height="15" border="0" style="margin-left:3px;" /></a> ';
    _html = _html+'          <ul> ';
   _html = _html+'               <li><a href="casa.html">Casa Subasio</a></li> ';
    _html = _html+'              <li><a href="gardens.html">The Gardens</a></li> ';
   _html = _html+'           </ul>    ';
    _html = _html+'      </li>';
    _html = _html+'      <li><a href="#" style="width:66px">Events </a>';
    _html = _html+'          <ul> ';
     _html = _html+'             <li><a href="cooking.html"> Cooking Classes </a></li>';
     _html = _html+'             <li><a href="artclasses.html"> Art Classes </a></li> ';
     _html = _html+'              <li><a href="archive.html">Archives</a></li>';
   _html = _html+'           </ul>  ';
    _html = _html+'      </li>';
   _html = _html+'    </ul>';
   document.getElementById('navmain').innerHTML = _html;
}