 		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;
		}
		
		//-- 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 validAddress1(obj, required)
		{
			// a-z, 0-9, space, and .,-_&()#/:\
			// minimum 1 and maximum 150 characters
			var address; 
			if(required)
				address = /^([a-z0-9\s\.,-_&\(\)#\/:\\]{1,150})$/i;
			else
				address = /^([a-z0-9\s\.,-_&\(\)#\/:\\]{0,150})$/i;
			var valid = address.test(trim(obj.value));
			if(valid)
				obj.style.backgroundColor = '';
			else
				obj.style.backgroundColor = '#ff6f62';
				
			return valid;
		}
	
		function validNameOrCity1(obj, required)
		{
			// a-z, space, dot, and hyphen
			// minimum 1 and maximum 25 characters
			var name;
			if(required)
				name = /^([a-z \.-]{1,25})$/i;
			else
				name = /^([a-z \.-]{0,25})$/i;
				
			var valid = name.test(trim(obj.value));
			if(valid)
				obj.style.backgroundColor = '';
			else
				obj.style.backgroundColor = '#ff6f62';
				
			return valid;
		}
		
		function validCompanyName1(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 = '#ff6f62';
				
			return valid;
		}
	
		function validPhone1(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 = '#ff6f62';
			
			return valid;
		}
		
		function validZip(obj)
		{
			var zip //= /\d{5}\s\d{3}-\d{4}/; 
			var valid;
			if(document.frm.ddlCountry.value == 'Canada')
			{
				//A1B C2D or 1A1 3D3
				//zip = /^([a-z]{1}\d{1}[a-z]{1}(\s?)[a-z]{1}\d{1}[a-z]{1})|(\d{1}[a-z]{1}\d{1}(\s?)\d{1}[a-z]{1}\d{1})$/i; 
				//valid = zip.test(obj.value);
				valid = trim(obj.value).length > 0;
			}
			else
			{
				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 = '#ff6f62';
			
			return valid;
		}
		
		function validAddress(obj)
		{
			// a-z, 0-9, space, and .,-_&()#/:\
			// minimum 1 and maximum 150 characters
			var address = /^([a-z0-9\s\.,-_&\(\)#\/:\\]{1,150})$/i;
			return address.test(trim(obj.value));
		}
	
		function validNameOrCity(obj)
		{
			// a-z, space, dot, and hyphen
			// minimum 1 and maximum 25 characters
			var name = /^([a-z \.-]{1,25})$/i;
			return name.test(trim(obj.value));
		}
	
		function validCompanyName(obj)
		{
			// a-z, space, 0-9
			// minimum 1 and maximum 50 characters
			var name = /^([a-z 0-9\.]{1,50})$/i;
			//var name = /^(?';#&,-_+|\\/[a-z 0-9\.]{1,50})$/i;
			return name.test(trim(obj.value));
		}
	
		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 = '#ff6f62';
			
			return valid;
		}
		
		function validPhone(number)
		{
			var phone = /\(\d{3}\)\s\d{3}-\d{4}/; 
			return phone.test(number);
		}
		
		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
				{
					if(document.frm.ddlCountry.value == 'Canada')
					    obj.value = val.substring(0, 6);
					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 notNumeric(str)
		{
			var vExp = /\D/;
			return vExp.test(str);
		}

		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;
			}
			//if(obj.className.toLowerCase() != 'num' && obj.value.length > 0)
			//	obj.className = 'num';			
		}
		
		function restrictLenForMLField(field,length)
		{
			if(field.value.length < length)
				return true;
			else
				return false;
		}
		
		function mouseOverOut(obj, img)
		{
			obj.src = 'img/buttons/'+ img;
		}

		// remove leading and trailing spaces from the give string
		function trim(val)
		{
			return val.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.'))
				for(var i=0; i<document.frm.elements.length;i++)
					if(document.frm.elements[i].type == 'text' || document.frm.elements[i].type == 'textarea')
						document.frm.elements[i].value = '';
					else if(document.frm.elements[i].type == 'select-one')
						document.frm.elements[i].selectedIndex = 0;
		}

		var yPosition = 251;

		//new ypSlideOutMenu("number menu", "slide position", left, top, width, height)
		
		new ypSlideOutMenu("classicMenu", "right", 265, yPosition, 192, 117)
		new ypSlideOutMenu("fmcMenu", "right", 265, yPosition + 22, 192, 117)
		new ypSlideOutMenu("xpertMenu", "right", 265, yPosition + 44, 192, 117)
		new ypSlideOutMenu("racingMenu", "right", 265, yPosition + 66, 192, 78)
		new ypSlideOutMenu("forherMenu", "right", 265, yPosition + 66, 192, 78)
		new ypSlideOutMenu("glovesMenu", "right", 265, yPosition + 66, 192, 98)

		function swapImgRestore() { 
		var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
		}
		function preloadImages() { 
		var d=document; if(d.images){ if(!d.p) d.p=new Array();
			var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
		}
		function findObj(n, d) { 
		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
		if(!x && document.getElementById) x=document.getElementById(n); return x;
		}
		function swapImage() { 
		var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
		if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
		}
		function showHideLayers() {
		var i,p,v,obj,args=showHideLayers.arguments;
		for (i=0; i<(args.length-2); i+=3) if ((obj=findObj(args[i]))!=null) { v=args[i+2];
			if (obj.style) { obj=obj.style	; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
			obj.visibility=v; }
		}

