<!-- hide script from old browsers

//	Vaughan Family Enterprise
//	Copyright 2004
//
//	wimps.js
//
//	Javascript file for Site
//
//	Revision History
//	29Jul04 - BAV	- Original
//

function Breakout(pname) {
	if (top.location != location) {
		top.location.href = pname;
	}
}

function PopUp(PName,WName,WinAt) {
	if (WinAt==1) {
		var WAttrib = 'titlebar=0,scrollbars=1,width=300,height=400';
	}
	if (WinAt==2) {
		var WAttrib = 'titlebar=0,scrollbars=1,width=700,height=300,resizable=1';
	}
	var page=PName;
	newWin=window.open(page, WName, WAttrib);
	newWin.focus();
}

//*****************************************	 
//Functions to support navigation menu
//*****************************************	 

var btnLastClass = null;
var btnLastFontColor = null;

function btnUp(oFrom){
	btnLastClass = oFrom.className;
	oFrom.className = "navDown";	
}

function btnHide(oFrom){
	oFrom.className = btnLastClass;
}

function btnDown(oFrom){
	oFrom.className = "navUp";	
}

//*****************************************	 
//End functions to support navigation menu
//*****************************************	 


function CustReset() {
	document.f.bolReset.value=1;
	document.f.CustNum.value="";
	document.f.CustNumSel.value="";
	document.f.submit();
}


function CheckNewReq(form) {
	var checkok = 1;
	var errmes="";
	if (form.selShipTo.value==0) {
		errmes="You must enter a Ship To Location\n";
		checkok=0;
	}
	if (form.selDept.value==0) {
		errmes=errmes+"You must enter a Dept\n";
		checkok=0;
	}
	if (form.selAcct.value==0) {
		errmes=errmes+"You must enter an Account\n";
		checkok=0;
	}
	if (form.txtAttn.value=="") {
		errmes=errmes+"You must enter an Attention To\n";
		checkok=0;
	}
	if (form.txtComment.value=="") {
		errmes=errmes+"You must enter a Comment\n";
		checkok=0;
	}
	if (checkok==1) {
		return true;
	} else {
		alert (errmes)
		return false;
	}
}

function CheckEditReq(form) {
	var checkok = 1;
	var errmes="";
	if (form.selShipTo.value==0) {
		errmes="You must enter a Ship To Location\n";
		checkok=0;
	}
	if (form.selDept.value==0) {
		errmes=errmes+"You must enter a Dept\n";
		checkok=0;
	}
	if (form.selAcct.value==0) {
		errmes=errmes+"You must enter an Account\n";
		checkok=0;
	}
	if (form.txtAttn.value=="") {
		errmes=errmes+"You must enter an Attention To\n";
		checkok=0;
	}
	if (form.txtComment.value=="") {
		errmes=errmes+"You must enter a Comment\n";
		checkok=0;
	}
	if (checkok==1) {
		return true;
	} else {
		alert (errmes)
		return false;
	}
}

function CheckUnSubReq() {
	var checkok = 1;
	var errmes="";
	if (document.fUnSubReq.COID.value==0) {
		errmes="You must select a requisition.\n";
		checkok=0;
	}
	if (checkok==1) {
		return true;
	} else {
		alert (errmes)
		return false;
	}
}

function CheckItemAdd(form) {
	var checkok = 1;
	var errmes="";
	if (form.txtPN.value=="" && form.txtDesc.value=="") {
		errmes=errmes+"You must enter a PN and/or Desc\n";
		checkok=0;
	}
	if (form.txtQty.value=="") {
		errmes=errmes+"You must enter a Qty\n";
		checkok=0;
	}
	if (form.selDept.value==0) {
		errmes=errmes+"You must enter a Dept\n";
		checkok=0;
	}
	if (form.selAcct.value==0) {
		errmes=errmes+"You must enter an Account\n";
		checkok=0;
	}
	if (checkok==1) {
		return true;
	} else {
		alert (errmes)
		return false;
	}
}

function ShowInv(which) {
	elmVisible = document.getElementById(which);
	if (elmVisible.style.visibility=="hidden") {
		elmVisible.style.visibility="visible";
	} else {
		elmVisible.style.visibility="hidden";
	}
	
}

//*****************************************	 
//Check for cookies enabled
//*****************************************	 


function cc()
{
 /* check for a cookie */
  if (document.cookie == "") 
  {
    /* if a cookie is not found - alert user -
     change cookieexists field value to false */
    alert("COOKIES need to be enabled!");

    /* If the user has Cookies disabled an alert will let him know 
        that cookies need to be enabled to log on.*/ 

    document.Login.cookieexists.value ="false"  
  } else {
   /* this sets the value to true and nothing else will happen,
       the user will be able to log on*/
    document.Login.cookieexists.value ="true"
  }
}

function setEvents() {

	var retval = "";
	var objChild;                           // Window
	var reWork = new RegExp('object','gi');	// Regular expression

	try {
		objChild = window.open('','child','width=1,height=1,status=no,resizable=no'); 
		objChild.close();
	}
	catch(e) { }

	if(!reWork.test(String(objChild)))
		retval = ' - A pop-up blocker is enabled for this site!\n';
	else
//		retval = ' - No pop-up blocker or pop-up blocker is disabled!\n';

	expdate = "Thu, 01-Jan-70 00:00:01 GMT"; 
	document.cookie = "Enabled=true"; 
	var cookieValid = document.cookie; 
 
	if( cookieValid.indexOf( "Enabled=true" ) != -1 ) { 
		cookiesEnabled = true; 
	} else { 
		cookiesEnabled = false; 
	} 
	document.cookie = "Enabled=" + ";expires=" + expdate; 
 
 	if( cookiesEnabled ) { 
//	        retval = retval + " - Cookies are enabled!\n"; 
	} else { 
	        retval = retval + " - Cookies are disabled!\n"; 
	} 
	if (retval) {
		alert("Errors Detected:\n" + retval + "\nBefore you can log into this site, you must first fix the problem(s) listed above."); 
		document.Login.cookieexists.value = "false";
	} else {
//		alert("Setting Cookie");
		document.Login.cookieexists.value = "true";

	}
}

function setPDAEvents() {

	var retval = "";

	expdate = "Thu, 01-Jan-70 00:00:01 GMT"; 
	document.cookie = "Enabled=true"; 
	var cookieValid = document.cookie; 
 
	if( cookieValid.indexOf( "Enabled=true" ) != -1 ) { 
		cookiesEnabled = true; 
	} else { 
		cookiesEnabled = false; 
	} 
	document.cookie = "Enabled=" + ";expires=" + expdate; 
 
 	if( cookiesEnabled ) { 
//	        retval = retval + " - Cookies are enabled!\n"; 
	} else { 
	        retval = retval + " - Cookies are disabled!\n"; 
	} 
	if (retval) {
		alert("Errors Detected:\n" + retval + "\nBefore you can log into this site, you must first fix the problem(s) listed above."); 
		document.Login.cookieexists.value = "false";
	} else {
//		alert("Setting Cookie");
		document.Login.cookieexists.value = "true";

	}
}

function CheckValidNum(num) {
	if (isNaN(num)) {
		alert ("You must enter a valid number in this field");
		return false;
	}
	return true;
}

function CheckValidAcct(num,accts) {
//	var arrAccts = split(accts,"|");
//	alert (accts == num);
//	if (isNaN(num)) {
//		alert ("You must enter a valid GL/Acct number"+accts);
//		return false;
//	}
	return true;
}
	
function CheckAddVend(form) {
	tmpName = form.txtVendName.value
	if (tmpName == "") {
		alert ("You need to enter a vendor short name");
		return false;
	}
	return true;
}

function CheckContact(value) {
	tmpName = document.frmContact.txtEmail.value;
	if (tmpName == "" && value==1) {
		alert ("You need to enter an e-Mail address first.");
		return false;
	}
	return true;
}

function CheckAddContact(form) {
	tmpFirstName = form.txtFirstName.value
	tmpLastName = form.txtLastName.value
	if (tmpFirstName == "" && tmpLastName == "") {
		alert ("You need to enter a complete name");
		return false;
	}
	return true;
}

function CheckNewUser(form) {
	tmpFirstName = form.txtFName.value
	tmpLastName = form.txtLName.value
	if (tmpFirstName == "" || tmpLastName == "") {
		alert ("You need to enter a complete name");
		return false;
	}
	tmpEmail = form.txtEMail.value
	if (tmpEmail == "") {
		alert ("You need to enter an e-Mail address");
		return false;
	}
	tmpPW = form.txtPW.value
	if (tmpPW == "") {
		alert ("You need to enter a temporary Password");
		return false;
	}
	intPWLen = tmpPW.length;
	if (tmpPW != "" && parseInt(intPWLen)<6) {
		alert ("You need to enter Password with a minimum of 6 characters");
		return false;
	}
	tmpPWC = form.txtPWC.value
	if (tmpPW != tmpPWC) {
		alert ("Passwords don\'t match, please re-enter and try again.");
		return false;
	}
	if (form.txtActive.checked==false) {
		alert ("PLEASE NOTE\n\n"+tmpFirstName+" "+tmpLastName+" has not been activated, edit to activate");
	}
	return true;
}

function ResetPO() {
	if (confirm("******************************\n                     ALERT\n******************************\n\nThis will reset ALL Customer PO Numbers back to 1\n\nThis should be done at the beginning of the year only.\n\nOK to RESET")==true) {
		return true;
	}
	return false;
}

function CheckCustRecv(form) {
	strPSNum = form.txtPSNum.value;
	if (strPSNum == "") {
		alert ("Packing Slip # missing");
		form.txtPSNum.focus();
		return false;
	}
	return true;
}

function ChangeEmpImage(elm) {
	f1.txtSign.value = elm;
}

function CustRecvAll(form) {
	intLen = form.length
	for (i = 0; i < intLen; i++) {
		str = form.elements[i].name
		if (str.substring(0,2) == "BO") {
			qtyID = "txtQty" + str.substring(2,str.length);
			BOQty = form.elements[i].value;
//			alert(form[qtyID].value);
			form[qtyID].value = BOQty;
		}
	}
}

function ClearLoad() {
	document.getElementById("Loading").style.visibility = "hidden";
}

// end hiding script from old browsers -->

 
