
function HitCounter()
{
  // Start hit counter code for BasicStat.com
  var data = '&r=' + escape(document.referrer)
	+ '&n=' + escape(navigator.userAgent)
	+ '&p=' + escape(navigator.userAgent)
	+ '&g=' + escape(document.location.href);

  if (navigator.userAgent.substring(0,1)>'3')
    data = data + '&sd=' + screen.colorDepth 
	+ '&sw=' + escape(screen.width+'x'+screen.height);

  document.write('<a title="free web counter" href="http://basicstat.com" target="_blank" >');
  document.write('<img alt="Free Web Counter" border=0 hspace=0 '+'vspace=0 src="http://basicstat.com/counter.php?i=749' + data + '">');
  document.write('</a>');
  // End hit counter code for BasicStat.com
}


function WelcomeMovie()
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="925" height="510">');
	document.write('<param name="movie" value="ta2.swf">');
	document.write('<param name="quality" value="high"><param name="BGCOLOR" value="#0033CC">');
	document.write('<embed src="ta2.swf" width="925" height="510" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#0033CC"></embed>');
	document.write('</object>');
}

function HomeMovie()
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="925" height="512">');
	document.write('<param name="movie" value="ta_main.swf">');
	document.write('<param name="quality" value="high"><param name="BGCOLOR" value="#0033CC">');
	document.write('<embed src="ta_main.swf" width="925" height="512" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#0033CC"></embed>');
	document.write('</object>');
}

function MenuMovie()
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="800" height="100">');
	document.write('<param name="movie" value="ta_header.swf">');
	document.write('<param name="quality" value="high"><param name="BGCOLOR" value="#0033CC">');
	document.write('<embed src="ta_header.swf" width="800" height="100" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#0033CC"></embed>');
	document.write('</object>');
}




		var digits = "0123456789";
		var phoneNumberDelimiters = "()- ";
		var validWorldPhoneChars = phoneNumberDelimiters + "+";
		var minDigitsInIPhoneNumber = 10;
		var n;
		var p;
		var p1;
		var commonPasswords = new Array('password', 'pass', '1234', '1246'); 
 
		var numbers = "0123456789";
		var lowercase = "abcdefghijklmnopqrstuvwxyz";
		var uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		var punctuation = "!.@$£#*()%~<>{}[]";
		
		//****************************************************
		//
		// StringContains
		//
		// verifies a password has valid characters
		//
		//****************************************************
		function StringContains(password, validChars)
		{
			var counter = 0;
			for (i = 0; i < password.length; i++)
			{
				var char = password.charAt(i);
				if (validChars.indexOf(char) > -1)
				{ counter++; }
			}
			return counter;
		}
		
		//****************************************************
		//
		// ValidatePasswordOnKeyUp
		//
		// Checks the strength of a password
		//
		//****************************************************
		function ValidatePasswordOnKeyUp(password, PasswordStrengthDiv)
		{ 
			var combinations = 0; 
			if (StringContains(password, numbers) > 0)
			{ combinations += 10; } 
 
			if (StringContains(password, lowercase) > 0)
			{ combinations += 26; } 
 
			if (StringContains(password, uppercase) > 0)
			{ combinations += 26; } 
 
			if (StringContains(password, punctuation) > 0)
			{ combinations += punctuation.length; } 
 
			// work out the total combinations 
			var totalCombinations = Math.pow(combinations, password.length); 
 
			// if the password is a common password, then everthing changes... 
			if (isCommonPassword(password))
			{ totalCombinations = 75000 } 
 
			// work out how long it would take to crack this (@ 200 attempts per second) 
			var timeInSeconds = (totalCombinations / 200) / 2; 
 
			// this is how many days? (there are 86,400 seconds in a day. 
			var timeInDays = timeInSeconds / 86400 
 
			// how long we want it to last 
			var lifetime = 365; 
 
			// how close is the time to the projected time? 
			var percentage = timeInDays / lifetime; 
 
			var friendlyPercentage = cap(Math.round(percentage * 100), 100); 
			if (totalCombinations != 75000 && friendlyPercentage < (password.length * 5))
			{ friendlyPercentage += password.length * 5; } 
 
			var progressBar = document.getElementById(PasswordStrengthDiv);
			progressBar.style.width = friendlyPercentage + "%"; 
 
			if (percentage > 1)
			{
				// strong password 
				progressBar.style.backgroundColor = "#3bce08"; 
				return; 
			}
 
			if (percentage > 0.5)
			{
				// reasonable password 
				progressBar.style.backgroundColor = "#ffd801"; 
				return; 
			}
 
			if (percentage > 0.10)
			{
				// weak password 
				progressBar.style.backgroundColor = "orange"; 
				return; 
			}
 
			// useless password! 
			if (percentage <= 0.10)
			{
				// weak password 
				progressBar.style.backgroundColor = "red"; 
				return; 
			}
		}
		
		//****************************************************
		//
		// cap
		//
		// Caps a number at it's max
		//
		//****************************************************
		function cap(number, max)
		{ 
			if (number > max)
			{ return max; }
			else
			{ return number; } 
		}
		
		//****************************************************
		//
		// isCommonPassword
		//
		// Checks if a password is common
		//
		//****************************************************
		function isCommonPassword(password)
		{ 
			for (i = 0; i < commonPasswords.length; i++)
			{
				var commonPassword = commonPasswords[i];
				if (password == commonPassword)
				{ return true; }
			}
			return false;
		}

		//*************************************************
		//
		// ValidatePasswordsOnBlur
		//
		// Confirms that Password and ConfirmPassword
		// are the same
		//
		//*************************************************
		function ValidatePasswordsOnBlur(Password, ConfirmPassword)
		{
			if(document.getElementById(Password).value != document.getElementById(ConfirmPassword).value)
			{
				document.getElementById(ConfirmPassword).value = "";
				alert("Make sure your Password and your Confirm Password are identical.");
			}
		}

		//*************************************************
		//
		// ValidatePhoneOnBlur
		//
		// Makes phone number correct format
		//
		//*************************************************
		function ValidatePhoneOnBlur(PhoneField)
		{
			var i;
			i = 0;
			while (i < 10)
			{
			
			p = document.getElementById(PhoneField).value;
			p1 = document.getElementById(PhoneField);
			if(p.length==3)
			{
				pp=p;
				d4=p.indexOf('(')
				d5=p.indexOf(')')
				if(d4==-1)
				{
					pp="("+pp;
				}
				if(d5==-1)
				{
					pp=pp+")";
				}
				document.getElementById(PhoneField).value="";
				document.getElementById(PhoneField).value=pp;
			}
			if(p.length>3)
			{
				d1=p.indexOf('(')
				d2=p.indexOf(')')
				if (d2==-1)
				{
					l30=p.length;
					p30=p.substring(0,4);
					p30=p30+")"
					p31=p.substring(4,l30);
					pp=p30+p31;
					document.getElementById(PhoneField).value="";
					document.getElementById(PhoneField).value=pp;
				}
			}
			if(p.length>5)
			{
				p11=p.substring(d1+1,d2);
				if(p11.length>3)
				{
					p12=p11;
					l12=p12.length;
					l15=p.length
					p13=p11.substring(0,3);
					p14=p11.substring(3,l12);
					p15=p.substring(d2+1,l15);
					document.getElementById(PhoneField).value="";
					pp="("+p13+")"+p14+p15;
					document.getElementById(PhoneField).value=pp;
				}
				l16=p.length;
				p16=p.substring(d2+1,l16);
				l17=p16.length;
				if(l17>3&&p16.indexOf('-')==-1)
				{
					p17=p.substring(d2+1,d2+4);
					p18=p.substring(d2+4,l16);
					p19=p.substring(0,d2+1);
					pp=p19+p17+"-"+p18;
					document.getElementById(PhoneField).value="";
					document.getElementById(PhoneField).value=pp;
				}
			}
			
			i = i + 1;
			}
			document.getElementById(PhoneField).value = document.getElementById(PhoneField).value.substring(0,14);
		}

		//*************************************************
		//
		// isInteger
		//
		// Identifies whether or not string is all integers
		//
		//*************************************************
		function isInteger(s)
		{
			var i;
			for (i = 0; i < s.length; i++)
			{   
				// Check that current character is number.
				var c = s.charAt(i);
				if (((c < "0") || (c > "9"))) return false;
			}
			// All characters are numbers.
			return true;
		}

		//*************************************************
		//
		// stripCharsInBag
		//
		// Gets rid of permitted but unneccessary
		// junk in phone string like "( ) -" chars
		//
		//*************************************************
		function stripCharsInBag(s, bag)
		{
			var i;
			var returnString = "";
			// Search through string's characters one by one.
			// If character is not in bag, append to returnString.
			for (i = 0; i < s.length; i++)
			{   
				// Check that current character isn't whitespace.
				var c = s.charAt(i);
				if (bag.indexOf(c) == -1) returnString += c;
			}
			return returnString;
		}
		
		//*************************************************
		//
		// checkInternationalPhone
		//
		// Checks if the specified number is an
		// international phone number
		//
		//*************************************************
		function checkInternationalPhone(strPhone)
		{
			s=stripCharsInBag(strPhone,validWorldPhoneChars);
			return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
		}

		//*************************************************
		//
		// ValidatePhoneNumber
		//
		// Checks any specified Phone field to make sure
		// it is really a phone number
		//
		//*************************************************
		function ValidatePhoneNumber(PhoneField)
		{
			var Phone=document.getElementById(PhoneField);
			if (checkInternationalPhone(Phone.value)==false)
			{
				alert("Please Enter a Valid Phone Number with Area Code\r\nin the following format: (555) 555-5555");
				Phone.value="";
				Phone.focus();
				return false;
			}
			return true;
		}

		//*************************************************
		//
		// DuplicateValue
		//
		// Duplicates the value in the first field into
		// the second, if the latter is blank
		//
		//*************************************************
		function DuplicateValue(FromField, ToField)
		{
			var FieldFrom=document.getElementById(FromField);
			var FieldTo=document.getElementById(ToField);
			if (FieldTo.value == '')
			{
				FieldTo.value = FieldFrom.value;
			}
		}

		//*************************************************
		//
		// ValidateCurrencyOnBlur
		//
		// Makes currency correct format
		//
		//*************************************************
		function ValidateCurrencyOnBlur(CurrencyField)
		{
			var DollarAmount = document.getElementById(CurrencyField).value.replace('$', '');
			var i = parseFloat(DollarAmount);
			if(isNaN(i)) { i = 0.00; }
			var minus = '';
			if(i < 0) { minus = '-'; }
			i = Math.abs(i);
			i = parseInt((i + .005) * 100);
			i = i / 100;
			s = new String(i);
			if(s.indexOf('.') < 0) { s += '.00'; }
			if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
			s = minus + s;
			document.getElementById(CurrencyField).value = s;
		}

		//*************************************************
		//
		// ValidateEmail
		//
		// Checks any specified Email field to make sure
		// it is really an Email Address
		//
		//*************************************************
		function ValidateEmail(EmailField)
		{
			var EmailField = document.getElementById(EmailField)
			var str = EmailField.value;
			if (str.length > 0)
			{
				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 Email Address");
					EmailField.value="";
					EmailField.focus();
					return false;
				}
				if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
				{
					alert("Please enter a valid Email Address");
					EmailField.value="";
					EmailField.focus();
					return false;
				}
				if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
				{
					alert("Please enter a valid Email Address");
					EmailField.value="";
					EmailField.focus();
					return false;
				}
				if (str.indexOf(at,(lat+1))!=-1)
				{
					alert("Please enter a valid Email Address");
					EmailField.value="";
					EmailField.focus();
					return false;
				}
				if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
				{
					alert("Please enter a valid Email Address");
					EmailField.value="";
					EmailField.focus();
					return false;
				}
				if (str.indexOf(dot,(lat+2))==-1)
				{
					alert("Please enter a valid Email Address");
					EmailField.value="";
					EmailField.focus();
					return false;
				}
				if (str.indexOf(" ")!=-1)
				{
					alert("Please enter a valid Email Address");
					EmailField.value="";
					EmailField.focus();
					return false;
				}
				return true;
			}
			else
			{
				return true;
			}
		}

		//*************************************************
		//
		// ValidateEmailOnBlur
		//
		// Confirms Email Address is a valid Email
		//
		//*************************************************
		function ValidateEmailOnBlur(EmailField)
		{
			if (document.getElementById(EmailField).value != "")
			{
				if (!isEmail(document.getElementById(EmailField).value))
				{
					document.getElementById(EmailField).value = "";
					alert("Please enter a valid Email Address.");
				}
			}
		}

		//*************************************************
		//
		// isEmail
		//
		// Confirms Email Address is a valid Email
		//
		//*************************************************
		function isEmail(str)
		{
			var at="@"
			var dot="."
			var lat=str.indexOf(at)
			var lstr=str.length
			var ldot=str.indexOf(dot)
			if (str.indexOf(at)==-1)
			{ return false; }

			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
			{ return false; }

			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
			{ return false; }

			if (str.indexOf(at,(lat+1))!=-1)
			{ return false; }

			if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
			{ return false; }

			if (str.indexOf(dot,(lat+2))==-1)
			{ return false; }

			if (str.indexOf(" ")!=-1)
			{ return false; }

			return true
		}

		//*************************************************
		//
		// ValidateDOBOnBlur
		//
		// Confirms that DOB field is correctly formatted
		//
		//*************************************************
		function ValidateDOBOnBlur(DOBField)
		{
			re = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
			if(document.getElementById(DOBField).value != '')
			{
				if(!document.getElementById(DOBField).value.match(re))
				{
					document.getElementById(DOBField).value = "";
					alert("Your Date of Birth must be in the following format: MM/DD/YYYY");
				}
			}
		}
