﻿	function copyShipping()
		{
			document.frmUser.ShippingLastName.value = document.frmUser.LastName.value;
			document.frmUser.ShippingFirstName.value = document.frmUser.FirstName.value;
			document.frmUser.ShippingCompany.value = document.frmUser.Company.value;
			document.frmUser.ShippingAddress1.value = document.frmUser.Address1.value;
			document.frmUser.ShippingAddress2.value = document.frmUser.Address2.value;
			document.frmUser.ShippingCity.value = document.frmUser.City.value;
			document.frmUser.State2.selectedIndex = document.frmUser.State1.selectedIndex;
			document.frmUser.ShippingZip.value = document.frmUser.Zip.value;
			document.frmUser.Country2.selectedIndex = document.frmUser.Country1.selectedIndex;
			document.frmUser.ShippingPhone1.value = document.frmUser.DayPhone.value;
			document.frmUser.ShippingPhone2.value = document.frmUser.EveningPhone.value;
			document.frmUser.ShippingEmail.value = document.frmUser.Email.value;
			document.frmUser.POBox.checked = document.frmUser.POBoxB.checked;
		}
	
	function testCopy()
		{
			if (document.frmUser.CopyShipping.checked == true)
				copyShipping();
		}

	function checkSettings()
		{
			var mError = 0;

			if (mError == 0)
				{
					document.frmUser.Mode.value="1VNR";
					document.frmUser.submit();
				}
		}

	function GoPrev()
		{
			var mError = 0;
			if (mError == 0)
				document.frmUser.Mode.value="";
				document.frmUser.submit();
		}

	function SetTaxExempt()
		{
			if (document.frmUser.CTypeS.checked == false)
				{
					if (document.frmUser.CTypeL.checked == false)
							{
								document.frmUser.TaxExempt.checked = 0;
								alert("Only Schools and Libraries may select Tax Exempt");	
							}
				}
		}


	function SetCustType(varCustType)
		{
			if (varCustType == 'S')
				{
					if (document.frmUser.CTypeS.checked == true)
						document.frmUser.CTypeL.checked = 0;
				}
			if (varCustType == 'L')
				{
					if (document.frmUser.CTypeL.checked == true)
						document.frmUser.CTypeS.checked = 0;
				}
//			if (document.frmUser.CTypeS.checked == false)
//				{
//					if (document.frmUser.CTypeL.checked == false)
//							{
//								document.frmUser.TaxExempt.checked = 0;
//							}
//				}
		}

	function SetCountry(idx)
		{
			if (idx == 1)
				{
					if (document.frmUser.CopyShipping.checked == true)
						{
							document.frmUser.State2.selectedIndex = document.frmUser.State1.selectedIndex;
						}
					if (document.frmUser.State1.value != "AP")
						{
							if (document.frmUser.State1.value != "OU")
								{
									document.frmUser.Country1.selectedIndex = 0;
									if (document.frmUser.CopyShipping.checked == true)
										{
											document.frmUser.Country2.selectedIndex = 0;
										}
								}
						}
				}
			else
				{
					if (document.frmUser.State2.value != "AP")
						{
							if (document.frmUser.State2.value != "OU")
								{
									document.frmUser.Country2.selectedIndex = 0;
								}
						}
				}
		}

	function SetState(idx)
		{
			if (idx == 1)
				{
					if (document.frmUser.CopyShipping.checked == true)
						{
							document.frmUser.Country2.selectedIndex = document.frmUser.Country1.selectedIndex;
						}
					if (document.frmUser.Country1.value != "United States")
						{
							if (document.frmUser.State1.value != "AP")
								{
									document.frmUser.State1.selectedIndex = 55;
									if (document.frmUser.CopyShipping.checked == true)
										{
											document.frmUser.State2.selectedIndex = 55;
										}
								}
						}
				}
			else
				{
					if (document.frmUser.Country2.value != "United States")
						{
							if (document.frmUser.State2.value != "AP")
								document.frmUser.State2.selectedIndex = 55;
						}
				}
		}

	function selOption(mOption)
		{
			if (mOption == 1)
				{
					document.frmUser.Source1[0].checked = true;
				}
			else
				{
					if (mOption == 2)
						{
							document.frmUser.Source1[1].checked = true;
						}
					else
						{
							document.frmUser.Source1[2].checked = true;
						}
				}
		}


// fill in source keys ...

function getSubCategories()
		{
			if (document.frmCategory.CategoryID.value == "")
				alert("Please select a category from the pull-down menu.");
			else
				document.frmCategory.submit();
		}


function initControls()
{
populateSourceKeyCat();

}
function populateSourceKeyCat()
{

document.frmUser.SourceKeyCat[0] = new Option('','');
document.frmUser.SourceKeyCat[1] = new Option('TV','22-302ZZ');
document.frmUser.SourceKeyCat[2] = new Option('Magazine','22-9980');
document.frmUser.SourceKeyCat[3] = new Option('Internet','22-9981');
document.frmUser.SourceKeyCat[4] = new Option('Radio','22-7999');
document.frmUser.SourceKeyCat[5] = new Option('Email','22-5900');
document.frmUser.SourceKeyCat[6] = new Option('Person','22-9998');
document.frmUser.SourceKeyCat[7] = new Option('Mailing','99-9999');


}

var arrSourceKey = new Array();
var arrSourceKeyCat = new Array();
var arrSourceKeyValue = new Array();


			 

arrSourceKeyValue[126] = '22-6000';
arrSourceKey[126] = 'Homeschooling Website';
arrSourceKeyCat[126] = '22-9981';

arrSourceKeyValue[130] = '22-302YT';
arrSourceKey[130] = 'YouTube';
arrSourceKeyCat[130] = '22-9981';

arrSourceKeyValue[131] = '22-5900';
arrSourceKey[131] = 'Muzzy Email';
arrSourceKeyCat[131] = '22-5900';

arrSourceKeyValue[137] = '22-5900';
arrSourceKey[137] = 'Other Email';
arrSourceKeyCat[137] = '22-5900';

			 
arrSourceKeyValue[172] = '22-9980';
arrSourceKey[172] = 'Other Magazine Ad';
arrSourceKeyCat[172] = '22-9980';

arrSourceKeyValue[200] = '20-7000';
arrSourceKey[200] = 'Radio Disney';
arrSourceKeyCat[200] = '20-7999';
		 
arrSourceKeyValue[222] = '22-9992';
arrSourceKey[222] = 'From a Teacher/School Administrator';
arrSourceKeyCat[222] = '22-9998';
			 
arrSourceKeyValue[224] = '22-9981';
arrSourceKey[224] = 'Surfing the Web';
arrSourceKeyCat[224] = '22-9981';

arrSourceKeyValue[226] = '22-6900';
arrSourceKey[226] = 'Facebook';
arrSourceKeyCat[226] = '22-9981';

arrSourceKeyValue[229] = '22-6901';
arrSourceKey[229] = 'Twitter';
arrSourceKeyCat[229] = '22-9981';
			 
arrSourceKeyValue[230] = '22-9998';
arrSourceKey[230] = 'Friend';
arrSourceKeyCat[230] = '22-9998';
			 
arrSourceKeyValue[231] = '22-5900';
arrSourceKey[231] = 'Email';
arrSourceKeyCat[231] = '22-9998';

arrSourceKeyValue[232] = '22-302SPW';
arrSourceKey[232] = 'Sprout';
arrSourceKeyCat[232] = '22-302ZZ';F
			 

arrSourceKeyValue[234] = '22-302NKG';
arrSourceKey[234] = 'Nickelodeon';
arrSourceKeyCat[234] = '22-302ZZ';


arrSourceKeyValue[241] = '22-302CNN';
arrSourceKey[241] = 'Cartoon Network';
arrSourceKeyCat[241] = '22-302ZZ';

arrSourceKeyValue[243] = '22-302BCN';
arrSourceKey[243] = 'CNBC';
arrSourceKeyCat[243] = '22-302ZZ';

arrSourceKeyValue[249] = '22-302DKG';
arrSourceKey[249] = 'The Hub';
arrSourceKeyCat[249] = '22-302ZZ';

arrSourceKeyValue[255] = '22-302HGN';
arrSourceKey[255] = 'HGTV';
arrSourceKeyCat[255] = '22-302ZZ';

arrSourceKeyValue[261] = '22-302MSN';
arrSourceKey[261] = 'MSNBC';
arrSourceKeyCat[261] = '22-302ZZ';

arrSourceKeyValue[267] = '22-302COR';
arrSourceKey[267] = 'Tru TV';
arrSourceKeyCat[267] = '22-302ZZ';

arrSourceKeyValue[268] = '22-302LCN';
arrSourceKey[268] = 'TLC';
arrSourceKeyCat[268] = '22-302ZZ';

arrSourceKeyValue[269] = '22-302TCN';
arrSourceKey[269] = 'The Travel Channel';
arrSourceKeyCat[269] = '22-302ZZ';


arrSourceKeyValue[286] = '22-302YT';
arrSourceKey[286] = 'YouTube';
arrSourceKeyCat[286] = '22-302ZZ';

arrSourceKeyValue[296] = '22-302ZZ';
arrSourceKey[296] = 'Other TV Station';
arrSourceKeyCat[296] = '22-302ZZ';



function fillSourceKey()
{
var strState = document.frmUser.SourceKeyCat.options[document.frmUser.SourceKeyCat.selectedIndex].value;
var intCount = arrSourceKey.length;
var n=0;
document.frmUser.SourceKey.options.length = 0;
document.frmUser.SourceKey[n++] = new Option('Select Source', '22-9981');

for (var i = 0; i < intCount; i++)
{

if (strState == arrSourceKeyCat[i])
document.frmUser.SourceKey[n++] = new Option(arrSourceKey[i], arrSourceKeyValue[i]);
}
if (strState != arrSourceKeyCat[i])
document.frmUser.SourceKey[n++] = new Option('Other', '22-9981');

}
