var $=new Function( 'id', 'return new childSelector(id);' );var ACP={isBlackHandler:false, Extend:function(destination,source){for ( var property in source ) destination[property]=source[property];return destination;}, createElement:function(tg,objct){var newTag=document.createElement( tg );for( var i in objct ){if( typeof objct[i] == 'object' ) for( var k in objct[i] ) newTag[i][k]=objct[i][k];else newTag[i]=objct[i];} return newTag;}, resize:function(me,maxSize){var x=parseInt(me.offsetWidth), newX=x, y=parseInt(me.offsetHeight), newY=y;if( x > maxSize ){newX=maxSize;newY=( y * ( maxSize / x ) );} else if( y > maxSize ){newY=maxSize;newX=( x * ( maxSize / y ) );} me.style.width=newX + 'px';me.style.height=newY + 'px';me.style.cursor='pointer';me.alt=me.title='';me.onclick=function(){window.open( this.src, 'POPUP', 'width=' + ( x + 10 ) + ',height=' + ( y + 10 ) + ',menubar=no,location=no,resizable=no,scrollbars=yes,status=no' );} } };var HTTPRequest=function(){this.myHandler=( window.XMLHttpRequest ? new XMLHttpRequest():new ActiveXObject( 'Microsoft.XMLHTTP' ) );this.noCache=false;this.connectionType='GET';this.paramData=this.paramPostData=[];this.gotParams=false;this.gotPostParams=false;this.userData={username: null, password: null };this.onready=this.onloading=this.onvalidaterror=this.onreadystatechange=function(){};};HTTPRequest.prototype={addForm:function(formElement,checkFields){var allData={}, allElements=[], inputList=formElement.getElementsByTagName( 'input' ), textList=formElement.getElementsByTagName( 'textarea' ), inputListLength=inputList.length, textListLength=textList.length, i=0, t=0;for( i;i < inputListLength;i++ ) allElements.push( inputList[i] );for( t;t < textListLength;t++ ) allElements.push( textList[t] );var l=allElements.length;for( i=0;i < l;i++ ){if( ( allElements[i].name in checkFields ) && ( allElements[i].type == 'text' || allElements[i].name == 'password' ) ){if( allElements[i].value == '' && checkFields[( allElements[i].name )][ 'required' ] ) return this.onvalidateerror( allElements[i].name, 'empty', allElements[i] );switch( checkFields[( allElements[i].name )][ 'type' ] ){case 'specialchars': if( ! allElements[i].value.match( /[a-zA-Z0-9]/ ) ) return this.onvalidateerror( allElements[i].name, checkFields[( allElements[i].name )][ 'type' ], allElements[i] );break;case 'email': if( ! allElements[i].value.match( /w{1,}[@][w-]{1,}([.]([w-]{1,})){1,3}$/ ) ) return this.onvalidateerror( allElements[i].name, checkFields[( allElements[i].name )][ 'type' ], allElements[i] );break;} } } for( i=0;i < l;i++ ){if( ( allElements[i].type == 'checkbox' || allElements[i].type == 'radio' ) ){if( allElements[i].checked ) this.addPost( { name: allElements[i].name, value: allElements[i].value } );} else this.addPost( { name: allElements[i].name, value: allElements[i].value } );} var selectList=formElement.getElementsByTagName( 'select' ), selectListLength=selectList.length, s=0;for( s;s < selectListLength;s++ ){var myList=0;l=selectList[s].options.length;for( myList;myList < l;myList++ ){if( selectList[s].options[( myList )].selected ) this.addPost( { name: selectList[s].name, value: selectList[s].options[( myList )].value } );} } }, send:function(url){url=( this.gotParams ? url + ( url.indexOf( '?' ) == -1 ? '?' + this.formatData( this.paramData ):'&' + this.formatData( this.paramData ) ):url );if( this.userData.username == null ) this.myHandler.open( this.connectionType, url, true );else this.myHandler.open( this.connectionType, url, true, this.userData.username, this.userData.password );this.myHandler.onreadystatechange=(function(obj){return function(){ obj.stateChange(this);} })(this);if( this.connectionType == 'POST' ){this.myHandler.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );} this.myHandler.send( ( this.connectionType == 'POST' && this.gotPostParams ? this.formatData( this.paramPostData ):null ) );}, currentState:function(){switch( this.myHandler.readyState ){case 0: return 'not_initialized';break;case 1: return 'open';break;case 2: return 'send';break;case 3: return 'loading';break;case 4: return 'completed';break;} }, isReady:function(){return ( this.currentState() == 'completed' );}, isLoading:function(){return ( ! this.isReady() && this.currentState() != 'not_initialized' );}, getResponse:function(){return this.myHandler.responseText;}, getXMLResponse:function(index){return this.myHandler.responseXML.documentElement.getElementsByTagName( index )[ 0 ].firstChild.data;}, gotXMLResponse:function(index){return !( this.myHandler.responseXML.documentElement.getElementsByTagName( index )[0] == null );}, stateChange:function(XMLObjct){if( this.isLoading() ) this.onloading();if( this.isReady() ) this.onready();this.onreadystatechange( this.currentState(), XMLObjct );}, authData:function(username,password){this.userData={username: username, password: password };}, addData:function(newMerge){this.gotParams=true;this.paramData.push( newMerge );}, addPost:function(newMerge){this.gotPostParams=true;this.paramPostData.push( newMerge );this.connectionType='POST';}, formatData:function(paramData){var appendString='';for( var addValue in paramData ) appendString+=paramData[addValue].name + '=' + encodeURIComponent( paramData[ addValue ].value ) + '&';return appendString;} };var childSelector=function(my){if( typeof my != 'object' ){var tLink;if( ( tLink=document.getElementById( my ) ) == null ){tLink=$(ACP.createElement('div',{}));this.isElem=false;} my=tLink;} this.privateElement=( my.isProto && ( 'privateElement' in my ) ? my.privateElement:my );return my.isElem;};childSelector.prototype={privateElement:null, isProto:true, isElem:true, me:function(){return this.privateElement;}, settings:function(apr){return this.privateElement[apr];}, clear:function(){while( ( c=this.privateElement.firstChild ) ) this.privateElement.removeChild( c );return this;}, fill:function(newInside){while( ( c=this.privateElement.firstChild ) ) this.privateElement.removeChild( c );this.privateElement.innerHTML=newInside;return this;}, content:function(){return this.privateElement.innerHTML;}, setSelectedOption:function(optionValue){var isMulti=!( this.get( 'multiple' ) == null );if( this.privateElement.nodeName.toLowerCase() == 'select' ){var allOptionsLength=this.privateElement.options.length, i=0;for( i;i < allOptionsLength;i++ ){if( this.privateElement.options[i].value == optionValue ) $(this.privateElement.options[i]).set( 'selected', 'selected' );else if( ( ! this.privateElement.options[i].selected && isMulti ) || !isMulti ) $(this.privateElement.options[i]).set( 'selected', null );} } return this;}, setAllSelected: function(){var isMulti=!( this.get( 'multiple' ) == null );if( this.privateElement.nodeName.toLowerCase() == 'select' ){var allOptionsLength=this.privateElement.options.length, i=0;for( i;i < allOptionsLength;i++ ) $(this.privateElement.options[i]).set( 'selected', 'selected' );} return this;}, getSelectedOption:function(){if( this.privateElement.nodeName.toLowerCase() == 'select' ){return this.privateElement.options[( this.privateElement.selectedIndex )].value;} return null;}, addOption:function(optionKey,optionValue,optionSelected){var isMulti=!( this.get( 'multiple' ) == null );if( this.privateElement.nodeName.toLowerCase() == 'select' ){var allOptionsLength=this.privateElement.options.length, i=0;for( i;i < allOptionsLength;i++ ){if( this.privateElement.options[i].value == optionValue ) return this;else if( optionSelected && this.privateElement.options[i].selected && !isMulti ) this.privateElement.options[i].selected=false;} try { this.privateElement.add( ACP.createElement( 'option', { value: optionValue, text: optionKey, selected: ( optionSelected == true ) } ), null );} catch( e ){this.privateElement.add( ACP.createElement( 'option', { value: optionValue, text: optionKey, selected: ( optionSelected == true ) } ) );} } return this;}, removeOption:function(optionValue){if( this.privateElement.nodeName.toLowerCase() == 'select' ){var allOptionsLength=this.privateElement.options.length, i=0;for( i;i < allOptionsLength;i++ ){if( this.privateElement.options[i].value == optionValue ){this.privateElement.options[i]=null;return this;} } } return this;}, remove:function(){var myParent=this.parent();myParent.me().removeChild( this.privateElement );return myParent;}, next:function(){var nextOne=this.privateElement.nextSibling;while( nextOne.nodeName == '#text' ) nextOne=nextOne.nextSibling;return $(nextOne);}, previous:function(){var prevOne=this.privateElement.previousSibling;while( prevOne.nodeName == '#text' ) prevOne=nextOne.previousSibling;return $(prevOne);}, click:function(){if( typeof this.privateElement.onclick == 'function' ) (this.privateElement).onclick();else if( typeof this.privateElement.click == 'function' ) (this.privateElement).click();return this;}, visible:function(){return ( ! this.privateElement.style.display != 'block' );}, toggle:function(){this.style({display: (this.privateElement.style.display == 'block' ? 'none':'block' )});return this;}, show:function(){this.style({display: 'block'});return this;}, hide:function(){this.style({display: 'none'});return this;}, fadeIn:function(speed,max){if( ! speed ) var speed=45;if( ! max ) var max=1;this.style({ opacity: 0, display: 'block' });this.currentFaderIn=setInterval( (function(myObject,myMax){ return function(){if( parseFloat( myObject.me().style.opacity ) >= myMax ){clearInterval( myObject.currentFaderIn );return ( myObject.currentFaderIn=false );} myObject.style({ opacity: ( parseFloat( myObject.me().style.opacity ) + 0.05 ) });return true;};})(this, max), speed );return this;}, fadeOut:function(speed,max){if( ! speed ) var speed=45;if( ! max ) var max=0;this.style({ opacity: ( isNaN( parseFloat( this.privateElement.style.opacity ) ) ? 1:parseFloat( this.privateElement.style.opacity ) ), display: 'block' });this.currentFaderOut=setInterval( (function(myObject,myMax){ return function(){if( parseFloat( myObject.me().style.opacity ) <= myMax ){myObject.style({ opacity: 0, display: 'none' });clearInterval( myObject.currentFaderOut );return ( myObject.currentFaderOut=false );} myObject.style({ opacity: ( parseFloat( myObject.me().style.opacity ) - 0.05 ) });return true;};})(this, max), speed );return this;}, width:function(){return parseInt(this.privateElement.offsetWidth);}, height:function(){return parseInt(this.privateElement.offsetHeight);}, windowWidth:function(){return parseInt( window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth );}, windowHeight:function(){return parseInt( window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight );}, attention:function(){if( $( 'black_screen' ).isElem ){$( 'black_screen' ).remove();$( document.body ).style({ overflow: 'auto' }) }else{ var newElem=$( document.body ).style({ overflow: 'hidden' }).createChild( 'div', { className: 'black_background', id: 'black_screen', style:{ display: 'none', width: this.windowWidth() + 'px', height: this.windowHeight() + 'px' } } ).fadeIn( null, 0.4 );if( ! ACP.isBlackHandler ){$( window ).bind( 'resize', function(){if( ( myObj=$( 'black_screen' ) ) ){myObj.style({ width: myObj.windowWidth() + 'px', height: myObj.windowHeight() + 'px' });} } );ACP.isBlackHandler=true;} } }, center:function(abrPos){if( ! abrPos ) abrPos=null;var screenX=this.windowWidth(), screenY=this.windowHeight(), makeUnvisible=false;if( ! this.visible() ){makeUnvisible=true;this.show();} var myY=this.height(), myX=this.width();var nY=( ( screenY - myY ) / 2 ), nX=( ( screenX - myX ) / 2 );this.style({ top: ( nY < 0 ? 0:nY ) + 'px', left: ( nX < 0 ? 0:nX ) + 'px', position: ( abrPos == null ? 'fixed':abrPos ) });if( ! this.binded ){$( window ).bind( 'resize', (function(myObj,abrPos){return function(){if( myObj.privateElement && myObj.visible() ){myObj.center( abrPos );} };})(this, abrPos) );this.binded=true;} if( makeUnvisible ) this.hide();return this;}, gotClass:function(currentClassName){var currentClass=this.privateElement.className.split( ' ' );return ( currentClassName in currentClass );}, addClass:function(newClass){var currentClass=this.privateElement.className.split( ' ' );currentClass.push( newClass );this.style({ className: currentClass.join( ' ' ) });return this;}, removeClass:function(oldClass){var currentClass=this.privateElement.className.split( ' ' );for( var i in currentClass ) if( currentClass[i] == oldClass ) delete currentClass[i];this.style({ className: currentClass.join( ' ' ) });return this;}, bind:function(opt,act){var el=this.privateElement;act=( typeof act == 'function' ? act:new Function( 'my' + act.replace( '.', '' ) + 'Callback', act + '();' ) );if ( el.addEventListener ) el.addEventListener( opt, act, false );else if ( el.attachEvent ) el.attachEvent( 'on' + opt, act );return this;}, getParent:function(){return $(this.privateElement.parentNode);}, parent:function(){return this.getParent();}, child:function(obj){return this.getChild( obj );}, getChild:function(obj){var searchNode=obj.toUpperCase();var childs=this.privateElement.childNodes;var i=0, l=childs.length;for( i;i < l;i++ ){if( childs[i].nodeName == searchNode ) return $( childs[i] );} return null;}, getChilds:function(){var childs=this.privateElement.childNodes;var rChilds=[], i=0;l=childs.length;for( i=0;i < l;i++ ) if( childs[i].nodeName != '#text' ) rChilds.push( $( childs[i] ) );return rChilds;}, createChild:function(tg,objct){var newTag=document.createElement( tg );for( var i in objct ){if( typeof objct[i] == 'object' ) for( var k in objct[i] ) newTag[i][k]=objct[i][k];else newTag[i]=objct[i];} return $(this.privateElement.appendChild( newTag ));}, getLastChild:function(){if( this.privateElement.lastChild ) return $( this.privateElement.lastChild );var childs=this.getChilds();return $(childs[childs.length-1]);}, getFirstChild:function(){return $( this.privateElement.firstChild );}, style:function(obj){for( var i in obj ){if( i == 'className' ) this.privateElement.className=obj[i];if( typeof obj[i] == 'object' ) for( var k in obj[i] ) this.privateElement.style[i][k]=obj[i][k];else this.privateElement.style[i]=obj[i];} return this;}, set:function(avg,val){if( val != null ){this.privateElement.setAttribute( avg, val );this.privateElement[avg]=val;}else{ this.privateElement[avg]=null;this.privateElement.removeAttribute( avg );} return this;}, get:function(avg){return this.privateElement.getAttribute( avg );} };