function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
		alert("Please enter a valid e-mail")
		return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		alert("Please enter a valid e-mail")
		return false
	}
	
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Please enter a valid e-mail")
		return false
	}
	
	if (str.indexOf(at,(lat+1))!=-1){
		alert("Please enter a valid e-mail")
		return false
	}
	
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Please enter a valid e-mail")
		return false
	}
	
	if (str.indexOf(dot,(lat+2))==-1){
		alert("Please enter a valid e-mail")
		return false
	}

	if (str.indexOf(" ")!=-1){
		alert("Please enter a valid e-mail")
		return false
	}

	return true
}

function InvalidCharacter(strInvalidList, strString1) {
	for (var i = 0; i < strString1.length; i++) {
		if (strInvalidList.indexOf(strString1.charAt(i)) > 0) {
			return true;
		}
	}
	return false;
}

function checkRegisterForm(form){
	if (form.alias.value == "") {
		alert("You need to pick an alias!");
		form.alias.value='';
		form.alias.focus();
		return false;
	}
	if (form.Password.value == "") {
		alert("Password cannot be blank! Please enter valid Password..");
		form.Password.focus();
		return false;
	}
	if ((form.email.value==null)||(form.email.value=="")){
		alert("Please enter a valid e-mail ")
		form.email.focus()
		return false
	}
	/*
	if (form.ConfirmPassword.value == "") {
	alert("Confirm Password cannot be blank! Please enter valid Confirm Password..");
	form.ConfirmPassword.focus();
	return false;
	}
	if (form.Password.value != form.ConfirmPassword.value) {
	alert("The password and confirm password is not the same! Please verify..");
	form.Password.focus();
	return false;
	}
	*/
	if (form.firstName.value == "") {
		alert("First Name cannot be blank! Please enter valid First name.. ");
		form.firstName.value='';
		form.firstName.focus();
		return false;
	}
	if (form.lastName.value == "") {
		alert("Last Name cannot be blank! Please enter valid Last name..");
		form.lastName.value='';
		form.lastName.focus();
		return false;
	}
	if (form.phone1.value == "") {
		alert("Phone cannot be blank! Please enter valid Phone Number..");
		form.phone1.value='';
		form.phone1.focus();
		return false;
	}
	if (form.address1.value == "") {
		alert("Address cannot be blank! Please enter valid Address..");
		form.address1.value='';
		form.address1.focus();
		return false;
	}
	if (form.city.value == "") {
		alert("City cannot be blank! Please enter valid City..");
		form.city.value='';
		form.city.focus();
		return false;
	}
	if (form.country.value == "") {
		alert("Address cannot be blank! Please enter valid Country..");
		form.country.value='';
		form.country.focus();
		return false;
	}
	return true;
}


function countryChange(form){
    if(form != null && form.state != null && form.country !=null) {
        var selectedCountryCode = form.country.options[form.country.selectedIndex].value.toUpperCase();

        // if selected country isn't Canada or the US, then pre-select 'Outside the US or Canada'
        if(selectedCountryCode != 'US' && selectedCountryCode != 'CA' && selectedCountryCode != 'MX')
            form.state.selectedIndex = 0;  // 0 = 'Outside the US or Canada'

        // if the country selection is Mexico, jump to the first state in the list
        if(selectedCountryCode == 'MX')
            form.state.selectedIndex = 1;  // 1 = 'Alabama'

		// if the country selection is United States, jump to the first state in the list
        if(selectedCountryCode == 'US')
            form.state.selectedIndex = 32;  // 1 = 'Alabama'

        // if the country selection is Canada, jump to the first province in the list
        if(selectedCountryCode == 'CA')
            form.state.selectedIndex = 82;  // 51 = 'Alberta'
    }
}

function stateChange(form){
    if(form != null && form.state != null && form.country !=null) {
		// if other is selected, then pre-select -Select Country- for the country
        if(form.state.selectedIndex == 0)
			form.country.selectedIndex = 0;
        // if a state is selected, then pre-select Mexico for the country
		if(form.state.selectedIndex >= 1 && form.state.selectedIndex <= 31)
            form.country.selectedIndex = 136;
		// if a state is selected, then pre-select United States for the country
		if(form.state.selectedIndex >= 32 && form.state.selectedIndex <= 81)
            form.country.selectedIndex = 227;
        // if a province/territory is selected, then pre-select Canada for the country
        if(form.state.selectedIndex >= 82 && form.state.selectedIndex <= 97)
            form.country.selectedIndex = 40;
    }

}