if (navigator.appName=="Netscape" && parseFloat(navigator.appVersion)<=4.9)
	alert("Warning\n\nYou are using an older Version of Netscape \nwhich is no longer supported.\n\nIt is recommended that you upgrade.\n\nYou may continue,  \nbut screen formatting and some options may not work as it was intended.");

var path = 'http://' + document.domain + '/';
var WIpath = 'http://www.wellpeople.com/';
var Editpath = 'admin/';
	
function showWin(which,parm,parm1)
{
	var newwinname = '_' + which;
	switch (which) {
		case 'upLoad': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=450,height=340';
			LinkURL = 'UpLoadFile.asp?up='+parm + '&val='+parm1;
			break;

		case 'help': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=450,height=340';
			LinkURL = path + 'WIShowTextSm.asp?PageType=help&help=' + parm ;
			break;

		case 'certifyPricing': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=480,height=740';
			LinkURL = path + 'WIShowTextSm.asp?PageType=certifyPricing';
			break;

		case 'disc': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=790,height=330';
			LinkURL = WIpath + 'WIShowText.asp?PageType=disc' ;
			break;

		case 'openEdit': 	
			opts = 'menubar=1,location=1,status=1,scrollbars=1,toolbar=1,resizable=1,width=804,height=600';
			LinkURL = path + Editpath + 'Editing.asp?tbv=' + parm + '&pkValue=' + parm1 ;
			break;

		case 'editNotes': 	
			opts = 'menubar=1,location=1,status=1,scrollbars=1,toolbar=1,resizable=1,width=804,height=600';
			LinkURL = path + Editpath + 'EditNotes.asp?tb=' + parm + '&pkValue=' + parm1 ;
			break;

		case 'openEditGen': 	
			opts = 'menubar=1,location=1,status=1,scrollbars=1,toolbar=1,resizable=1,width=804,height=680';
			LinkURL = path + 'WIEditing.asp?tbv=' + parm + '&pkValue=' + parm1 ;
			break;

		case 'contact': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=466,height=526';
			LinkURL = path + 'WIShowTextSm.asp?PageType=contact&UId='+parm + '&GId='+parm1;
			break;

		case 'Login': 	// ?? 
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=1,resizable=1,width=804,height=590';
			LinkURL = path + 'WILogin.asp';
			break;

		case 'startTest': 	
			opts = 'menubar=1,location=1,status=1,scrollbars=1,toolbar=1,resizable=1,width=804,height=600';
			LinkURL = parm + '/WISignUp.asp';
			break;

		case 'userSub': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=0,toolbar=0,resizable=0,left=12000,width=10,height=10';
			LinkURL = path + 'WISubscribe.asp?Ui='+parm+'&un='+parm1;
			break;

		case 'helpNum': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=450,height=340';
			LinkURL = path + 'WIShowTextSm.asp?PageType=help&helpid=' + parm ;
			break;

		case '5steps': 	
			opts = 'menubar=1,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=560';
			LinkURL = path + 'WIShowText.asp?PageType=5steps&stepNo=' + parm + '&nextStep=' + parm1;
			break;

		case 'overview': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=660';
			LinkURL = path + 'WIMainIntro.asp?UId=' + parm ;
			break;

		case 'planHelp': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=560';
			LinkURL = path + 'WIShowText.asp?PageType=planHelp';
			break;

		case 'tour': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=570,height=650';
			LinkURL = WIpath + 'WellnessTour.asp?src=' + parm + '&grpTr='  ;
			break;

		case 'pass': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=340,height=200';
			LinkURL = path + 'WISendPass.asp?gv=' + parm;
			break;

		case 'resultsz': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=600';
			LinkURL = path + 'WIWheel.asp?ex=yz&type=int&TId=' + parm + '&score=' + parm1 ;
			break;

		case 'createPlan': 	
			opts = 'menubar=1,location=1,status=1,scrollbars=1,toolbar=1,resizable=1,width=804,height=600';
			LinkURL = path + 'WIWellPlan1.asp?TId='+parm +'&ed='+parm1 ;
			break;

		case 'editPlan': 	
			opts = 'menubar=1,location=1,status=1,scrollbars=1,toolbar=1,resizable=1,width=804,height=600';
			LinkURL = path + 'WIEditActionPlan.asp?WPId='+parm + '&e=' + parm1;
			break;

		case 'testCompare': 	
			opts = 'menubar=1,location=1,status=1,scrollbars=1,toolbar=1,resizable=1,width=804,height=630';
			LinkURL = path + 'WITestCompare.asp?e=yz&UId=' + parm;
			break;

		case 'quickWheel': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=804,height=552';
//			LinkURL = path + 'WIWheel.asp?ws=' + parm + '&TId='+parm1 ;
			LinkURL = path + 'WIWheelScore.asp?type=edx&ws=' + parm + '&TId='+parm1;
			newwinname =  'qw' + parm + parseInt(parm1,0);
			break;

		case 'ShowNotes':
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=804,height=600';
			LinkURL = path + Editpath + 'ShowNotes.asp?Id='+parm + '&nt='+parm1;
			break;

		case 'emailopts':
			opts = 'menubar=0, location=0, status=0, scrollbars=1, height=525, width=460';
			LinkURL = path + 'WIEmailOptions.asp?Id=' + parm + '&e=' + parm1 ; 
			break;

		case 'plannotes': 			//	???
			opts = 'menubar=1,resizable,location=0,status=0,scrollbars=1,toolbar=0,height=200,width=450';		
			LinkURL = path + 'WIShowTextSm.asp?PageType=plannotes&planid=' + parm ;
			break;		

		case 'reminder':			// ?? 
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=400,height=360';		
			LinkURL = path + 'WIShowTextSm.asp?PageType=' + which ;
			break;		

		case 'intro':
			opts = 'menubar=1,resizable,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=460';
			LinkURL = path + 'WIShowText.asp?PageType=ShortIntro&section=' + parm ;
			break;

		case 'introlong':
			opts = 'menubar=1,resizable,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=600';
			LinkURL = path + 'WIShowText.asp?PageType=LongIntro&section=' + parm ;
			break;

		case 'results':
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=600';
			LinkURL = path + 'WIWheel.asp?type=int&TId=' + parm + '&score=' + parm1 ;
			break;

		case 'planname':
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=340';
			LinkURL = path + 'WIWellPlan1.asp?type=int&TId=' + parm + '&chk=' + parm1 ;
			break;

		case 'wellplanprint':
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=640';
			LinkURL = path + 'WIActionPlan.asp?pr=y&e=y12&WPId=' + parm + '&UId=' + parm1 ;
			break;

		case 'dualWheel': 	
			opts = 'menubar=0,resizable,location=0,status=0,scrollbars=1,toolbar=0,width=804,height=702';
			LinkURL = path + Editpath + 'EditShowWheels.asp?ws=' + parm + '&TId='+parm1;
			newwinname =  'qwt' + parm + parseInt(parm1,0);
			break;

		case 'actionstep':
			newwinname +=  parm;
			opts = 'menubar=1,resizable,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=520';
			LinkURL = path + 'WIShowText.asp?PageType=actionstep&stateid=' + parm ;
			break;
//		,'commentary1'
		case 'commentary1':
			newwinname += parm + parm1;
			opts = 'menubar=1,resizable,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=520';
			LinkURL = path + 'WIShowText.asp?PageType='+which+'&section=' + parm + '&questionId=' + parm1 ;
			break;

		case 'commentary':
			newwinname += parm + parm1;
			opts = 'menubar=1,resizable,location=0,status=0,scrollbars=1,toolbar=0,width=802,height=520';
			LinkURL = path + 'WIShowText.asp?PageType='+which+'&section=' + parm + '&questionId=' + parm1 ;
			break;

		case 'thanks':
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=803,height=400';
			LinkURL = path + 'WIThankYou.asp';
			break;

		case 'homepage':
			opts = 'menubar=1,location=1,status=1,scrollbars=1,toolbar=1,resizable=1,width=804,height=600';
			LinkURL = parm + '/WI_HomePage.asp';
			break;

		case 'quickInfo':
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,resizable=1,width=800,height=410';
			LinkURL = path + 'WIInfo.asp?pt='+parm+ '&UId='+parm1			
			break;

		case 'ResDesc':
			opts = 'menubar=0,location=0,status=0,scrollbars=0,toolbar=0,resizable=1,width=800,height=400';
			LinkURL = path + 'WIShowText.asp?PageType=ResDesc&Id=' + parm ;
			break;

		case 'chkList': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=0,toolbar=0,resizable=1,width=600,height=670';
			LinkURL = path + Editpath + 'CheckList.asp?GId=' + parm ;
			break;

		case 'wptutorial': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,resizable=1,width=800,height=930';
			LinkURL = '/features/Tips_CreatingActionSteps.pdf' // path + 'WIWellPlanTutorial.asp?QSId=' + parm ;
			break;

		case 'editit': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,resizable=1,width=800,height=430';
			LinkURL = path + Editpath + 'Editing.asp?tbv='+parm+ '&pkValue='+parm1	
			break;

		case 'Admin': 	
			opts = 'menubar=0,location=0,status=0,scrollbars=1,toolbar=0,width=522,height=574';
			LinkURL = 'http://www.wellnessinventory.net/Admintour/Index' + parm + '.asp';
			break;
	}

	thiswin = window.open(LinkURL, newwinname, opts );
	thiswin.focus();
	
}

function askDelete( path, strName, delmsg )
{
	var msg = 'Are you sure you want to DELETE\n\n' + strName  + '?' + '\n';
	if (delmsg != '') 
		msg = delmsg ;
		
	if( confirm(msg) )
	{
		path.deleteEntry.value = "yes";
		path.submit();
	}
}

function inValidCharacters(str,charset)
{
	var result = false;
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))>-1)
		{	result = true;
			break;
		}
	return result;
}

function stripscript(theField)	{

	var astr = theField.value;
	astr = astr.replace(/script/gi, '');
	astr = astr.replace(/.js/gi, '');
	astr = astr.replace(/http/gi, '');
	astr = astr.replace(/</g, '');
	astr = astr.replace(/>/g, '');
	theField.value = astr;
}

function logOff( mcode ) 
{	
	var msg='\n           You have been logged off.\n\n You may continue at a later time by clicking on resume test on your Wellness Homepage.\n';
	if (mcode=='r') {
//		msg+= '\n An email reminder will be sent in 7 days\n';
	}	
	alert(msg);
	window.location = path;
}

function NextStep(form) 
{	
	var newUrl = '';
//	alert('0:'+ form.action[0].checked + ' 1:' + form.action[1].checked + ' 2:' + form.action[2].checked + ' 3:' + form.action[3].checked);

	if (form.action[0].checked==true)  {
		newUrl = 'WIResourceCenters.asp?UId='+ form.UId.value ;
		}
	else
	 	if (form.action[1].checked==true) {
			newUrl = 'WIJournal.asp?UId='+ form.UId.value ;			
			}
		else
	 		if (form.action[2].checked==true) {
				newUrl = 'WIStudyCenters.asp??ex=yz&emailType='+ form.emailType.value + '&UId='+ form.UId.value ;
				}
			else {
				newUrl = 'WICheckLogoff.asp?ex=yz&emailType='+ form.emailType.value + '&UId='+ form.UId.value ;
			}
	
	window.location = newUrl;
	return false;
}

function checkanswer(answer,parm1,parm2)
{
	if (eval(answer)==-1) {
		showWin('commentary1',parm1,parm2);	
		qForm.elements['Answer' + parm2].selectedIndex=-1;
	}	
}

function OpenLinkUpdate(LinkType, Id, Prod )
{
	LinkURL = 'EditLinks.asp?LinkType=' + LinkType + '&Id=' + Id + '&Prod=' + Prod;	
	window.open (LinkURL, LinkType, 'scrollbars=1,titlebar=1,status=1,resizable=1,ll;l, height=410, width=804');
}

function findchecked( path,items,testid )
{
	var chk = '';
	for (var i = 0; i < items; i++) {
		 if (path.elements[i].type=='checkbox') 
		 	if (path.elements[i].checked) 
		 		chk+=path.elements[i].value + ",";
	}		
	if (chk=='') 
		alert('Please select at least 1 statement');
	else {
		path.chk.value=chk;
		path.submit();

	}	
}

function checkJournal( path )
{
	var msg = '';
	if (path.SectionId.value == "0")
		 msg += "\n Section" ;
	if ( path.entry.value == "" )
		 msg += '\n New Entry' ;

	if ( msg != "" )	   	
		{	msg = 'Please fill in the following field(s)\n' + msg;
			alert(msg);
			return false;
		}
	else 
		return true;	
}
		 
function checkemail( path, type )
{
	var msg = '';
	if (path.subject.value == "")
		 msg += "\n Subject" ;
	if ( path.mailBody.value == "" )
		 msg += '\n Email Body' ;

	if ( type == 'test' )	{
		if ( path.TestFrom.value == "" )
			 msg += '\n Test email address' ;
		}
	else	{
		if ( path.fromName.value == "" )
			 msg += '\n From Name' ;
		if ( path.fromEmail.value == "" )
			 msg += '\n From Email' ;
	}

	if ( msg != "" )	   	
		{	msg = 'Please fill in the following field(s)\n' + msg;
			alert(msg);
		}
	else {
	 	path.action.value=type;
		window.document.email.submit(); 
	}
}

function checkProfile( path, type )
{
	var msg = '';
	msg += ValidateEmail(path.email.value,'Profile') ;
	if ( path.FirstName.value == "" )
		 msg += '\n First Name' ;
	if ( path.LastName.value == "" )
		 msg += '\n Last Name' ;
	if ( msg != "" )	   	
		{	msg = 'Please fill in the following field(s)\n' + msg;
			alert(msg);
			return false;
		}
	else return true;
}

function checkPlanName( path )
{
	if( path.PlanName.value == "" )
	{
		alert('Please give your Wellness Plan a name');
		return false;
	}
	return true;
}

function checkActionItems( path )
{
	return true;
}

function checkActionSteps(path)
{
	var newfld ='';
	for (var i = 1; i < path.actioncount.value; i++) {
	 	newfld = eval('WellnessName.ActionStep' + i + '.value') ;
		 if (newfld != '') 
		 	return true;
	}		
	alert('Please create at least 1 action step ');
	return false;
}

function checkNotes( path )
{
	if( path.Notes.value == "" )
	{
		alert('Please fill in Notes ');
		return false;
	}
	return true;
}

function checkEntryLogIn( path )
{
	if( path.UserName.value == "" )
	{
		alert('UserName is required');
		return false;
	}
	if( path.password.value == "" )
	{
		alert('Password is required');
		return false;
	}
	return true;
}

function checkNewGrpUser( path )		{

	var	msg = "";
	if ( path.GroupName.value == "" )
		 msg += '\n     -  Group Name' ;
	if ( path.LoginCode.value == "" )
		 msg += '\n     -  Login Code' ;

	if ( msg != "" )	   	
		{	msg = 'Please fill in the following field(s)\n' + msg;
			alert(msg);
			return false
		}
	else {
		return true; 
	}
}

function checkForm (form) {
		msg = "";
		if (form.GroupLoginName.value == "") {
			msg += "\n  Group Login Name is required  ";
			alert(msg);
			return false;
		}
		else return true;
}

function checkCertSignUp(path) {
	var msg = "";
	if ( path.LoginName.value == "")
		 msg += '\n     -  Login Name' ;
	if ( path.CertificationCourseId.value==0)
		 msg += '\n     -  Certification Course' ;
	if ( path.password1.value == "" || path.password2.value == "")
		 msg += '\n     -  Password' ;
	if ( path.password1.value != path.password2.value)
		msg += '\n     -  Passwords do Not match' ;
	else	{
		if ( path.password1.value.length < 6)
			msg += '\n     -  Passwords need to be 6 or more characters long' ;
	}
	if ( msg != "" )	   	
		{	msg = 'Please correct or fill in the following field(s)\n' + msg;
			alert(msg);
			return false
		}
	else {
		return true; 
	}
}
	
function checkAddress(path) {
	var msg = "";
	if (path.FirstName.value == "")
		 msg += '\n     -  First Name' ;
	if ( path.LastName.value == "" )
		 msg += '\n     -  Last Name' ;
	if ( path.Address.value == "" )
		 msg += '\n     -  Address' ;
	if ( path.City.value == "" )
		 msg += '\n     -  City' ;
	if (trim(path.State.value) == "" && (path.Country.value == "USA" || path.Country.value == "Canada" )) 
			msg += "\n     -  State";
	if ( path.ZipCode.value == "" )
		 msg += '\n     -  Zip Code' ;
	if ( path.Country.value == "" )
		 msg += '\n     -  Country' ;
	if ( path.Phone.value == "" )
		 msg += '\n     -  Phone' ;
	if ( path.password1.value == "" || path.password2.value == "")
		 msg += '\n     -  Password' ;
	if ( path.password1.value != path.password2.value)
		msg += '\n     -  Passwords do Not match' ;
	else	{
//		alert ('l:'+ path.password1.value.length);
		if ( path.password1.value.length < 6)
			msg += '\n     -  Passwords need to be 6 or more characters long' ;
	}
	msg += ValidateEmail(path.Email.value,'') ;
	
	if ( path.sut.value > 1){
		if (path.FirstNameG.value == "")
			 msg += '\n     -  Gift to First Name' ;
		if ( path.LastNameG.value == "" )
		 	msg += '\n     -  Gift to Last Name' ;
		msg += ValidateEmail(path.EmailG.value,' Gift to') ;	
		if ( path.FromFirstName.value == "" )
		 	msg += '\n     -  Gift From First Name' ;
		if ( path.FromLastName.value == "" )
		 	msg += '\n     -  Gift From Last Name' ;
		if ( path.GiftNote.value == "" )
		 	msg += '\n     -  Gift Note' ;
	}
	
	if ( msg != "" )	   	
		{	msg = 'Please correct or fill in the following field(s)\n' + msg;
			alert(msg);
			return false
		}
	else {
		return true; 
	}
}

function checkAffiliate(path) {
	var msg = "";
	if (path.AffiliateName.value == "")
		 msg += '\n     -  Affiliate Name' ;
	if (path.AffiliateLoginName.value == "")
		 msg += '\n     -  Affiliate Login Name' ;
	if (path.PayTo.value == "")
		 msg += '\n     -  Pay To Name' ;
	if ( path.TaxId.value == "" )
		 msg += '\n     -  Taxpayer Id' ;
	if ( path.TaxType.value == "" )
		 msg += '\n     -  Taxpayer Id Type' ;
	if ( path.BusinessType.value == "" )
		 msg += '\n     -  Business Type' ;
	if ( msg != "" )	   	
		{	msg = 'Please fill in the following field(s)\n' + msg;
			alert(msg);
			return false
		}
	else return true; 
}

function checkCC(path) {
	var msg = "";
	if (path.FirstName.value == "")
		 msg += '\n     -  First Name' ;
	if ( path.LastName.value == "" )
		 msg += '\n     -  Last Name' ;
	if ( path.Address.value == "" )
		 msg += '\n     -  Address' ;
	if ( path.City.value == "" )
		 msg += '\n     -  City' ;
	if ( path.State.value == "" )
		 msg += '\n     -  State' ;
	if ( path.ZipCode.value == "" )
		 msg += '\n     -  Zip Code' ;
	if ( path.Country.value == "" )
		 msg += '\n     -  Country' ;
	if ( path.Phone.value == "" )
		 msg += '\n     -  Phone' ;

	msg += ValidateEmail(path.Email.value,'') ;

	if ( msg != "" )	   	
		{	msg = 'Please fill in the following field(s)\n' + msg;
			alert(msg);
			return false
		}
	else {
		return true; 
	}
}

function ValidateEmail(em,emtype) {
		if (em == "") 
			return "\n     - " + emtype + " Email Address" ;
		else {
			if (em.length < 6 || em.indexOf('@')==-1 || em.indexOf('@')==0 || em.indexOf('.')==-1) 
				return "\n     -  Invalid " + emtype + " Email Address";
			else
				return '';
		}	
}		

function checkContinue(form) {

	var chk=false;
	for (var i = 0; i < form.elements.length; i++) {
		 if (form.elements[i].type=='radio') 
		 	if (form.elements[i].checked) {
		 		chk=true;
				form.price.value = form.elements[i+1].value;
				}
	}		
	if (chk==false) {
		alert("\n  Please select your wellness plan option ");
		return false;
	}
	else return true;

}

function checkGroup1(form) {

	var msg='';
	if (form.GroupLoginName.value=='')
		 msg += '\n     -  Group Login Name' ;
	if (form.GroupName.value=='')
		 msg += '\n     -  Group Name' ;
	if (form.DemoCatId.value=='0')
		 msg += '\n     -  Business Category' ;
	if ( msg != "" )	   	
		{	msg = 'Please fill in the following field(s)\n' + msg;
			alert(msg);
			return false
		}
	else {
		return true; 
	}
}

function checkNewUser(form) {
	if (form.LoginCode.value == '') {
		alert('Please supply a Login Name');
		return false
	}
	else return true; 
}

function checkStart(form) {
	var msg='';
	if (form.UserName.value == '')
		 msg += "\n     -  User Name" ;
	if (form.Password.value == '') 
		msg += "\n     -  Password";

	if ( msg != "" )	   	
		{	msg = "Please fill in the following field(s)\n" + msg;
			alert(msg);
			return false
		}
	else return true; 
}

function renewal(form) {
	var msg='';
	if (form.UserName.value == '')
		 msg += "\n     -  User Name for Renewal" ;
	if (form.Password.value == '') 
		msg += "\n     -  Password for Renewal";
	if ( msg != "" )	   	
		{	msg = "Please fill in the following field(s)\n" + msg;
			alert(msg);
			return false
		}
	else return true; 
}	


function checkOrder(form)
{	// credit card checks		
	var ccNum = trim(form.CCNumber.value);
	var ccty = form.CCId.value;
	var len = 0; 
	var msg = '';

	if (form.CCId.value == "0")
		 msg += '\n     -  Credit Card Type' ;
	if (form.CId.value == '') 
		msg += "\n      -  Card Verification Code";
	if (ccNum == '') {
		msg += "\n     -  Credit Card Number";
		}
	else {
		if (ccNum.indexOf('-') > 0) {
			msg += "\n     -  No dashes allowed in Credit Card Number";
		}
		if (ccNum.indexOf(' ') > 0) {
			msg += "\n     -  No spaces allowed in Credit Card Number";
		}
		len = 16;
		if (ccty=='3') {
			 len = 15;
		}	 	
		if (ccNum.length != len) 
			msg += "\n     -  Invalid or Inocomplete Credit Card Number"
	}	

	if (msg != "") {
		msg ="\n" +
			 "The following fields must be filled in or corrected\n" +
			 msg + "\n" +
			 "\nPlease re-enter ";
		alert(msg);
		return false;
	}
	else return true;
}
function checkGroupEmail( path )	{

	var msg='';
	msg += ValidateEmail(path.ClientEmails.value,'Client');

	if (msg != "") {
		msg ="\n" +
			 "The following fields must be filled in or corrected\n" +
			 msg + "\n" +
			 "\nPlease re-enter ";
		alert(msg);
		return false;
	}
	else return true;
}

function checkContactMe( path )	
{
	var msg='';

	if ( path.name.value == "" )
		msg += '\n     -  Your Name' ;

	msg += ValidateEmail(path.email.value,'');

	if (msg != "") {
		msg ="\n" +
			 "The following fields must be filled in or corrected\n" +
			 msg + "\n" +
			 "\nPlease re-enter ";
		alert(msg);
		return false;
	}
	else return true;
}

function checkContact( path )	
{
	var msg='';
	if ( path.Name.value == "" )
		msg += '\n     -  Message text' ;

	if ( path.Phone.value == "" )
		msg += '\n     -  Message text' ;

	msg += ValidateEmail(path.Email.value,'');

	if ( path.Message.value == "" )
		msg += '\n     -  Message text' ;

	if (msg != "") {
		msg ="\n" +
			 "The following fields must be filled in or corrected\n" +
			 msg + "\n" +
			 "\nPlease re-enter ";
		alert(msg);
		return false;
	}
	else return true;
}

function checkContact2( path )	
{
	var msg='';

	if (path.ContactType[0].checked==false && path.ContactType[1].checked==false )
		msg += '\n     -  Type Selection' ;

	if ( path.Message.value == "" )
		msg += '\n     -  Message text' ;

	msg += ValidateEmail(path.Email.value,'');

	if (msg != "") {
		msg ="\n" +
			 "The following fields must be filled in or corrected\n" +
			 msg + "\n" +
			 "\nPlease re-enter ";
		alert(msg);
		return false;
	}
	else return true;
}

function startTest(ren,dom)
{
	if (ren==0) {
		showWin('startTest',dom,'');
		alert('Your payment has been accepted\n\nPlease continue your Wellness Inventory signup by creating a username, password and demographic information\n'); 
	}	
	if (ren==1) {
		showWin('homepage',dom,''); 
		alert('Your payment has been accepted\n\nThank You.\n'); 
	}
}

function OrderComplete()
{
	alert('Your payment has been accepted\n\n You have been sent an email with your Login Code and URL. \n\nThank You for signing up to take the Wellness Inventory'); 
}

function setImage(CCId)
{
	var imgpath = '/images/';
	var w = 75;
	var h = 47;
	switch (CCId) {
		case '0':
			var src = imgpath+'cc_A_D_M_V.gif';
			w = 127;
			h = 103;
			break;
		case '1' : 	
			var src = imgpath+'cc_VisaCard.gif';
			break;
		case '2' :
			var src = imgpath+'cc_MasterCard.gif';
			break;
		case '3' :
			var src = imgpath+'cc_AmexCard.gif';
			break;
		case '4' :
			var src = imgpath+'cc_DiscoverCard.gif';
			break;
	}	
	PlaceOrder.ccImage.src=src;
	PlaceOrder.ccImage.height=h;
	PlaceOrder.ccImage.width=w;
}
function ltrim ( s )
{
	return s.replace( /^\s*/, "" );
}

function rtrim ( s )
{
	return s.replace( /\s*$/, "" );
}

function trim ( s )
{
	return rtrim(ltrim(s));
}

function mxCreate(which) {
	var mt = 'mailto';
	var m  = 'info';
	var gu = 'wellpeople';
	var fem = mt + ':' + m + '@' + gu + '.' + 'com';
	document.write("<a href='" + fem + "'>E-mail Customer Support</a>");
}	

function popID(id){
	if(document.getElementById(id).style.display == "none"){
		document.getElementById(id).style.display = "";
		}  
	else {
		document.getElementById(id).style.display = "none";				
		}
	return false;
}

function OpenDelWin(Id,OrderType,nameit)
	{
		url = path + Editpath + 'DeleteOrder.asp?Id=' + Id + '&ot='+OrderType + '&nm=' + nameit;
		window.open(url,'delwin','menubar=0,resizable,location=0,status=0,scrollbars=1,toolbar=0,width=370,height=130');
	}

function getFieldName(theField)
{
	var queryArray;
	var theName;
	queryArray = document.forms[0].query_string.value.split(/[&=]/)
	for (i = 0; i < queryArray.length; i++) 		{
		if (queryArray[i].toLowerCase() == theField)	{
			theName = queryArray[i+1];
		break;
		}
	}
	return theName
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
