/*
 *               ____
 *              /\   \
 *             ___\   \___
 *            /\          \
 *            \ \___    ___\
 *        ____ \/__/\   \__/
 *       /\   \    \ \___\    klof  |  innovative web technology
 *      ___\   \___ \/___/
 *     /\          \          Animation: HTML Element animation
 *     \ \___    ___\         requirements: keen/dynamic.js
 *      \/__/\   \__/                       keen/animation.js
 *          \ \___\           
 *           \/___/           Drag: Create and handle draggable objects
 *                            requirements: keen/style.js
 *                                          keen/dynamic.js
 * 
 *                            Dynamic: HTML Element manipulation
 *                            requirements: keen/style.js
 * 
 *                            Link: Link multiple keen.dynamic objects together
 *                            requirements: keen/style.js
 *                                          keen/dynamic.js
 * 
 *                            Style: HTML Element style manipulation
 * 
 *                            XML: XML manipulation
 * 
 *                            Addon / movement: Library of movement functions
 *
 *                            Copyright 2003-2007, klof
 *                            http://keen.klof.net/                           
 */
if(typeof Keen!="object")
Keen=new(function(){this._child=0})();Keen.dynamic=function(mElement)
{this._version="1.1.3";if(typeof mElement!="undefined")
this.init(mElement);return this;};Keen.dynamic.prototype.init=function(mElement)
{if(typeof mElement=="string"&&document.getElementById)
this._object=document.getElementById(mElement);else if(typeof mElement=="object")
this._object=mElement;else
return false;this._id=typeof this._object.id=="string"&&this._object.id!=""?this._object.id:"Keen"+(++Keen._child)+"_";this._x=this._object.offsetLeft||parseInt(this.getStyle("left"))||0;this._y=this._object.offsetTop||parseInt(this.getStyle("top"))||0;this._z=this.getStyle("zIndex");this._width=this._object.offsetWidth||parseInt(this.getStyle("width"))||0;this._height=this._object.offsetHeight||parseInt(this.getStyle("height"))||0;this._visible=this.getStyle("visibility")!="hidden";this._fps=20;window[(this._self=this._id+"Object")]=this;};Keen.dynamic.prototype.getStyle=function(sProperty)
{return Keen.style.get(this._object,sProperty);};Keen.dynamic.prototype.setStyle=function(sProperty,mValue)
{return Keen.style.set(this._object,sProperty,mValue);};Keen.dynamic.prototype.attachMethod=function(sMethod,oFunction)
{this[sMethod]=oFunction;};Keen.dynamic.prototype.detachMethod=function(sMethod)
{this[sMethod]=null;delete this[sMethod];};Keen.dynamic.prototype.attachEvent=function(sEvent,sMethod)
{eval("this._object.on"+sEvent.toLowerCase()+"= new Function( \"evt\", \"return "+this._self+"."+sMethod+"( evt );\" )");};Keen.dynamic.prototype.detachEvent=function(sEvent)
{this._object["on"+sEvent.toLowerCase()]=null;};Keen.dynamic.prototype.timedcall=function(mCall,nMillisecond)
{return setTimeout(typeof mCall=="function"?mCall:this._self+"."+mCall,nMillisecond);};Keen.dynamic.prototype.setX=function(nValue)
{this._x=parseInt(this.setStyle("left",nValue+"px"));};Keen.dynamic.prototype.setY=function(nValue)
{this._y=parseInt(this.setStyle("top",nValue+"px"));};Keen.dynamic.prototype.setWidth=function(nValue)
{this._width=parseInt(this.setStyle("width",nValue+"px"));};Keen.dynamic.prototype.setHeight=function(nValue)
{this._height=parseInt(this.setStyle("height",nValue+"px"));};Keen.dynamic.prototype.setVisible=function(mValue)
{this._visible=this.setStyle("visibility",typeof mValue=="boolean"?mValue?"visible":"hidden":mValue)=="visible";};Keen.dynamic.prototype.getAlpha=function()
{this._alpha=this.getStyle("opacity")||this.getStyle("MozOpacity")||this.getStyle("KHTMLOpacity")||false;if(!this._alpha)
{if(typeof object.filters!="undefined"&&typeof object.filters.alpha!="undefined"&&typeof object.filters.alpha.opacity!="undefined")
this._alpha=parseInt(object.filters.alpha.opacity);else
this._alpha=100;}
else
{this._alpha*=100;}
return this._alpha;};Keen.dynamic.prototype.setAlpha=function(nPercentage)
{this.setStyle("filter","alpha(opacity="+nPercentage+")");nPercentage/=100;this.setStyle("opacity",nPercentage);this.setStyle("MozOpacity",nPercentage);this.setStyle("KHTMLOpacity",nPercentage);};Keen.dynamic.prototype.move=function(nX,nY)
{this.setX(nX);this.setY(nY);};Keen.dynamic.prototype.resize=function(nW,nH)
{this.setWidth(nW);this.setHeight(nH);};Keen.dynamic.prototype.show=function()
{this.setVisible(true);};Keen.dynamic.prototype.hide=function()
{this.setVisible(false);};if(typeof Keen!="object")
Keen=new(function(){this._child=0})();Keen.animation=function(mElement)
{this._version="1.0.0";this._posstep=20;this._dimstep=20;this._fadestep=10;this._callAfterSlide=false;this._callAfterGrow=false;this.init(mElement);};Keen.animation.prototype=new Keen.dynamic;Keen.animation.prototype.slide=function(nX,nY,mMode,nStep,oCallWhenDone)
{if(typeof mMode!="function"&&typeof this[mMode]!="function")
mMode="linear";if(typeof nStep=="number")
this._posstep=nStep;this._posbeginX=this._x;this._posbeginY=this._y;this._posendX=nX;this._posendY=nY;this._postime=0;this._posmode=typeof mMode=="function"?mMode:this[mMode];this._callAfterSlide=(typeof oCallWhenDone=="function"?oCallWhenDone:false);clearTimeout(this.__position);this.__position=this.timedcall("slidestep();",1000/this._fps);};Keen.animation.prototype.slidestep=function()
{if(++this._postime<this._posstep)
{this.move(this._posmode(this._posbeginX,this._posendX,this._postime,this._posstep),this._posmode(this._posbeginY,this._posendY,this._postime,this._posstep));this.__position=this.timedcall("slidestep();",1000/this._fps);}
else
{this.move(this._posendX,this._posendY);clearTimeout(this.__position);if(this._callAfterSlide)
this._callAfterSlide();}};Keen.animation.prototype.grow=function(nW,nH,mMode,nStep,oCallWhenDone)
{if(typeof mMode!="function"&&typeof this[mMode]!="function")
mMode="linear";if(typeof nStep=="number")
this._dimstep=nStep;this._dimbeginW=this._width;this._dimbeginH=this._height;this._dimendW=nW;this._dimendH=nH;this._dimtime=0;this._dimmode=typeof mMode=="function"?mMode:this[mMode];this._callAfterGrow=(typeof oCallWhenDone=="function"?oCallWhenDone:false);clearTimeout(this.__dimension);this.__dimension=this.timedcall("growstep();",1000/this._fps);};Keen.animation.prototype.growstep=function()
{if(++this._dimtime<this._dimstep)
{this.resize(this._dimmode(this._dimbeginW,this._dimendW,this._dimtime,this._dimstep),this._dimmode(this._dimbeginH,this._dimendH,this._dimtime,this._dimstep));this.__dimension=this.timedcall("growstep();",1000/this._fps);}
else
{this.resize(this._dimendW,this._dimendH);clearTimeout(this.__dimension);if(this._callAfterGrow)
this._callAfterGrow();}};Keen.animation.prototype.fade=function(nAlpha,mMode,nStep,oCallWhenDone)
{if(typeof mMode!="function"&&typeof this[mMode]!="function")
mMode="linear";if(typeof nStep=="number")
this._fadestep=nStep;this._fadebeginAlpha=this.getAlpha();this._fadeendAlpha=nAlpha;this._fadetime=0;this._fademode=typeof mMode=="function"?mMode:this[mMode];this._callAfterFade=(typeof oCallWhenDone=="function"?oCallWhenDone:false);clearTimeout(this.__fadetimer);this.__fadetimer=this.timedcall("fadestep();",1000/this._fps);};Keen.animation.prototype.fadestep=function()
{if(++this._fadetime<this._fadestep)
{this.setAlpha(this._fademode(this._fadebeginAlpha,this._fadeendAlpha,this._fadetime,this._fadestep));this.__fadetimer=this.timedcall("fadestep();",1000/this._fps);}
else
{this.setAlpha(this._fadeendAlpha);clearTimeout(this.__fadetimer);if(this._callAfterFade)
this._callAfterFade();}};Keen.animation.prototype.linear=function(nBegin,nEnd,nStep,nNumStep)
{return(nEnd-nBegin)*nStep/nNumStep+nBegin;};if(typeof Keen!="object")
Keen=new(function(){this._child=0})();var sDragManager="Keen_dragmanager_object";Keen.drag=function(mElement,bNoRegister)
{this._version="1.0.0";if(typeof mElement!="undefined")
this.initDrag(mElement,bNoRegister);};Keen.drag.prototype=new Keen.dynamic;Keen.drag.prototype.initDrag=function(mElement,bNoRegister)
{this.init(mElement);this._manager=window[sDragManager];if(!bNoRegister)
this._manager.register(this);this._xmouse=0;this._ymouse=0;this.attachEvent("mousedown","mouseDown");};Keen.drag.prototype.getMouseOffset=function(e)
{this._xmouse=(!window.event&&e.pageX?e.pageX:window.event.clientX)-this._x;this._ymouse=(!window.event&&e.pageY?e.pageY:window.event.clientY)-this._y;};Keen.drag.prototype.mouseDown=function(e)
{this.getMouseOffset(e);this._manager.mouseDown(this,e);};Keen.drag.prototype.moveRelative=function(nX,nY)
{this.move(nX-this._xmouse,nY-this._ymouse);};Keen.drag.prototype.setZ=function(nValue)
{this._z=parseInt(this.setStyle("zIndex",nValue));};Keen.dragManager=function()
{this._version="1.0.0";this.init();};Keen.dragManager.prototype.init=function()
{this._child=new Array();this._active=false;document.onmousemove=function(e)
{window[sDragManager].mouseMove(e);}
document.onmouseup=function(e)
{window[sDragManager].mouseUp(e);}};Keen.dragManager.prototype.register=function(oDrag)
{if(typeof oDrag!="undefined")
{var nIndex=this._child.length;this._child[nIndex]=oDrag;this._child[nIndex].setZ(nIndex);return this._child[nIndex];}
return false;};Keen.dragManager.prototype.mouseMove=function(e)
{if(this._active)
{var nX=(window.event?window.event.clientX:e.pageX);var nY=(window.event?window.event.clientY:e.pageY);this._active.moveRelative(nX,nY);}};Keen.dragManager.prototype.mouseDown=function(oDrag,e)
{if(typeof oDrag=="object")
{this.zOrder(this.getIndex(oDrag));this._active=oDrag;}};Keen.dragManager.prototype.mouseUp=function(e)
{this._active=false;};Keen.dragManager.prototype.getIndex=function(oChild)
{for(var i=0;i<this._child.length;++i)
if(this._child[i]==oChild)
break;return i;};Keen.dragManager.prototype.zOrder=function(nIndex)
{for(var i=0;i<this._child.length;++i)
if(this._child[i]._z>=this._child[nIndex]._z)
this._child[i].setZ(this._child[i]._z-1);this._child[nIndex].setZ(i);};if(typeof window[sDragManager]!="object")
window[sDragManager]=new Keen.dragManager();if(typeof Keen!="object")
Keen=new(function(){this._child=0})();Keen.link=function(mElement)
{this._version="1.0.0";this._link=new Array();if(typeof mElement!="undefined")
this.add(mElement);};Keen.link.prototype.add=function(mElement)
{if(mElement.__proto__==Array.prototype)
for(var i=0;i<mElement.length;++i)
this.add(mElement[i]);else if(typeof mElement=="object"||typeof mElement=="string")
return this._link[this._link.length]=new Keen.dynamic(mElement);};Keen.link.prototype.call=function(sMethod)
{var aParam=new Array();if(arguments.length==2&&arguments[1].__proto__==Array.prototype)
aParam=arguments[1];else
for(var i=1;i<arguments.length;++i)
aParam[aParam.length]=arguments[i];for(var i=0;i<this._link.length;++i)
this._link[i][sMethod].apply(this._link[i],aParam);};if(typeof Keen!="object")
Keen=new(function(){this._child=0})();Keen.style=function()
{this._version="1.0.1";};Keen.style.prototype.get=function(oElement,sProperty)
{if(typeof document.defaultView=="object"&&typeof document.defaultView.getComputedStyle!="undefined")
{var oCS=document.defaultView.getComputedStyle(oElement,"");if(oCS&&oCS.getPropertyValue)
return oCS.getPropertyValue(this.cssProperty(sProperty));}
else if(oElement.currentStyle)
{return oElement.currentStyle[this.scriptProperty(sProperty)];}
return false;};Keen.style.prototype.set=function(oElement,sProperty,mValue)
{return oElement.style[this.scriptProperty(sProperty)]=mValue;};Keen.style.prototype.scriptProperty=function(sProperty)
{var n=0;while((n=sProperty.indexOf("-",n))>=0)
sProperty=sProperty.substr(0,n)+sProperty.charAt(++n).toUpperCase()+sProperty.substring(n+1);return sProperty;};Keen.style.prototype.cssProperty=function(sProperty)
{return sProperty.replace(/([A-Z])/g,"-$1").toLowerCase();};Keen.style.prototype.propertyExists=function(oElement,sProperty)
{return(typeof oElement.style[sProperty]!="undefined");};Keen.style=new Keen.style;if(typeof Keen!="object")
Keen=new(function(){this._child=0})();Keen.xml=function(bAutoRedirectOnFail)
{this._version="1.0.2";this._redirect=typeof bAutoRedirectOnFail=="boolean"?bAutoRedirectOnFail:false;};Keen.xml.prototype.init=function()
{if(window.XMLHttpRequest)
this._xml=new XMLHttpRequest();else if(window.ActiveXObject)
this._xml=new ActiveXObject("Microsoft.XMLHTTP");return typeof this._xml=="object";};Keen.xml.prototype.setHeader=function(sName,sValue)
{this._xml.setRequestHeader(sName,sValue);};Keen.xml.prototype.getHeader=function(sName)
{return this._xml.getResponseHeader(sName);};Keen.xml.prototype.request=function(sURL,sMethod,bAsync,oData,sUsername,sPassword)
{if(this.init())
{var sParam=null;if(typeof sMethod!="string")
sMethod="GET";else
sMethod=sMethod.toUpperCase();if(typeof bAsync!="boolean")
bAsync=true;if(typeof oData=="object")
{sParam="";for(var p in oData)
if(typeof oData[p]!="object")
sParam+=(sParam!=""?"&":"")+p+"="+escape(oData[p]).replace(/\+/g,"%2B");}
if(bAsync)
{var oBackRef=this;this._xml.onreadystatechange=function(){oBackRef.onReadyStateChange();}}
if(sMethod=="GET"&&typeof sParam=="string"&&sParam!="")
{sURL+="?"+sParam;sParam=null;}
if(this._xml.overrideMimeType)
this._xml.overrideMimeType("text/xml");this._xml.open(sMethod,sURL,bAsync,sUsername,sPassword);if(sMethod=="POST"&&typeof sParam=="string"&&sParam!="")
{this.setHeader("Content-type","application/x-www-form-urlencoded");this.setHeader("Content-length",sParam.length);this.setHeader("Connection","close");}
this.setHeader("X-JSXML","Keen.xml/"+this._version+" (klof.net)");this._xml.send(sParam);if(!bAsync)
return this._xml.responseXML;else
return true;}
else if(this._redirect)
{document.location=sURL};return false;};Keen.xml.prototype.onReadyStateChange=function()
{if(this._xml.readyState==4)
{if(this._xml.status==200)
{if(typeof this.$__onload=="function")
this.$__onload();if(typeof this.onload=="function")
this.onload();}
else
{if(typeof this.$__onerror=="function")
this.$__onerror(this._xml.status);if(typeof this.onerror=="function")
this.onerror(this._xml.status,this._xml.statusText);}}};Keen.xml.prototype.get=function(sURL,bAsync,oData,sUsername,sPassword)
{return this.request(sURL,"GET",bAsync,oData,sUsername,sPassword);};Keen.xml.prototype.post=function(sURL,bAsync,oData,sUsername,sPassword)
{return this.request(sURL,"POST",bAsync,oData,sUsername,sPassword);};Keen.xml.prototype.getData=function(bText)
{if(bText)
return this._xml.responseText;else if(!this._xml.responseXML.firstChild)
this._xml.responseXML.loadXML(this._xml.responseText);return this._xml.responseXML;};Keen.xml.prototype.loadIntoElement=function(mElement,sURL,sMethod,oParamData,sUsername,sPassword)
{this.$__onload=function()
{if(typeof this._xml.responseXML!="object"&&typeof this.onerror=="function")
{this.onerror(this._xml.status,this._xml.statusText);return false;}
var oHTML=this.convertToHTML(this._xml.responseXML);if(typeof oHTML=="object"&&typeof this.$__element=="object")
this.$__element.appendChild(oHTML);delete this.$__element;delete this.$__onload;if(typeof this.onload=="function")
this.onload();};this.$__element=typeof mElement!="object"?document.getElementById(mElement):mElement;return this.request(sURL,sMethod,true,oParamData,sUsername,sPassword);};Keen.xml.prototype.getIntoElement=function(mElement,sURL,oParamData,sUsername,sPassword)
{this.loadIntoElement(mElement,sURL,"GET",oParamData,sUsername,sPassword);};Keen.xml.prototype.postIntoElement=function(mElement,sURL,oParamData,sUsername,sPassword)
{this.loadIntoElement(mElement,sURL,"POST",oParamData,sUsername,sPassword);};Keen.xml.prototype.convertToHTML=function(oXML)
{var oNode=null;var oDOM=null;if(oXML.nodeType==1||oXML.nodeType==9)
{var bXMLNS=false;if(oXML.nodeType==1)
if(typeof oXML.getAttribute=="function")
{bXMLNS=oXML.getAttribute("xmlns")!="";}
else if(typeof oXML.attributes=="object")
{for(var i=0;i<oXML.attributes.length;++i)
if(oXML.attributes[i].name.toLowerCase()=="xmlns")
{bXMLNS=true;break;}}
var nOffset=oXML.nodeName.indexOf(":")+1;if(oXML.nodeType==1&&(nOffset>0||bXMLNS||(arguments.length>1&&((typeof arguments[1]=="boolean"&&arguments[1])||(typeof arguments[1]=="string"&&arguments[1].toLowerCase()==oXML.nodeName.toLowerCase())))))
{var sNodeName=nOffset>0?oXML.nodeName.substr(nOffset,oXML.nodeName.length-nOffset):oXML.nodeName;oDOM=document.createElement(sNodeName);for(var i=0;i<oXML.attributes.length;++i)
{if(oXML.attributes[i].name=="class")
oDOM.className=oXML.attributes[i].value;else if(oXML.attributes[i].name!="xmlns")
oDOM.setAttribute(oXML.attributes[i].name,oXML.attributes[i].value);}
for(var i=0;i<oXML.childNodes.length;++i)
if((name=oXML.childNodes[i].nodeName)!=null)
if(typeof(oNode=arguments.callee(oXML.childNodes[i],true))=="object")
{if(oDOM.nodeName.toLowerCase()!="style"&&oDOM.nodeName.toLowerCase()!="script")
oDOM.appendChild(oNode);}}
else
{for(var i=0;i<oXML.childNodes.length;++i)
if(oXML.childNodes[i].nodeType==1)
oDOM=arguments.callee(oXML.childNodes[i],arguments[1]);}}
else if(oXML.nodeType==3||oXML.nodeType==4)
{oDOM=document.createTextNode(oXML.nodeValue);}
else if(oXML.nodeType==8)
{oDOM=document.createComment(oXML.nodeValue);}
return oDOM;};if(typeof Keen!="object")
Keen=new(function(){this._child=0})();Keen.movement=function(mElement)
{this._version="1.0.0";};Keen.movement.prototype.smooth=function(nBegin,nEnd,nStep,nNumStep)
{return(nEnd-nBegin)/2*((nStep/=nNumStep/2)<1?Math.pow(nStep,3):(nStep-=2)*Math.pow(nStep,2)+2)+nBegin;};Keen.movement.prototype.elastic=function(nBegin,nEnd,nStep,nNumStep)
{return(nEnd-nBegin)*((nStep=nStep/nNumStep-1)*nStep*(((Math.PI/3)+1)*nStep+(Math.PI/3))+1)+nBegin;};Keen.movement=new Keen.movement;
