
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
if(typeof vp=="undefined"){var vp={};}vp.events=function(){};vp.events.boundObjects=[];vp.events.cancelEvent=function(oEvent){oEvent=oEvent||window.event;if(!oEvent){throw new Error("No event argument was passed into vp.events.cancelEvent()");}oEvent.returnValue=false;if(oEvent.preventDefault){oEvent.preventDefault();}};vp.events.cancelBubble=function(oEvent){oEvent=oEvent||window.event;if(!oEvent){throw new Error("No event argument was passed into vp.events.cancelBubble()");}if(oEvent.stopPropagation){oEvent.stopPropagation();}else{oEvent.cancelBubble=true;}};vp.events.cancel=function(oEvent){vp.events.cancelEvent(oEvent);vp.events.cancelBubble(oEvent);};vp.events.blurAll=function(){var oBlurElement=document.getElementById("__blurElement");if(!oBlurElement){oBlurElement=document.createElement("INPUT");oBlurElement.type="text";oBlurElement.style.position="absolute";oBlurElement.style.backgroundColor="transparent";document.body.appendChild(oBlurElement);}oBlurElement.style.top=Math.max(document.documentElement.scrollTop,document.body.scrollTop)+10;oBlurElement.style.left=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft)+10;oBlurElement.style.visibility="visible";oBlurElement.focus();oBlurElement.blur();oBlurElement.style.visibility="hidden";};vp.events._callHandlers=function(oEvent){oEvent=window.event||oEvent;if(this.handlers[oEvent.type]){for(var i=0;i<this.handles[oEvent.type].length;i++){this.handlers[oEvent.type](oEvent);}}};vp.events.add=function(vTarget,sEvent,fnHandler){if(!vTarget){throw new Error("The argment vTarget was a null element reference when calling vp.events.add()");}var oTarget=(typeof vTarget=="string"?document.getElementById(vTarget):vTarget);if(!oTarget){throw new Error("Invalid target object when calling vp.events.add()");}vp.events.boundObjects[vp.events.boundObjects.length]={target:oTarget,eventName:sEvent,handler:fnHandler};if(oTarget.addEventListener){oTarget.addEventListener(sEvent,fnHandler,false);}else if(oTarget.attachEvent){oTarget.attachEvent("on"+sEvent,fnHandler);}else{if(!oTarget.handlers){oTarget.handlers={};}if(!oTarget.handlers[sEvent]){oTarget.handlers[sEvent]=[];}oTarget.handlers[sEvent][oTarget.handlers[sEvent].length]=fnHandler;oTarget["on"+sEvent]=vp.events._callHandlers;}};vp.events.addToOnLoad=function(fnHandler){vp.events.add(window,"load",fnHandler);};vp.events.addToOnUnload=function(fnHandler){vp.events.add(window,"unload",fnHandler);};vp.events.getEvent=function(oEvent){oEvent=oEvent||window.event;if(typeof oEvent.target!="object"&&oEvent.srcElement){oEvent.target=oEvent.srcElement;}oEvent.realTarget=oEvent.target;if(oEvent.target.nodeType==3){oEvent.realTarget=oEvent.target.parentNode;}if(typeof oEvent.charCode!="number"&&oEvent.keyCode){oEvent.charCode=oEvent.keyCode;}if(typeof oEvent.pageX!="number"&&oEvent.offsetX){oEvent.pageX=oEvent.offsetX;oEvent.pageY=oEvent.offsetY;}if(oEvent.type=="mouseout"&&typeof oEvent.toElement!="undefined"&&!oEvent.relatedTarget){oEvent.relatedTarget=oEvent.toElement;}if(oEvent.type=="mouseover"&&typeof oEvent.fromElement!="undefined"&&!oEvent.relatedTarget){oEvent.relatedTarget=oEvent.fromElement;}return oEvent;};vp.events.isRightClick=function(e){if(e.button==2||e.type=="contextmenu"){return true;}};vp.events.remove=function(vTarget,sEvent,fnHandler){if(!vTarget){throw new Error("The argment vTarget was a null element reference when calling vp.events.remove()");}var oTarget=(typeof vTarget=="string"?document.getElementById(vTarget):vTarget);if(!oTarget){throw new Error("Invalid target object when calling vp.events.remove()");}if(oTarget.removeEventListener){oTarget.removeEventListener(sEvent,fnHandler,false);}else if(oTarget.detachEvent){oTarget.detachEvent("on"+sEvent,fnHandler);}else{if(!oTarget.handlers){oTarget.handlers={};}if(!oTarget.handlers[sEvent]){oTarget.handlers[sEvent]=[];}for(var i=0;i<oTarget.handlers[sEvent].length;i++){if(oTarget.handlers[sEvent][i]==fnHandler){oTarget.handlers[sEvent][i]=new Function();}}oTarget.handlers[sEvent][oTarget.handlers[sEvent].length]=fnHandler;oTarget["on"+sEvent]=vp.events._callHandlers;}};vp.events.removeAll=function(){for(var i=0;i<vp.events.boundObjects.length;i++){var oBound=vp.events.boundObjects[i];vp.events.remove(oBound.target,oBound.eventName,oBound.handler);}};vp.events.isVisibleKeyCode=function(iKeyCode){if(iKeyCode>=112&&iKeyCode<=123){return false;}if(iKeyCode>=33&&iKeyCode<=40){return false;}if(iKeyCode>=14&&iKeyCode<=31){return false;}switch(iKeyCode){case 9:case 45:case 91:case 145:return false;break;default:return true;}return true;};vp.events.CustomEvent=function(oObj,sEventName){var _aHandlers=[];var _oObj=oObj;var _sEventName=sEventName;this.addHandler=function(fnHandler){if(fnHandler.__isClosure){_aHandlers.push(fnHandler);}else{_aHandlers.push(fnHandler.getClosure(_oObj));}};this.removeHandler=function(fnHandler){for(var i=0;i<_aHandlers.length;i++){if(_aHandlers[i].__funId==fnHandler.__funId){_aHandlers.splice(i,1);return;}}};this.fire=function(e){if(!e){e={};}if(!e.target){e.target=_oObj;}if(!e.type){e.type=_sEventName;}for(var i=0;i<_aHandlers.length;i++){_aHandlers[i](e);}return e.cancelCustomEvent?false:true;};};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

