
	function doRedirect(sFormName,sElementName,sPageName)
	{
		var iID 
		iID = eval('document.' + sFormName + '.' + sElementName + '.options[document.' + sFormName + '.' + sElementName + '.selectedIndex].value'); 
		if (iID > 0)
		{ 
			eval("document.location.href = '" + sPageName + ".asp?CustomerID=" + iID + "'");
		}
		else
		{
			eval("document.location.href = '" + sPageName + ".asp'");
		}
	}	
	function submitForm(sAction,sFormName)
	{
		eval("document." + sFormName + ".ACTION.value = '" + sAction + "'");
		if (sAction == "DELETE") 
		{
			if (confirm('Delete this record?'))
			{
				eval("document." + sFormName + ".submit()");
			}
		}
		else if (sAction == "SEND") 
		{
			if (confirm('Send this email?'))
			{
				eval("document." + sFormName + ".submit()");
			}
		}
		else
		{
			eval("document." + sFormName + ".submit()");
		}
	}
	function openWindow(sPageName,iHeight,iWidth)
	{
		eval('window.open("' + sPageName + '","theWin","height=' + iHeight + ',width=' + iWidth + ',scrollbars=1,menubar=0,locationbar=0")');
	}
	
	function isDate(dateStr) {
		// ******************************************************************
		// This function accepts a string variable and verifies if it is a
		// proper date or not. It validates format matching either
		// mm-dd-yyyy or mm/dd/yyyy. Then it checks to make sure the month
		// has the proper number of days, based on which month it is.
		// The function returns true if a valid date, false if not.
		// FROM : http://www.bitbucketheaven.com/code/isdate.shtml
		// ******************************************************************
	    var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
	    var matchArray = dateStr.match(datePat); // is the format ok?
	
	    if (matchArray == null) {
	        alert("Please enter date as either mm/dd/yyyy or mm-dd-yyyy.");
	        return false;
	    }
	
	    month = matchArray[1]; // parse date into variables
	    day = matchArray[3];
	    year = matchArray[5];
	
	    if (month < 1 || month > 12) { // check month range
	        alert("Month must be between 1 and 12.");
	        return false;
	    }
	
	    if (day < 1 || day > 31) {
	        alert("Day must be between 1 and 31.");
	        return false;
	    }
	
	    if ((month==4 || month==6 || month==9 || month==11) && day==31) {
	        alert("Month "+month+" doesn't have 31 days!")
	        return false;
	    }
	
	    if (month == 2) { // check for february 29th
	        var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
	        if (day > 29 || (day==29 && !isleap)) {
	            alert("February " + year + " doesn't have " + day + " days!");
	            return false;
	        }
	    }
	    return true; // date is valid
	}	
	function backendToggleOn(sIDName)
	{
		if (document.getElementById(sIDName).style.display=="block")
		{
			document.getElementById(sIDName).style.display="none";
			document.getElementById(sIDName + '_img').src = "./../images/Global/PlusBox_b.gif";
		}
		else
		{
			document.getElementById(sIDName).style.display="block";
			document.getElementById(sIDName + '_img').src = "./../images/Global/MinusBox.gif";
		}
	}
	function isEmail(email) {
	    // ******************************************************************
		// This function accepts a string variable and verifies if it is in
		// the proper format for an e-mail address or not.
		// The function returns true if the format is valid, false if not.
		// From: http://www.bitbucketheaven.com/code/isemail.shtml
		// ******************************************************************
		invalidChars = " ~\'^\`\"*+=\\|][(){}$&!#%/:,;";
	    // Check for null
	    //if (email == "") {
	    //    return true;
	    //}
	    // Check for invalid characters as defined above
	    for (i=0; i<invalidChars.length; i++) {
	        badChar = invalidChars.charAt(i);
	        if (email.indexOf(badChar,0) > -1) {
	            return false;
	        }
	    }
	    lengthOfEmail = email.length;
	    if ((email.charAt(lengthOfEmail - 1) == ".") || (email.charAt(lengthOfEmail - 2) == ".")) {
	        return false;
	    }
	    Pos = email.indexOf("@",1);
	    if (email.charAt(Pos + 1) == ".") {
	        return false;
	    }
	    while ((Pos < lengthOfEmail) && ( Pos != -1)) {
	        Pos = email.indexOf(".",Pos);
	        if (email.charAt(Pos + 1) == ".") {
	            return false;
	        }
	        if (Pos != -1) {
	            Pos++;
	        }
	    }
	    // There must be at least one @ symbol
	    atPos = email.indexOf("@",1);
	    if (atPos == -1) {
	        return false;
	    }
	    // But only ONE @ symbol
	    if (email.indexOf("@",atPos+1) != -1) {
	        return false;
	    }
	    // Also check for at least one period after the @ symbol
	    periodPos = email.indexOf(".",atPos);
	    if (periodPos == -1) {
	        return false;
	    }
	   // if (periodPos+3 > email.length) {
	   //    return false;
	   // }
	    return true;
	}
    
	// Function bookMarkPage
	// Written By: david renz 03/17/2003
	// this function will add a Favorite to a users Internet Explorer browser
	//
	// In: 
	//       sURL                = the link that will go to the selected website
	//       sBookMarkCaption    = the caption that will appear in the users favorites list
	// Out:
	//       none
	// Limitations:
	//       this function will only work for IE 4.0 and better.
	//  Best Use:
	//       Sniff the user browser before adding the link, otherwise the user will get the alert if browser is NS/Mozilla
	//
	function bookMarkPage(sURL,sBookMarkCaption)
	{
	    var url = sURL;
		var caption = sBookMarkCaption
		var ver = navigator.appName
		var num = parseInt(navigator.appVersion)
		if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
		   	window.external.AddFavorite(url,caption);
		}
	    else
	    {
	         alert("We are sorry. Your browser does not support this function.");
	         return false;
	    }  
	}
	
	function returnConfig(sHeight,sWidth) {
			
				/// create the object that we are gonna use for all editor toolbars
				var config = new Object();    // create new config object

				config.width = sWidth;
				config.height = sHeight;
				config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
				config.debug = 0;

				// NOTE:  You can remove any of these blocks and use the default config!

				config.toolbar = [
					['fontname'],
					['fontsize'],
					['fontstyle'],
					['linebreak'],
					['bold','italic','underline','separator'],
			    	['strikethrough','subscript','superscript','separator'],
					['justifyleft','justifycenter','justifyright','separator'],
					['OrderedList','UnOrderedList','Outdent','Indent','separator'],
					['forecolor','backcolor','separator'],
					['HorizontalRule','Createlink','htmlmode','separator'],
					['popupeditor'],
				];

				config.fontnames = {
					"Arial":           "arial, helvetica, sans-serif",
					"Courier New":     "courier new, courier, mono",
					"Georgia":         "Georgia, Times New Roman, Times, Serif",
					"Tahoma":          "Tahoma, Arial, Helvetica, sans-serif",
					"Times New Roman": "times new roman, times, serif",
					"Verdana":         "Verdana, Arial, Helvetica, sans-serif"
				};
				config.fontsizes = {
					"1 (8 pt)":  "1",
					"2 (10 pt)": "2",
					"3 (12 pt)": "3",
					"4 (14 pt)": "4",
					"5 (18 pt)": "5",
					"6 (24 pt)": "6",
					"7 (36 pt)": "7"
				};
				
				config.fontstyles = [{
  						name: "Use no style",
  						className: "bodytext"
					},{
  						name: "bodytext",
  						className: "bodytext"
					},{
  						name: "bodytext_red",
  						className: "bodytext_red"
					},{
  						name: "bodytext_green",
  						className: "bodytext_green"
					},{
  						name: "bodytext_bold",
  						className: "bodytext_bold"
					},{
  						name: "boxheads",
  						className: "boxheads"
					},{
  						name: "bodytext_head",
  						className: "bodytext_head"
					},{
  						name: "bodytext_centered",
  						className: "bodytext_centered"
					},{
  						name: "bodytext_title",
  						className: "bodytext_title"
					},{
  						name: "page_titleCentered",
  						className: "page_titleCentered"
					},{
  						name: "boxheads2",
  						className: "boxheads2"
					},{
  						name: "boxheads_black",
  						className: "boxheads_black"}
					];

				return config;
			
			}