        var backColor = "#E1F8FF";
		
 		var isIE = (window.navigator.userAgent.indexOf("MSIE") > 0);

					

		// ----- make FF more IE compatible -----

		if (! isIE) {

			// ----- HTML objects -----

			HTMLElement.prototype.__defineGetter__("innerText", function () { return(this.textContent); });

			HTMLElement.prototype.__defineSetter__("innerText", function (txt) { this.textContent = txt; });



			// Hint: This is no perfect optimization. "obj.children" in IE contains no text nodes.

			HTMLElement.prototype.__defineGetter__("children", function () { return(this.childNodes); });



			HTMLElement.prototype.__defineGetter__("XMLDocument", function () { 

				return ((new DOMParser()).parseFromString(this.innerHTML, "text/xml"));

			});



			// ----- Event objects -----

			// We need a wrapper method, because we need to store the actual event object on every call
			// to window.event.

			HTMLElement.prototype.attachEvent = function (eventName, fHandler) {

				fHandler._wrapHandler = function (e) {

					window.event = e;

					fHandler();

					return (e.returnValue);

					};

				this.addEventListener(eventName.substr(2), fHandler._wrapHandler, false);

			};




			HTMLElement.prototype.detachEvent = function (eventName, fHandler) {

				if (fHandler._wrapHandler != null)

					this.removeEventListener(eventName.substr(2), fHandler._wrapHandler, false);

			};



			// enable using evt.srcElement in Mozilla/Firefox
			Event.prototype.__defineGetter__("srcElement", function () {
				var node = this.target;
				while (node.nodeType != 1) node = node.parentNode;
				// test this:
				if (node != this.target) alert("Unexpected event.target!") // it still happens sometime, why ?
				return node;
			});


			// enable using event.cancelBubble=true in Mozilla/Firefox
			Event.prototype.__defineSetter__("cancelBubble", function (b) {

				if (b) this.stopPropagation();

			});





			// enable using event.returnValue=false in Mozilla/Firefox
			// Hint: event.returnValue=true doesn't work !
			Event.prototype.__defineSetter__("returnValue", function (b) {

				if (!b) this.preventDefault();

				this._returnValue = b;

				return(b);

			});



			// enable querying event.returnValue in Mozilla/Firefox
			Event.prototype.__defineGetter__("returnValue", function () {

				return (this._returnValue);

			});



			// ----- XML objects -----

		  

			// select the first node that matches the XPath expression

			// xPath: the XPath expression to use

			XMLDocument.prototype.selectSingleNode = function(xPath) {

				var doc = this;

				if (doc.nodeType != 9)

					doc = doc.ownerDocument;

				if (doc.nsResolver == null) doc.nsResolver = function(prefix) { return(null); };

				var node = doc.evaluate(xPath, this, doc.nsResolver, XPathResult.ANY_UNORDERED_NODE_TYPE, null);

				if (node != null) node = node.singleNodeValue;

				return(node);

			}; // selectSingleNode



			Node.prototype.__defineGetter__("text", function () {

				return(this.textContent);

			}); // text

		}



		var pagex, pagey, keycode, keytype, srcElement, keyup;

		if(!document.all)
		{
			window.captureEvents(Event.MOUSEMOVE);
			window.onmousemove = captureMousePosition;
			window.releaseEvents(Event.MOUSEMOVE);
			window.captureEvents(Event.KEYPRESS);
			window.onkeypress = captureKeyPress;
			window.releaseEvents(Event.KEYPRESS);
			window.captureEvents(Event.CLICK);
			window.onclick = captureClick;
			window.releaseEvents(Event.CLICK);
			window.captureEvents(Event.KEYDOWN);
			window.onclick = captureDown;
			window.releaseEvents(Event.KEYDOWN);
			window.captureEvents(Event.KEYUP);
			window.onclick = captureUp;
			window.releaseEvents(Event.KEYUP);
		}



		function captureMousePosition(e)

		{

			pagex = e.pageX - 85;

			pagey = e.pageY + 10;

		}



		function captureKeyPress(e)

		{

			keycode = e.which;

		}

		

		function captureClick(e)

		{

			srcElement = e.currentTarget;

		}

		

		function captureUp(e)

		{

			keyup= e.which;

		}
		
		
		function captureDown(e)
		{
			
			keydown= e.which;
		}
		

		//-- end of FF compatibility



		//alert('b4 new menuin this.ns4');

	    // this function restrict the hackers to send any executeable through the multi line text fields

		function validCharacters(str)

		{

			str = str.replace(/\n/g,'').replace(/\r/g,'');

			// all possible keyboard characters

			var kbChars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ?><,/;\':".[]\\{}|=-+_)(*&^%$#@!~`';

			for(var i=0; i < str.length; i++)

				if(kbChars.indexOf(str.charAt(i)) == -1)

					return false;// invalid character found so return false

		

			// no invalid character found so return true

			return true;

		}

		

		function validAddress(obj, required)

		{

			// a-z, 0-9, space, and .,-_&()#/:\

			// minimum 1 and maximum 150 characters

			var address; 

			if(required)

				address = /^([a-z0-9\s\.,-_&\(\)#\/:\\]{1,250})$/i;

			else

				address = /^([a-z0-9\s\.,-_&\(\)#\/:\\]{0,250})$/i;

			var valid = address.test(trim(obj.value));

			if(valid)

				obj.style.backgroundColor = '';

			else

				obj.style.backgroundColor = backColor;

				

			return valid;

		}

	

		function validNameOrCity(obj, required)

		{

			// a-z, space, dot, and hyphen

			// minimum 1 and maximum 50 characters

			var name;

			if(required)

				name = /^([a-z \.-]{1,50})$/i;

			else

				name = /^([a-z \.-]{0,50})$/i;

				

			var valid = name.test(trim(obj.value));

			if(valid)

				obj.style.backgroundColor = '';

			else

				obj.style.backgroundColor = backColor;

				

			return valid;

		}

		

		function validAddlCounties(obj, required)

		{

			// a-z, space, dot, comma and hyphen

			// minimum 1 and maximum 50 characters

			var name;

			if(required)

				name = /^([a-z \.,-]{1,250})$/i;

			else

				name = /^([a-z \.,-]{0,250})$/i;

				

			var valid = name.test(trim(obj.value));

			if(valid)

				obj.style.backgroundColor = '';

			else

				obj.style.backgroundColor = backColor;

				

			return valid;

		}

		

		function validCompanyName(obj, required)

		{

			// a-z, space, 0-9

			// minimum 1 and maximum 50 characters

			var name;

			if(required)

			{

				//name = /^([a-z 0-9\.']{1,50})$/i;

				name = /^([a-z 0-9\.',-_&\(\)#\/:\\]{1,50})$/i;

			}

			else

			{

				//name = /^([a-z 0-9\.']{0,50})$/i;

				name = /^([a-z 0-9\.',-_&\(\)#\/:\\]{0,50})$/i;

			}

			var valid = name.test(trim(obj.value));

			if(valid)

				obj.style.backgroundColor = '';

			else

				obj.style.backgroundColor = backColor;

				

			return valid;

		}

	

		function validPhone(obj)

		{

			var phone = /\(\d{3}\)\s\d{3}-\d{4}/; 

			var valid = phone.test(obj.value);

			if(valid)

				obj.style.backgroundColor = '';

			else

				obj.style.backgroundColor = backColor;

			

			return valid;

		}

		

		function validSSN(obj, required)

		{

			var ssn = /^\d{3}-\d{2}-\d{4}$/; 

			var valid;

			if(required)

			    valid = ssn.test(obj.value);

			else

			    valid = trim(obj.value).length == 0 || ssn.test(obj.value);

			    

			if(valid)

				obj.style.backgroundColor = '';

			else

				obj.style.backgroundColor = backColor;

			

			return valid;

		}

		

		function validZip(obj)

		{

			var zip //= /\d{5}\s\d{3}-\d{4}/; 

			var valid;

			zip = /^\d{5}$/; 

			var zip1 = /^\d{5}-\d{4}$/;

			valid = ( zip.test(obj.value) || zip1.test(obj.value) );

			

			if(valid)

				obj.style.backgroundColor = '';

			else

				obj.style.backgroundColor = backColor;

			

			return valid;

		}

		

		function validEmail(obj)

		{

			var email = /^\w(\.?[\w])*@\w(\.?[-\w])*\.([a-z]{3}(\.[a-z]{2})?|[a-z]{2}(\.[a-z]{2})?)$/i;

			var valid = ( trim(obj.value).length > 0 && email.test(obj.value) );

			if(valid)

				obj.style.backgroundColor = '';

			else

				obj.style.backgroundColor = backColor;

			

			return valid;

		}

		

		var keyIsValid;

		function onKeyUp(obj, isPhone)

		{

			// if valid key was pressed then format the phone number or zip code

			if(keyIsValid)

			{

				var val = '';

				// loop through all characters and remove any non-numeric character

				for(var i=0; i<obj.value.length; i++)

					if(!isNaN(obj.value.charAt(i)))

						val += obj.value.charAt(i);

				

				// remove any spaces

				val = val.replace(/\s/g,'');

				// reset the value of the field after removing non-numeric characters

				obj.value = val;

				

				if(isPhone)

				{

					// initialize the formatted phone number 

					var formattedPhone = '(';

					// set new value only if olde value is not empty

					if(val.length > 0)

					{

						// if old value is less than three characters

						if(val.length < 3)

							formattedPhone += val;

						else if(val.length < 6) // old value is less than six characters

							formattedPhone += val.substring(0, 3) +') '+ val.substring(3, val.length);

						else // old value is greater than five characters, truncate the characters after 10 digits

							formattedPhone += val.substring(0, 3) +') '+ val.substring(3, 6) +'-'+ val.substring(6, 10);

						// reset the field value

						obj.value = formattedPhone;

					}

				}

				else

				{

				    // initialize the formatted zip

				    var formattedZip = '';

				    // set new value only if old value is not empty

				    if(val.length > 0)

				    {

					    // if old value is less than three characters

					    if(val.length < 6)

						    formattedZip += val;

					    else // old value is greater than five characters, truncate the characters after 10 digits

						    formattedZip += val.substring(0, 5) +'-'+ val.substring(5, 9);

					    // reset the field value

					    obj.value = formattedZip;

				    }

				}

			}

		}

		

		function allowDigitsOnly(obj)

		{

			var code = getCode();

			// ctrl, del, backspace, tab, or any of navigational key was pressed

			// return true and set the keyIsValid flag to false so that 

			// onkeyup function does not format the phone/zip code

			if ( code == 17 || code == 46 || code == 8 || code == 9 || code == 0 || (code > 34 && code < 41) )

			{

				keyIsValid = false;

				return true;

			}	

			// 48 to 57 num keypad, 96 to 105 numbers row above alphabet rows

			keyIsValid = (code > 47 && code < 58) || (code > 95 && code < 106);

			return keyIsValid;

		}

		

		function notAlpha(str)

		{

			var vExp = /\W|_|\d/;

			return vExp.test(str);

		}



		function notAlphaNumeric(str)

		{

			var vExp = /\W|_/;

			return vExp.test(rtrim(str));

		}



		function spaceToZero(val)

		{

			if(trim(val).length == 0)

				return 0;

			else

				return val;

		}

		

		function zeroToSpace(val)

		{

			if(val == 0)

				return '';

			else

				return val;

		}	

		

		function removeZerosFromRight(value)

		{

			var arr = value.split(".");

			var dec;

			if(arr.length > 0)

			{

				dec = arr[1].replace(/0+$/g,"");

			}

			if(dec.length > 0)

				return arr[0] + "."+ dec;

			else

				return arr[0];

		}

		

		function getCode()

		{

			if(isIE)

				return event.keyCode;

			else

				return keycode;

		}

		

		function allowNumeric()

		{

			var code = getCode();

			if( code == 0 || code == 8 || (code > 47 && code < 58)) 

				return true; 

			else

				return false;

		}



		function allowAlpha()

		{

			var code = getCode();

			if( code == 0 || code == 8 || (code > 64 && code < 91) || (code > 96 && code < 123) ) 

				return true; 

			else

				return false;

		}



		function holdValue(value)

		{

			document.getElementById('txtValidate').value = value;

		}

		

		function onKeyPressedDigitsOnly()

		{

			var code = getCode();

			return ( code == 0 || code == 8 || (code > 47 && code < 58) )

		}

		

		

		function checkKeyPressed(obj, intPart, decPoints)

		{

			var code = getCode();

			var decPoint = /\./;

			// 0 for arrow keys, delete etc. 8 for backspace (in netscape/firefox)

			if(decPoints > 0 && !decPoint.test(obj.value) && obj.value.length == intPart && code != 0 && code != 8 && code != 46)

				obj.value += '.';

			holdValue(obj.value);

			

			if(decPoints > 0)

				return ( code == 0 || code == 8 || code == 46 || (code > 47 && code < 58) )

			else

				return ( code == 0 || code == 8 || (code > 47 && code < 58) )

		}

		

		function allowDecimal(obj, intPart, decPoints)

		{

			var vExp, str;

			var decPoint = /\./;

			if(decPoint.test(obj.value))

				str = "^\\d{0,"+ intPart +"}\\.?\\d{0,"+ decPoints +"}$";

			else

				str = "^\\d{0,"+ intPart +"}$";

			vExp = new RegExp(str);

			if(vExp.test(obj.value))

			{

				holdValue(obj.value);

			}

			else

			{

				obj.value = document.getElementById('txtValidate').value;

			}

		}

		

		function validMLField(field, length)

		{

			var flag = validCharacters(trim(field.value));

			if(flag)

			    flag = (field.value.length < length)

			if(flag)

			    field.style.backgroundColor = '';

			else

			{

			    field.style.backgroundColor = backColor;

			}

			return flag;

		}

		

		function mouseOverOut(obj, img)

		{

			obj.src = 'img/buttons/'+ img;

		}



		// remove leading and trailing spaces from the give string

		function trim(val)

		{

			return val.toString().replace(/^[\s]+/g,"").replace(/[\s]+$/g,"");

		}

		

		// right trim

		function rtrim(val)

		{

			return val.replace(/[\s]+$/g,"");

		}

		

		function openWindow(url)

		{

			var child = window.open(url,'newwin',"location=no,scroll=no,directories=no,menubar=no,toolbar=no,status=no,width=650,height=660");

			child.focus();

		}

		

		function displayMessage(e)

		{

			alert('There is a script error on the page:\n\n\t'+ e.name +': '+ e.description +'\n\nPlease report this error to the help desk.');

		}

	

		function clearForm()

		{

			if(confirm('Are you sure you want to clear the form? If you do so, you will lose any changes you have made.'))

				try{

				    for(var i=0; i<document.form2.elements.length;i++)

					    if((document.form2.elements[i].type == 'text' || document.form2.elements[i].type == 'textarea') && !(document.form2.elements[i].readOnly))

					    {

						    //alert(document.form2.elements[i].type);

						    document.form2.elements[i].value = '';

					        document.form2.elements[i].style.backgroundColor = '';

					    }

					    else if(document.form2.elements[i].type == 'select-one')

					    {

						    document.form2.elements[i].selectedIndex = 0;

					        document.form2.elements[i].style.backgroundColor = '';

					    }

			    }

			    catch(e)

			    {

			        alert(e.description);

			    }

		}

		

		function isValidDate(field)

		{

			var date = rtrim(field.value);

			if(date.length > 0)

			{

				if(date.indexOf('-') > 0)

					date = date.replace(/\-/g,'/');

				var dateParts, curYear, year, validYear, month, day, mm, dd, validDay, validMonth;

				dateParts = date.split("/");

				var len = dateParts.length;

				//var cDate = new Date(currentDate);

				//curYear = cDate.getFullYear();

				/*if(len == 1 && !isNaN(dateParts[0]))

				{

					var dt = new Date(currentDate);

					if(parseFloat(dateParts[0]) != 0)

						dt.setDate(dt.getDate() + (parseFloat(dateParts[0])));

					field.value = get2Digits((dt.getMonth() + 1)) +'/'+ get2Digits(dt.getDate()) +'/'+ dt.getFullYear();	

					return true;

				}

				else*/ 

				if(len == 3)

				{

					year = trim(dateParts[2]);

			    	validYear = isValidYear(year);

					mm = rtrim(dateParts[0]);

					dd = trim(dateParts[1]);

					month = parseInt(mm,10);

					day = parseInt(dd,10);

					validMonth = digitsOnly(mm) && month > 0 && month < 13;

					validDay = digitsOnly(dd) && day > 0 && day < 32;

					

					if(validYear && validMonth && validDay)

					{

						var days = new Array(29,31,28,31,30,31,30,31,31,30,31,30,31);

						var mDays = days[month];

						/*if(year.length < 4)

						{

							year = curYear.toString().substring(0,(4 - year.length)) + year;

							if(parseInt(year) > (parseInt(curYear) + 25))

								year = parseInt(year) - 100;

						}*/

							

						if( (month == 2) && ( (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0) ) )

							mDays = 29;

						if(day <= mDays)

						{

							month = get2Digits(month);

							day = get2Digits(day)

							//if(len == 2 && new Date(month +'/'+ day +'/'+ year) < cDate)

							//	year = parseInt(year) + 1;

							field.value = month +'/'+ day +'/'+ year;

							return true;

						}

						else 

							return false;

					}

					else

						return false;

				}

				else

					return false;

			}

			else

				return false;

		}

		

		function confDeals()

		{

			return false;

		}

		

		function isValidYear(year)

		{

			return digitsOnly(year) && (year.length == 2 || year.length == 4)

		}

		

		function digitsOnly(str)

		{

			var vExp = /\D/;

			return !vExp.test(str);

		}

		

		function get2Digits(n) {

			return ((n.toString().length == 1)?"0":"")+n;

		}

		

		function validBankAndOfficers(bankRequired)

		{

		    var retFlag = true;

			var obj;

			    

		    if(!validCompanyName(document.getElementById('txtBankName'), bankRequired))

		        retFlag = false;

    		

		    if(!validAddress(document.getElementById('txtBankAddress'), bankRequired))

		        retFlag = false;

    		

		    if(!validAddress(document.getElementById('txtBankSuite'), false))

		        retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtBankCity'), bankRequired))

		        retFlag = false;

    		

		    if (bankRequired)

		    {

		        if(document.getElementById('ddlBankState').selectedIndex == 0)

		        {

		            retFlag = false;

			        document.getElementById('ddlBankState').style.backgroundColor = backColor;

		        }

		        else

		           document.getElementById('ddlBankState').style.backgroundColor = '';

    		     

		        if(!validZip(document.getElementById('txtBankZip')))

		            retFlag = false;

        		

		        obj = document.getElementById('txtBankAccount');

		        if(trim(obj.value).length == 0)

			    {

		            retFlag = false;

			        obj.style.backgroundColor = backColor;

			    }

			    else

			        obj.style.backgroundColor = '';

        	}

        		

		    if(!validNameOrCity(document.getElementById('txtOfficer1Name'), true))

			    retFlag = false;

    		

		    obj = document.getElementById('txtOfficer1Title');

		    if(trim(obj.value).length == 0)

		    {

		        retFlag = false;

		        obj.style.backgroundColor = backColor;

		    }

		    else

		        obj.style.backgroundColor = '';

		        

		    obj = document.getElementById('txtOfficer1DOB');

		    if(!isValidDate(obj))

		    {

		        retFlag = false;

		        obj.style.backgroundColor = backColor;

		    }

		    else

		        obj.style.backgroundColor = '';

		        

		    obj = document.getElementById('txtOfficer1Percentage');

		    if(trim(obj.value).length == 0)

		    {

		        retFlag = false;

		        obj.style.backgroundColor = backColor;

		    }

		    else

		        obj.style.backgroundColor = '';

		        

		    obj = document.getElementById('txtOfficer1SSN');

			if(!validSSN(obj, true))

			    retFlag = false;    		

			

		    obj = document.getElementById('txtOfficer2SSN');

			if(!validSSN(obj, false))

			    retFlag = false;    		

			

			obj = document.getElementById('txtOfficer3SSN');

			if(!validSSN(obj, false))

			    retFlag = false;    		

					    

		    if(!validAddress(document.getElementById('txtOfficer1Address'), true))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtOfficer1City'), true))

			    retFlag = false;

    		

		    if(document.getElementById('ddlOfficer1State').selectedIndex == 0)

		    {

			    retFlag = false;

			    document.getElementById('ddlOfficer1State').style.backgroundColor = backColor;

		    }

		    else

		       document.getElementById('ddlOfficer1State').style.backgroundColor = '';

		     

		    if(!validZip(document.getElementById('txtOfficer1Zip')))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtOfficer1Phone').value).length > 0 && !validPhone(document.getElementById('txtOfficer1Phone')))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtOfficer1Fax').value).length > 0 && !validPhone(document.getElementById('txtOfficer1Fax')))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtOfficer2Name'), false))

			    retFlag = false;

    		

		    obj = document.getElementById('txtOfficer2DOB');

		    if(trim(obj.value).length > 0 && !isValidDate(obj))

		    {

		        retFlag = false;

		        obj.style.backgroundColor = backColor;

		    }

		    else

		        obj.style.backgroundColor = '';

		        

		    if(!validAddress(document.getElementById('txtOfficer2Address'), false))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtOfficer2City'), false))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtOfficer2Zip').value).length > 0 && !validZip(document.getElementById('txtOfficer2Zip')))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtOfficer2Phone').value).length > 0 && !validPhone(document.getElementById('txtOfficer2Phone')))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtOfficer2Fax').value).length > 0 && !validPhone(document.getElementById('txtOfficer2Fax')))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtOfficer3Name'), false))

			    retFlag = false;

    		

		    obj = document.getElementById('txtOfficer3DOB');

		    if(trim(obj.value).length > 0 && !isValidDate(obj))

		    {

		        retFlag = false;

		        obj.style.backgroundColor = backColor;

		    }

		    else

		        obj.style.backgroundColor = '';

		        

		    if(!validAddress(document.getElementById('txtOfficer3Address'), false))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtOfficer3City'), false))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtOfficer3Zip').value).length > 0 && !validZip(document.getElementById('txtOfficer3Zip')))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtOfficer3Phone').value).length > 0 && !validPhone(document.getElementById('txtOfficer3Phone')))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtOfficer3Fax').value).length > 0 && !validPhone(document.getElementById('txtOfficer3Fax')))

			    retFlag = false;

    		

		    return retFlag;

		}

			 

		function validContactInfo()

		{

		    var retFlag = true;

			    

		    if(!validNameOrCity(document.getElementById('txtContactFirstName'), true))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtContactLastName'), true))

			    retFlag = false;

    		

		    if(!validAddress(document.getElementById('txtContactAddress'), true))

			    retFlag = false;

    		

		    if(document.getElementById('txtContactSuite') && !validAddress(document.getElementById('txtContactSuite'), false))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtContactCity'), true))

			    retFlag = false;

    		

		    if(document.getElementById('ddlContactState').selectedIndex == 0)

		    {

			    retFlag = false;

			    document.getElementById('ddlContactState').style.backgroundColor = backColor;

		    }

		    else

		       document.getElementById('ddlContactState').style.backgroundColor = '';

		     

		    if(!validZip(document.getElementById('txtContactZip')))

			    retFlag = false;

    		

		    if(!validPhone(document.getElementById('txtContactPhone')))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtContactFax').value).length > 0 && !validPhone(document.getElementById('txtContactFax')))

			    retFlag = false;

    		

		    return retFlag;

		}

			 

		function valid_Cont_Pay_Cmts()

		{

		    var retFlag = true;

			    

		    // contact

		    if(!validNameOrCity(document.getElementById('txtContactFirstName'), true))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtContactLastName'), true))

			    retFlag = false;

    		

		    if(!validAddress(document.getElementById('txtContactAddress'), true))

			    retFlag = false;

    		

		    if(!validAddress(document.getElementById('txtContactSuite'), false))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtContactCity'), true))

			    retFlag = false;

    		

		    if(document.getElementById('ddlContactState').selectedIndex == 0)

		    {

			    retFlag = false;

			    document.getElementById('ddlContactState').style.backgroundColor = backColor;

		    }

		    else

		       document.getElementById('ddlContactState').style.backgroundColor = '';

		     

		    if(!validZip(document.getElementById('txtContactZip')))

			    retFlag = false;

    		

		    if(!validPhone(document.getElementById('txtContactPhone')))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtContactFax').value).length > 0 && !validPhone(document.getElementById('txtContactFax')))

			    retFlag = false;

    		

		    // login

		    if(!validEmail(document.getElementById('ccEmail')))

			    retFlag = false;

			    

			var obj = document.getElementById('ccPswd');

			if(obj.value.length == 0)

			{

			    retFlag = false;

			    obj.style.backgroundColor = backColor;

			}

			else

			    obj.style.backgroundColor = '';



		    // payment

		    if(!validNameOrCity(document.getElementById('txtCardFirstName'), true))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtCardLastName'), true))

			    retFlag = false;

			

		    if(document.getElementById('ddlCardType').selectedIndex == 0)

		    {

			    retFlag = false;

			    document.getElementById('ddlCardType').style.backgroundColor = backColor;

		    }

		    else

		       document.getElementById('ddlCardType').style.backgroundColor = '';

		     

		    if(document.getElementById('ddlCardExpirationMonth').selectedIndex == 0)

		    {

			    retFlag = false;

			    document.getElementById('ddlCardExpirationMonth').style.backgroundColor = backColor;

		    }

		    else

		       document.getElementById('ddlCardExpirationMonth').style.backgroundColor = '';

		     

		    if(document.getElementById('ddlCardExpirationYear').selectedIndex == 0)

		    {

			    retFlag = false;

			    document.getElementById('ddlCardExpirationYear').style.backgroundColor = backColor;

		    }

		    else

		       document.getElementById('ddlCardExpirationYear').style.backgroundColor = '';

		     

		    var obj = document.getElementById('txtCardNumber');

		    var card = obj.value;

		    var cardLen = (document.getElementById('ddlCardType').value == 'AMEX') ? 15 : 16;

		    if(!digitsOnly(card) || trim(card).length != cardLen )

		    {

			    retFlag = false;

		        obj.style.backgroundColor = backColor;

		    }

		    else

			    obj.style.backgroundColor = '';



		    return retFlag;

		}

		

		function validLoginInfo()

		{

		    var retFlag = true;

			    

		    if(!validEmail(document.getElementById('ccEmail')))

			    retFlag = false;

			    

			var obj = document.getElementById('ccPswd');

			if(obj.value.length == 0)

			{

			    retFlag = false;

			    obj.style.backgroundColor = backColor;

			}

			else

			    obj.style.backgroundColor = '';



		    return retFlag;

		}

			 

        function validPaymentInfo()

		{

		    var retFlag = true;

		    if(!validNameOrCity(document.getElementById('txtCardFirstName'), true))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtCardLastName'), true))

			    retFlag = false;

			

		    if(!validAddress(document.getElementById('txtCardAddress'), true))

			    retFlag = false;

    		

		    if(!validNameOrCity(document.getElementById('txtCardCity'), true))

			    retFlag = false;

    		

		    if(document.getElementById('ddlCardState').selectedIndex == 0)

		    {

			    retFlag = false;

			    document.getElementById('ddlCardState').style.backgroundColor = backColor;

		    }

		    else

		       document.getElementById('ddlCardState').style.backgroundColor = '';

		     

			
			
			
		   
		   
		   
		   
		   if(!validZip(document.getElementById('txtCardZip')))

			    retFlag = false;

    		

		    if(!validPhone(document.getElementById('txtCardPhone')))

			    retFlag = false;

    		

		    if(trim(document.getElementById('txtCardFax').value).length > 0 && !validPhone(document.getElementById('txtCardFax')))

			    retFlag = false;

    		

		    if(document.getElementById('ddlCardType').selectedIndex == 0)

		    {

			    retFlag = false;

			    document.getElementById('ddlCardType').style.backgroundColor = backColor;

		    }

		    else

		       document.getElementById('ddlCardType').style.backgroundColor = '';

		     

		    if(document.getElementById('ddlCardExpirationMonth').selectedIndex == 0)

		    {

			    retFlag = false;

			    document.getElementById('ddlCardExpirationMonth').style.backgroundColor = backColor;

		    }

		    else

		       document.getElementById('ddlCardExpirationMonth').style.backgroundColor = '';

		     

		    if(document.getElementById('ddlCardExpirationYear').selectedIndex == 0)

		    {

			    retFlag = false;

			    document.getElementById('ddlCardExpirationYear').style.backgroundColor = backColor;

		    }

		    else

		       document.getElementById('ddlCardExpirationYear').style.backgroundColor = '';

		     

		    var obj = document.getElementById('txtCardNumber');

		    var card = obj.value;

		    var cardLen = (document.getElementById('ddlCardType').value == 'AMEX') ? 15 : 16;

		    if(!digitsOnly(card) || trim(card).length != cardLen )

		    {

			    retFlag = false;

		        obj.style.backgroundColor = backColor;

		    }

		    else

			    obj.style.backgroundColor = '';

			
			
			//card security	start		
			objcsv = document.getElementById('txtCSVCode');
			if(objcsv.value.length == 0)
			{
			    invalidFields = true;    		
			    objcsv.style.backgroundColor = backColor;
			}
			else
			    objcsv.style.backgroundColor = '';

			//card security	ends
			
			
			
			
			

		    // comments

		    if(document.getElementById('txtComments') && !validMLField(document.getElementById('txtComments'), 1000))

			    retFlag = false;

    		

		    return retFlag;			    

    	}



    function copyCAddress(copyFlag)

    {

		if(copyFlag)

		{

			document.getElementById('txtContactAddress').value = document.getElementById('txtCompanyAddress').value;

			document.getElementById('txtContactCity').value = document.getElementById('txtCompanyCity').value;

			document.getElementById('ddlContactState').value = '<?=$_POST["cpyState"];?>';

			document.getElementById('txtContactZip').value = document.getElementById('txtCompanyZip').value;

		}

    }    

    
	
	
	function copyAddressShareHolder(copyFlag, officer)

    {

		if(copyFlag)

		{

			document.getElementById('txtShareholder'+ officer +'Name').value = document.getElementById('txtContactFirstName').value +' '+ document.getElementById('txtContactLastName').value;

			document.getElementById('txtShareholder'+ officer +'Address').value = document.getElementById('txtContactAddress').value;
			document.getElementById('txtShareholder'+ officer +'City').value = document.getElementById('txtContactCity').value;
			document.getElementById('ddlShareholder'+ officer +'State').value = document.getElementById('ddlContactState').value;
			document.getElementById('txtShareholder'+ officer +'Zip').value = document.getElementById('txtContactZip').value;
			//document.getElementById('txtOfficer'+ officer +'Phone').value = document.getElementById('txtContactPhone').value;
			//document.getElementById('txtOfficer'+ officer +'Fax').value = document.getElementById('txtContactFax').value;

		}

    }    
	
	
	function copyAdd(copyFlag, officer)
	{
		
		if(copyFlag){
				
				document.getElementById('txtOfficer'+ officer +'Name').value = document.getElementById('txtContactFirstName').value +' '+ document.getElementById('txtContactLastName').value;

			document.getElementById('txtOfficer'+ officer +'Address').value = document.getElementById('txtContactAddress').value;
			document.getElementById('txtOfficer'+ officer +'City').value = document.getElementById('txtContactCity').value;
			document.getElementById('ddlOfficer'+ officer +'State').value = document.getElementById('ddlContactState').value;
			document.getElementById('txtOfficer'+ officer +'Zip').value = document.getElementById('txtContactZip').value;
			document.getElementById('txtOfficer'+ officer +'Phone').value = document.getElementById('txtContactPhone').value;
			document.getElementById('txtOfficer'+ officer +'Fax').value = document.getElementById('txtContactFax').value;

			}
		
		
	}

    function copyAddress(copyFlag, officer)

    {
		
		if(copyFlag)

		{
			
			document.getElementById('txtOfficer'+ officer +'Name').value = document.getElementById('txtContactFirstName').value +' '+ document.getElementById('txtContactLastName').value;

			document.getElementById('txtOfficer'+ officer +'Address').value = document.getElementById('txtContactAddress').value;
			document.getElementById('txtOfficer'+ officer +'City').value = document.getElementById('txtContactCity').value;
			document.getElementById('ddlOfficer'+ officer +'State').value = document.getElementById('ddlContactState').value;
			document.getElementById('txtOfficer'+ officer +'Zip').value = document.getElementById('txtContactZip').value;
			//document.getElementById('txtOfficer'+ officer +'Phone').value = document.getElementById('txtContactPhone').value;
			//document.getElementById('txtOfficer'+ officer +'Fax').value = document.getElementById('txtContactFax').value;

		}

    }    

    

    function copyAddress2(copyFlag)

    {

		if(copyFlag)

		{

			document.getElementById('txtCardFirstName').value = document.getElementById('txtContactFirstName').value; 

			document.getElementById('txtCardLastName').value = document.getElementById('txtContactLastName').value;

			document.getElementById('txtCardAddress').value = document.getElementById('txtContactAddress').value;

			document.getElementById('txtCardCity').value = document.getElementById('txtContactCity').value;

			document.getElementById('ddlCardState').value = document.getElementById('ddlContactState').value;

			document.getElementById('txtCardZip').value = document.getElementById('txtContactZip').value;

			document.getElementById('txtCardPhone').value = document.getElementById('txtContactPhone').value;

			document.getElementById('txtCardFax').value = document.getElementById('txtContactFax').value;

		}

    }    

		
		
		function copyContactData2ccForeign()
		{
		document.getElementById('txtCardForeignAddress').value = document.getElementById('txtForeignAddress').value;	
		document.getElementById('txtCardPhoneForeign').value = document.getElementById('txtContactPhoneForeign').value;
		document.getElementById('txtCardFaxForeign').value = document.getElementById('txtContactFaxForeign').value;
		document.getElementById('txtCardFirstName').value = document.getElementById('txtContactFirstName').value;
		document.getElementById('txtCardLastName').value = document.getElementById('txtContactLastName').value;
		
		}
		
		
		
		
		
		function copyContact2BForeign()
		{
		document.getElementById('txtBusinessForeignAddress').value = document.getElementById('txtForeignAddress').value;	
		}
		
		
		
		function copyAddressForeign(copyFlag, officer)
        {
		
		if(copyFlag)
		{
		document.getElementById('txtOfficer'+ officer +'ForeignAddress').value = document.getElementById('txtForeignAddress').value;
		document.getElementById('txtOfficer'+ officer +'NameForeign').value = document.getElementById('txtContactFirstName').value +' '+ document.getElementById('txtContactLastName').value;
		document.getElementById('txtOfficer'+ officer +'PhoneForeign').value = document.getElementById('txtContactPhoneForeign').value;
		document.getElementById('txtOfficer'+ officer +'FaxForeign').value = document.getElementById('txtContactFaxForeign').value;
		
		}

    	}    
		
		

		function copyContactData(copyFlag)
    {
		if(copyFlag)
		{
			document.getElementById('txtCardFirstName').value = document.getElementById('txtContactFirstName').value;
			document.getElementById('txtCardLastName').value = document.getElementById('txtContactLastName').value;
			document.getElementById('txtCardAddress').value = document.getElementById('txtContactAddress').value;
			document.getElementById('txtCardCity').value = document.getElementById('txtContactCity').value;
			document.getElementById('ddlCardState').selectedIndex = document.getElementById('ddlContactState').selectedIndex;
			document.getElementById('txtCardZip').value = document.getElementById('txtContactZip').value;
			document.getElementById('txtCardPhone').value = document.getElementById('txtContactPhone').value;
			document.getElementById('txtCardFax').value = document.getElementById('txtContactFax').value;
		}
    }    

	
	function copyContactDataToB(copyFlag)
    {
		if(copyFlag)
		{
			document.getElementById('txtBusinessAddress').value = document.getElementById('txtContactAddress').value;
			document.getElementById('txtBusinessSuite').value = document.getElementById('txtContactSuite').value;
			document.getElementById('txtBusinessCity').value = document.getElementById('txtContactCity').value;
			document.getElementById('ddlBusinessState').selectedIndex = document.getElementById('ddlContactState').selectedIndex;
			document.getElementById('txtBusinessZip').value = document.getElementById('txtContactZip').value;
						
		}
    }    

	function copyContactDataToB2(copyFlag)
    {
		if(copyFlag)
		{
			document.getElementById('txtBusinessAddress').value = document.getElementById('txtContactAddress').value;
			document.getElementById('txtBusinessSuite').value = document.getElementById('txtContactSuite').value;
			document.getElementById('txtBusinessCity').value = document.getElementById('txtContactCity').value;
			//document.getElementById('ddlBusinessState').selectedIndex = document.getElementById('ddlContactState').selectedIndex;
			document.getElementById('txtBusinessZip').value = document.getElementById('txtContactZip').value;
						
		}
    }    	


	function showCsvHelp(divID, cssClass)

    {

        divID.className = cssClass;

    }

