//MAIN.JS
function $defined( object, value ) { if( typeof( object ) == 'undefined' ) { return false; } if( typeof( value ) != 'undefined' ) { if( typeof( object[value] ) == 'undefined' ) { return false; } } return true; }; function $type( value ) { if( !$defined( value ) ) { return 'undefined'; } if( $defined( value, '$name' ) ) { return value.$name; } return typeof value; }; function $extend( object, extend ) { if( $defined( object ) && $defined( extend ) ) { if( $type( object ) == 'array' ) { for( var p = 0; p < object.length; p++ ) { $extend( object[p], extend ); } } else { if( $defined( object, 'prototype' ) ) { for( key in extend ) { object.prototype[key] = extend[key]; } } else if( typeof( object ) == 'object' ) { for( key in extend ) { object[key] = extend[key]; } } } } return object; }; function $empty() { return function() {}; }; function $overload( overloads ) { var functions = []; var formats = []; for( var format in overloads ) { functions.push( overloads[format] ); formats.push( format.toLowerCase().replace( /[^a-z0-9,$\=]/, '' ).split( ',' ) ); } if( formats.length == 1 ) { return functions[0]; } else { return function() { for( var f = 0; f < formats.length; f++ ) { if( arguments.length == formats[f].length ) { for( var a = 0; a <= arguments.length; a++ ) { if( a == arguments.length ) { return functions[f].apply( this, arguments ); } else { if( typeof( arguments[a] ) != formats[f][a] && ( '$' + $type( arguments[a] ) ) != formats[f][a] && ( '=' + arguments[a] ) != formats[f][a] ) { break; } } } } } return false; } } return $empty(); }; function $time() { var date = new Date(); var time = date.getTime(); delete date; return time; };

//BROWSER.JS
var Browser = { name : navigator.appName, engin : 'unknown', cookies : navigator.cookieEnabled, language : navigator.userLanguage || navigator.language, unknown : false, gecko : false, presto : false, trident : false }; if( $defined( window, 'GeckoActiveXObject' ) ) { Browser.engin = 'gecko'; } else if( $defined( window, 'opera' ) ) { Browser.engin = 'presto'; } else if( $defined( window, 'ActiveXObject' ) ) { Browser.engin = 'trident'; } Browser[Browser.engin] = true;

//WINDOW.JS
$extend( window, { '$name' : 'window' } );

//DOCUMENT.JS
$extend( document, { '$name' : 'document' } ); var Html = document.getElementsByTagName( 'html' )[0]; var Head = document.getElementsByTagName( 'head' )[0];

//FUNCTION.JS
$extend( Function, { '$name' : 'function', 'delegate' : function( to, argumentss ) { var self = this; if( $type( argumentss ) != 'array' ) { argumentss = []; } return function() { return self.apply( to, argumentss ); } }, 'timeout' : function( to, argumentss, delay ) { return setTimeout( this.delegate( to, argumentss ), delay ); }, 'interval' : function( to, argumentss, delay ) { return setInterval( this.delegate( to, argumentss ), delay ); } } );

//ARRAY.JS
$extend( Array, { '$name' : 'array', 'remove' : function( key ) { this.slice( key, 1 ); }, 'key' : function( value ) { for( var p = 0; p < this.length; p++ ) { if( value === this[p] ) { return p; break; } } return -1; }, 'value' : function( key ) { if( $defined( this, key ) ) { return this[key]; } return null; } } );

//BOOLEAN.JS
$extend( Boolean, { '$name' : 'boolean' } );

//COLOR.JS
var Color = { 'toValue' : function( string ) { if( $type( string ) != 'string' ) { return string; } var rgb = string.match( /^rgb\(([0-9 ]*),([0-9 ]*),([0-9 ]*)\)/i ); if( rgb ) { return this.make( [ rgb[1].toNumber(), rgb[2].toNumber(), rgb[3].toNumber() ] ); } var hex = string.match( /^#([0-9a-f]{1,2})([0-9a-f]{1,2})([0-9a-f]{1,2})/i ); if( hex ) { for( var h = 1; h < 4; h++ ) { if( hex[h].length == 1 ) { hex[h] = hex[h] + hex[h]; }; hex[h] = unescape( '%' + hex[h] ).charCodeAt( 0 ); } return this.make( [ hex[1], hex[2], hex[3] ] ); } return string; }, 'toRGB' : function( color ) { return 'rgb(' + this.red( color ) + ', ' + this.green( color ) + ', ' + this.blue( color ) + ')'; }, 'toHEX' : function( color ) { return '#' + escape( String.fromCharCode( this.red( color ) ) + String.fromCharCode( this.green( color ) ) + String.fromCharCode( this.blue( color ) ) ).replaceAll( '%', '' ); }, 'toString' : function( color ) { return this.toRGB( color ); }, 'make' : function( red, green, blue ) { if( $type( red ) == 'array' ) { return red[0] | ( red[1] << 8 ) | ( red[2] << 16 ); } return red | ( green << 8 ) | ( blue << 16 ); }, 'red' : function( color ) { return color & 255; }, 'green' : function( color ) { return ( color >> 8 ) & 255; }, 'blue' : function( color ) { return ( color >> 16 ) & 255; } }; $extend( Color, { 0 : Color.red, 1 : Color.green, 2 : Color.blue } );

//REGEXP.JS
$extend( RegExp, { '$name' : 'regexp' } );

//STRING.JS
$extend( String, { '$name' : 'string', '_replace' : String.prototype.replace, 'replace' : function( search, replace ) { if( $type( replace ) == 'function' ) { if( Browser.trident ) { var funct = replace; replace = function( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z ) { return funct( [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z] ); } } } return this._replace( search, replace ); }, 'replaceAll' : function( search, replace ) { var string = this; while( string.match( search ) ) { string = string.replace( search, replace ); } return string; }, 'matchAll' : function( regexp ) { var matches = []; var string = this; while( true ) { var match = string.match( regexp ); if( match ) { for( key in match ) { if( $type( matches[key] ) !== 'array' ) { matches[key] = []; } matches[key].push( match[key] ); } string = string.slice( match[0].length ); } else { break; } } return matches; }, 'toNumber' : function() { return Number( this ); }, 'format' : function() { var args = arguments; var arg = 0; return this.replaceAll( /%[a-z0-9$]+/, function( base ) { var p = 1; var a = 0; if( base[p] >= 1 && base[p] <= args.length && base[p+1] == '$' ) { a = base[p] - 1; p += 2; } else { a = arg; arg++; } if( base[p] == 'd' ) { return String( Number( args[a] ) ); } else if( base[p] == 's' ) { return String( args[a] ); } return args[a]; } ); } } );

//MATH.JS
$extend( Math, { '$name' : 'math', 'sign' : function( value ) { if( value > 0 ) { return 1; } else if( value == 0 ) { return 0; } return -1; }, 'degtorad' : function( dec ) { return dec * Math.PI / 180; }, 'radtodeg' : function( rad ) { return rad / Math.PI; } } );

//NUMBER.JS
$extend( Number, { '$name' : 'number', 'round' : function( p ) { if( !$defined( p ) ) { return Math.round( this ); } p = Math.pow( 10, p ); return Math.round( this * p ) / p; }, 'ceil' : function( p ) { if( !$defined( p ) ) { return Math.ceil( this ); } p = Math.pow( 10, p ); return Math.ceil( this * p ) / p; }, 'floor' : function( p ) { if( !$defined( p ) ) { return Math.floor( this ); } p = Math.pow( 10, p ); return Math.floor( this * p ) / p; }, 'abs' : function() { return Math.abs( this ); }, 'sign' : function() { return Math.sign( this ); }, 'max' : function( num ) { return Math.max( this, num ); } } );

//DATE.JS
$extend( Date, { '$name' : 'date' } );

//GET.JS
var Get = { '$name' : 'get' }; var link = document.location + '&'; var value = null; var key = null; var start = link.indexOf( '?' ); var end = 0; if( start !== -1 ) { start++; while( true ) { end = link.indexOf( '&', start ); if( end == -1 ) { break; } value = link.slice( start, end ); start = value.indexOf( '=' ); if( start == -1 ) { key = value; value = null; } else { key = value.slice( 0, start ); value = value.slice( start + 1, value.length ); } start = end + 1; if( key !== null ) { if( key.length > 0 ) { Get[key] = value; } } } }

//COOKIES.JS
var Cookie = { '$name' : 'cookie', 'get' : function( name ) { var cookies = ' ' + document.cookie + '; '; var start = cookies.indexOf( ' ' + name + '=' ); if( start != -1 ) { start += name.length + 2; var end = cookies.indexOf( '; ', start ); if( end != -1 ) { return unescape( cookies.slice( start, end ) ); } } return false; }, 'set' : function( name, value, time, path ) { var cookie = name + '=' + escape( value ); if( $defined( time ) ) { if( time !== 0 ) { var now = new Date(); now.setTime( now.getTime() + time ); cookie += '; expires=' + now.toGMTString(); } } if( $defined( path ) ) { cookie += '; path=' + path; } document.cookie = cookie; return true; } };

//ELEMENT.JS
if( $defined( Element ) ) { var newElement = $empty(); newElement.prototype = Element.prototype; Element = newElement; } else { var Element = $empty(); } $extend( Element, { '$name' : 'element' } ); $extend( [window,document,Element], { '$element' : true, 'append' : function( tag, id ) { var element = document.createElement( tag ); if( $type( id ) == 'string' ) { element.id = id; } this.appendChild( element ); return element; }, 'buld' : function( construct ) { if( !$defined( construct.tag ) ) { return this; } var element = this.append( construct.tag ); delete construct.tag; if( $defined( construct.events ) ) { element.addEvents( type, construct.events ); delete construct.events; } if( $defined( construct.styles ) ) { element.setStyles( style, construct.styles ); delete construct.styles; } if( $defined( construct.childs ) ) { element.buld( construct.childs ); delete construct.childs; } for( var prop in construct ) { element[prop] = construct[prop]; } return element; }, 'remove' : function() { this.removeChilds(); var parent = this.parentNode; parent.removeChild( this ); return parent; }, 'removeChilds' : function() { for( var c = 0; c < this.childNodes.length; c++ ) { if( this.childNodes[c].nodeType == 1 ) { this.childNodes[c].remove(); } } return this; }, 'addClass' : function( clas ) { if( this.className.length > 0 ) { this.className += ' ' + clas; } else { this.className = clas; } return this; }, 'removeClass' : function( clas ) { var classes = this.className.split( ' ' ); this.className = ''; for( var c = 0; c < classes.length; c++ ) { if( classes[c] != clas ) { if( this.className.length > 0 ) { this.className += ' ' + classes[c]; } else { this.className = classes[c]; } } } return this; }, 'hasClass' : function( clas ) { var classes = this.className.split( ' ' ); for( var c = 0; c < classes.length; c++ ) { if( classes[c] == clas ) { return true; } } return false; }, 'getChildByTag' : function( tag ) { tag = tag.toLowerCase(); for( var c in this.childNodes ) { var element = this.childNodes[c]; if( $type( element ) !== 'element' ) { continue; } if( element.tagName ) { if( element.tagName.toLowerCase() == tag ) { return element; } } } return false; }, 'getChildsByTag' : function( tag ) { var elements = []; tag = tag.toLowerCase(); for( var c in this.childNodes ) { var element = this.childNodes[c]; if( $type( element ) !== 'element' ) { continue; } if( element.tagName ) { if( element.tagName.toLowerCase() == tag ) { elements.push( element ); } } } return elements; }, 'getChildByClass' : function( clas ) { var classes = clas.split( ' ' ); for( var c in this.childNodes ) { var element = this.childNodes[c]; if( $type( element ) !== 'element' ) { continue; } if( element.className ) { for( var cc = 0; cc < classes.length; cc++ ) { if( !element.hasClass( classes[cc] ) ) { break; } else { return element; } } } } return false; }, 'getChildsByClass' : function( clas ) { var elements = []; var classes = clas.split( ' ' ); for( var c = 0; c < this.childNodes.length; c++ ) { var element = this.childNodes[c]; if( $type( element ) !== 'element' ) { continue; } if( element.className ) { for( var cc = 0; cc < classes.length; cc++ ) { if( !element.hasClass( classes[cc] ) ) { break; } else { elements.push( element ); } } } } return elements; }, 'getElementByTag' : function( tag ) { for( var c in this.childNodes ) { var element = this.childNodes[c]; if( $type( element ) !== 'element' ) { continue; } if( element.tagName ) { if( element.tagName.toLowerCase() == tag ) { return element; } } if( element.childNodes ) { var found = element.getElementByTag( tag ); if( found ) { return found; } } } return false; }, 'getElementsByTag' : function( tag ) { var elements = []; for( var c in this.childNodes ) { var element = this.childNodes[c]; if( $type( element ) !== 'element' ) { continue; } if( element.tagName ) { if( element.tagName.toLowerCase() == tag ) { elements.push( element ); } } if( element.childNodes ) { elements = elements.concat( element.getElementsByTag( tag ) ); } } return element; }, 'getElementByClass' : function( clas ) { var classes = clas.split( ' ' ); for( var c in this.childNodes ) { var element = this.childNodes[c]; if( $type( element ) !== 'element' ) { continue; } if( element.className ) { for( var cc = 0; cc < classes.length; cc++ ) { if( !element.hasClass( classes[cc] ) ) { break; } else { return element; } } } if( element.childNodes ) { var found = element.getElementByClass( clas ); if( found ) { return found; } } } return false; }, 'getElementsByClass' : function( clas ) { var elements = []; var classes = clas.split( ' ' ); for( var c in this.childNodes ) { var element = this.childNodes[c]; if( $type( element ) !== 'element' ) { continue; } if( element.className ) { for( var cc = 0; cc < classes.length; cc++ ) { if( !element.hasClass( classes[cc] ) ) { break; } else if( cc + 1 == classes.length ) { elements.push( element ); } } } if( element.childNodes ) { elements = elements.concat( element.getElementsByClass( clas ) ); } } return elements; }, 'getX' : function() { return this.offsetLeft; }, 'getY' : function() { return this.offsetTop; } } ); if( Browser.trident ) { $extend( document, { '_createElement' : document.createElement, 'createElement' : function( tag ) { var e = document._createElement( tag ); $extend( e, Element.prototype ); return e; }, '_getElementById' : document.getElementById, 'getElementById' : function( id ) { var e = document._getElementById( id ); if( !$defined( e, '$element' ) ) { $extend( e, Element.prototype ); } return e; }, '_getElementsByTagName' : document.getElementsByTagName, 'getElementsByTagName' : function( id ) { var e = document._getElementsByTagName( id ); for( var p = 0; p < e.length; p++ ) { if( typeof e[p] == 'object' ) { if( e[p].nodeType == 1 ) { if( !$defined( e[p], '$element' ) ) { $extend( e[p], Element.prototype ); } } } }; return e; }, 'setElementsUp' : function( e ) { if( e.nodeType == 1 ) { if( !$defined( e, '$element' ) ) { $extend( e, Element.prototype ); } } for( var i = 0; i < e.childNodes.length; i++ ) { if( typeof e.childNodes[i] == 'object' ) { document.setElementsUp( e.childNodes[i] ); } } } } ); }; function $( id ) { var element; if( $type( id ) == 'string' ) { element = document.getElementById( id ); } else if( typeof( id ) == 'object' ) { element = id; if( element == document || element == window ) { return element; } else { if( !$defined( element, '$element' ) ) { $extend( element, Element.prototype ); } } } else { return null; } return element; };

//EVENT.JS
var Event = { '$name' : 'event', 'add' : function( element, type, funct ) { if( type.match( /mousewheel|DOMMouseScroll/ ) ) { if( $type( element ) == 'window' ) { element = document; } if( Browser.gecko ) { type = 'DOMMouseScroll'; } else { type = 'mousewheel'; } } if( !$defined( element, 'events' ) ) { element.events = {}; } if( !$defined( element.events, type ) ) { element.events[type] = []; } var baseFunct = funct; var elementType = $type( element ); if( elementType == 'element' || elementType == 'window' || elementType == 'document' ) { if( $defined( Event.Types, type ) ) { if( Event.Types[type] === true ) { funct = function( event ) { event = new EventHandle( event ); if( baseFunct.apply( element, [event] ) === false ) { event.stop(); return false; }; return true; } } if( $defined( element, 'addEventListener' ) ) { element.addEventListener( type, funct, false ); } else if( $defined( element, 'attachEvent' ) ) { element.attachEvent( 'on' + type, funct ); } } } element.events[type].push( { 'base' : baseFunct, 'child' : funct } ); return element; }, 'remove' : function( element, type, funct ) { if( type.match( /mousewheel|DOMMouseScroll/ ) ) { if( $type( element ) == 'window' ) { element = document; } if( Browser.gecko ) { type = 'DOMMouseScroll'; } else { type = 'mousewheel'; } } if( !$defined( element, 'events' ) ) { element.events = {}; } if( !$defined( element.events, type ) ) { return element; } for( var e = 0; e < element.events[type].length; e++ ) { if( element.events[type][e].base === funct ) { var elementType = $type( element ); if( elementType == 'element' || elementType == 'window' || elementType == 'document' ) { if( $defined( Event.Types, type ) ) { var removefunct = $empty(); if( Event.Types[type] === true ) { removefunct = element.events[type][e].child; } else { removefunct = element.events[type][e].base; } if( $defined( element, 'removeEventListener' ) ) { element.removeEventListener( type, removefunct, false ); } else if( $defined( element, 'detachEvent' ) ) { element.detachEvent( 'on' + type, removefunct ); } } } this.events[type].remove( e ); break; } } return element; }, 'call' : function( element, type, arguments ) { if( type.match( /mousewheel|DOMMouseScroll/ ) ) { if( $type( element ) == 'window' ) { element = document; } if( Browser.gecko ) { type = 'DOMMouseScroll'; } else { type = 'mousewheel'; }; }; if( !$defined( element, 'events' ) ) { element.events = {}; } if( !$defined( element.events, type ) ) { return element; } if( $type( arguments ) != 'array' ) { arguments = []; } for( var e = 0; e < element.events[type].length; e++ ) { element.events[type][e].base.apply( element, arguments ); } return element; } }; Event.Types = { 'keypress' : true, 'keyup' : true, 'click' : true, 'dblclick' : true, 'mouseup' : true, 'mousedown' : true, 'mousewheel' : true, 'DOMMouseScroll' : true, 'mousemove' : true, 'mouseout' : true, 'mouseover' : true, 'blur' : true, 'change' : true, 'focus' : true, 'reset' : true, 'select' : true, 'submit' : true, 'scroll' : true, 'abort': false, 'error' : false, 'load' : false, 'resize' : false, 'unload' : false, 'ready' : false }; Event.Keys = { 257 : 'none', 8 : 'backspace', 9 : 'tab', 13 : 'enter', 27 : 'esc', 32 : 'space', 37 : 'left', 38 : 'up', 39 : 'right', 40 : 'down', 46 : 'delete' }; Event.Buttons = { 257 : 'none', 2 : 'right', 1 : 'middle', 0 : 'left' }; var EventHandle = function( event ) { if( !$defined( event ) ) { event = window.event; } this.event = event; this.type = event.type; this.key = -1; this.keyCode = -1; this.mouse = { 'button' : -1, 'wheel' : 0, 'x' : event.clientX, 'y' : event.clientY }; if( this.type.match( /key/i ) ) { var keyCode = 257; if( $defined( event, 'which' ) ) { this.keyCode = event.which; } else if( $defined( event, 'keyCode' ) ) { this.keyCode = event.keyCode; } if( $defined( Event.Keys[this.keyCode] ) ) { this.key = Event.Keys[this.keyCode]; } else { this.key = String.fromCharCode( this.keyCode ).toLowerCase(); } } else if( this.type.match( /mouse|click/i ) ) { if( this.type.match( /mousewheel|DOMMouseScroll/ ) ) { if( $defined( event, 'wheelDelta' ) ) { this.mouse.wheel = -event.wheelDelta / 120; } else if( $defined( event, 'detail' ) ) { this.mouse.wheel = event.detail / 3; } } else { var buttonCode = 257; if( Browser.trident ) { if( this.type == 'dblclick' ) { buttonCode = event.button; } else { buttonCode = event.button == 1 ? 0 : ( event.button == 4 ? 1 : ( event.button == 2 ? 2 : -1 ) ); } } else { buttonCode = event.button; } this.mouse.button = Event.Buttons[buttonCode]; } } return this; }; $extend( EventHandle, { '$name' : 'eventhandle', 'stop' : function() { if( $defined( this.event, 'stopPropagation' ) ) { this.event.stopPropagation(); } if( $defined( this.event, 'cancelBubble' ) ) { this.event.cancelBubble = true; } if( $defined( this.event, 'preventDefault' ) ) { this.event.preventDefault(); } if( $defined( this.event, 'returnValue' ) ) { this.event.returnValue = false; } return this; } } ); $extend( [window,document,Element], { 'addEvent' : function( type, funct ) { return Event.add( this, type, funct ); }, 'addEvents' : function( events ) { for( var type in events ) { Event.add( this, type, events[type] ); } return true; }, 'removeEvent' : function( type, funct ) { return Event.remove( this, type, funct ); }, 'callEvent' : function( type, arguments ) { return Event.call( this, type, arguments ); } } ); var onReadyCheck = function() { if( document.getElementsByTagName( 'body' )[0] ) { if( Browser.trident ) { document.setElementsUp( document ); } window.callEvent( 'ready' ); document.callEvent( 'ready' ); } else { onReadyCheck.timeout( window, [], 100 ); } }; onReadyCheck.timeout( window, [], 100 );

//FX.JS
var Fx = function( element, input ) { this.deltatime = 10; this.styles = {}; if( $type( input.styles ) == 'object' ) { this.styles = input.styles; } this.stylesStart = {}; this.time = 1000; if( $type( input.time ) == 'number' ) { this.time = input.time; } this.transition = Fx.Transitions.smoth; if( $type( input.transition ) == 'function' ) { this.transition = input.transition; } this.onStart = $empty(); if( $type( input.onStart ) == 'function' ) { this.onStart = input.onStart; } this.onUpdate = $empty(); if( $type( input.onUpdate ) == 'function' ) { this.onUpdate = input.onUpdate; } this.onEnd = $empty(); if( $type( input.onEnd ) == 'function' ) { this.onEnd = input.onEnd; } this.element = element; this.working = false; this.process = 0; return this; }; $extend( Fx, { '$name' : 'fx', 'start' : function( styles ) { if( this.working ) { return false; } this.working = true; this.pauze = false; this.process = 0; if( $type( styles ) == 'object' ) { this.styles = styles; } this.onStart(); for( style in this.styles ) { switch( Style.type( style ) ) { case 1: case 3: case 5: this.stylesStart[style] = Style.get( this.element, style ); break; case 2: this.styles[style] = Color.toValue( this.styles[style] ); this.stylesStart[style] = Color.toValue( Style.get( this.element, style ) ); break; default: delete this.styles[style]; } } this.timer = this.update.timeout( this, [], this.deltatime ); return this; }, 'update' : function() { if( !this.working ) { return false; } if( !this.pauze ) { this.process += Math.min( 100, 100 / ( this.time / this.deltatime ) ); if( this.process >= 100 ) { for( style in this.styles ) { Style.set( this.element, style, this.styles[style] ); } this.onUpdate(); this.abort(); this.onEnd(); } else { var multpl = this.transition( this.process ); for( style in this.styles ) { switch( Style.type( style ) ) { case 1: case 3: case 5: Style.set( this.element, style, this.stylesStart[style] + ( this.styles[style] - this.stylesStart[style] ) * multpl ); break; case 2: var colorTo = this.styles[style]; var colorStart = this.stylesStart[style]; var colorNow = [0,0,0]; for( var p = 0; p < 3; p++ ) { colorNow[p] = Color[p]( colorStart ) + ( Color[p]( colorTo ) - Color[p]( colorStart ) ) * multpl; } Style.set( this.element, style, Color.make( colorNow ) ); break; } } this.onUpdate(); this.timer = this.update.timeout( this, [], this.deltatime ); } } return this; }, 'pause' : function() { if( !this.working || this.pauze ) { return false; } clearTimeout( this.timer ); this.pauze = true; return this; }, 'resume' : function() { if( !this.working || !this.pauze ) { return false; } this.timer = this.update.timeout( this, [], this.deltatime ); this.pauze = false; return this; }, 'abort' : function() { if( !this.working ) { return false; } clearTimeout( this.timer ); this.working = false; return this; } } ); Fx.Transitions = { 'linear' : function( p ) { return p / 100; }, 'smoth' : function( p ) { return -( Math.cos( Math.degtorad( p * 1.8 ) ) - 1 ) / 2; } };

//MOUSE.JS
var Mouse = { '$name' : 'mouse', 'x' : 0, 'y' : 0 }; document.addEvent( 'mousemove', function( event ) { Mouse.x = event.mouse.x; Mouse.y = event.mouse.y; } );

//PRELOADER.JS
var Preload = function( input ) { this.onStart = $empty(); if( $type( input.onStart ) == 'function' ) { this.onStart = input.onStart; } this.onUpdate = $empty(); if( $type( input.onUpdate ) == 'function' ) { this.onUpdate = input.onUpdate; } this.onEnd = $empty(); if( $type( input.onEnd ) == 'function' ) { this.onEnd = input.onEnd; } this.onImageLoaded = $empty(); if( $type( input.onImageLoaded ) == 'function' ) { this.onImageLoaded = input.onImageLoaded; } this.onImageError = $empty(); if( $type( input.onImageError ) == 'function' ) { this.onImageError = input.onImageError; } this.process = 0; this.count = 0; this.loaded = 0; this.timer = 0; this.working = false; this.images = {}; if( $type( input.images ) == 'array' ) { for( var i = 0; i < input.images.length; i++ ) { var image = input.images[i]; if( !$defined( this.images, image ) ) { this.images[image] = null; } } } else { window.addEvent( 'ready', ( function() { for( var i = 0; i < document.images.length; i++ ) { var image = document.images[i].src.replace( document.location, '' ); if( !$defined( this.images, image ) ) { this.images[image] = null; } } var elements = document.getElementsByTagName( '*' ); for( var e = 0; e < elements.length; e++ ) { if( elements[e].nodeType == 1 ) { var image = Style.get( elements[e], 'background-image' ); if( image != '' ) { if( !$defined( this.images, image ) ) { this.images[image] = null; } } } } this.start(); } ).delegate( this, [] ) ); } return this; }; $extend( Preload, { '$name' : 'preloader', 'start' : function() { if( this.working ) { return false; } this.process = 0; this.count = 0; this.loaded = 0; for( var image in this.images ) { this.count++; if( this.images[image] == null ) { var newimage = new Image(); newimage.error = false; newimage.timeout = ( function() { this.error = true; } ).timeout( newimage, [], 30000 ); newimage.onerror = function() { this.error = true; }; newimage.src = image; this.images[image] = newimage; } } this.working = true; this.onStart(); this.onUpdate(); this.timer = this.update.timeout( this, [], 500 ); return this; }, 'update' : function() { if( !this.working ) { return false; } var update = false; for( var image in this.images ) { if( this.images[image].error || this.images[image].complete ) { this.loaded++; update = true; if( this.images[image].error ) { this.onImageError( image ); } else { this.onImageLoaded( image ); } delete this.images[image]; } } if( this.loaded == this.count ) { this.process = 1; this.onUpdate(); this.onEnd(); this.abort(); } else { this.process = ( this.loaded / this.count ).round( 4 ); if( update ) { this.onUpdate(); } this.timer = this.update.timeout( this, [], 500 ); } return this; }, 'abort' : function() { if( !this.working ) { return false; } clearTimeout( this.timer ); this.working = false; return this; } } );

//STYLE.JS
var Style = { 'type' : function( style ) { style = this.toCss( style ); return this.Styles[style]; }, 'toCss' : function( style ) { if( $defined( this.StylesCss, style ) ) { style = this.StylesCss[style]; } return style; }, 'toCamel' : function( style ) { if( $defined( this.StylesCamel, style ) ) { style = this.StylesCamel[style]; } return style; }, 'read' : function( element, style ) { style = this.toCss( style ); var styleCamel = this.toCamel( style ); if( $defined( element.style, styleCamel ) ) { if( element.style[styleCamel] != '' ) { return element.style[styleCamel]; } } var value = false; if( $defined( element, 'currentStyle' ) ) { if( $defined( element.currentStyle, styleCamel ) ) { value = element.currentStyle[styleCamel]; } } else if( $defined( document, 'defaultView' ) ) { value = document.defaultView.getComputedStyle( element, null ).getPropertyValue( style ); } element.style[styleCamel] = value; return value; }, 'write' : function( element, style, value ) { var styleCamel = this.toCamel( style ); element.style[styleCamel] = value; return true; }, 'get' : function( element, style ) { style = this.toCss( style ); var type = 0; if( $defined( this.Styles, style ) ) { type = this.Styles[style]; } switch( type ) { case 1: var value = this.read( element, style ); value = value.match( /^(.+)px/ ); if( value ) { return value[1].toNumber(); } return 0; break; case 2: var value = this.read( element, style ); value = Color.toValue( value ); return value; break; case 3: var value = 100; if( Browser.trident ) { value = this.read( element, 'filter' ).match( /opacity=(\d+)/i ); if( value ) { value = Math.round( value[1] ); }; } else { value = this.read( element, 'opacity' ) * 100; }; return value; break; case 4: var value = this.read( element, style ); if( value == 'none' ) { return ''; } value = value.match( /url\(('|"){0,1}([^\(\)"']*)('|"){0,1}\)/i ); if( value ) { value = value[2].replace( document.location, '' ); } else { return ''; }; return value; break; case 5: var value = 0; if( style == 'scroll-x' ) { if( $defined( window, 'scrollX' ) ) { return window.scrollX; } else if( $defined( window, 'pageXOffset' ) ) { return window.pageXOffset; } else if( $defined( document, 'body' ) ) { return document.body.scrollLeft; } else if( $defined( Html, 'scrollLeft' ) ) { return Html.scrollLeft; } else { return window.Scroll.x; } } else if( style == 'scroll-y' ) { if( $defined( window, 'scrollY' ) ) { return window.scrollY; } else if( $defined( window, 'pageYOffset' ) ) { return window.pageYOffset; } else if( $defined( document, 'body' ) ) { return document.body.scrollTop; } else if( $defined( Html, 'scrollTop' ) ) { alert(Html.scrollTop); return Html.scrollTop; } else { return window.Scroll.y; } } return 0; break; default: return this.read( element, style ); } return false; }, 'set' : function( element, style, value ) { style = this.toCss( style ); var type = 0; if( $defined( this.Styles, style ) ) { type = this.Styles[style]; }; switch( type ) { case 1: this.write( element, style, Math.round( value ) + 'px' ); break; case 2: if( $type( value ) == 'string' ) { this.write( element, style, value ); } else { this.write( element, style, Color.toString( value ) ); } break; case 3: value = Math.round( value ); if( Browser.trident ) { this.write( element, 'filter', 'alpha(Opacity=' + value + ',FinishOpacity=0,)' ); } else { this.write( element, 'opacity', value / 100 ); }; if( value > 0 && value <= 100 ) { this.write( element, 'visibility', 'visible' ); } else { this.write( element, 'visibility', 'hidden' ); }; break; case 4: this.write( element, style, 'url("' + value + '")' ); break; case 5: var x = 0, y = 0; if( style == 'scroll-x' ) { x = value.round(); y = this.get( element, 'scroll-y' ); window.Scroll.x = x; } else if( style == 'scroll-y' ) { x = this.get( element, 'scroll-x' ); y = value.round(); window.Scroll.y = y; } window.scrollTo( x, y ); break; default: this.write( element, style, value ); } return true; } }; Style.Styles = { 'visibility' : 0, 'white-spaces' : 0, 'display' : 0, 'width' : 1, 'height' : 1, 'left' : 1, 'top' : 1, 'right' : 1, 'bottom' : 1, 'font-size' : 1, 'margin' : 1, 'margin-top' : 1, 'margin-right' : 1, 'margin-bottom' : 1, 'margin-left' : 1, 'padding' : 1, 'padding-top' : 1, 'padding-right' : 1, 'padding-bottom' : 1, 'padding-left' : 1, 'color' : 2, 'background-color' : 2, 'background-image' : 4, 'alpha' : 3, 'scroll-x' : 5, 'scroll-y' : 5 }; Style.StylesCamel = {}; Style.StylesCss = {}; for( var style in Style.Styles ) { var styleCss = style; var styleCamel = style.replaceAll( /-([a-z])/, function( matches ) { return matches[1].toUpperCase(); } ); Style.StylesCamel[styleCss] = styleCamel; Style.StylesCss[styleCamel] = styleCss; }; $extend( [Element], { 'getStyle' : function( style ) { return Style.get( this, style ); }, 'setStyle' : function( style, value ) { return Style.set( this, style, value ); }, 'setStyles' : function( styles ) { for( var style in styles ) { Style.set( this, style, styles[style] ); } return true; } } ); $extend( window, { 'Scroll' : { 'x' : 0, 'y' : 0 } } );

//XMLREQUEST.JS
var XMLHttp = function() { var xmlhttp = null; if( window.ActiveXObject ) { try { xmlhttp = new ActiveXObject( 'Msxml2.XMLHTTP' ); } catch( e ) { try { xmlhttp = new ActiveXObject( 'Microsoft.XMLHTTP' ); } catch( e ) { xmlhttp = null; } } } else { if( window.XMLHttpRequest ) { xmlhttp = new XMLHttpRequest(); } } return xmlhttp; }; var XMLRequest = function( input ) { this.xmlhttp = new XMLHttp(); if( $type( this.xmlhttp ) != 'object' ) { return false; } this.method = 'post'; if( $type( input.method ) == 'string' ) { this.method = input.method.toLowerCase() == 'get' ? 'get' : 'post'; } this.async = true; if( $type( input.async ) == 'boolean' ) { this.async = input.async; } this.charset = 'utf-8'; if( $type( input.charset ) == 'string' ) { this.charset = input.charset; } this.onStart = $empty(); if( $type( input.onStart ) == 'function' ) { this.onStart = input.onStart; } this.onEnd = $empty(); if( $type( input.onEnd ) == 'function' ) { this.onEnd = input.onEnd; } this.onError = $empty(); if( $type( input.onError ) == 'function' ) { this.onError = input.onError; } this.response = { text : '', xml : '' }; this.working = false; return this; }; $extend( XMLRequest, { '$name' : 'xmlrequest', 'send' : function( file, data ) { if( this.working ) { return false; } this.working = true; if( this.method == 'post' ) { if( $type( data ) == 'object' ) { var sdata = ''; for( key in data ) { sdata = sdata + ( sdata.length > 0 ? '&' : '' ) + key + '=' + data[key]; } data = sdata; } else if( $type( data ) != 'string' ) { return false; } } else { }; alert( file + ' ' + data ); this.xmlhttp.onreadystatechange = this.recieve.delegate( this ); this.xmlhttp.open( this.method.toUpperCase(), encodeURI( file ), this.async ); if( this.method == 'post' ) { this.xmlhttp.setRequestHeader( 'Connection', 'close' ); this.xmlhttp.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded; charset:' + this.charset ); } this.xmlhttp.send( data ); this.onStart(); return true; }, 'abort' : function() { if( !this.working ) { return false; } this.xmlhttp.onreadystatechange = $empty(); this.xmlhttp.abort(); this.working = false; return true; }, 'recieve' : function() { if( !this.working || this.xmlhttp.readyState != 4 ) { return false; } this.working = false; if( this.xmlhttp.status == 200 ) { this.response.text = this.xmlhttp.responseText; this.response.xml = this.xmlhttp.responseXML; this.onEnd(); return true; } this.onError( this.xmlhttp.status ); return false; } } ); 
