
	
	var alertmsg = ""
		
	//******************************************************************************************
	//******************************************************************************************
	
	function fnCheckProfile(form) {
		if (form.txtName.value == "") {
			alertmsg = alertmsg + ("- your NAME is required\n")
		}
		if (form.txtOrganization.value == "") {
			alertmsg = alertmsg + ("- your ORGANIZATION is required\n")
		}
		if (form.txtEmail_Address.value == "") {
			alertmsg = alertmsg + ("- your EMAIL ADDRESS is required\n")
		}
		if (form.txtIndustry.value == "") {
			alertmsg = alertmsg + ("- your INDUSTRY is required\n")
		} else if (form.txtIndustry.value == "Other" && form.txtIndustry_Other.value == "") {
			alertmsg = alertmsg + ("- please specify your non-listed INDUSTRY\n")
		}
		if (form.txtRepresentative_Clients.value == "") {
			alertmsg = alertmsg + ("- your REPRESENTATIVE CLIENTS are required\n")
		}
		if (form.txtNumber_in_Firm.value == "") {
			alertmsg = alertmsg + ("- your EMPLOYEE TOTAL is required\n")
		}
		if (form.txtGeneral_Location.value == "") {
			alertmsg = alertmsg + ("- your GENERAL LOCATION is required\n")
		}
		if (form.txtReason.value == "") {
			alertmsg = alertmsg + ("- your BIG REASON is required\n")
		}
		if (form.txtAddress.value == "") {
			alertmsg = alertmsg + ("- your ADDRESS is required\n")
		}
		if (form.txtCity.value == "") {
			alertmsg = alertmsg + ("- your CITY is required\n")
		}
		if (form.txtState.value == "") {
			alertmsg = alertmsg + ("- your STATE is required\n")
		}
		if (form.txtZip.value == "") {
			alertmsg = alertmsg + ("- your ZIP is required\n")
		}
		if (form.txtPhone_Number.value == "") {
			alertmsg = alertmsg + ("- your PHONE NUMBER is required\n")
		}
		if (form.txtCompany_Overview.value == "") {
			alertmsg = alertmsg + ("- your COMPANY OVERVIEW is required\n")
		}
		if (form.txtWhat_Makes_Us_Special.value == "") {
			alertmsg = alertmsg + ("- your SPECIALTY is required\n")
		}
		if (alertmsg!="") {
			alert("Incorrect Information: \n\n" + alertmsg + "\nPlease return to the form and correct your information.\n\nThank You.\n")
			alertmsg = ""
			return false
			}
		return true;
		}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function fnCheckApplication(form) {
		if (form.txtName.value == "") {
			alertmsg = alertmsg + ("- your NAME is required\n")
		}
		if (form.txtOrganization.value == "") {
			alertmsg = alertmsg + ("- your ORGANIZATION is required\n")
		}
		if (form.txtEmail_Address.value == "") {
			alertmsg = alertmsg + ("- your EMAIL ADDRESS is required\n")
		}
		if (form.txtIndustry.value == "") {
			alertmsg = alertmsg + ("- your INDUSTRY is required\n")
		} else if (form.txtIndustry.value == "Other" && form.txtIndustry_Other.value == "") {
			alertmsg = alertmsg + ("- please specify your non-listed INDUSTRY\n")
		}
		if (form.txtRepresentative_Clients.value == "") {
			alertmsg = alertmsg + ("- your REPRESENTATIVE CLIENTS are required\n")
		}
		if (form.txtNumber_in_Firm.value == "") {
			alertmsg = alertmsg + ("- your EMPLOYEE TOTAL is required\n")
		}
		if (form.txtGeneral_Location.value == "") {
			alertmsg = alertmsg + ("- your GENERAL LOCATION is required\n")
		}
		if (form.txtReason.value == "") {
			alertmsg = alertmsg + ("- your BIG REASON is required\n")
		}
		if (alertmsg!="") {
			alert("Incorrect Information: \n\n" + alertmsg + "\nPlease return to the form and correct your information.\n\nThank You.\n")
			alertmsg = ""
			return false
			} else {
			var emailStr = form.txtEmail_Address.value
			return emailCheck(emailStr);
		}
		return true;
		}
		
		
	//******************************************************************************************
	//******************************************************************************************
	
	function fnCheckLogin(form) {
		if (form.txtLoginID.value == "") {
			alertmsg = alertmsg + ("- your LOGIN ID is required\n")
		}
		if (form.txtPassword.value == "") {
			alertmsg = alertmsg + ("- your PASSWORD is required\n")
		}
		if (alertmsg!="") {
			alert("Incorrect Information: \n\n" + alertmsg + "\nPlease return to the form and correct your information.\n\nThank You.\n")
			alertmsg = ""
			return false
			}
		return true;
		}
		
		
	//******************************************************************************************
	//******************************************************************************************
	
	function fnCheckTellAFriend(form) {
		if (form.txtEmail_Address.value == "") {
			alertmsg = alertmsg + ("- your EMAIL ADDRESS is required\n")
		}
		if (form.txtEmail_Address1.value == "" && form.txtEmail_Address2.value == "" && form.txtEmail_Address3.value == "") {
			alertmsg = alertmsg + ("- at LEAST ONE RECIPIENT is required\n")
		}
		if (form.txtEmail_Subject.value == "") {
			alertmsg = alertmsg + ("- an EMAIL SUBJECT is required\n")
		}
		if (alertmsg!="") {
			alert("Incorrect Information: \n\n" + alertmsg + "\nPlease return to the form and correct your information.\n\nThank You.\n")
			alertmsg = ""
			return false
			} else {
			var emailStr = form.txtEmail_Address.value
			return emailCheck(emailStr);
		}
		return true;
		}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function fnOpenDaughterWindow(strFileName,strName)
		{
			newWindow = window.open(strFileName,"newWindow","top=40, left=40, toolbar=0,menubar=1,status=0,scrollbars=0,width=420,height=420,resizable")
		}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function fnEmptyValue(name) {
		if (document.form[name].value == document.form[name].defaultValue) {
			document.form[name].value = ""
			alert('Incorrect Information: ' + name + ' is empty.')
			return false;
		}
	}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function fnCheckValue(name,type) {
		if (document.form[name].value != document.form[name].defaultValue && document.form[name].value != "") {
			//place code here to check value based on type
			if (type == 'email') {
				var emailStr = document.form[name].value
				return isEmail(emailStr,document.form[name])
			}
		}
		else
		{
			document.form[name].value = document.form[name].defaultValue
			fnEmptyValue(name);
			return false;
		}
	}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function validate(form) {
		if (isBlank(document.form.txtLogin.value)) {
			alert("Please enter a Login ID.");
			document.form.txtLogin.focus();
			return false;
		}
		if (isBlank(document.form.txtPassword.value)) {
			alert("Please enter your password.");
			document.form.txtPassword.focus();
			return false;
		}
		return true;
	}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function emailCheck(emailStr) {

		var checkTLD=1;
		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|us|uk|tv|ca|sw|nz|au)$/;
		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("Incorrect email syntax: check @ and .'s");
		return false;
		}
		var user=matchArray[1];
		var domain=matchArray[2];
		
		
		for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
		alert("Incorrect email syntax: username contains invalid characters.");
		return false;
		   }
		}
		for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
		alert("Incorrect email syntax: domain name contains invalid characters.");
		return false;
		   }
		}
		if (user.match(userPat)==null) {
		alert("Incorrect email syntax: 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("Incorrect email syntax: destination IP address is invalid!");
		return false;
		   }
		}
		return true;
		}
		
		var atomPat=new RegExp("^" + atom + "$");
		var domArr=domain.split(".");
		var len=domArr.length;
		for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
		alert("Incorrect email syntax: domain name does not seem to be valid.");
		return false;
		   }
		}
		var domaintext = domArr[domArr.length-1];
		domaintext = (domaintext.toLowerCase());
		if (checkTLD && domArr[domArr.length-1].length!=2 && domaintext.search(knownDomsPat)==-1) {
		alert("Incorrect email syntax: address must end in a well-known domain or two letter " + "country.");
		return false;
		}
		
		if (len<2) {
		alert("Incorrect email syntax: address is missing a hostname!");
		return false;
		}
		
		return true;
		}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function checkHMRebate(form) {
		if (form.FirstName.value == "") {
			alertmsg = alertmsg + (" - please enter your First Name. \n")
		}
		if (form.LastName.value == "") {
			alertmsg = alertmsg + (" - please enter your Last Name. \n")
		}
		if (form.Establishment.value == "") {
			alertmsg = alertmsg + (" - please enter your Establishment. \n")
		}
		if (form.Address.value == "") {
			alertmsg = alertmsg + (" - please enter your Address. \n")
		}
		if (form.City.value == "") {
			alertmsg = alertmsg + (" - please enter your City. \n")
		}
		if (form.StateID.value == "") {
			alertmsg = alertmsg + (" - please enter your State. \n")
		}
		if (form.Zip.value == "") {
			alertmsg = alertmsg + (" - please enter your Zip. \n")
		}
		if (form.Phone.value == "") {
			alertmsg = alertmsg + (" - please enter your Phone. \n")
		}
		if (form.Email.value == "") {
			alertmsg = alertmsg + (" - please enter your Email. \n")
		}
		if (form.TypeofSegment.value == "") {
			alertmsg = alertmsg + (" - please enter your Type of Segment. \n")
		}
		if (alertmsg!="") {
			//alert("Incorrect Information: \n\n" + alertmsg)
			alert("Incorrect Information: please complete ALL fields. \n" + alertmsg)
			alertmsg = ""
			return false
			} else {
				var emailStr = form.Email.value
				return emailCheck3(emailStr);
			}
		return true;
		}
		
	//******************************************************************************************
	//******************************************************************************************
	
		var _chosenItem = "";
		var _imageDown  = new Image();
		var _imageRight = new Image();
		_imageDown.src  = '/global_images/item_contract.gif';
		_imageRight.src = '/global_images/item_collapse.gif';
		
	function getElementById( id ) {
			if (navigator.appVersion.search('Safari') == -1) {
				return document.all[id];
			} else {
				return document.getElementById(id);
			}
		}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function onMenuClicked( evt, eSrc, id ) {
			if (navigator.appVersion.search('Safari') == -1) {
				window.event.cancelBubble = true;
			} else {
				evt.stopPropagation();
			}
		    var eSpan = getElementById('span'+id);
		    eSpan.className = (eSpan.className=='clsShow') ? 'clsHide' : 'clsShow';
		    var eImg = getElementById('img'+id);
		    if( eSpan.className=='clsHide' ) {
		        eImg.src = _imageRight.src;
		    }
		    else {
		        eImg.src = _imageDown.src;
		    }
		}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function isFolder(sValue)
		{
			var reFolder = /^[a-z]+[a-z_0-9\-]*$/i
			
			return (reFolder.test(sValue));
		}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function isBlank(sValue)
		{
			var reChar = /./
			
			return (! reChar.test(sValue));
		}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function isMoney(sValue)
		{
			var reMoney = /^\d*$|^\d*\.\d{2}$/
			
			return (reMoney.test(sValue));
		}
		
	//******************************************************************************************
	//******************************************************************************************
	
	function isHex(sValue)
		{
			var reHex = /[0-9A-F]{6}/
			
			return (reHex.test(sValue));
		}
		
	//******************************************************************************************
	//******************************************************************************************
	