function validate_minimailinglist(theform){
	var name = theform.Name;
	var email = theform.Email;

	useremail=isEmail(email.value);

	if (name.value==""){
		alert("Name cannot be blank.");
		name.focus();
		return false;
	}

	if (useremail==false) {
		alert("Please enter a valid email address.");
		email.focus();
		return false;
	}
}

function validate_incorporate(theform){
	var optservice = valButton(theform.optServiceName);
	var state = theform.State;

	if (optservice==null){
		alert("Please select your preferred business type.");
		return false;
	}

	if (state.selectedIndex==0){
		alert("Please select your state from the list.");
		state.focus();
		return false;
	}
}

function validate_step1(theform){
	var company = theform.CompanyName1;
	var address = theform.Address;
	var city = theform.City;
	var state = theform.State;
	var zip = theform.Zip;
	var country = theform.Country;
	var shipaddress = theform.Ship_Address;
	var shipcity = theform.Ship_City;
	var shipstate = theform.Ship_State;
	var shipzip = theform.Ship_Zip;
	var shipcountry = theform.Ship_Country;

	if (company.value==""){
		alert("Company name 1 cannot be blank.");
		company.focus();
		return false;
	}

	if (address.value==""){
		alert("Address cannot be blank.");
		address.focus();
		return false;
	}
	else{
		if (isPOBox(address, address)==true){
			alert("We do not accept P.O. Box addresses.");
			address.focus();
			return false;
		}
	}

	if (city.value==""){
		alert("City cannot be blank.");
		city.focus();
		return false;
	}

	if (state.value==""){
		alert("State cannot be blank.");
		return false;
	}

	if (zip.value==""){
		alert("Zip code cannot be blank.");
		zip.focus();
		return false;
	}

	if (country.selectedIndex==0){
		alert("Please select your country from the list.");
		country.focus();
		return false;
	}

	if (shipaddress.value==""){
		alert("Delivery address cannot be blank.");
		shipaddress.focus();
		return false;
	}
	else{
		if (isPOBox(shipaddress, shipaddress)==true){
			alert("We do not accept P.O. Box delivery addresses.");
			shipaddress.focus();
			return false;
		}
	}

	if (shipcity.value==""){
		alert("Delivery city cannot be blank.");
		shipcity.focus();
		return false;
	}

	if (shipstate.value==""){
		alert("Delivery state cannot be blank.");
		return false;
	}

	if (shipzip.value==""){
		alert("Delivery zip code cannot be blank.");
		shipzip.focus();
		return false;
	}

	if (shipcountry.selectedIndex==0){
		alert("Please select your delivery country from the list.");
		shipcountry.focus();
		return false;
	}
}

function validate_step1_tm(theform){
	var entitytype = theform.EntityType;
	var citizenshipcountry = theform.CitizenshipCountry;
	var name = theform.Name;
	var address = theform.Address;
	var city = theform.City;
	var state = theform.State;
	var zip = theform.Zip;
	var country = theform.Country;
	var phone = theform.Phone;
	var email = theform.Email;
	var chkbox = theform.Authorize;

	useremail=isEmail(email.value);

	if (entitytype.selectedIndex==0){
		alert("Please select an entity type from the list.");
		entitytype.focus();
		return false;
	}

	if (name.value==""){
		alert("Name cannot be blank.");
		name.focus();
		return false;
	}

	if (entitytype.selectedIndex==1){
		if (citizenshipcountry.selectedIndex==0){
			alert("Please select your country of citizenship from the list.");
			citizenshipcountry.focus();
			return false;
		}
	}

	if (address.value==""){
		alert("Address cannot be blank.");
		address.focus();
		return false;
	}
	//else{
	//	if (isPOBox(address, address)==true){
	//		alert("We do not accept P.O. Box addresses.");
	//		address.focus();
	//		return false;
	//	}
	//}

	if (city.value==""){
		alert("City cannot be blank.");
		city.focus();
		return false;
	}

	if (state.value==""){
		alert("State cannot be blank.");
		return false;
	}

	if (zip.value==""){
		alert("Zip code cannot be blank.");
		zip.focus();
		return false;
	}

	if (country.selectedIndex==0){
		alert("Please select your country from the list.");
		country.focus();
		return false;
	}

	if (phone.value==""){
		alert("Phone cannot be blank.");
		phone.focus();
		return false;
	}

	if (useremail==false) {
		alert("Please enter a valid email address.");
		email.focus();
		return false;
	}

	if (!chkbox.checked){
		alert("Please check this box to indicate that you authorize the US Patent and Trademark Office to contact you by email.");
		return false;
	}
}

function validate_step2_corporation(theform){
	var shareholder = theform.ShareHolderName1;
	var shares = theform.Shares1;
	var director = theform.DirectorName1;
	var president = theform.President;
	var treasurer = theform.Treasurer_CFO;
	var secretary = theform.Secretary;
	var vicepresident = theform.VicePresident;

	if (shareholder.value==""){
		alert("Shareholder 1 cannot be blank.");
		shareholder.focus();
		return false;
	}
	else{
		if (shares.value==""){
			alert("Shareholder's share 1 cannot be blank.");
			shares.focus();
			return false;
		}
	}

	if (director.value==""){
		alert("Director 1 cannot be blank.");
		director.focus();
		return false;
	}

	if (president.value==""){
		alert("President cannot be blank.");
		president.focus();
		return false;
	}

	if (treasurer.value==""){
		alert("Treasurer/CFO cannot be blank.");
		treasurer.focus();
		return false;
	}

	if (secretary.value==""){
		alert("Secretary cannot be blank.");
		secretary.focus();
		return false;
	}

	/*
	if (vicepresident.value==""){
		alert("Vice president cannot be blank.");
		vicepresident.focus();
		return false;
	}
	*/
}

function validate_step2_lp(theform){
	var generalpartner = theform.GeneralPartnerName1;
	var generalpercentage = theform.GeneralPartnerPercentage1;
	var limitedpartner = theform.LimitedPartnerName1;
	var limitedpercentage = theform.LimitedPartnerPercentage1;

	if (generalpartner.value==""){
		alert("General partner 1 cannot be blank.");
		generalpartner.focus();
		return false;
	}

	if (generalpercentage.value==""){
		generalpercentage.value = "0";
	}
	else if (!IsNumeric(generalpercentage.value)){
		alert("General partner's percentage 1 should be a numeric entry.\nEnter zero if none.");
		generalpercentage.focus();
		return false;
	}

	if (limitedpartner.value==""){
		alert("Limited partner 1 cannot be blank.");
		limitedpartner.focus();
		return false;
	}

	if (limitedpercentage.value==""){
		limitedpercentage.value = "0";
	}
	else if (!IsNumeric(limitedpercentage.value)){
		alert("Limited partner's percentage 1 should be a numeric entry.\nEnter zero if none.");
		limitedpercentage.focus();
		return false;
	}
}

function validate_step2_nonpc(theform){
	var optcorpmembers = valButton(theform.CorpMembers);
	var member = theform.MemberName1;
	var director = theform.DirectorName1;
	var president = theform.President;
	var treasurer = theform.Treasurer_CFO;
	var secretary = theform.Secretary;
	var vicepresident = theform.VicePresident;

	if (optcorpmembers==null){
		alert("Please select if this corporation has members.");
		return false;
	}
	else if (optcorpmembers=="Yes"){
		if (member.value==""){
			alert("Member 1 cannot be blank.");
			member.focus();
			return false;
		}
	}

	if (director.value==""){
		alert("Director 1 cannot be blank.");
		director.focus();
		return false;
	}

	if (president.value==""){
		alert("President cannot be blank.");
		president.focus();
		return false;
	}

	if (treasurer.value==""){
		alert("Treasurer/CFO cannot be blank.");
		treasurer.focus();
		return false;
	}

	if (secretary.value==""){
		alert("Secretary cannot be blank.");
		secretary.focus();
		return false;
	}

	/*
	if (vicepresident.value==""){
		alert("Vice president cannot be blank.");
		vicepresident.focus();
		return false;
	}
	*/
}

function validate_step2_llc(theform){
	var optmanagemethod = valButton(theform.ManageMethod);
	var member = theform.MemberName1;
	var memberpercentage = theform.MemberPercentage1;
	var membermanaged = theform.MemberManaged;
	var managermanaged = theform.ManagersManaged;
	var president = theform.President;

	if (member.value==""){
		alert("Member 1 cannot be blank.");
		member.focus();
		return false;
	}

	if (memberpercentage.value==""){
		memberpercentage.value = "0";
	}
	else if (!IsNumeric(memberpercentage.value)){
		alert("Member's percentage 1 should be a numeric entry.\nEnter zero if none.");
		memberpercentage.focus();
		return false;
	}

	if (optmanagemethod==null){
		alert("Please select if this will be manage by the members or by manager(s).");
		return false;
	}
	else if (optmanagemethod=="By Manager"){
		if (managermanaged.value==""){
			alert("Name of manager(s) cannot be blank.");
			managermanaged.focus();
			return false;
		}
	}
	/*
	else if (optmanagemethod=="By Member"){
		if (membermanaged.value==""){
			alert("Member managed cannot be blank.");
			membermanaged.focus();
			return false;
		}
	}

	if (president.value==""){
		alert("President cannot be blank.");
		president.focus();
		return false;
	}
	*/
}

function validate_step2_pc(theform){
	var shareholder = theform.ShareHolderName1;
	var shares = theform.Shares1;
	var director = theform.DirectorName1;
	var president = theform.President;
	var treasurer = theform.Treasurer_CFO;
	var secretary = theform.Secretary;
	var vicepresident = theform.VicePresident;

	if (shareholder.value==""){
		alert("Shareholder 1 cannot be blank.");
		shareholder.focus();
		return false;
	}
	else{
		if (shares.value==""){
			alert("Shareholder's share 1 cannot be blank.");
			shares.focus();
			return false;
		}
	}

	if (director.value==""){
		alert("Director 1 cannot be blank.");
		director.focus();
		return false;
	}

	if (president.value==""){
		alert("President cannot be blank.");
		president.focus();
		return false;
	}

	if (treasurer.value==""){
		alert("Treasurer/CFO cannot be blank.");
		treasurer.focus();
		return false;
	}

	if (secretary.value==""){
		alert("Secretary cannot be blank.");
		secretary.focus();
		return false;
	}

	/*
	if (vicepresident.value==""){
		alert("Vice president cannot be blank.");
		vicepresident.focus();
		return false;
	}
	*/
}

function validate_step2_tm(theform){
	var trademarkstatement = theform.TrademarkStatement;
	var trademarkaccurate = theform.TrademarkAccurate;
	var trademarkdate = theform.TrademarkDate;
	var trademarkkeyword = theform.TrademarkKeyword;
	var trademarkspecs = theform.TrademarkProductSpecs;

	if (trademarkstatement.selectedIndex==0){
		alert("Please select the most accurate statement from the list.");
		trademarkstatement.focus();
		return false;
	}

	if (trademarkaccurate.selectedIndex==0){
		alert("Please select the most accurate mark from the list.");
		trademarkaccurate.focus();
		return false;
	}
	else if (trademarkaccurate.selectedIndex==1){
		if (isDate(trademarkdate.value)==false){
			return false;
		}
	}

	if (trademarkkeyword.value==""){
		alert("Words included in the trademark you wish to register cannot be blank.");
		trademarkkeyword.focus();
		return false;
	}

	if (trademarkspecs.value==""){
		alert("Specific products or services represented by the trademark cannot be blank.");
		trademarkspecs.focus();
		return false;
	}
}

function validate_step2_annualminutes(theform){
	var shareholder = theform.ShareHolderName1;
	var shares = theform.Shares1;
	var director = theform.DirectorName1;
	var president = theform.President;

	if (shareholder.value==""){
		alert("Current shareholder(s) cannot be blank.");
		shareholder.focus();
		return false;
	}

	if (director.value==""){
		alert("Current director(s) cannot be blank.");
		director.focus();
		return false;
	}

	if (president.value==""){
		alert("President cannot be blank.");
		president.focus();
		return false;
	}
}

function validate_step3(theform){
	var ssn = theform.SSN;
	var principalbusinessactivity = theform.PrincipalBusinessActivity;

	if (ssn.value==""){
		alert("Social security number of principal officer cannot be blank.");
		ssn.focus();
		return false;
	}

	if (principalbusinessactivity.value==""){
		alert("Principal business activity cannot be blank.");
		principalbusinessactivity.focus();
		return false;
	}
}

function validate_step3_tm(theform){
	var trademarkclasses = theform.TrademarkClasses;

	//if (trademarkclasses.selectedIndex==0){
	//	alert("Please select how many classes of goods or services you would like to register under the trademark from the list.");
	//	trademarkclasses.focus();
	//	return false;
	//}
}

function validation_order(theform){
	var useremail;
	var name = theform.Name;
	var fname = theform.First;
	var lname = theform.Last;
	var email = theform.Email;
	var phone = theform.Phone;
	var address = theform.Address;
	var city = theform.City;
	var state = theform.State;
	var zip = theform.Zip;
	var country = theform.Country;

	useremail=isEmail(email.value);

	if (fname.value==""){
		alert("First name cannot be blank.");
		fname.focus();
		return false;
	}

	if (lname.value==""){
		alert("Last name cannot be blank.");
		lname.focus();
		return false;
	}

	if (useremail==false) {
		alert("Please enter your proper username/email address.");
		email.focus();
		return false;
	}

	if (phone.value==""){
		alert("Phone cannot be blank.");
		phone.focus();
		return false;
	}

	if (address.value==""){
		alert("Address cannot be blank.");
		address.focus();
		return false;
	}

	if (city.value==""){
		alert("City cannot be blank.");
		city.focus();
		return false;
	}

	if (state.selectedIndex==0){
		alert("Please select a state from the list.");
		state.focus();
		return false;
	}

	if (zip.value==""){
		alert("Zip code cannot be blank.");
		zip.focus();
		return false;
	}

	if (country.selectedIndex==0){
		alert("Please select a country from the list.");
		country.focus();
		return false;
	}

	if (typeof(name) == "object"){
		name.value = fname.value+" "+lname.value;
	}
	/*
	var pwd = theform.Password;
	var confpwd = theform.ConfPassword;
	var validate = theform.hasConfirmPwd;
	if (validate.value=="True"){
		if (pwd.value==""){
			alert("Please enter your password.");
			pwd.focus();
			return false;
		}
		else if (confpwd.value==""){
			alert("Please enter the confirmation password.");
			confpwd.focus();
			return false;
		}
		else{
			if ((pwd.value) != (confpwd.value)){
				alert("Password and Confirm Password does not match.");
				pwd.focus();
				return false;
			}
		}
	}
	*/
}

function copy_address(theform, thectrl){
	var address = theform.Address;
	var address2 = theform.Address2;
	var city = theform.City;
	var county = theform.County;
	var state = theform.State;
	var zip = theform.Zip;
	var country = theform.Country;
	var shipaddress = theform.Ship_Address;
	var shipaddress2 = theform.Ship_Address2;
	var shipcity = theform.Ship_City;
	var shipcounty = theform.Ship_County;
	var shipstate = theform.Ship_State;
	var shipzip = theform.Ship_Zip;
	var shipcountry = theform.Ship_Country;

	if (thectrl.checked){
		shipaddress.value = address.value;
		shipaddress2.value = address2.value;
		shipcity.value = city.value;
		shipcounty.value = county.value;
		shipstate.value = state.value;
		shipzip.value = zip.value;
		shipcountry.value = country.value;
	}
	else{
		shipaddress.value = "";
		shipaddress2.value = "";
		shipcity.value = "";
		shipcounty.value = "";
		shipstate.selectedIndex = 0;
		shipzip.value = "";
		shipcountry.selectedIndex = 0;
	}
}

function copy_addresses(theform, straddress){
	var address = theform.Address;
	var address2 = theform.Address2;
	var city = theform.City;
	var county = theform.County;
	var state = theform.State;
	var zip = theform.Zip;
	var country = theform.Country;
	var companyaddress = theform.Company_Address;
	var companyaddress2 = theform.Company_Address2;
	var companycity = theform.Company_City;
	var companycounty = theform.Company_County;
	var companystate = theform.Company_State;
	var companyzip = theform.Company_Zip;
	var companycountry = theform.Company_Country;
	var deliveryaddress = theform.Delivery_Address;
	var deliveryaddress2 = theform.Delivery_Address2;
	var deliverycity = theform.Delivery_City;
	var deliverycounty = theform.Delivery_County;
	var deliverystate = theform.Delivery_State;
	var deliveryzip = theform.Delivery_Zip;
	var deliverycountry = theform.Delivery_Country;

	if (straddress=="company"){
		address.value = companyaddress.value;
		address2.value = companyaddress2.value;
		city.value = companycity.value;
		county.value = companycounty.value;
		state.value = companystate.value;
		zip.value = companyzip.value;
		country.value = companycountry.value;
	}
	else if (straddress=="delivery"){
		address.value = deliveryaddress.value;
		address2.value = deliveryaddress2.value;
		city.value = deliverycity.value;
		county.value = deliverycounty.value;
		state.value = deliverystate.value;
		zip.value = deliveryzip.value;
		country.value = deliverycountry.value;
	}
}

function enable_entity(theform){
	var entitytype = theform.EntityType;
	var citizenshipcountry = theform.CitizenshipCountry;

	if (entitytype.selectedIndex == 1){
		citizenshipcountry.disabled = false;
	}
	else{
		citizenshipcountry.disabled = true;
	}
}

function Put_Services(){
	for(var i=0; i<server_name.length; i++){
		document.write("<tr>");
		document.write("<td align=\"left\" bgcolor=\"#FFFFFF\">" + server_name[i] + "</td>");
		document.write("<td align=\"right\" bgcolor=\"#FFFFFF\"><div style=\"padding-left:60px\"><strong><li></li></strong></div></td>");
		document.write("<td align=\"right\" bgcolor=\"#FFFFFF\"><div style=\"padding-left:60px\">")

		if(i < 9){
			document.write("<strong><li></li></strong>")
		}

		document.write("</div></td>");
		document.write("<td align=\"right\" bgcolor=\"#FFFFFF\"><div style=\"padding-left:60px\">")

		if(i < 6){
			document.write("<strong><li></li></strong>")
		}

		document.write("</div></td>");
		document.write("<td align=\"right\" bgcolor=\"#FFFFFF\">");
		document.write("<input name=\"custom\" id=\"custom" + Package_Custom_InfoID[i] + "\" type=\"checkbox\" value=\"" + server_name[i] + "\" onclick=\"Select_Custom(frmPC)\"/>");
		document.write("</td>");
		document.write("</tr>");
	}
}

function Change_State(theform){
	var custom = theform.custom;
	var Premium = theform.Premium;
	var Basic = theform.Basic;
	var Budget = theform.Budget;
	var post = theform.post;
	var Custom_Submit = theform.Custom_Submit;
	var Premium_Filing_Lb = document.getElementById("Premium_Filing_Lb");
	var Basic_Filing_Lb = document.getElementById("Basic_Filing_Lb");
	var Budget_Filing_Lb = document.getElementById("Budget_Filing_Lb");
	var Custom_Filing_Lb = document.getElementById("Custom_Filing_Lb");
	var Rush_Price_Lb = document.getElementById("Rush_Price_Lb");
	var Super_Rush_Price_Lb = document.getElementById("Super_Rush_Price_Lb");

	sel_state = ObjState[ObjState.selectedIndex].value;
	if(state[ObjState.selectedIndex] == "0"){
		for(var i=0; i<custom.length; i++){
			custom[i].disabled=true;
			custom[i].checked=false;
		}
		//for(var i=0; i<theform.elements.length; i++){
		//	var e = theform.elements[i];
		//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
		//		e.disabled = true;
		//		e.checked = false;
		//	}
		//}

		for(var i=0;i<post.length; i++){
			post[i].disabled=true;
		}

		Premium_Price.value = "$0";
		Basic_Price.value = "$0";
		Budget_Price.value = "$0";

		Premium_State_Filing.value = "$0";
		Basic_State_Filing.value = "$0";
		Budget_State_Filing.value = "$0";

		Premium_Total.value = "$0";
		Basic_Total.value = "$0";
		Budget_Total.value = "$0";
		Rush_Price.value = "$0";
		Super_Rush_Price.value = "$0";

		Premium_State_Filing.style.display = "block";
		Premium_Filing_Lb.style.display = "none";

		Basic_State_Filing.style.display = "block";
		Basic_Filing_Lb.style.display = "none";

		Budget_State_Filing.style.display = "block";
		Budget_Filing_Lb.style.display = "none";

		Custom_State_Filing.style.display = "block";
		Custom_Filing_Lb.style.display = "none";

		Rush_Price.style.display = "block";
		Rush_Price_Lb.style.display = "none";

		Super_Rush_Price.style.display = "block";
		Super_Rush_Price_Lb.style.display = "none";
	}
	else{
		for(var i=0; i<custom.length; i++){
			custom[i].disabled=false;
			custom[i].checked=false;
			custom[i].title = "Price: $" + server_fee[sel_state][server_name[i]];
		}
		//for(var i=0; i<theform.elements.length; i++){
		//for(var i=0; i<chklength.length + 2; i++){
		//	var e = theform.elements[i];
		//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox')){
		//		e.disabled = false;
		//		e.checked = false;
		//		e.title = "Price: $" + server_fee[sel_state][server_name[i]];
		//	}
		//}

		for(var i=0; i<post.length; i++){
			post[i].disabled=false;
		}

		if(state_rush[state[ObjState.selectedIndex]] < 0){
			post[1].disabled = true;
		}

		if(state_super_rush[state[ObjState.selectedIndex]] < 0){
			post[2].disabled = true;
		}

		Premium_Price.value = "$" + packages_price[packages[0]];
		Basic_Price.value = "$" + packages_price[packages[1]];
		Budget_Price.value = "$" + packages_price[packages[2]];

		if(State_Filing[state[ObjState.selectedIndex]] >=0){
			Premium_State_Filing.value = "$" + State_Filing[state[ObjState.selectedIndex]];
			Premium_State_Filing.style.display = "block";
			Premium_Filing_Lb.style.display = "none";

			Basic_State_Filing.value = "$" + State_Filing[state[ObjState.selectedIndex]];
			Basic_State_Filing.style.display = "block";
			Basic_Filing_Lb.style.display = "none";

			Budget_State_Filing.value = "$" + State_Filing[state[ObjState.selectedIndex]];
			Budget_State_Filing.style.display = "block";
			Budget_Filing_Lb.style.display = "none";

			Custom_State_Filing.value = "$" + State_Filing[state[ObjState.selectedIndex]];
			Custom_State_Filing.style.display = "block";
			Custom_Filing_Lb.style.display = "none";
		}
		else{
			Premium_State_Filing.style.display = "none";
			Premium_State_Filing.value = 0;
			Premium_Filing_Lb.style.display = "block";

			Basic_State_Filing.value = 0;
			Basic_State_Filing.style.display = "none";
			Basic_Filing_Lb.style.display = "block";

			Budget_State_Filing.value = 0;
			Budget_State_Filing.style.display = "none";
			Budget_Filing_Lb.style.display = "block";

			Custom_State_Filing.value = 0;
			Custom_State_Filing.style.display = "none";
			Custom_Filing_Lb.style.display = "block";
		}

		if(state_rush[state[ObjState.selectedIndex]] >= 0){
			Rush_Price.style.display = "block";
			Rush_Price_Lb.style.display = "none";
		}
		else{
			Rush_Price.style.display = "none";
			Rush_Price_Lb.style.display = "block";
		}

		if(state_super_rush[state[ObjState.selectedIndex]] >= 0){
			Super_Rush_Price.style.display = "block";
			Super_Rush_Price_Lb.style.display = "none";
		}
		else{
			Super_Rush_Price.style.display = "none";
			Super_Rush_Price_Lb.style.display = "block";
		}
			if(State_Filing[state[ObjState.selectedIndex]] >=0){
			Premium_Total.value = "$" + (packages_price[packages[0]] + State_Filing[state[ObjState.selectedIndex]]);
			Basic_Total.value = "$" + (packages_price[packages[1]] + State_Filing[state[ObjState.selectedIndex]]);
			Budget_Total.value = "$" + (packages_price[packages[2]] + State_Filing[state[ObjState.selectedIndex]]);
			Rush_Price.value = "$" + state_rush[state[ObjState.selectedIndex]];
			Super_Rush_Price.value = "$" + state_super_rush[state[ObjState.selectedIndex]];
		}
		else{
			Premium_Total.value = "$" + packages_price[packages[0]];
			Basic_Total.value = "$" + packages_price[packages[1]];
			Budget_Total.value = "$" + packages_price[packages[2]];
			Rush_Price.value = "$" + state_rush[state[ObjState.selectedIndex]];
			Super_Rush_Price.value = "$" + state_super_rush[state[ObjState.selectedIndex]];
		}
	}

	for(var i=0; i<post.length; i++){
		post[i].checked=false;
	}

	Premium.disabled = false;
	Basic.disabled = false;
	Budget.disabled = false;
	Custom_Total_Price.value = "";
	Premium_Total_Price.value = "$0";
	Basic_Total_Price.value = "$0";
	Budget_Total_Price.value = "$0";
	Custom_Price.value = "";
	Custom_State_Filing.value = "";
	Custom_Total.value = "";
	Custom_Submit.disabled = false;
}

function Select_Custom(theform){
	var custom = theform.custom;
	var Custom_Submit = theform.Custom_Submit;
	var flag = 0;
	var post_method = theform.post;
	value = 0;
	Custom_Price.value = 0;

	for(var i=0; i<custom.length; i++){
		if(custom[i].checked == true){
			flag = 1;
			break;
		}
	}
	//for(var i=0; i<theform.elements.length; i++){
	//	var e = theform.elements[i];
	//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
	//		if(e.checked == true){
	//			flag = 1;
	//			break;
	//		}
	//	}
	//}

	for(var i=0; i<post_method.length; i++){
		if(post_method[i].checked == true && flag ==1){
			flag = 2;
			Custom_Submit.disabled = false;
			break;
		}
	}

	if(flag != 2){
		Custom_Submit.disabled = true;
	}

	for(var i=0; i<custom.length; i++){
		if(custom[i].checked == true){
			value=value + Number(server_fee[sel_state][server_name[i]]);
		}
	}
	//for(var i=0; i<theform.elements.length; i++){
	//	var e = theform.elements[i];
	//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
	//		if(e.checked == true){
	//			value=value + Number(server_fee[sel_state][server_name[i]]);
	//		}
	//	}
	//}

	custom_value = value;
	if(value == 0){
		for(var i=0; i<custom.length; i++){
			if(custom[i].checked == true) break; 
		}
		//for(var i=0; i<theform.elements.length; i++){
		//	var e = theform.elements[i];
		//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
		//		if(e.checked == true) break; 
		//	}
		//}

		//if(i >= chklength){
		if(i >= custom.length){
			Custom_Price.value="";
			Custom_State_Filing.value = "";
			Custom_Total.value = "";
			Custom_Total_Price.value = "";
		}
		else{
			Custom_Price.value = "$0";
			if(State_Filing[state[ObjState.selectedIndex]] >= 0){
				if (custom[3].checked == true){
					Custom_State_Filing.value = "$" + State_Filing[state[ObjState.selectedIndex]];
					Custom_Total.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + value);
				}
				else{
					Custom_State_Filing.value = "";
					Custom_Total.value = "$" + value;
				}
				//for(var i=0; i<theform.elements.length; i++){
				//	var e = theform.elements[i];
				//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
				//		if(i == 4){
				//			if (e.checked == true){
				//				Custom_State_Filing.value = "$" + State_Filing[state[ObjState.selectedIndex]];
				//				Custom_Total.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + value);
				//			}
				//			else{
				//				Custom_State_Filing.value = "";
				//				Custom_Total.value = "$" + value;
				//			}
				//		}
				//	}
				//}
			}
			else{
				Custom_State_Filing.value = "$" + 0;
				Custom_Total.value = "$" + (0 + value);
			}

			if(flag == 2){
				Custom_Total_Price.value = "$0";
			}
			else{
				Custom_Total_Price.value = "";
			}
		}
	}
	else{
		Custom_Price.value = "$" + value;
		if(State_Filing[state[ObjState.selectedIndex]] >= 0){
			if (custom[3].checked == true){
				Custom_State_Filing.value = "$" + State_Filing[state[ObjState.selectedIndex]];
				Custom_Total.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + value);
			}
			else{
				Custom_State_Filing.value = "";
				Custom_Total.value = "$" + value;
			}
			//for(var i=0; i<theform.elements.length; i++){
			//	var e = theform.elements[i];
			//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
			//		if(i == 4){
			//			if (e.checked == true){
			//				Custom_State_Filing.value = "$" + State_Filing[state[ObjState.selectedIndex]];
			//				Custom_Total.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + value);
			//			}
			//			else{
			//				Custom_State_Filing.value = "";
			//				Custom_Total.value = "$" + value;
			//			}
			//		}
			//	}
			//}
		}
		else{
			Custom_State_Filing.value = "$" + 0 ;
			Custom_Total.value = "$" + ( 0 + value);
		}

		Post_Method(frmPC);
	}
}

function Post_Method(theform){
    var post_method = theform.post; 
    var custom = theform.custom;
    var Premium = theform.Premium;
    var Basic = theform.Basic;
    var Budget = theform.Budget;
    var flag = 0;
    var Custom_Submit = theform.Custom_Submit;

	for(var i=0; i<post_method.length; i++){
		if(post_method[i].checked == true){
			Premium.disabled = false;
			Basic.disabled = false;
			Budget.disabled = false;
			break;
		}
	}

	for(var i=0; i<custom.length; i++){
		if(custom[i].checked == true){
			flag = 1;
			break;
		}
	}
	//for(var i=0; i<theform.elements.length; i++){
	//	var e = theform.elements[i];
	//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
	//		if(e.checked == true){
	//			flag = 1;
	//			break;
	//		}
	//	}
	//}

	for(var i=0; i<post_method.length; i++){
		if(post_method[i].checked == true && flag ==1){
			flag = 2;
			Custom_Submit.disabled = false;
			break;
		}
	}

	if(flag != 2){
		Custom_Submit.disabled = false;
	}

	for(var i=0; i<post_method.length; i++){
		if(post_method[i].checked && post_method[i].value == "0"){
			if(State_Filing[state[ObjState.selectedIndex]] >= 0){
				Premium_Total_Price.value = "$" + (packages_price[packages[0]] + State_Filing[state[ObjState.selectedIndex]]);
				Basic_Total_Price.value = "$" + (packages_price[packages[1]] + State_Filing[state[ObjState.selectedIndex]]);
				Budget_Total_Price.value = "$" + (packages_price[packages[2]] + State_Filing[state[ObjState.selectedIndex]]);
				for(var j=0; j<custom.length; j++){
					if(custom[j].checked){
						if(custom[3].checked){
							Custom_Total_Price.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + custom_value);
						}
						else{
							Custom_Total_Price.value = "$" + custom_value;
						}
						break;
					}
				}
				//for(var i=0; i<theform.elements.length; i++){
				//	var e = theform.elements[i];
				//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
				//		if(e.checked){
				//			if(i == 4){
				//				if(e.checked){
				//					Custom_Total_Price.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + custom_value);
				//				}
				//				else{
				//					Custom_Total_Price.value = "$" + custom_value;
				//				}
				//				break;
				//			}
				//		}
				//	}
				//}
			}
			else{
				Premium_Total_Price.value = "$" + (packages_price[packages[0]]);
				Basic_Total_Price.value = "$" + (packages_price[packages[1]]);
				Budget_Total_Price.value = "$" + (packages_price[packages[2]]);
				for(var j=0; j<custom.length; j++){
					if(custom[j].checked){
						Custom_Total_Price.value = "$" + (custom_value);
						break;
					}
				}
				//for(var i=0; i<theform.elements.length; i++){
				//	var e = theform.elements[i];
				//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
				//		if(e.checked){
				//			Custom_Total_Price.value = "$" + (custom_value);
				//			break;
				//		}
				//	}
				//}
			}
		}

		if(post_method[i].checked && post_method[i].value == "1"){
			if(State_Filing[state[ObjState.selectedIndex]] >= 0){
				if(state_rush[state[ObjState.selectedIndex]] >= 0){
					Premium_Total_Price.value = "$" + (packages_price[packages[0]] + State_Filing[state[ObjState.selectedIndex]] + state_rush[state[ObjState.selectedIndex]]);
					Basic_Total_Price.value = "$" + (packages_price[packages[1]] + State_Filing[state[ObjState.selectedIndex]] + state_rush[state[ObjState.selectedIndex]]);
					Budget_Total_Price.value = "$" + (packages_price[packages[2]] + State_Filing[state[ObjState.selectedIndex]] + state_rush[state[ObjState.selectedIndex]]);
					
					for(var j=0; j<custom.length; j++){  
						if(custom[j].checked){
							if(custom[3].checked){
								Custom_Total_Price.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + custom_value + state_rush[state[ObjState.selectedIndex]]);
							}
							else{
								Custom_Total_Price.value = "$" + (custom_value + state_rush[state[ObjState.selectedIndex]]);
							}
							break;
						}
					}
					//for(var i=0; i<theform.elements.length; i++){
					//	var e = theform.elements[i];
					//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
					//		if(e.checked){
					//			if(i == 4){
					//				if(e.checked){
					//					Custom_Total_Price.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + custom_value + state_rush[state[ObjState.selectedIndex]]);
					//				}
					//				else{
					//					Custom_Total_Price.value = "$" + (custom_value + state_rush[state[ObjState.selectedIndex]]);
					//				}
					//				break;
					//			}
					//		}
					//	}
					//}
				}
				else{
					Premium_Total_Price.value = "$" + (packages_price[packages[0]] + State_Filing[state[ObjState.selectedIndex]]);
					Basic_Total_Price.value = "$" + (packages_price[packages[1]] + State_Filing[state[ObjState.selectedIndex]]);
					Budget_Total_Price.value = "$" + (packages_price[packages[2]] + State_Filing[state[ObjState.selectedIndex]]);
			
					for(var j=0; j<custom.length; j++){  
						if(custom[j].checked){
							if(custom[3].checked){
								Custom_Total_Price.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + custom_value);
							}
							else{
								Custom_Total_Price.value = "$" + (custom_value);
							}
							break;
						}
					}
					//for(var i=0; i<theform.elements.length; i++){
					//	var e = theform.elements[i];
					//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
					//		if(e.checked){
					//			if(i == 4){
					//				if(e.checked){
					//					Custom_Total_Price.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + custom_value);
					//				}
					//				else{
					//					Custom_Total_Price.value = "$" + (custom_value);
					//				}
					//				break;
					//			}
					//		}
					//	}
					//}
				}
			}
			else{
				if(state_rush[state[ObjState.selectedIndex]] >= 0){
					Premium_Total_Price.value = "$" + (packages_price[packages[0]] + state_rush[state[ObjState.selectedIndex]]);
					Basic_Total_Price.value = "$" + (packages_price[packages[1]] + state_rush[state[ObjState.selectedIndex]]);
					Budget_Total_Price.value = "$" + (packages_price[packages[2]] + state_rush[state[ObjState.selectedIndex]]);

					for(var j=0; j<custom.length; j++){  
						if(custom[j].checked){
							Custom_Total_Price.value = "$" + (custom_value + state_rush[state[ObjState.selectedIndex]]);
							break;
						}
					}
					//for(var i=0; i<theform.elements.length; i++){
					//	var e = theform.elements[i];
					//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
					//		if(e.checked){
					//			Custom_Total_Price.value = "$" + (custom_value + state_rush[state[ObjState.selectedIndex]]);
					//			break;
					//		}
					//	}
					//}
				}
				else{
					Premium_Total_Price.value = "$" + (packages_price[packages[0]]);
					Basic_Total_Price.value = "$" + (packages_price[packages[1]]);
					Budget_Total_Price.value = "$" + (packages_price[packages[2]]);

					for(var j=0; j<custom.length; j++){
						if(custom[j].checked){
							Custom_Total_Price.value = "$" + (custom_value);
							break;
						}
					}
					//for(var i=0; i<theform.elements.length; i++){
					//	var e = theform.elements[i];
					//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
					//		if(e.checked){
					//			Custom_Total_Price.value = "$" + (custom_value);
					//			break;
					//		}
					//	}
					//}
			   }
			}
		}

		if(post_method[i].checked && post_method[i].value == "2"){
			if(State_Filing[state[ObjState.selectedIndex]] >= 0){
				if(state_super_rush[state[ObjState.selectedIndex]] >= 0){
					Premium_Total_Price.value = "$" + (packages_price[packages[0]] + State_Filing[state[ObjState.selectedIndex]] + state_super_rush[state[ObjState.selectedIndex]]);
					Basic_Total_Price.value = "$" + (packages_price[packages[1]] + State_Filing[state[ObjState.selectedIndex]] + state_super_rush[state[ObjState.selectedIndex]]);
					Budget_Total_Price.value = "$" + (packages_price[packages[2]] + State_Filing[state[ObjState.selectedIndex]] + state_super_rush[state[ObjState.selectedIndex]]);
	
					for(var j=0; j<custom.length; j++){ 
						if(custom[j].checked){
							if(custom[3].checked){
								Custom_Total_Price.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + custom_value + state_super_rush[state[ObjState.selectedIndex]]);
							}
							else{
								Custom_Total_Price.value = "$" + ( custom_value + state_super_rush[state[ObjState.selectedIndex]]);
							}
							break;
						}
					}
					//for(var i=0; i<theform.elements.length; i++){
					//	var e = theform.elements[i];
					//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
					//		if(e.checked){
					//			if(i == 4){
					//				if(e.checked){
					//					Custom_Total_Price.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + custom_value + state_super_rush[state[ObjState.selectedIndex]]);
					//				}
					//				else{
					//					Custom_Total_Price.value = "$" + ( custom_value + state_super_rush[state[ObjState.selectedIndex]]);
					//				}
					//				break;
					//			}
					//		}
					//	}
					//}
				}
				else{
					Premium_Total_Price.value = "$" + (packages_price[packages[0]] + State_Filing[state[ObjState.selectedIndex]]);
					Basic_Total_Price.value = "$" + (packages_price[packages[1]] + State_Filing[state[ObjState.selectedIndex]]);
					Budget_Total_Price.value = "$" + (packages_price[packages[2]] + State_Filing[state[ObjState.selectedIndex]]);

					for(var j=0; j<custom.length; j++){ 
						if(custom[j].checked){
							if(custom[3].checked){
								Custom_Total_Price.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + custom_value);
							}
							else{
								Custom_Total_Price.value = "$" + custom_value;
							}
							break;
						}
					}
					//for(var i=0; i<theform.elements.length; i++){
					//	var e = theform.elements[i];
					//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
					//		if(e.checked){
					//			if(i == 4){
					//				if(e.checked){
					//					Custom_Total_Price.value = "$" + (State_Filing[state[ObjState.selectedIndex]] + custom_value);
					//				}
					//				else{
					//					Custom_Total_Price.value = "$" + custom_value;
					//				}
					//				break;
					//			}
					//		}
					//	}
					//}
				} 
			}
			else{
				if(state_super_rush[state[ObjState.selectedIndex]] >= 0){
					Premium_Total_Price.value = "$" + (packages_price[packages[0]] + state_super_rush[state[ObjState.selectedIndex]]);
					Basic_Total_Price.value = "$" + (packages_price[packages[1]] + state_super_rush[state[ObjState.selectedIndex]]);
					Budget_Total_Price.value = "$" + (packages_price[packages[2]] + state_super_rush[state[ObjState.selectedIndex]]);

					for(var j=0; j<custom.length; j++){ 
						if(custom[j].checked){
							Custom_Total_Price.value = "$" + (custom_value + state_super_rush[state[ObjState.selectedIndex]]);
							break;
						}
					}
					//for(var i=0; i<theform.elements.length; i++){
					//	var e = theform.elements[i];
					//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
					//		if(e.checked){
					//			Custom_Total_Price.value = "$" + (custom_value + state_super_rush[state[ObjState.selectedIndex]]);
					//			break;
					//		}
					//	}
					//}
				}
				else{
					Premium_Total_Price.value = "$" + (packages_price[packages[0]]);
					Basic_Total_Price.value = "$" + (packages_price[packages[1]]);
					Budget_Total_Price.value = "$" + (packages_price[packages[2]]);

					for(var j=0; j<custom.length; j++){ 
						if(custom[j].checked){
							Custom_Total_Price.value = "$" + custom_value;
							break;
						}
					}
					//for(var i=0; i<theform.elements.length; i++){
					//	var e = theform.elements[i];
					//	if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
					//		if(e.checked){
					//			Custom_Total_Price.value = "$" + custom_value;
					//			break;
					//		}
					//	}
					//}
				}
			}
		}
	}
}

function put_state(){
	for(var i=0; i<state.length; i++){
		if(i==0){
			document.write('<option value="' + state[i] + '">Select state</option>');
		}
		else{
			document.write('<option value="' + state[i] + '">' + state[i] + '</option>');
		}
	}
}

function Premium_re(theform){
	var optpost = valButton(theform.post);
	if (optpost==null){
		alert("Select how quickly would you like the original documents to be delivered to you.")
		return false;
	}
	//else{
		//theform.submit();
	//}
}

function Custom_Submit_re(theform){
	var custom_total = theform.Custom_Total;
	if (custom_total.value == ""){
		alert("Please select custom from the checkbox(es).")
		return false;
	}

	var optpost = valButton(theform.post);
	if (optpost==null){
		alert("Select how quickly would you like the original documents to be delivered to you.")
		return false;
	}

	var optpay = valButton(theform.pay_method);
	if (optpay==null){
		alert("Please select the method of delivery of your documents.")
		return false;
	}
//	else{
//		theform.submit();
//	}
}

function Init_Page(state){
	if(state != ""){
		ObjState.value = state;
		Change_State(document.frmPC);
	}

	if(ObjState[ObjState.selectedIndex].value == "0"){ 
		Premium_Price.value = "$0";
		Basic_Price.value = "$0";
		Budget_Price.value = "$0";
		Premium_State_Filing.value = "$0";
		Basic_State_Filing.value = "$0";
		Budget_State_Filing.value = "$0";
		Premium_Total.value = "$0";
		Basic_Total.value = "$0";
		Budget_Total.value = "$0";
		Rush_Price.value = "$0";
		Super_Rush_Price.value = "$0";
		Premium_Total_Price.value = "$0";
		Basic_Total_Price.value = "$0";
		Budget_Total_Price.value = "$0";
		var Premium = document.frmPC.elements["Premium"];
		var Basic = document.frmPC.elements["Basic"];
		var Budget = document.frmPC.elements["Budget"];
		var Custom_Submit = document.frmPC.elements["Custom_Submit"];
		Premium.disabled = true;
		Basic.disabled = true;
		Budget.disabled = true;
		Custom_Submit.disabled = true;

		var custom = document.frmPC.elements["custom"];
		for(var i=0; i<custom.length; i++){
			custom[i].disabled = true;
		}
		//for(var i=0; i<frmPC.elements.length; i++){
			//var e = document.frmPC.elements[i];
			//if ((e.name.indexOf("custom") == 0) && (e.type=='checkbox') && (!e.disabled)){
			//	e.disabled = true;
			//}
		//}

		var post = document.frmPC.elements["post"];
		for(var i=0; i<post.length; i++){
			post[i].disabled=true;
			post[i].checked=false;
		}
	}
}

/** Trademarks validation **/
function validate_trademark(theform){
	var ObjSearch = theform.elements["trasearches"];
	var Objdeliverytime = theform.elements["deliverytime"];
	var optsearches = valButton(theform.trasearches);

	if (optsearches==null){
		alert("Please select a trademark search.");
		return false;
	}

	for(var i=0; i < ObjSearch.length; i++){
		if(ObjSearch[i].checked){
			break;
		}
	}

	if(i < ObjSearch.length){
		for(var j=0;j<Objdeliverytime.length;j++){
			if(Objdeliverytime[j].checked){
				break;
			}
		}

		if(j >= Objdeliverytime.length){
			alert("Please select a processing time.");
			return false;
		}
	}

	var trareg = theform.elements["trareg"];
	var filling = theform.elements["filling"];
	for(var i = 0 ; i < trareg.length; i++){
		if(trareg[i].checked){
			break;
		}
	}

	if(i < trareg.length){
		for(var j = 0; j < filling.length; j++){
			if(filling[j].checked){
				break;
			}
		}
		if(j >= filling.length){
			alert("Please select a filing time for your trademark application.");
			return false;
		}
	}
	return true;
}

function validate_ras(theform){
	var optservicetype = valButton(theform.AgentServiceType);
	var companytype = theform.CompanyType;
	var optincorporated = valButton(theform.Incorporated);
	var companyname = theform.CompanyName;
	var intendtouse = theform.IntendToUse;
	var statecompany = theform.State_Company;
	var stateras = theform.State_RAS;

	if (optservicetype==null){
		alert("Please select if you are ordering new or just renewing.");
		return false;
	}

	if (companytype.selectedIndex==0){
		alert("Please select your company type from the list.");
		companytype.focus();
		return false;
	}

	if (optincorporated==null){
		alert("Please select if the company already been incorporated.");
		return false;
	}
	else if(optincorporated.toLowerCase()=="yes"){
		if (companyname.value==""){
			alert("Company name cannot be blank.")
			companyname.focus();
			return false;
		}
	}
	else if(optincorporated.toLowerCase()=="no"){
		if (intendtouse.value==""){
			alert("Name you intend to use cannot be blank.")
			intendtouse.focus();
			return false;
		}
	}

	if (statecompany.selectedIndex==0){
		alert("Please select your state from the list.");
		statecompany.focus();
		return false;
	}

	/*List box */
	if (stateras.selectedIndex==-1){
		alert("Please select one or more state for registered agent services.");
		stateras.focus();
		return false;
	}
}

function enable_control(ctrlenable, ctrldisable){
	document.getElementById(ctrldisable).value = "";
	document.getElementById(ctrlenable).disabled = false;
	document.getElementById(ctrldisable).disabled = true;
	document.getElementById(ctrlenable).focus();
}
