// This is for the Vertical Menu
var menuids=new Array("verticalmenu") //Enter id(s) of UL menus, separated by commas
var submenuoffset = 0 //Offset of submenus from main menu. Default is -2 pixels.

function createcssmenu(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    var spanref=document.createElement("span")
		spanref.className="arrowdiv"
		spanref.innerHTML="&nbsp;&nbsp;"
		ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.left=this.parentNode.offsetWidth+submenuoffset+"px"
    this.getElementsByTagName("ul")[0].style.display="block"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.display="none"
    }
    }
  }
}


if (window.addEventListener)
window.addEventListener("load", createcssmenu, false)
else if (window.attachEvent)
window.attachEvent("onload", createcssmenu)
// This ends the Vertical Menu


// This are the functions for the search form in the header
function noShow()
{
	var x=document.getElementById("drinkNameSearch");
	x.style.background = "#FFFFFF";
}

function show()
{
	var x=document.getElementById("drinkNameSearch");
	if( x.value == "" )
	{
	    x.style.background = "#FFFFFF url(http://www.goodcocktails.com/images/drink_search.gif) no-repeat";
	}	
}

function noSearch( myForm )
{
    // This is going to check that you typed a drink name to search
	  if( myForm.drinkName.value == "" )
	  {
		    alert( "Please Enter a Drink Name!" );
		    myForm.drinkName.focus();
		    myForm.drinkName.select();
		    return false;
	  }
}

// This checks the email (comments.php, add_site.php)
function validEmail( email )
{
	var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	
	if( re.test( email ) ) 
	{
		return true;
	}
	else
	{
		return false;
	}
}

// This checks for a valide URL (add_site.php)
function isValidURL( url )
{
	var r= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/;
     
	if( r.test( url ) )
    {
		return true;
    }
	else
	{
		return false;
	}
}