function imgswap2(name, image)  
{
  eval("document." + name + ".src = 'uploaded/" + image + "'");
}

function ValidateLogin(theForm)
{
  if (theForm.Email.value == "" || theForm.Email.value == "Login Email Address")
  {
    alert("Please enter your email.");
    theForm.Email.focus();
    return (false);
  }
  if (theForm.Password.value == "" || theForm.Password.value == "Password")
  {
    alert("Please enter your password.");
    theForm.Password.focus();
    return (false);
  }  
  return (true); 
}

function ValidateRegisterRetail(theForm)
{

  if (theForm.Name.value == "")
  {
    alert("Please enter your name");
    theForm.Name.focus();
    return (false);
  }
  
  if (theForm.Address.value == "")
  {
    alert("Please enter your address");
    theForm.Address.focus();
    return (false);
  } 

  if (theForm.Postcode.value == "")
  {
    alert("Please enter your postcode");
    theForm.Postcode.focus();
    return (false);
  }    
  
  if (theForm.Phone.value == "")
  {
    alert("Please enter your telephone number");
    theForm.Phone.focus();
    return (false);
  }  

  if (theForm.Email.value == "")
  {
    alert("Please enter your email address");
    theForm.Email.focus();
    return (false);
  }

  var pat_email = /^[-._&0-9a-zA-Z]+[@][-._&0-9a-zA-Z]+[.][._0-9a-zA-Z]+[a-zA-Z]$/;

  if ( pat_email.exec(theForm.Email.value) == null )
  {
         alert("You have not entered a valid email address");
         theForm.Email.focus();
         return (false);
  }
  
  if (theForm.Password.value == "")
  {
    alert("Please choose a password");
    theForm.Password.focus();
    return (false);
  }   
  

  return (true); 
}

function ValidateRegisterWholesale(theForm)
{

  if (theForm.ShopName.value == "")
  {
    alert("Please enter your shop name");
    theForm.ShopName.focus();
    return (false);
  }
  
  if (theForm.ShopAddress.value == "")
  {
    alert("Please enter your shop address");
    theForm.ShopAddress.focus();
    return (false);
  } 

  if (theForm.Postcode.value == "")
  {
    alert("Please enter your postcode");
    theForm.Postcode.focus();
    return (false);
  }    
  
  if (theForm.Name.value == "")
  {
    alert("Please enter your name");
    theForm.Name.focus();
    return (false);
  } 

  if (theForm.VATNo.value == "")
  {
    alert("Please enter your vat number.  If you don't have one please call +44 (0) 20 7580 7775");
    theForm.VATNo.focus();
    return (false);
  } 

  if (theForm.Phone.value == "")
  {
    alert("Please enter your phone number");
    theForm.Phone.focus();
    return (false);
  }         

  if (theForm.Email.value == "" || theForm.Email.value == "enter your e-mail address")
  {
    alert("Please enter your email address");
    theForm.Email.focus();
    return (false);
  }

  var pat_email = /^[-._&0-9a-zA-Z]+[@][-._&0-9a-zA-Z]+[.][._0-9a-zA-Z]+[a-zA-Z]$/;

  if ( pat_email.exec(theForm.Email.value) == null )
  {
         alert("You have not entered a valid email address");
         theForm.Email.focus();
         return (false);
  }

  if (theForm.Password.value == "")
  {
    alert("Please choose a password");
    theForm.Password.focus();
    return (false);
  }   

  return (true); 
}

function popUp(URL,myWidth,myHeight,myScroll) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars="+myScroll+",location=0,statusbar=0,menubar=0,resizable=0,width="+myWidth+",height="+myHeight+",left = 426,top = 282');");
}
	
function imgswap(name, type)  
{
	 
  eval(document.getElementById(name).setAttribute('src','images/btn/' +name+ '_' +type+ '.gif'));	
}

function goto(form)
{
	var index=form.select.selectedIndex
		if (form.select.options[index].value != "0") {
		location=form.select.options[index].value;}
}

function ClearForm() {
  document.frmSearch.strSearch.value= "";
}
