

/**
* Sorts the output display of a module
*
* @param Object obj
* @param String module
*/
function sort( obj, module )
{
var	url = location.href,
reg = new RegExp( module + '/.*?/|' + module + '/.*$', 'gi' );
url = url.replace( reg, '' ) + '/';
url = url.replace( /\/+$/, '/' );
if ( obj.type == 'checkbox' )
if ( obj.checked )
location.href = url + module + '/' + obj.value;
else
location.href = url;
else if ( obj.value )
location.href = url + module + '/' + obj.options[obj.selectedIndex].value;
else
location.href = url;
}

/*---------------------------------------------------------------------------------------------------
* File:		animation.js
* Author:		Peter Quinn
* Copyright:	(C)Copyright 2007.  All rights reserved.
* Version:		1.00
* Date:
*
* Description:
*
* Methods:
*
*-------------------------------------------------------------------------------------------------*/
var	LEFT				= 0,
RIGHT				= 1,
UP					= 2,
DOWN				= 3,
ALPHA				= 4,
WIDTH				= 5,
HEIGHT				= 6,
WIDTH_LEFT			= 7,
HEIGHT_UP			= 8,
SCROLL_LEFT			= 9,
SCROLL_RIGHT		= 10,
SCROLL_UP			= 11,
SCROLL_DOWN			= 12,
WIDTH_CENTER		= 13,
HEIGHT_CENTER		= 14,
HEIGHT_CENTER_CLOSE	= 15,
SLIDE_LEFT			= 16,
SLIDE_RIGHT			= 17;
/*---------------------------------------------------------------------------------------------------
*
* Animation Class
*
*/
function Animation( name, object )
{
this.name			= name || "unnamed";
this.parent			= parent || null;
this.object			= object || null;
this.timer			= null;
this.waitingTimer	= null;
this.delay			= 6;
this.duration		= null;
this.destination	= 0;
this.init			= 0;
this.distance		= 0;
this.time			= 0;
this.formula		= null;
this.action			= null;
this.step			= 0;
this.startTime		= 0;
this.startPos		= 0;
this.onstart		= null;
this.onfinish		= null;
this.onexecute		= null;
this.active			= false;
this.paused			= false;
this.pos			= 0;
/**
* starts the animation
*/
this.start = function()
{
clearTimeout( this.timer );
if ( this.onstart )
this.onstart( this );
this.time		= 0;
this.init		= this.getStart();
this.distance	= this.destination - this.init;
this.step		= this.distance / this.duration / this.duration;
this.startTime	= new Date().getTime();
this.active		= true;
this.exec();
}
/**
* Calculates the initial parameters
*
* @return int
*/
this.getStart = function()
{
if ( this.action == HEIGHT_UP || this.action == HEIGHT_CENTER || this.action == HEIGHT_CENTER_CLOSE )
this.startPos = this.object.getY();
else if ( this.action == WIDTH_LEFT || this.action == WIDTH_CENTER || this.action == HEIGHT_CENTER_CLOSE )
this.startPos = this.object.getX();
switch( this.action )
{
case SCROLL_UP:
case SCROLL_DOWN:
return this.object.getScrollY();
case SCROLL_LEFT:
case SCROLL_RIGHT:
return this.object.getScrollX();
case UP:
case DOWN:
return this.object.getY();
case LEFT:
case RIGHT:
return this.object.getX();
case SLIDE_LEFT:
case SLIDE_RIGHT:
return this.pos;
case WIDTH:
case WIDTH_LEFT:
return this.object.getWidth();
case HEIGHT:
case HEIGHT_UP:
return ie ? this.object.getHeight() : this.object.getHeight() - 2;
case WIDTH_CENTER:
return this.object.getWidth();
case HEIGHT_CENTER:
return this.object.getHeight();
case HEIGHT_CENTER_CLOSE:
return ie ? this.object.getHeight() : this.object.getHeight() - 2;
case ALPHA:
return this.object.getAlpha();
}
}
/**
* Main animation execution
*/
this.exec = function()
{
clearTimeout( this.timer );
this.time = new Date().getTime() - this.startTime;
if ( ! this.duration || this.time < this.duration )
{
if ( ! this.paused )
{
switch( this.action )
{
case UP:
this.object.moveY( this.formula() );
break;
case DOWN:
this.object.moveY( this.formula() );
break;
case SLIDE_LEFT:
this.object.moveX( this.pos-- );
break;
case SLIDE_RIGHT:
this.object.moveX( this.pos++ );
break;
case LEFT:
this.object.moveX( this.formula( this.object.getX() ) );
break;
case RIGHT:
this.object.moveX( this.formula( this.object.getX() ) );
break;
case WIDTH:
this.object.resizeX( this.formula() );
break;
case SCROLL_LEFT:
case SCROLL_RIGHT:
this.object.scrollX( this.formula( this.object.getScrollX() ) );
break;
case SCROLL_UP:
case SCROLL_DOWN:
this.object.scrollY( this.formula( this.object.getScrollY() ) );
break;
case WIDTH_LEFT:
n = this.formula();
this.object.resizeX( n );
this.object.moveX( this.init + this.startPos - n );
break;
case HEIGHT:
this.object.resizeY( this.formula() );
break;
case HEIGHT_UP:
n = this.formula();
this.object.resizeY( n );
this.object.moveY( this.init + this.startPos - n );
break;
case WIDTH_CENTER:
n = this.formula();
this.object.resizeX( n );
this.object.moveX( this.init + this.startPos - (n / 2) );
break;
case HEIGHT_CENTER:
n = this.formula();
this.object.resizeY( n );
this.object.moveY( this.init + this.startPos - (n / 2) );
break;
case HEIGHT_CENTER_CLOSE:
n = this.formula();
this.object.resizeY( n );
this.object.moveY( this.init - this.startPos - (n / 2) );
break;
case ALPHA:
this.object.alpha( this.formula() );
break;
}
if ( this.onexecute )
this.onexecute( this );
}
this.timer = setTimeout( this.name + ".exec()", this.delay );
}
else
{
this.active = false;
switch( this.action )
{
case UP:
this.object.moveY( this.destination );
break;
case DOWN:
this.object.moveY( this.destination );
break;
case LEFT:
this.object.moveX( this.destination );
break;
case RIGHT:
this.object.moveX( this.destination );
break;
case WIDTH:
this.object.resizeX( this.destination );
break;
case WIDTH_LEFT:
this.object.resizeX( this.destination );
this.object.moveX( this.init + this.startPos - this.destination );
break;
case HEIGHT:
this.object.resizeY( this.destination );
break;
case HEIGHT_UP:
this.object.resizeY( this.destination );
this.object.moveY( this.init + this.startPos - this.destination );
break;
case WIDTH_CENTER:
this.object.resizeX( this.destination );
this.object.moveX( this.init + this.startPos - (this.destination / 2) );
break;
case HEIGHT_CENTER:
this.object.resizeY( this.destination );
this.object.moveY( this.init + this.startPos - (this.destination / 2) );
break;
/*
case HEIGHT_CENTER_CLOSE:
this.object.resizeY( this.destination );
this.object.moveY( this.init + this.startPos - (this.destination / 2) );
break;
*/
case ALPHA:
this.object.alpha( this.destination );
break;
}
if ( this.onfinish )
this.onfinish( this );
if ( this.onfinal )
this.onfinal( this );
}
}
this.stop = function()
{
clearTimeout( this.timer );
}
this.pause = function( flag )
{
this.paused = flag;
}
this.incremental = function( n )
{
switch( this.action )
{
case UP:
case LEFT:
case SCROLL_LEFT:
case SLIDE_LEFT:
return n;
case DOWN:
case RIGHT:
case SCROLL_RIGHT:
case SLIDE_RIGHT:
return ++n;
}
}
/**
* Power function
*/
this.pow = function()
{
return this.distance - Math.round( Math.pow( this.duration - this.time, 2 ) * this.step ) + this.init;
}
/**
* Power function
*/
this.pow2 = function( p, x )
{
this.object.layer.innerHTML += "a ";
return Math.pow( p, x || 6 );
}
/**
* EXPO function
*/
this.expo = function( p )
{
this.object.layer.innerHTML += " e";
return Math.pow( 2, 8 * (p - 1) );
}
/**
* Circular function
*/
this.circ = function( p )
{
return 1 - Math.sin( Math.acos( p ) );
}
/**
* Sine function
*/
this.sine = function( p )
{
return 1 - Math.sin( (1 - p) * Math.PI / 2 );
}
/**
* Back function
*/
this.back = function( p, x )
{
x = x[0] || 1.618;
return Math.pow( p, 2 ) * ( (x + 1) * p - x );
}
/**
* Bounce function
*/
this.bounce = function( p )
{
var	value;
for( var a = 0, b = 1; 1; a += b, b /= 2 )
if ( p >= (7 - 4 * a) / 11 )
{
value = -Math.pow( (11 - 6 * a - 11 * p) / 4, 2 ) + b * b;
break;
}
return value;
}
/**
* Elastic function
*/
this.elastic = function( p, x )
{
return Math.pow( 2, 10 * --p ) * Math.cos( 20 * p * Math.PI * (x[0] || 1) / 3 );
}
// sets the default animation function
this.formula = this.pow;
}
/*-------------------------------------------------------------------------------------------------*/

/**---------------------------------------------------------------------------------------------------
*
* File:		layer.js
* Date:		25.07.2007
* Description:	Dynamic Adverts
*
* Usage:
*
*--------------------------------------------------------------------------------------------------*/
var	ie		= document.all,
dragObj	= null;
/**---------------------------------------------------------------------------------------------------
*
* Layer Object
*
*/
function Layer( name, layerName, parent )
{
this.obj			= name;
this.name			= layerName		|| null;
this.parent			= parent		|| null;
this.dragStatus		= false;
this.dragStarted	= false;
this.constrainX		= false;
this.constrainY		= false;
this.layer			= null;
this.alphaValue		= 100;
this.visible		= false;
this.type			= 'layer';
this.document		= document;
this.window			= window;
/**
* Only works in FireFox
*
*/
this.drag = function()
{
if ( this.layer )
this.layer.setAttribute( "onmousedown", this.obj + ".startDrag()" );
}
/**
* Layer constructor
*
*/
this.construct = function( id )
{
if ( id )
{
this.name					= id;
this.layer					= this.document.getElementById( id );
//	this.layer.style.position	= this.parent ? "relative" : "absolute";
this.parent					= this.parent ? this.parent : this.document.body;
}
else if ( this.name && this.document.getElementById( this.name ) )
{
this.layer					= this.document.getElementById( this.name );
this.parent					= this.parent ? this.parent : this.document.body;
}
else
{
this.name					= this.obj;
this.layer					= this.document.createElement( "DIV" );
this.layer.style.position	= this.parent ? "relative" : "absolute";
if ( this.parent )
this.parent.appendChild( this.layer );
else
{
this.parent				= this.document.body;
this.document.body.appendChild( this.layer );
}
this.layer.setAttribute( "id", this.name );
}
if ( this.layer )
this.layer.style.display = "none";
}
/**
* Removes the layer from the DOM
*
*/
this.close = function()
{
if ( this.layer )
{
this.document.body.removeChild( this.layer );
this.layer = null;
}
}
/**
* Moves the layer to position X
*
* @param int x
*/
this.moveX = function( x )
{
var	left = this.getBrowserLeft();
if ( ie )
{
if ( this.constrainX )
{
if ( x > this.parent.clientWidth - this.layer.clientWidth + left )
x = this.parent.clientWidth - this.layer.clientWidth + left;
if ( x < left )
x = left;
}
}
else
{
if ( this.constrainX )
{
if ( x > window.innerWidth - this.layer.offsetWidth + left )
x = window.innerWidth - this.layer.offsetWidth + left;
if ( x < left )
x = left;
}
}
if ( this.layer )
this.layer.style.left = x + 'px';
}
/**
* Moves the layer to position Y
*
* @param int y
*/
this.moveY = function( y )
{
var	top = this.getBrowserTop();
if ( ie )
{
if ( this.constrainY )
{
if ( y > this.parent.clientHeight - this.layer.clientHeight + top )
y = this.parent.clientHeight - this.layer.clientHeight + top;
if ( y < top )
y = top;
}
}
else
{
if ( this.constrainY )
{
if ( y > window.innerHeight - this.layer.offsetHeight + top )
y = window.innerHeight - this.layer.offsetHeight + top;
if ( y < top )
y = top;
}
}
if ( this.layer )
this.layer.style.top = y + 'px';
}
/**
* Moves the layer to position X, Y
*
* @param int x
* @param int y
*/
this.move = function( x, y )
{
this.moveX( x );
this.moveY( y );
}
/**
* Moves the layer at a given degree to a certain distance
*
* @param int x
* @param in ty
*/
this.moveTo = function( degree, distance )
{
var	x = distance * Math.cos( (degree - 90) * Math.PI / 180 ),
y = distance * Math.sin( (degree - 90) * Math.PI / 180 );
this.moveX( this.getX() + x );
this.moveY( this.getY() + y );
}
/**
* Sets the alpha blending of the layer
*
* @param int alpha
*/
this.alpha = function( alpha )
{
this.alphaValue = alpha;
if ( this.layer )
{
this.layer.style.opacity	= parseInt( alpha ) / 100;
this.layer.style.MozOpacity	= parseInt( alpha ) / 100;
if ( ie )
this.layer.style.filter	= "alpha(opacity=" + alpha + ")";
}
}
/**
* Writes content to the layer
*
* @param string str
*/
this.write = function( str )
{
if ( this.layer )
this.layer.innerHTML = str;
}
/**
* Outputs content to the layer
*
* @param string str
*/
this.output = function( str )
{
if ( this.layer )
this.layer.innerHTML += str;
}
/**
* Resizes the layer
*
* @param int xsize
* @param int ysize
*/
this.resize = function( xsize, ysize )
{
if ( this.layer )
{
this.layer.style.width	= xsize + 'px';
this.layer.style.height	= ysize + 'px';
}
}
/**
* Resizes the layer
*
* @param int xsize
*/
this.resizeX = function( xsize )
{
if ( this.layer )
this.layer.style.width	= xsize + 'px';
}
/**
* Resizes the layer
*
* @param int ysize
*/
this.resizeY = function( ysize )
{
if ( this.layer )
this.layer.style.height	= ysize + 'px';
}
/**
* Displays / Hides the layer
*
* @param bool flag
*/
this.show = function( flag )
{
this.visible = flag;
if ( this.layer )
this.layer.style.display = flag ? "block" : "none";
}
/**
* Gets the absolute position of the layer
*
* @param object obj
*/
this.getPos = function( object )
{
var	left	= 0,
top		= 0;
if ( object )
obj = object;
else
obj = this.layer;
if ( obj && obj.offsetParent )
{
left = obj ? obj.offsetLeft : 0;
top  = obj ? obj.offsetTop : 0;
if ( obj )
while( obj = obj.offsetParent )
{
left += obj.offsetLeft;
top  += obj.offsetTop;
}
}
return [ left, top, this.getWidth( object ), this.getHeight( object ) ];
}
/**
* Returns the alpha value of the layer
*
* @return int
*/
this.getAlpha = function()
{
return parseInt( this.alphaValue );
}
/**
* Returns the X position of the layer
*
* @return int
*/
this.getX = function()
{
if ( this.layer.position == undefined || this.layer.position == "relative" )
{
pos = this.getPos( this.layer );
return pos[0];
}
return parseInt( this.layer.style.left == "" ? 0 : this.layer.style.left );
}
/**
* Returns the Y position of the layer
*
* @return int
*/
this.getY = function()
{
if ( this.layer.position == undefined || this.layer.position == "relative" )
{
pos = this.getPos( this.layer );
return pos[1];
}
return parseInt( this.layer.style.top );
}
/**
* Returns the width of the layer
*
* @return int
*/
this.getWidth = function( obj )
{
if ( obj )
return parseInt( ie ? obj.offsetWidth + 2 : obj.offsetWidth );
else if ( this.layer )
return parseInt( ie ? this.layer.clientWidth + 2 : this.layer.offsetWidth );
}
/**
* Returns the height of the layer
*
* @return int
*/
this.getHeight = function( obj )
{
if ( obj )
return parseInt( ie ? obj.offsetHeight + 2 : obj.offsetHeight );
else if ( this.layer )
return parseInt( ie ? this.layer.clientHeight + 2 : this.layer.offsetHeight );
}
this.getBrowserLeft = function()
{
return ie ? (this.document.documentElement ? this.document.documentElement.scrollLeft : this.document.body.scrollLeft) : this.window.pageXOffset ;
}
this.getBrowserTop = function()
{
return ie ? (this.document.documentElement ? this.document.documentElement.scrollTop : this.document.body.scrolltop) : this.window.pageYOffset ;
}
this.getBrowserWidth = function()
{
//	return ie ? (this.document.documentElement ? this.document.documentElement.clientWidth : this.document.body.clientWidth) : this.window.innerWidth;
return ie ? this.document.body.clientWidth : this.window.innerWidth;
}
this.getBrowserHeight = function()
{
return ie ? this.document.body.clientHeight : this.window.innerHeight;
}
this.getWindowHeight = function()
{
return ie ? document.documentElement.clientHeight : this.window.innerHeight;
}
this.setWidth = function( width )
{
if ( this.layer )
this.layer.style.width = width + 'px';
}
this.setHeight = function( height )
{
if ( this.layer )
this.layer.style.height = height + 'px';
}
this.resize = function( width, height )
{
this.setWidth( width );
this.setHeight( height );
}
/**
* Sets the scroll of the layer
*
* @param int n
*/
this.scrollX = function( n )
{
if ( this.layer )
this.layer.scrollLeft = n;
}
/**
* Sets the scroll of the layer
*
* @param int n
*/
this.scrollY = function( n )
{
if ( this.layer )
this.layer.scrollTop = n;
}
this.getScrollX = function()
{
if ( this.layer )
return this.layer.scrollLeft;
}
this.getScrollY = function()
{
if ( this.layer )
return this.layer.scrollTop;
}
this.getScrollWidth = function()
{
if ( this.layer )
return this.layer.scrollWidth;
}
this.getScrollHeight = function()
{
if ( this.layer )
return this.layer.scrollHeight;
}
/**
* Starts the layer dragging process
*
* @param object e Event object
*/
this.startDrag = function( e )
{
dragObj					= this;
this.dragStatus			= true;
this.dragStarted		= true;
document.onmouseup		= this.endDrag;
document.onmousemove	= this.doDrag;
document.onselectstart	= function() { return false; };
document.onmousedown	= function() { return false; };
}
/**
* Starts the layer resizing process
*
* @param object a Event object
*/
this.startResize = function( e )
{
dragObj					= this;
this.dragStatus			= true;
this.dragStarted		= true;
document.onmouseup		= this.endDrag;
document.onmousemove	= this.doResize;
document.onselectstart	= function() { return false; };
document.onmousedown	= function() { return false; };
}
/**
* Ends the layer dragging process
*
*/
this.endDrag = function()
{
this.dragStatus			= false;
document.onmousemove	= null;
document.onselectstart	= null;
document.onmousedown	= null;
}
/**
* Performs the layer dragging
*
* @param object e Event object
*/
this.doDrag = function( e )
{
var	top		= document.body.scrollTop,
left	= document.body.scrollLeft;
if ( dragObj.dragStarted )
{
dragObj.dragStartX	= left + parseInt(ie ? window.event.clientX : e.pageX) - parseInt( dragObj.layer.style.left );
dragObj.dragStartY	= top + parseInt(ie ? window.event.clientY : e.pageY) - parseInt( dragObj.layer.style.top );
dragObj.dragStarted = false;
}
var	mouseX	= left + parseInt( ie ? window.event.clientX : e.pageX ) - parseInt( dragObj.dragStartX ),
mouseY	= top + parseInt( ie ? window.event.clientY : e.pageY ) - parseInt( dragObj.dragStartY );
dragObj.move( mouseX, mouseY );
}
/**
* Performs the layer resizing
*
* @param object a Event object
*/
this.doResize = function( e )
{
var	top		= document.body.scrollTop,
left	= document.body.scrollLeft;
if ( dragObj.dragStarted )
{
dragObj.dragStartX	= left + parseInt(ie ? window.event.clientX : e.pageX) - parseInt( dragObj.layer.style.left );
dragObj.dragStartY	= top + parseInt(ie ? window.event.clientY : e.pageY) - parseInt( dragObj.layer.style.top );
dragObj.dragStarted = false;
}
var	mouseX	= left + parseInt( ie ? window.event.clientX : e.pageX ) - parseInt( dragObj.dragStartX ),
mouseY	= top + parseInt( ie ? window.event.clientY : e.pageY ) - parseInt( dragObj.dragStartY );
dragObj.resize( mouseX, mouseY );
}
/**
* Changes the z-index of a layer
*
* @param integer n
*/
this.index = function( n )
{
if ( this.layer )
this.layer.style.zIndex = n;
}
/**
* Returns the visibility status of the layer
*
* @return Bool
*/
this.isVisible = function()
{
return this.visible;
}
}
/*--------------------------------------------------------------------------------------------------*/


var	previews = new Array;
function startPreview( name, id, max, size )
{
previews[ id ] = new Object();
previews[ id ].timer	= null;
previews[ id ].name		= name;
previews[ id ].id		= id;
previews[ id ].max		= max;
previews[ id ].size		= size;
previews[ id ].frame	= 1;
previews[ id ].status	= true;
getPreview( previews[ id ] );
}
function endPreview( id )
{
clearTimeout( previews[ id ].timer );
previews[ id ].status = false;
send( recvPreview, previews[ id ], '/library/ajax/get-preview.php', 'id=' + previews[ id ].id + '&frame=' + 1 + '&size=' + previews[ id ].size );
}
function recvPreview( data, obj )
{
var	img = document.getElementById( obj.name ),
m	= data.match( /^(\d+),(.*)$/ );
obj.frame	= m[1];
img.src 	= m[2];
if ( obj.status )
obj.timer = setTimeout( 'getPreview( previews[ ' + obj.id + ' ] )', 700 );
}
function getPreview( obj )
{
clearTimeout( obj.timer );
obj.frame++;
if ( obj.status )
send( recvPreview, obj, '/library/ajax/get-preview.php', 'id=' + obj.id + '&frame=' + obj.frame + '&size=' + obj.size );
}

/**---------------------------------------------------------------------------------------------------
*
* File:		advert.js
* Date:		25.07.2007
* Description:	Dynamic Adverts
*
* Usage:
*
*--------------------------------------------------------------------------------------------------*/
/**---------------------------------------------------------------------------------------------------
*
* Network wrapper
*
*/
function send( recv, obj, url, data, flag )
{
net = new Network( recv, obj, flag );
net.send( url, data );
}
/**---------------------------------------------------------------------------------------------------
*
*
*/
function Network( recv, obj, flag )
{
this.obj			= obj;
this.synchronous	= ! flag;
this.xmlHttpReq		= window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject( "Microsoft.XMLHTTP" );
/**
* Sends a string of data to a URL
*
* @param string url	URL to send data to
* @param string data	data to send
*/
this.send = function( url, data )
{
var	self = this;
try
{
self.xmlHttpReq.open( "POST", url, self.synchronous );
self.xmlHttpReq.setRequestHeader(	"Content-Type",
"application/x-www-form-urlencoded" );
self.xmlHttpReq.onreadystatechange = function()
{
if ( self.xmlHttpReq.readyState == 4 && self.recv )
self.recv( self.xmlHttpReq.responseText, self.obj );
}
this.xmlHttpReq.send( data );
}
catch( e )
{
alert( "Cannot access remote domain." );
}
}
this.recv = recv;
}
/*--------------------------------------------------------------------------------------------------*/

