// JavaScript Document
function clear_field(x){
	document.getElementById(x).value='';
	}
	
function clear_name(){
	document.getElementById('name').value='';
	}	
	
function activateTab(i){
	n=i.substr(1,1);
	for(c=1;c<=5;c++){
		document.getElementById('t'+c).style.display='none';
		document.getElementById('m'+c).className='';
	}
	document.getElementById('t'+n).style.display='block';
	document.getElementById('m'+n).className='prod-active';
}

function activateTabSearch(i){
	n=i.substr(1,1);
	for(c=1;c<=2;c++){
		document.getElementById('t'+c).style.display='none';
		document.getElementById('m'+c).className='';
	}
	document.getElementById('t'+n).style.display='block';
	document.getElementById('m'+n).className='prod-active';
}

function popit(){
	document.getElementById('mail_popup').style.display='block';
	document.getElementById('mail-input').focus();
	}	
	
function update(){
	document.frm.action='shoppingcart.asp?Action=update'
	javascript:document.frm.submit()
}
	
function validatesignupform()
{
	if(document.signupform.email.value!=document.signupform.email2.value)
	{
		alert("The 2 email addresses do not match. Please re-comfirm your email address.");
		document.signupform.email.focus();
		return false;
	}

	if(document.signupform.password.value.length==0)
	{
		alert("Password is required.");
		document.signupform.password.focus();
		return false;
	}

	if(document.signupform.password.value.length<5)
	{
		alert("Password must contains 5 or more characters.");
		document.signupform.password.focus();
		return false;
	}
	if(document.signupform.password.value!=document.signupform.password2.value)
	{
		alert("The two passwords do not match. Please re-enter password.");
		document.signupform.password.focus();
		return false;
	}
	if(document.signupform.name.value.length==0)
	{
		alert("Your full name is required.");
		document.signupform.name.focus();
		return false;
	}
	if(document.signupform.Phone.value.length==0)
	{
		alert("Contact number is required for us to confirm your account.");
		document.signupform.Phone.focus();
		return false;
	}
	getNumber();
	if(document.signupform.oftencall.value==0)
	{
		alert("Please select a country that you most often call.");
		document.signupform.oftencall.focus();
		return false;
	}
	if(document.signupform.Address.value.length==0)
	{
		alert("Your billing address is required.");
		document.signupform.Address.focus();
		return false;
	}
	if(document.signupform.City.value.length==0)
	{
		alert("Please enter city.");
		document.signupform.City.focus();
		return false;
	}
	if(document.signupform.Zip.value.length==0)
	{
		alert("Zip code of billing address is required.");
		document.signupform.Zip.focus();
		return false;
	}
}
function getNumber()
{
   var ValidChars = "0123456789";
   var Char;
   document.form
   for (i = 0; i < document.signupform.Phone.value.length; i++){
      Char = document.signupform.Phone.value.charAt(i);
      if (ValidChars.indexOf(Char) != -1)
		document.signupform.numPhone.value=document.signupform.numPhone.value+Char
   }
}
	