document.onmousedown = rtclicknocopy

window.defaultStatus ="Landwealth Financing Company, Inc...for investments with HIGHER interest rates!" 

var mymessage = "PLEASE RESPECT INTELLECTUAL PROPERTY. The contents of this site, including the scripts, written materials, graphics and audio files, are COPYRIGHT PROTECTED. Please do not copy and post its contents, in part or in whole, on ANY commercial, non-profit, or personal website and other similar media. Thank you.";

function rtclicknocopy(keyp){
  if (navigator.appName == "Netscape" && keyp.which == 3) {
    alert(mymessage);
    return false;
  }

  if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) {
    alert(mymessage);
    return false;
  }
}

// pop-up window for printing 
function openNewWindow(URL,winName,features) {
  window.open(URL,winName,features);
}

//function to validate numeric entry
function validNum(item,label,max,min,sint) {

   if (isNaN(item.value)) 
      {errorAlert(item,"INVALID: "+label+" Must Be Numeric"); }

   if (item.value > max) 
      {errorAlert(item,"INVALID: "+label+" Exceeds Maximum Allowable Value"); }
 
   if (item.value < min) 
      {errorAlert(item,"INVALID: "+label+" Is Below Minimum Allowable Value"); }

   if (sint=="yes") {
      // convert to integer
      item.value=Math.round(item.value); 
   }
} 

//function to validate credit card entry
function validCard(item,label,max,min) {
   msgError = " Is Not A Valid Card Number";

   if (isNaN(item.value)) 
      {errorAlert(item,"INVALID: "+label+msgError); }

   if (item.value > max) 
      {errorAlert(item,"INVALID: "+label+msgError); }
 
   if (item.value < min) 
      {errorAlert(item,"INVALID: "+label+msgError); }
} 


//function to validate date using select data entry
function validDate2(month,day,year,msg) {
   var invalid = 'n'; 

   if (((month==4 || month==6 || month==9 || month==11) && day>30)) 
      {invalid = 'y';}
   else
      {if (day>31) invalid='y';}
   
   if ((month==2 && (year/4)==0 && day>29) || (month==2 && (year/4)!=0 && day>28)) 
      invalid = 'y'; 
   
   if (invalid=='y')
      errorAlert2("INVALID: "+msg);
}


//function to validate blank entry
function validBlank(item) {
   return (item.length > 0);
}

//function to compare values
function validPassword(pass1,pass2) {
   return (pass1 == pass2);
}

//function to validate an email address
function validEmail(item) {
   var wAt=item.indexOf ('@')
   // if without @ or at start
   if (wAt== -1 || wAt== 0) return false;
   return true;
}

//function to validate radio buttons
function validRadio(item) {
   var wChk = -1
   for (i=0; i<item.length;i++) {
		if (item[i].checked) {
			wChk = i
	    }
   }
   if (wChk==-1) return false;
   return true;
}

//function to determine checked radio button
function chkRadio(item) {
   var wChk = -1
   for (i=0; i<item.length;i++) {
		if (item[i].checked) {
			wChk = i
	    }
   }
   return wChk;
}

//function to un-check radio buttons
function unchkRadio(item) {
   for (i=0; i<item.length;i++) {
		if (item[i].checked) {
			item[i].checked=false
	    }
   }
}

// display an error alert and return to erroneous data
function errorAlert(elem, text) {
   // abort if we already found an error, one error handling at a time
   if (errFound) return;
   window.alert(text);
   elem.select();
   elem.focus();

   errFound = true;
}

// display an error alert for radio buttons
function errorAlert2(text) {
   // abort if we already found an error, one error handling at a time
   if (errFound) return;
   window.alert(text);

   errFound = true;
}

//global variable for error flag
var errFound = false;

// main validation function


function validBookApptForm(bookapptForm) {
	errFound = false;
	// blank
	if (!validBlank(document.bookapptForm.car_apptdate.value))
		errorAlert(document.bookapptForm.car_apptdate,"INVALID: Appointment Date Must Be Specified");
	if (!validBlank(document.bookapptForm.firstname.value))
		errorAlert(document.bookapptForm.firstname,"INVALID: First Name Must Be Specified");
	if (!validBlank(document.bookapptForm.lastname.value))
		errorAlert(document.bookapptForm.lastname,"INVALID: Last Name Must Be Specified");
	if (!validBlank(document.bookapptForm.phones.value) && !validBlank(document.bookapptForm.fax.value) && !validBlank(document.bookapptForm.email.value) && !validBlank(document.bookapptForm.cell.value))
		errorAlert(document.bookapptForm.phones,"INVALID: At Least One Contact Information Must Be Provided.");

	return !errFound; /* true if there are no errors */
}

