		var eventTarget;
		var eventType;
		var stopEvents=0;
		var tmpEvent;

		/* change background image position otherwise change class */
		var changePosition=true;
		var normalImgPos=0;
		var mouseoverImgPos=-100;
		var pressImgPos=-200;
		var pressPaddingTop=1;

		function getChilds(element,childTagName,returnFirst){
			var results = new Array;
			if (element.childNodes){
				ecn = element.childNodes;
				bound = element.childNodes.length;
				if (bound>0){
					for(var i = 0; i < bound; i++){
						if (ecn[i].tagName && ecn[i].tagName==childTagName){
							if (returnFirst) {
								return ecn[i]
							}
							results[results.length]=ecn[i]
						}
					}			
				}
			}
			if(returnFirst){
				return null;
			}else{
				return results
			}
		}
		
		function btnLoad(el,disable){
			var a;
			var nn;
			var tbody,tr,tds,bound;
			tbody=getChilds(el,'TBODY',true)
			if(tbody){
				tr=getChilds(tbody,'TR',true)
			}
			if (tr){
				tds=getChilds(tr,'TD')
			}
			if (tds && tds.length){
				bound=tds.length;
				if (disable == null){
					if (tds!=null && bound>0){
						setBtnEvents(el);
						for(var i = 0; i < bound; i++){
							if (getChilds(tds[i],'A',true) != null) {
								a=getChilds(tds[i],'A',true)
								tmpEvent=a.onclick;
								setAEvents(a)
							}
						}
						for(var i = 0; i < bound; i++){
							if (getChilds(tds[i],'DIV',true) != null) {
								if (a != null){
									nn=getChilds(tds[i],'DIV',true)
									tmpEvent=a.onclick;
									setAEvents(nn)
								}
							}
						}
						for(var i = 0; i < bound; i++){
							setBtnEvents(tds[i]);
							var td=tds[i];
							if (a != null){
								td.onclick = a.onclick; 
							}
						}
					}
					if (a!=null){
						a.onclick = stopDoubleEvent;
						a.unselectable='on';
						for(var i = 0; i < bound; i++){
							changeButton(tds[i],'_M');
						}
					}
				}else{
					if (tds!=null && bound>0){
						for(var i = 0; i < bound; i++){
							if (getChilds(tds[i],'A',true) != null) {
								a=getChilds(tds[i],'A',true)
								a.style.cursor='default';
							}
						}

						for(var i = 0; i < bound; i++){
							var td=tds[i];
							td.style.cursor='default';
						}
					}
				}
				/*
				for(var i = 0; i < bound; i++){
					var td=tds[i];
					if (i!=1 && (td.innerHTML==' ' || td.innerHTML=='&nbsp;' || td.innerHTML=='' || td.innerHTML==null)){
						td.innerHTML='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
					}
				}
				*/
			}
		}

		function setBtnEvents(el){
			el.onmouseover = doBtnEvent;
			el.onmouseout = doBtnEvent;
			el.onmousedown = doBtnEvent;
			el.onmouseup = doBtnEvent;
		}
		function setAEvents(el){
			el.onmouseover = doAEvent;
			el.onmouseout = doAEvent;
			el.onmousedown = doAEvent;
			el.onmouseup = doAEvent;
			el.onmousedown = doAEvent;
		}
		function changeButton(el,ex){
			if(el.parentNode && el.parentNode.childNodes){
				elpc=el.parentNode.childNodes;
				if (ex=='_P'){
				    el.parentNode.focus();
				}
				orgCls=getBaseClassName(el.className);
				var j=1;
				for(var i = 0; i < elpc.length; i++){
					if (elpc[i].tagName == 'TD') {
						if (changePosition==false){
							elpc[i].className=orgCls+'_'+j+ex;j+=1
						}else{
							if (elpc[i].style){
								var bPos;
								var tPos;
								var tpos2;
								var bPosStyle;
								if (ex==''){
									bPos=normalImgPos;
									tPos=0;
									tPos2=pressPaddingTop;
								}
								if (ex=='_M'){
									bPos=mouseoverImgPos;
									tPos=0;
									tPos2=pressPaddingTop;
								}
								if (ex=='_P'){
									bPos=pressImgPos;
									tPos=pressPaddingTop;
									tPos2=0;
								}
								elpc[i].style.backgroundPosition = '0px '+bPos+'px' ;
								elpc[i].style.paddingTop= tPos + 'px';
								elpc[i].style.paddingBottom= tPos2 + 'px';
							}
						}
					}
				}
			}
		}
		function changeAnchor(el,ex){
			if (el.parentNode && el.parentNode.tagName=='TD'){changeButton(el.parentNode,ex)}
			if (el.parentNode && el.parentNode.parentNode && el.parentNode.parentNode.tagName=='TD'){changeButton(el.parentNode.parentNode,ex)}
		}
		
		function getBaseClassName(className){
			if (className && className.substring && className.indexOf){
				return className.substring(0,className.indexOf('_'))
			}
		}
		function doBtnEvent(e)
		{
			doEvent(e);			
			if (eventTarget!=null && eventType!=null){
				var ex;
				changeButton(eventTarget,getExType(ex));
			}
		}
		function doAEvent(e)
		{
			doEvent(e);			
			if (eventTarget!=null && eventType!=null){
				var ex;
				
				changeAnchor(eventTarget,getExType(ex));
			}
		}
		function stopDoubleEvent(e)
		{
		}
		function getExType(){
			if (eventType == 'mouseout'){return ''};
			if (eventType == 'mouseover'){return '_M'};
			if (eventType == 'mouseup'){return ''};
			if (eventType == 'mousedown'){return '_P'};
		}
		function doEvent(e)
		{
			if (!e) {
				var e = window.event
			};
			
			if (e.target) {
				eventTarget = e.target
			}else if (e.srcElement) {
				eventTarget = e.srcElement
			}else {
				eventTarget=null
			};
			
			if (e!=null){
				eventType = e.type;
			}else{
				eventType=null;
			}
		}
		function btnValidate(){
			if (typeof(Page_ClientValidate) == 'function') {
				Page_ClientValidate(); 
				if (Page_IsValid) {
					return true
				}
			}else{
				return true
			}
			return false
		}
		
		/**** uncomment following lines to simulate ASP.NET submit ****/
		/*
		actionYet = false;

		//simulates original PostBack except the submit command
		function doMyPostBack(eventTarget, eventArgument) {
			if (!actionYet) {
				var theform;
				theform = document.forms[0];
				theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
				theform.__EVENTARGUMENT.value = eventArgument;
			}
		}

		//prevents the same form to be posted twice 
		function checkIsValid() {
			if (!actionYet) {
				if (window.ValidatorOnSubmit) {
					ValidatorOnSubmit();
					if (Page_IsValid) {
						actionYet = true;
					}
				} else {
					actionYet = true;
				}
			}
		}		
		*/
