function clearme(formItem, keyword)
{ 
	if (formItem.value == keyword) formItem.value = ''; 
}



startList = function() {
if (document.all&&document.getElementById) {
    navRoot = document.getElementById("subnav");
    if(navRoot!=null){
        for (i=0; i<navRoot.childNodes.length; i++) {
            node = navRoot.childNodes[i];
            if (node.nodeName=="LI") {
                node.onmouseover=function() {this.className+=" over";}
                node.onmouseout=function() {this.className=this.className.replace(" over", "");}
            }
        }
    }
 }
}
window.onload=startList;




function validateAccountFormOnSubmit(theForm) {
var reason = "";

    if (theForm.name.value.length == 0) {
        reason += "- Please enter your Full Name.\n"
    }; 
    if (theForm.name.value == 'Name') {
        reason += "- Please enter your Full Name.\n"
    };   
    if (theForm.companyname.value.length == 0) {
        reason += "- Please enter your Company Name.\n"
    }; 
    if (theForm.companyname.value == 'Company Name') {
        reason += "- Please enter your Company Name.\n"
    };
    if (theForm.email.value.length == 0) {
        reason += "- Please enter a valid Email Address.\n"
    }; 
    if (theForm.email.value == 'Email Address') {
        reason += "- Please enter a valid Email Address.\n"
    };
    if (theForm.telephone.value.length == 0) {
        reason += "- Please enter a contact Telephone Number.\n"
    }; 
    if (theForm.telephone.value == 'Telephone Number') {
        reason += "- Please enter a contact Telephone Number.\n"
    };
    if (theForm.accountnumber.value.length == 0) {
        reason += "- Please enter your Customer Account Number.\n"
    }; 
    if (theForm.accountnumber.value == 'Account Number') {
        reason += "- Please enter your Customer Account Number.\n"
    };       

  if (reason != "") {
    alert("Some fields need attention:\n" + reason);
    return false;
  }
}




function validatePPProCheckoutOnSubmit(theForm) {
var reason = "";

    if (theForm.firstName.value.length == 0) {
        reason += "- Please enter your First Name.\n"
    }; 
    if (theForm.firstName.value == 'First Name') {
        reason += "- Please enter your First Name.\n"
    };   
    if (theForm.lastName.value.length == 0) {
        reason += "- Please enter your Last Name.\n"
    }; 
    if (theForm.lastName.value == 'Last Name') {
        reason += "- Please enter your Last Name.\n"
    };
    if (theForm.email.value.length == 0) {
        reason += "- Please enter a valid Email Address.\n"
    }; 
    if (theForm.email.value == 'Email Address') {
        reason += "- Please enter a valid Email Address.\n"
    };
    if (theForm.telephone.value.length == 0) {
        reason += "- Please enter a contact Telephone Number.\n"
    }; 
    if (theForm.telephone.value == 'Telephone Number') {
        reason += "- Please enter a contact Telephone Number.\n"
    };
    
    
    if (theForm.b_line1.value.length == 0) {
        reason += "- Please enter the first line of your Billing Address.\n"
    }; 
    if (theForm.b_line1.value == 'Address Line 1') {
        reason += "- Please enter the first line of your Billing Address.\n"
    };   
    if (theForm.b_towncity.value.length == 0) {
        reason += "- Please enter the name of your Billing Address Town / City.\n"
    }; 
    if (theForm.b_towncity.value == 'Town / City') {
        reason += "- Please enter the name of your Billing Address Town / City.\n"
    };
    if (theForm.b_county.value.length == 0) {
        reason += "- Please enter the name of your Billing Address County.\n"
    }; 
    if (theForm.b_county.value == 'County') {
        reason += "- Please enter the name of your Billing Address County.\n"
    };    
    if (theForm.b_postcode.value.length == 0) {
        reason += "- Please enter your Post Code of your Billing Address.\n"
    }; 
    if (theForm.b_postcode.value == 'County') {
        reason += "- Please enter your Post Code of your Billing Address.\n"
    };        
    if (theForm.b_country.value.length == 0) {
        reason += "- Please select your Billing Address Country.\n"
    }; 
    
        
    if (theForm.DeliveryAddress[1].checked) {
        if (theForm.d_line1.value.length == 0) {
            reason += "- Please enter the first line of your Delivery Address.\n"
        }; 
        if (theForm.d_line1.value == 'Address Line 1') {
            reason += "- Please enter the first line of your Delivery Address.\n"
        };   
        if (theForm.d_towncity.value.length == 0) {
            reason += "- Please enter the name of your Delivery Address Town / City.\n"
        }; 
        if (theForm.d_towncity.value == 'Town / City') {
            reason += "- Please enter the name of your Delivery Address Town / City.\n"
        };
        if (theForm.d_county.value.length == 0) {
            reason += "- Please enter the name of your Delivery Address County.\n"
        }; 
        if (theForm.d_county.value == 'County') {
            reason += "- Please enter the name of your Delivery Address County.\n"
        };    
        if (theForm.d_postcode.value.length == 0) {
            reason += "- Please enter your Post Code of your Delivery Address.\n"
        }; 
        if (theForm.d_postcode.value == 'County') {
            reason += "- Please enter your Post Code of your Delivery Address.\n"
        };   
        if (theForm.d_country.value.length == 0) {
        reason += "- Please select your Delivery Address Country.\n"
        }; 
    };   
    
    if (theForm.creditCardNumber.value.length == 0) {
        reason += "- Please enter a valid Credit / Debt Card number.\n"
    };  
    if (theForm.cvv2Number.value.length == 0) {
        reason += "- Please enter a valid CVV2 Card security number.\n"
    }; 
   

  if (reason != "") {
    alert("Some fields need attention:\n" + reason);
    return false;
  }
}


function validatePPCheckoutOnSubmit(theForm) {
var reason = "";

    if (theForm.firstName.value.length == 0) {
        reason += "- Please enter your First Name.\n"
    }; 
    if (theForm.firstName.value == 'First Name') {
        reason += "- Please enter your First Name.\n"
    };   
    if (theForm.lastName.value.length == 0) {
        reason += "- Please enter your Last Name.\n"
    }; 
    if (theForm.lastName.value == 'Last Name') {
        reason += "- Please enter your Last Name.\n"
    };
    if (theForm.email.value.length == 0) {
        reason += "- Please enter a valid Email Address.\n"
    }; 
    if (theForm.email.value == 'Email Address') {
        reason += "- Please enter a valid Email Address.\n"
    };
    if (theForm.telephone.value.length == 0) {
        reason += "- Please enter a contact Telephone Number.\n"
    }; 
    if (theForm.telephone.value == 'Telephone Number') {
        reason += "- Please enter a contact Telephone Number.\n"
    };
    
    
    if (theForm.b_line1.value.length == 0) {
        reason += "- Please enter the first line of your Billing Address.\n"
    }; 
    if (theForm.b_line1.value == 'Address Line 1') {
        reason += "- Please enter the first line of your Billing Address.\n"
    };   
    if (theForm.b_towncity.value.length == 0) {
        reason += "- Please enter the name of your Billing Address Town / City.\n"
    }; 
    if (theForm.b_towncity.value == 'Town / City') {
        reason += "- Please enter the name of your Billing Address Town / City.\n"
    };
    if (theForm.b_county.value.length == 0) {
        reason += "- Please enter the name of your Billing Address County.\n"
    }; 
    if (theForm.b_county.value == 'County') {
        reason += "- Please enter the name of your Billing Address County.\n"
    };    
    if (theForm.b_postcode.value.length == 0) {
        reason += "- Please enter your Post Code of your Billing Address.\n"
    }; 
    if (theForm.b_postcode.value == 'County') {
        reason += "- Please enter your Post Code of your Billing Address.\n"
    };        
    if (theForm.b_country.value.length == 0) {
        reason += "- Please select your Billing Address Country.\n"
    }; 
    
        
    if (theForm.DeliveryAddress[1].checked) {
        if (theForm.d_line1.value.length == 0) {
            reason += "- Please enter the first line of your Delivery Address.\n"
        }; 
        if (theForm.d_line1.value == 'Address Line 1') {
            reason += "- Please enter the first line of your Delivery Address.\n"
        };   
        if (theForm.d_towncity.value.length == 0) {
            reason += "- Please enter the name of your Delivery Address Town / City.\n"
        }; 
        if (theForm.d_towncity.value == 'Town / City') {
            reason += "- Please enter the name of your Delivery Address Town / City.\n"
        };
        if (theForm.d_county.value.length == 0) {
            reason += "- Please enter the name of your Delivery Address County.\n"
        }; 
        if (theForm.d_county.value == 'County') {
            reason += "- Please enter the name of your Delivery Address County.\n"
        };    
        if (theForm.d_postcode.value.length == 0) {
            reason += "- Please enter your Post Code of your Delivery Address.\n"
        }; 
        if (theForm.d_postcode.value == 'County') {
            reason += "- Please enter your Post Code of your Delivery Address.\n"
        };   
        if (theForm.d_country.value.length == 0) {
        reason += "- Please select your Delivery Address Country.\n"
        }; 
    };   
       

  if (reason != "") {
    alert("Some fields need attention:\n" + reason);
    return false;
  }
}




function editqty(linenumber)
{  
    var checkstatus = $('qtyedit' + linenumber).style.display;

    if (checkstatus == 'block' )
    {
    	$('qtyedit' + linenumber).style.display = "none";
	    $('qty' + linenumber).style.display = "block";
    }
    else
    {
    	$('qtyedit' + linenumber).style.display = "block";
	    $('qty' + linenumber).style.display = "none";
    }
}




function validateAddToBasketSubmit(theForm) {
    var reason = "";
    var ValidChars = "0123456789";
    var IsNumber=true;
    var Char;
    var sText = theForm.Quantity.value;
    
    if (theForm.Quantity.value.length == 0) {
        reason += " "
    };  
    
    if (theForm.Quantity.value == '0') {
        reason += " "
    };  
    
    for (i = 0; i < sText.length && IsNumber == true; i++)
    {
    Char = sText.charAt(i);
    if ((i == 0) && (Char == "-")) // check first character for minus sign
    continue;
        if (ValidChars.indexOf(Char) == -1)
            {
            reason += " "
            }
    }

    if (reason != "") {
        return false;
    }
}