// JavaScript Document

var searchrollover1 = new Image();
searchrollover1.src="images/navbar_full_001a.jpg"
var searchrollover2 = new Image();
searchrollover2.src="images/navbar_full_001aselected.jpg"
var searchrollover3 = new Image();
searchrollover3.src="images/navbar_full_001b.jpg"
var searchrollover4 = new Image();
searchrollover4.src="images/navbar_full_001bselected.jpg"

function validateLogIn(theForm) {
	
	var entry = document.getElementById("fuser").value;
		
	if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'User' field cannot be blank.");
				 return false;
     }
	
	entry = document.getElementById("fpwd").value;
		
	if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Password' field cannot be blank.");
				 return false;
     }
	
	}

function ValidateFeedbackInfo(theForm) {
	
  var entry = document.getElementById("fname").value;
  
  if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Name' field cannot be blank.");
				 return false;
     }
	
  	entry = document.getElementById("femail").value;
  
  if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'E-Mail' field cannot be blank.");
				 return false;
     }
	
  entry = document.getElementById("fsubject").value;
  
  if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Subject' field cannot be blank.");
				 return false;
     }

  entry = document.getElementById("fnotes").value;
  
  if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Notes' field cannot be blank.");
				 return false;
     }

}

function validateNewsLetterData(theForm) {
	
	var entry = document.getElementById("fnewsletter").value;
		
	if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Newsletter' field cannot be blank.");
				 return false;
     }
	
	var mpos = theForm.fnewsletter.value.indexOf("@");
		 
				 if(mpos==-1) {
					alert("Invalid e-mail address. Try again.");
					theForm.fnewsletter.focus();
					return false;
				 }
		 
	mpos = theForm.fnewsletter.value.indexOf(".");
		 
				if(mpos==-1) {
					alert("Invalid e-mail address. Try again.");
					theForm.fnewsletter.focus();
					return false;
	}	
	
		
}

function validateSignUp(theForm) {
	
	var entry = document.getElementById("fuserid").value;
		
	if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'User' field cannot be blank.");
				 return false;
     }
	
	entry = document.getElementById("fpassword").value;
	var entry1 = entry;
	
	if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Password' field cannot be blank.");
				 theForm.fpassword.focus();
				 return false;
     }
	
	if (entry.length < 6)	{
		alert("Your password must have 6 or more characters!");
		return false;
	}
	
	
	var strValidChars = "0123456789"
	var strChar;
	var blnResult;
	
	strChar = entry.substring(0,1);
	
	if (strValidChars.indexOf(strChar) == -1) {
		blnResult = 0;
	}
	else
	{
		blnResult = 1;
	}
	
	if (blnResult == 1) {
		alert("Cannot have a number to begin a password.");
		return false;
	}
	
	blnResult = 0;
	
	for (i=0; i < entry.length; i++)
	  {
		 strChar = entry.charAt(i);
		 if (strValidChars.indexOf(strChar) > 0)
		   {
			 blnResult = 1;
		  }
	  }
	  
	  if (blnResult == 0) {
		alert("You must have at least one number in your password.");
		return false;
	  }
		  
	
	
	
	
	
		
	entry = document.getElementById("fcpassword").value;
	var entry2 = entry;
	
	if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The ' Confirm Password' field cannot be blank.");
				 theForm.fpassword.focus();
				 return false;
     }
	
	if (entry1 != entry2) {
	   alert("The password and confirm password are not the same. Please change now so they match.");
	   return false;
	}
	
	
	
	
	
	entry = document.getElementById("fname").value;
		
	if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Name' field cannot be blank.");
				 theForm.fname.focus();
				 return false;
     }
	
	entry = document.getElementById("fphone").value;
		
	if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Phone' field cannot be blank.");
				 theForm.fphone.focus();
				 return false;
     }

   if((theForm.ffindus.value == 0) || (theForm.ffindus.value == NaN)) {
	alert("How did you find us selection must be selected before submitting data.");
	return false;
	  }
	  
	  
   var chkbox_choices=0;
   for (counter=0;counter<signupform.fservices.length;counter++)
   	{
		if (signupform.fservices[counter].checked)
		   {
			   chkbox_choices = chkbox_choices + 1;
		   }
	}
	
	if(chkbox_choices==0)
	{
		alert("You must select at least one service that you are interested in.");
		return false;
	}
}

function getuserdata(sel,divID)
	{
	
	var entry = sel.options[sel.selectedIndex].value;
	getAJAXdata('ajax/getuser.asp?id=' + entry,divID);
		
	}

function ConvertProjectSubmit(theForm) {

var entry = document.getElementById("fprojectid").value;
			
			if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Project Number' field cannot be blank.");
				 return false;
             }

}

function ConfirmDeleteUser(id) {
	if (confirm("Are you sure you want to delete user at this time?")) {
    		document.location = "deleteuser.asp?id=" + id
      }
}

function ConfirmDeleteRequest(id,rtype) {
	if (confirm("Are you sure you want to delete this request at this time?")) {
    		document.location = "deleterequest.asp?keyid=" + id + "&type=" + rtype;
      }
    
	
}

function validateCheckPassword(theForm) {

var entry = document.getElementById("fpassword").value;
			
			if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Password' field cannot be blank.");
				 return false;
             }

}

function validateCheckEmail(theForm) {

var entry = document.getElementById("fpassword").value;
			
			if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'E-Mail' field cannot be blank.");
				 return false;
             }

}


function getprojectadmindata(sel,divID)
	{
	
	var entry = sel.options[sel.selectedIndex].value;
	getAJAXdata('ajax/getprojectadmin.asp?id=' + entry,divID);
		
	}

function gettransactionadmindata(sel,divID)
	{
	
	var entry = sel.options[sel.selectedIndex].value;
	getAJAXdata('ajax/gettransactionadmin.asp?id=' + entry,divID);
		
	}


function ConfirmDeleteNote(sel) {

var entry = sel.options[sel.selectedIndex].value;

if (confirm("Are you sure you want to delete " + entry + " this request at this time?")) {

    document.location = "deletenote.asp?id=" + entry;
	
}

}

function ConfirmDeleteProject(sel) {

var entry = sel.options[sel.selectedIndex].value;

if (confirm("Are you sure you want to delete this project? If you do, YOU CANNOT RESTORE IT! Proceed with caution.")) {

    document.location = "deleteproject.asp?id=" + entry;
	
}

}

function ConfirmDeleteProjectFile(filename,filepath) {

if (confirm("Are you sure you want to delete file " + filename + "? If you do, YOU CANNOT RESTORE IT! Proceed with caution.")) {

    document.location = "deleteprojectfile.asp?" + filepath;
	
}

}

function ConfirmDeleteAdminFile(filename) {

if (confirm("Are you sure you want to delete file " + filename + "? If you do, YOU CANNOT RESTORE IT! Proceed with caution.")) {

    document.location = "deleteadminfile.asp?file=" + filename;
	
}

}

function ConfirmDeleteTransaction(id) {

if (confirm("Are you sure you want to clear these transactions now?")) {
    document.location = "cleartransaction.asp?id=" + id;
}

}

function ConfirmDeleteFeedBack(id) {

if (confirm("Are you sure you want to clear this feedback entry now?")) {
    document.location = "deletefeedback.asp?id=" + id;
}

}

function validateAlphaNumeric(objEvent)
	  {
       var iKeyCode;
	   var mValid;
	  iKeyCode = objEvent.charCode ? objEvent.charCode : objEvent.keyCode;
	  mValid = 0;
	 	  
      if(iKeyCode>=48 && iKeyCode<=57) {
		  mValid = 1;
	  }
		  
	  if(iKeyCode>=65 && iKeyCode<=90)  {
		  mValid = 1;
	  }
	  
	  if(iKeyCode>=97 && iKeyCode<=122)  {
		  mValid = 1;
	  }
	  
	  if (mValid == 1) {
		   return true;
	  } else {
		   return false;
	  }
		 	     
      }

function ValidatePayPalForm(theForm) {

            var entry = document.getElementById("fprojectdesc").value;
			
			if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Description' field cannot be blank.");
				 return false;
             }
	
	      entry = document.getElementById("fprojectcost").value;
			
			if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Cost' field cannot be blank.");
				 return false;
             }
	
	      entry = document.getElementById("fprojecttax").value;
			
			if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Tax' field cannot be blank.");
				 return false;
             }
	
	      entry = document.getElementById("fprojectshipping").value;
			
			if ((entry.length > 0) && (!entry.match(/^\s*$/))) {
				
			          } else {
				 alert("The 'Shipping' field cannot be blank.");
				 return false;
             }
	
}

function validateMoneyField (objEvent)
	  {
        var iKeyCode;
		iKeyCode = objEvent.charCode ? objEvent.charCode : objEvent.keyCode;
	  if (iKeyCode == 46) return true;
      if(iKeyCode>=48 && iKeyCode<=57) return true;
	  if (iKeyCode == 8) return true;
        return false;
      }

function ConfirmDeleteInvoice(id,keyid,divID) {

if (confirm("Are you sure you want to delete " + id + " at this time?")) {
    document.location = 'deleteinvoice.asp?id=' + id + '&keyid=' + keyid;
}

}


