// This is for the Addthis Toolbox
var addthis_config = {
	 "data_track_clickback": true,
	 ui_cobrand: "Good Cocktails",
     ui_header_color: "#ffffff",
     ui_header_background: "#336699"
}

// These 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;
	}
}

// Check all the checkboxes
function checkAll( thisForm )
{
	for( var i = 0; i < thisForm.elements.length; i++ )
	{
		thisForm.elements[ i ].checked = true;
	}
}

// Uncheck all the checkboxes
function uncheckAll( thisForm )
{
	for( var i = 0; i < thisForm.elements.length; i++ )
	{
		thisForm.elements[ i ].checked = false;
	}
}
