     

	


if (document.images) {
    company_off = new Image(84,16); company_off.src = "/images/company_off.gif";
    company_on = new Image(84,16); company_on.src = "/images/company_on.gif";

    products_off = new Image(84,16); products_off.src = "/images/products_off.gif";
    products_on = new Image(84,16); products_on.src = "/images/products_on.gif";
    
    support_off = new Image(84,16); support_off.src = "/images/support_off.gif";
    support_on = new Image(84,16); support_on.src = "/images/support_on.gif";
    
    resources_off = new Image(84,16); resources_off.src = "/images/resources_off.gif";
    resources_on = new Image(84,16); resources_on.src = "/images/resources_on.gif";
    
    events_off = new Image(84,16); events_off.src = "/images/events_off.gif";
    events_on = new Image(84,16); events_on.src = "/images/events_on.gif";
	
	webservices_off = new Image(84,16); webservices_off.src = "/images/webservices_off.gif";
    webservices_on = new Image(84,16); webservices_on.src = "/images/webservices_on.gif";
	
	contact_off = new Image(75,16); contact_off.src = "/images/contact_off.gif";
	contact_on = new Image(75,16); contact_on.src = "/images/contact_on.gif";
}

/* Function that swaps images. */
function di20(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

/* Functions that track and set toggle group button states. */
function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}

function deleteAgenda(intEventAgendaID,intEventID) {
    location.href="deleteagenda.asp?EventAgendaID=" + intEventAgendaID + "&EventID=" + intEventID;
}

function deleteDates(strEventBeginDate,strEventEndDate,intEventID) {
    location.href="deletedate.asp?EventBeginDate=" + strEventBeginDate + "&EventEndDate=" + strEventEndDate + "&EventID=" + intEventID;
}

function confirmReset() {
    if (confirm('Are you sure you want to clear all form values?')) {
        return true;
    } else {
        return false;
    }
}

function emailCheck(emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);
if (matchArray==null) {
	alert("Email address seems incorrect (check @ and .'s)");
	return false;
}
var user=matchArray[1];
var domain=matchArray[2];
if (user.match(userPat)==null) {
    alert("The username doesn't seem to be valid.")
    return false;
}
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!");
		return false;
	    }
    }
    return true;
}
var domainArray=domain.match(domainPat);
if (domainArray==null) {
	alert("The domain name doesn't seem to be valid.");
    return false;
}
var atomPat=new RegExp(atom,"g");
var domArr=domain.match(atomPat);
var len=domArr.length;
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>4) {
   alert("Invalid domain group. Must be like 'com', 'net', 'org', 'info', or a two character country code.");
   return false;
}
if (len<2) {
   var errStr="This address is missing a hostname!";
   alert(errStr);
   return false;
}
return true;
}

function checkLogin(emailStr) {
    if (document.update.intCnID.checked == false) {
        alert('You must select a contact listed on this page.');
        return false;
    }
    return emailCheck(emailStr);
}

function checkPass() {
	if (document.login.password.value == '') {
		alert('You must enter a password.');
       	return false;
   	} else {
		return true;
    }
}

function checkUpdatePass() {
    if (document.update.password.value == '') {
        alert('You must enter a password.');
        return false;
    } else {
        return true;
    }
}

function checkContact(emailStr) {
    if (document.contact.strName.value == '') {
        alert('You must enter your name.');
        return false;
    }
    if (document.contact.strCompany.value == '') {
        alert('You must enter your company name.');
        return false;
    }
    if (document.contact.strCity.value == '') {
        alert('You must enter your city.');
        return false;
    }
    if (document.contact.strZipcode.value == '') {
        alert('You must enter your zipcode.');
        return false;
    }
    if (document.contact.strPhone.value == '') {
        alert('You must enter your phone number.');
        return false;
    }
    return emailCheck(emailStr);
}

function checkKBSearch() {
    if (document.search.intProductID.value == 1 && document.search.intKBCatID.value == 1 && document.search.keywords.value == '') {
        alert('You must choose either a product, a category or at least one keyword, or a combination of those parameters, to conduct a search.\n\nIf you wish to search based on all products and all categories, you must enter at least one keyword.');
        return false;
    } else {
        return true;
    }
}

function newScreenShotWin(img) {
	var imgpath = "screen.asp?img=" + img;
	window.open(imgpath,"screenshot","toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes, resizable=yes");
}

function checkFirstLast(obj) {
	if (obj.firstname.value == '' && obj.lastname.value == '') {
		alert('You must enter at least part of a first or last name. You cannot leave both fields blank.');
		return false;
	} else {
		return true;
	}
}

function checkUploadFileDelete(fileid) {
	if (confirm('Are you sure you want to delete this file?') == true){
		location.href = 'delete.asp?fileid=' + fileid;
		return true;
	} else {
		return false;
	}
}

function slideShowWin() {
	window.open("132slideshow.asp","slideshow","width=760, height=550, toolbar=no, location=no, directories=no, menubar=no, scrollbars=yes, resizable=yes");
}

/*function for DPIAdmin/events/appendagendaitem.asp file(Bret-2/27/2002)*/
function CheckAgendaItem(){
	var strTemp; 
	var strError; 
	var strMessage; 
	
	strError = "";
	strMessage = "Please complete the following fields, then click the 'Save Agenda Item' button\n\n";
	
	strTemp = document.frmMain.intDay.value;
	if (strTemp.length == 0){
		strError = "Day\n";
	}
	
	strTemp = document.frmMain.strItemName.value;
	if (strTemp.length == 0){
		strError += "Item\n";
	}
	
	if (strError.length == 0){
		document.frmMain.submit();
	} else {
		strMessage += strError;
		alert(strMessage);
	}
}

/*function for DPIAdmin/events/appenddate.asp file(Bret-2/27/2002)*/
function CheckEventDates(){
	var strBeginDate;
	var strEndDate;
	var strError;
	var strMessage;
	
	strBeginDate = document.frmMain.txtBeginDate.value;
	strEndDate = document.frmMain.txtEndDate.value;
	strError = "";
	strMessage = "The following date(s) is/are not valid:\n\n";
		
	if(!IsDate(strBeginDate)){
		strError = "Begin Date\n";
	}
	if(!IsDate(strEndDate)){
		strError += "End Date\n";
	}
	if(strError.length == 0){
		if (CompareDates(strBeginDate, strEndDate)){
			document.frmMain.submit();
		} else {
			strError = 'Please enter a stop date equal to or later than the start date!';
			alert(strError);
		}
	} else {
		strMessage += strError;
		alert(strMessage);
	}
}

/*general function for validating dates(Bret-2/27/2002)*/
/*checks to see if the date is in the following format: mm/dd/yy,mm-dd-yy,mm/dd/yyyy, or mm-dd-yyyy*/
function IsDate(strDate){
	var blnValid;
	var intNewPosition;
	var intOldPosition;
	var intLastPosition;
	var strTemp;
	var intTemp;
	var strDivider;

	blnValid = true;	

	/*if the string does not contain either a "-" or a "/" then this will not be a valid date no matter what*/
	intPosition = strDate.indexOf("/", 0);
	if(intPosition > 0){
		strDivider = "/";
	} else {
		intPosition = strDate.indexOf("-", 0);
		if(intPosition > 0){
			strDivider = "-";
		} else {
			blnValid = false;
		}
	}
	
	if(blnValid){		
		/*1. get the month*/
		/*return the position of the first divider*/
		intNewPosition = strDate.indexOf(strDivider, 0);
		/*return the string before the first divider("01/" or "01-")*/
		strTemp = strDate.substring(0, intNewPosition);
		/*save the current divider position to intOldPosition and increment by 1*/
		intOldPosition = intNewPosition + 1;
		/*convert the string to an integer*/
		intTemp = strTemp;
		/*verify the month is <= 12*/
		if(!(intTemp > 0 && intTemp <= 12)){
			blnValid = false;
		}
							
		/*2. get the day*/
		/*return the position of the second divider*/
		intNewPosition = strDate.indexOf(strDivider, intOldPosition);
		/*return the string between the first and second dividers("/01/" or "-01-")*/
		strTemp = strDate.substring(intOldPosition, intNewPosition);
		/*save the current divider position to intOldPosition and increment by 1*/
		intOldPosition = intNewPosition + 1;
		/*convert the string to an integer*/
		intTemp = strTemp;
		/*verify the day is <= 31*/
		if(!(intTemp > 0 && intTemp <= 31)){
			blnValid = false;
		}
						
		/*3. get the year*/
		/*return the length of the string*/
		intLastPosition = strDate.length;
 		/*return the string after the second slash("/2000" or "-2000")*/
		strTemp = strDate.substring(intOldPosition, intLastPosition);
		/*convert the string to an integer*/
		intTemp = strTemp;
		/*check to see if the year is between 1 and 99*/
		if(!(intTemp >= 0 && intTemp <= 99)){
			/*check to see if the year is between 1900 and 9999*/
			if(!(intTemp >= 1900 && intTemp <= 9999)){
				blnValid = false;
			}
		}
	}
					
	return blnValid;
	}
	
//compares a start date with an stop date------------------------
//returns true if start date if before the stop date-------------
//returns false if the start date is after the stop date---------
function CompareDates(dtmStartDate, dtmStopDate){
	var dtmStart = new Date(dtmStartDate);
	var dtmStop = new Date(dtmStopDate);
	var intStartDay = dtmStart.getDate();
	var intStartMonth = dtmStart.getMonth();
	var intStartYear = dtmStart.getYear();
	var intStopDay = dtmStop.getDate();
	var intStopMonth = dtmStop.getMonth();
	var intStopYear = dtmStop.getYear();
		
	//if the stop year is greater than or equal to the start year, then return true
	if (intStopYear >= intStartYear){
		//if the stop month is equal to the start month, then compare the days
		if (intStopMonth == intStartMonth){
			//if the stop day is greater than or equal to the start day, then return true
			if (intStopDay >= intStartDay){
				return true;
			} else {
				return false;
			}
		} else {
			if (intStopMonth >= intStartMonth){
				return true;
			} else {
				return false;
			}
		}
	} else {
		return false;
	}
}
//---------------------------------------------------------------
	
/*function for confirming deletions from the database(Bret-3/1/2002)*/
function PromptDelete(strIDName, intID){
	var strMessage;
	var strLocation;
	
	strMessage = "CONFIRM DELETE\n\n"
	strMessage += "Are you sure you want to DELETE this item?";
	strLocation = "delete.asp?" + strIDName + "=" + intID
	if(confirm(strMessage)){
		location.href = strLocation;				
	}
}

function openwindow(){
	window.open("eftprocess.htm", "" , "width=650,height=450,toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no");
}
	
// ------------------------------------------

/* function to expand/collaps ares on web page - click on plus/minus */
function expanderClick(poImg, poDiv, pcName) {
	var imgsrc = poImg.src;
	var llExpand = (poImg.src.indexOf('/plus.gif') >= 0  ? true : false);
	
	if (llExpand) {
		var i = 1;
		var lcDiv = pcName + '_' + i;
		var lcImg;
		
		do {
			lcImg = 'img'+lcDiv;
			document.all.item(lcImg).src = '/images/plus.gif';
			document.all.item(lcDiv).style.display = 'none';
			
			i++;
			lcDiv = pcName + '_' + i;
		} while (document.all.item(lcDiv) != null);		
	}

	poImg.src = '/images/' + (llExpand  ? 'minus.gif' : 'plus.gif');
	poDiv.style.display = (llExpand ? '' : 'none');
}

function GetDownload(p_id1, p_id2, p_fn, p_fd){
	var strURL = 'getdownload.asp?id1=' + p_id1 + '&id2=' + p_id2 + '&fn=' + p_fn + '&fd=' + p_fd;
	window.location.href = strURL;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
