function placeFocus() 
{
	if (document.forms.length > 0) 
	{
		var field = document.forms[0];
		for (i = 0; i < field.length; i++) 
		{
			if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") ) 
			{


						document.forms[0].elements[i].focus();
						break;

		    }
	    }
    }
}

function showinstructions()
{
	window.open("trialinstructions.htm","trialinstructions","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,WIDTH=600,HEIGHT=550");
}

function trialagreement()
{
	window.open("trialagreement.htm","trialagreement","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,WIDTH=400,HEIGHT=400");
}
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		secondary_04_home_2_over = newImage("images/secondary_04-home_2_over.gif");
		home_2_over = newImage("images/home_2-over.gif");
		my_spot2_over = newImage("images/my_spot2-over.gif");
		my_spot2_packages_2_over = newImage("images/my_spot2-packages_2_over.gif");
		packages_2_over = newImage("images/packages_2-over.gif");
		design_your_site2_over = newImage("images/design_your_site2-over.gif");
		sample_sites2_over = newImage("images/sample_sites2-over.gif");
		faq2_over = newImage("images/faq2-over.gif");
		tips2_over = newImage("images/tips2-over.gif");
		big_dog_log_in2_over = newImage("images/big_dog_log_in2-over.gif");
		about_us_2_over = newImage("images/about_us_2-over.gif");
		contact_us2_over = newImage("images/contact_us2-over.gif");
		referral2_over = newImage("images/referral2-over.gif");
		support2_over = newImage("images/support2-over.gif");
		preloadFlag = true;
	}
}

function f_contactinfo_validate()
{
	if (document.f_contactinfo.cname.value=="")
	{
		alert("The company name field cannot be null");
		document.f_contactinfo.cname.focus();
		return false;
	}
	if (document.f_contactinfo.email.value=="")
	{
		alert("The Email field cannot be null");
		document.f_contactinfo.email.focus();
		return false;
	}	
	if (document.f_contactinfo.phone.value=="")
	{
		alert("The Phone field cannot be null");
		document.f_contactinfo.phone.focus();
		return false;
	}
	for (i=0;i<=document.f_contactinfo.phone.value.length ;i++ )
	{
		if (isNaN(document.f_contactinfo.phone.value.substring(i,1)))
		{
			document.f_contactinfo.phone.focus();
			alert("The phone feild cannot contain characters other than integers.");
			return false;
		}
	}
	return true;
}

function f_passwordchange_validate()
{
		if (document.f_passwordchange.password.value=="")
		{
			alert("The password field cannot be null");
			document.f_passwordchange.pwd.focus();
			return false;
		}
		return true;
}

function f_registration_validate(eid)
{
	if (document.f_registration.cname.value=="")
	{
		alert("The company name field cannot be null");
		document.f_registration.cname.focus();
		return false;
	}
	if (document.f_registration.uname.value=="")
	{
		alert("The user name field cannot be null");
		document.f_registration.uname.focus();
		return false;
	}
	if (document.f_registration.pwd.value=="")
	{
		alert("The password field cannot be null");
		document.f_registration.pwd.focus();
		return false;
	}
	if (document.f_registration.slogan.value=="")
	{
		alert("The Slogan field cannot be null");
		document.f_registration.slogan.focus();
		return false;
	}
	if (document.f_registration.mpone.value=="")
	{
		alert("The marketing phrase one field cannot be null");
		document.f_registration.mpone.focus();
		return false;
	}
	if (document.f_registration.address.value=="")
	{
		alert("The address field cannot be null");
		document.f_registration.address.focus();
		return false;
	}
	if (document.f_registration.city.value=="")
	{
		alert("The city field cannot be null");
		document.f_registration.city.focus();
		return false;
	}
	if (document.f_registration.statename.value=="")
	{
		alert("The State field cannot be null");
		document.f_registration.statename.focus();
		return false;
	}
	if (document.f_registration.zipcode.value=="")
	{
		alert("The Zipcode field cannot be null");
		document.f_registration.zipcode.focus();
		return false;
	}
	if (document.f_registration.email.value=="")
	{
		alert("The Email field cannot be null");
		document.f_registration.email.focus();
		return false;
	}	
	if (document.f_registration.phone.value=="")
	{
		alert("The Phone field cannot be null");
		document.f_registration.phone.focus();
		return false;
	}
	for (i=0;i<=document.f_registration.phone.value.length ;i++ )
	{
		if (isNaN(document.f_registration.phone.value.substring(i,1)))
		{
			document.f_registration.phone.focus();
			alert("The phone feild cannot contain characters other than integers.");
			return false;
		}
	}	
	for (i=0;i<=document.f_registration.zipcode.value.length ;i++ )
	{
		if (isNaN(document.f_registration.zipcode.value.substring(i,1)) && document.f_registration.zipcode.value.substring(i,1)!=".")
		{
			document.f_registration.zipcode.focus();
			alert("The zipcode feild cannot contain characters other than integers.");
			return false;
		}
	}	
	if (eid=="0")
	{
		if (document.f_registration.trial.checked==false)
		{
			alert("Please read the Trial agreement and check the I Agree box.")
			return false;
		}
	}
	
	return true;
}

function f_paymentpage_validate()
{
	if (document.f_paymentpage.cno.value=="")
	{
		alert("The Credit Card Number field cannot be null");
		document.f_paymentpage.cno.focus();
		return false;
	}
	for (i=0;i<=document.f_paymentpage.cno.value.length ;i++ )
	{
		if (isNaN(document.f_paymentpage.cno.value.substring(i,1)))
		{
			document.f_paymentpage.cno.focus();
			alert("The credit card number feild cannot contain characters other than integers.");
			return false;
		}
	}
	if (document.f_paymentpage.yname.value=="")
	{
		alert("The Name as it appears on the Credit card field cannot be null");
		document.f_paymentpage.yname.focus();
		return false;
	}
	if (document.f_paymentpage.vemail.value=="")
	{
		alert("The Verify Email field cannot be null");
		document.f_paymentpage.vemail.focus();
		return false;
	}
	return true;
}

function f_buyssl_validate()
{
	if (getSelectedRadioValue(document.f_buyssl.ssl)==document.f_buyssl.pssl.value)
	{
		alert("Please Select a Different SSL Option. Your Current SSL Option is " + document.f_buyssl.pssl.value);
		return false;
	}
	return true;
}

function getSelectedRadio(buttonGroup) 
{
   // returns the array number of the selected radio button or -1 if no button is selected
   if (buttonGroup[0]) 
   { // if the button group is an array (one button is not an array)
      for (var i=0; i<buttonGroup.length; i++) 
	  {
         if (buttonGroup[i].checked) 
		 {
            return i
         }
      }
   } 
   else 
   {
      if (buttonGroup.checked) { return 0; } // if the one button is checked, return zero
   }
   // if we get to this point, no radio button is selected
   return -1;
} // Ends the "getSelectedRadio" function


function getSelectedRadioValue(buttonGroup) 
{
   // returns the value of the selected radio button or "" if no button is selected
   var i = getSelectedRadio(buttonGroup);
   if (i == -1) 
   {
      return "";
   } 
   else 
   {
      if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
         return buttonGroup[i].value;
      } else { // The button group is just the one button, and it is checked
         return buttonGroup.value;
      }
   }
} // Ends the "getSelectedRadioValue" function

