browserName = navigator.appName;
browserVer = parseInt ( navigator.appVersion );
version = "n2";
if ( browserName == "Netscape" && browserVer >= 3 ) version = "n3";
if ( browserName == "Microsoft Internet Explorer" && browserVer >= 4 ) version = "e4";
if ( version == "n3" || version == "e4" ) {

	Top              = new Image ( 5 , 119 );
	Top              = new Image ( 5, 119 );
	Top.src	         = "images/Tilesets/Top.gif";
	Top.src	         = "images/Tilesets/Top.gif";

	Home_On	         = new Image ( 93 , 29 );
	Home_Off         = new Image ( 93, 29 );
	Home_On.src      = "images/Buttons/Hover/Home-On.gif";
	Home_Off.src     = "images/Buttons/Hover/Home-Off.gif";

	A_List_On        = new Image ( 93 , 29 );
	A_List_Off       = new Image ( 93, 29 );
	A_List_On.src    = "images/Buttons/Hover/A-List-On.gif";
	A_List_Off.src   = "images/Buttons/Hover/A-List-Off.gif";

	Menu_On          = new Image ( 93 , 29 );
	Menu_Off         = new Image ( 93, 29 );
	Menu_On.src      = "images/Buttons/Hover/Menu-On.gif";
	Menu_Off.src     = "images/Buttons/Hover/Menu-Off.gif";

        Seasonal_On      = new Image ( 93 , 29 );
	Seasonal_Off     = new Image ( 93 , 29 );
	Seasonal_On.src  = "images/Buttons/Hover/Seasonal-On.gif";
	Seasonal_Off.src = "images/Buttons/Hover/Seasonal-Off.gif";

	Wine_On          = new Image ( 93 , 29 );
	Wine_Off         = new Image ( 93, 29 );
	Wine_On.src      = "images/Buttons/Hover/Wine-On.gif";
	Wine_Off.src     = "images/Buttons/Hover/Wine-Off.gif";
}
function button_on ( imgName ) {
	if (version == "n3" || version == "e4") {
		butOn = eval(imgName + "_On.src");
		document [imgName].src = butOn;
	}
}
function button_off ( imgName ) {
	if (version == "n3" || version == "e4") {
		butOff = eval(imgName + "_Off.src");
		document [imgName].src = butOff;
	}
}

//form validation and effects for alist page

var foc ='';
function colon (tobj) {
	if (version == "e4")
	{
	var tobj = document.all[tobj]
		if (tobj.type == "submit") {
		  tobj.style.backgroundColor = "#D5BB6C";
		} else	{
		  tobj.style.color = "#D5BB6C";
		}
	}
}

function coloff (tobj)
{ 
if (version == "e4") 

  { 
       var tobjbox = tobj.substring (4, (tobj.length))
       tobjbox = "input"+tobjbox;
       var tobj = document.all[tobj]
       tobjbox = document.all[tobjbox]
  if (tobj.type == "submit" && foc != tobj.id) { tobj.style.backgroundColor = "#009c82";}
	     
  if (tobj.type != "submit")
       {
    if (foc != tobj.id && tobjbox.value == "") { tobj.style.color = "#009c82" } 
       
    if (tobjbox.value != "") { tobj.style.color = "#004E50" } 
       }

  }
}

function resetform()
{
if (version == "e4")
	{

var alistformonly = document.forms[0]
var alistform = document.forms[0].elements
       for (var i = 0; i< alistform.length; i++)
            {     
  if (alistform[i].type != "submit" & alistform[i].type != "hidden" && alistform[i].value != "")
          {
            var text ="text"+ alistform[i].name
            var text = document.all[text]
            text.style.color = "#004E50";
          }


            }
}
}


function check_mandatory_fields(theForm)
{ 

  if (theForm.Name.value == "" || theForm.Name.value == false)
  {
    alert("Please enter your name.");
    theForm.Name.focus();
    return false;
  }

   if (theForm.Email.value == "" || theForm.Email.value == false)
  {
    alert("Please enter your e-mail address.");
    theForm.Email.focus();
    return false;
  }

   // If e-mail address is defined, check format is correct (someone@somewhere.something)
   
   var ml_email = theForm.Email.value
   ml_email = ml_email.replace(/^\s*(.*)/, "$1");
   ml_email = ml_email.replace(/(.*?)\s*$/, "$1");
   
   if (ml_email != "") {
      var emailStr = new String(ml_email);
      var emindex  = emailStr.indexOf("@");
      
      if (emindex > 0) {
          var pindex = emailStr.indexOf(".",emindex);
          if ((pindex > emindex+1) && (emailStr.length > pindex+1)) {
               return true;
          } else {
               alert("Please specify a valid e-mail address (yourname@yourdomain.com)");
               theForm.Email.focus();
               return false;
          }
      } else {
          alert("Please specify a valid e-mail address (yourname@yourdomain.com)");
          theForm.Email.focus();
          return false;
      }
   }
   
   return true;
   

}


