if (!window.console || !console.firebug)
{
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

    window.console = {};
    for (var i = 0; i < names.length; ++i)
        window.console[names[i]] = function() {}
}


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}







CC = {}

CC.Formcheck = {};



CC.Helpers = {
	Stack: []
	,hideAll: function ()
	{
		for (var i = 0; Helper = CC.Helpers.Stack[i]; i ++)
			Helper.style.display = 'none';
	}
	
	,showError: function(ErrText, Err)
	{
		if (!arguments[1])
			Err = 1;
		
		$('help_error_' + Err).innerHTML = ErrText;
		$('help_error_' + Err).style.display = 'block';
	}
	
	,hideError: function(Err)
	{
		if (!arguments[1])
			Err = 1;
		
		$('help_error_' + Err).style.display = 'none';
	}
}

/**
 * FormCheck-Objekt für Registrierungsformular
 */
CC.Formcheck.Checks = {
	
	 Errors: ''
	,ErrorCount: 0
	,FocusOn: null
	,YesNo: []
	
	,step4: function()
	{
	    this.checkEmpty($('description'), 	'Gib eine Beschreibung');
	    this.checkEmpty($('wishes'),		'Gib Deine Wünsche an');
	    this.checkLength($('description'), 	100, 'Die Beschreibung erfordert min. 100 Zeichen');
	    this.checkLength($('wishes'),		100, 'Die Wünsche erfordert min. 100 Zeichen');
	    
		for (i = 0; i < this.YesNo.length; i ++)
		{
			var OnID = this.YesNo[i];
			var Obj1 = $('yesno_' + OnID + '_yes');

			var Obj2 = $('yesno_' + OnID + '_no');
			
		    if (Obj1.checked != true && Obj2.checked != true)
		    {
				this.addError('Geben Sie Ihr Interesse für ' + OnID + ' an');
		        this.setFocus(Obj1);
		    }
		}
	    
		return this.endCheck();
	},
	
	endCheck: function()
	{
	    if (this.FocusOn == null)
	    {
	        return true;
	    }
	    else
	    {
	        alert(this.Errors);
	        this.FocusOn.focus();
	        return false;
	    }
	},
	
	
	setFocus: function(Obj)
	{
		var Err;
		
		try
		{
			if (Obj.addClass)
			{
				Obj.addClass('error');	
//				Obj.addEvent('onchange', function(){
//				});
			}
	
	        if (this.FocusOn == null)
	        {
	            this.FocusOn = Obj;	
	        }
		}
		catch (e)
		{
			Err = e;
		}
		
		if (Err)
		{
			console.log('Setting Focus:: ' + Err);
		}
	},
	
	addError: function(Msg, Obj)
	{
		console.log('concatenateing: ' + Msg);
		this.Errors += '- ' + Msg + '\n';	
		this.ErrorCount ++;
	}
	
	,addLine: function(Content)
	{
		this.Errors += Content + '\n';
	}
	
	,checkLength: function(Obj, Length, Msg)
	{
		if (!Obj.value)
			return;
			
	    if (Obj.value.length < Length)
	    {
			this.addError(Msg);
	        this.setFocus(Obj);
	    }
	}
	
	,checkMaxLength: function(Obj, Length, Msg)
	{
		if (!Obj.value)
			return;
			
	    if (Obj.value.length > Length)
	    {
			this.addError(Msg);
	        this.setFocus(Obj);
	    }
	},
	
	checkChecked: function(Obj, Msg)
	{
	    if (Obj.checked != true)
	    {
			this.addError(Msg);
	        this.setFocus(Obj);
	    }
	},
	
	checkSelect: function(Obj, Msg)
	{
		if (!Obj)
			alert(Msg);
		
	    if (Obj.options[Obj.options.selectedIndex].value == ''
	    || Obj.options[Obj.options.selectedIndex].value == 0)
	    {
			this.addError(Msg);
	        this.setFocus(Obj);
	    }
	},
	
	checkCheckedOneOf: function(IDs, Msg)
	{
		var OneChecked = false;
		
		for (i = 0; i < IDs.length; i ++)
		{
			if ($(IDs[i]).checked == true)
				OneChecked = true;
		}
		
	    if (false === OneChecked)
	    {
			this.addError(Msg);
	    }
	},
	
	checkEmpty: function(Obj, Msg)
	{
		if (!Obj)
			alert(Msg);

	    if (!Obj.value || Obj.value == '')
	    {
			this.addError(Msg);
	        this.setFocus(Obj);
	    }
	},
	
	checkEquality: function(Obj, Obj2, Msg)
	{
		if (Obj.value != Obj2.value)
		{
			this.addError(Msg);
	        this.setFocus(Obj);
		}
	},
	
	checkRadio: function(Objs, Msg)
	{
	    Objs.hasCheck = false;
	    
	    for (i = 0; i < Objs.length; i ++)
	    {
	        if (Objs[i].checked == true)
	        {
	            Objs.hasCheck = true;
	        }
	    }
	    if (false == Objs.hasCheck)
	    {
			this.addError(Msg);
	        this.setFocus(Objs[0]);
	    }
	}
}

CC.Jax = {
	pageRefresh: function()
	{
		if (CC.Jax.lastRequest.url)
		{
			try
			{
				new ajax(
					CC.Jax.lastRequest.url
					,{
						 method: 'post'
						,postBody: 'JaxCall=1'
						,onComplete: CC.Jax.lastRequest.onComplete.bind(CC.Jax.lastRequest.bind)
					}
				);	
			}
			catch (e)
			{
				document.location.href = CC.Jax.lastRequest.url;
			}
		}
		else
		{
			document.location.reload();
		}
	}
	
	,lastRequest: {
		 url: null
		,onComplete: null
		,bind: null
	}
}

CC.Jax.TopAdd = new Class();
CC.Jax.TopAdd.prototype = {
	 initialize: function(Target)
	{
		this.Target = Target;
		this.TimeOut = window.setInterval(this.loadAd.bind(this), 30000);
	}
	
	,Target: null
	,TimeOut: null
	
	,loadAd: function()
	{
		new ajax(
			'/anzeigen/banner.php',
			{
				 method: 'post'
				,postBody: 'Page=' + document.location.href
				,onComplete: this.receiveResponse.bind(this)
			}
		);
	}
	
	,receiveResponse: function(Response)
	{
		this.Target.innerHTML = Response.responseText;
	}	
}








































function updatePartyTip()
{
	window.setInterval(updatePartyTip_Do, 30000);
}

function updatePartyTip_Do()
{
	new ajax(
		'/partytip_jax.php',
		{
			method: 'get',
			onComplete: updatePartyTip_Paint
		}
	);
}

function updatePartyTip_Paint(req)
{
	$('partytip_box').innerHTML = req.responseText;
}




function openPNRead(PN)
{
    PNWindow = openWindow('/community/messenger/view.php?PN=' + PN, 450, 400);
}

function toggleDescription(DescNumber)
{
	Description = document.getElementById('desc' + DescNumber);
	if (Description.style.display == 'none')
		Description.style.display = 'block';
	else
		Description.style.display = 'none';		
}

function toggleNav(ID)
{
	var Status = toggleElement(ID);

	var	Navs = $S('ul.subnav');

	for (i = 0; Nav = Navs[i]; i ++)
	{
		if (Nav.id != ID)
		{
			Nav.style.display = 'none';
		}
	}

	new ajax('/plugin/de.newmedia-tech/ajax/notifyNav.php', {
		 postBody: 'Nav=' + ID + '&Status=' + Status
	});
}

function toggleElement(ID)
{
	TheElement = $(ID);
	
	if (TheElement.style.display == 'none')
	{
		TheElement.style.display = 'block';
	}
	else
	{
		TheElement.style.display = 'none';	
	}
	
	return TheElement.style.display;
}


function picureToGuestbook()
{
	popUp('/includes/popups/community/addguestposting.php?Photo=' + $('picture_id').value + '&User=' + $('guestbook_name').value, 'width=500,height=400,resizable=yes');
	return false;
}


function openPNWrite()
{
    PNWindow = openWindow('/includes/popups/messenger/write.php', 450, 400);
}

function openPNWriteEmfpaenger(Emfpaenger)
{
    PNWindow = openWindow('/includes/popups/messenger/write.php?empfaenger=' + Emfpaenger, 450, 400);
}

    
    function popUpClose()
    {
        PopUp.close();
        window.location.reload();
    }
function openWindow(Url, Width, Height)
{
    if (Width == undefined)
        Width = 520;
    if (Height == undefined)
        Height = 300;
        
    var Left    = screen.availWidth / 2 - Width / 2;
    var Top     = screen.availHeight / 2 - Height / 2;
    
    return window.open(Url, 'OpenedWindow', 'width=' + Width + ', height=' + Height + ', left=' + Left + ', top=' + Top + ', resizable=yes');
}

function closePNWrite()
{
    window.setTimeout('closePNWriteDo()', 5000);
}

function closePNWriteDo()
{
    PNWindow.close();
}

var PNChecks    = new Array();
var PNChecked   = false;

function checkAllPNChecks()
{
    for (i = 0; i < PNChecks.length; i++)
    {
        PNCheck = document.getElementById(PNChecks[i]);
        
        if (PNChecked)
        {
            PNCheck.checked = false;
        }
        else
        {
            PNCheck.checked = true;
        }
    }
        
    if (PNChecked)
    {
        PNChecked = false;
    }
    else
    {
        PNChecked = true;
    }
}

function ResizeImgs(Element) {
	if (!Element)
	{
	    Element = document.getElementById('usergb');
	}
    TraverseNode(Element, '');
}

function ResizeImgsDo(Obj) {
    alert(Obj.src);
    if (Obj.src.substring(0,22) != "http://www.clipfisch.newmedia-tech.de"){
        if (Obj.width > 400) {
            Obj.width = 400;
        }
    }
}
    


var SaveCount = 0;
var SaveBreak = 200;

function debugOut(Msg)
{
    debug = document.getElementById('debug');
    debug.innerHTML += Msg + '<br/>';
}
function openGuestbookComment(GBEntry)
{
    GuestBook = openWindow('/includes/popups/community/addguestcomment.php?GBEntry=' + GBEntry);
}


function closeViolationReport()
{
    window.setTimeout('closeViolationReportDo()', 5000);
}

function closeViolationReportDo()
{
    ViolationReport.close();
}

function closeGuestbook()
{
    GuestBook.close();
    //window.location.href = window.location.href + '#usergb';
    window.location.reload();
}

function TraverseNode(Nodes, Name)
{
	return;
	var Node = 0;
    var ActualNode;
    
    Name = Name + '>' + Nodes.nodeName;
    for (Node = 0; Node < Nodes.childNodes.length; Node++)
    {
        ActualNode = Nodes.childNodes[Node];
    
        if (ActualNode.nodeName != '#text')
        {
            if (ActualNode.nodeName == 'IMG')
            {
                if (ActualNode.src.substring(0,22) != "http://www.clipfisch.newmedia-tech.de"){
                    if (ActualNode.width > 400) {
                        ActualNode.width = 400;
                    }
                }
            }
                
            SaveCount++;
            if (SaveCount > SaveBreak)
                return;
            
            if (ActualNode.hasChildNodes())
            {
                TraverseNode(ActualNode, Name);
            }
        }
    }
}



function makeNewLocationType()
{
	parameters  = 'id=' + $('location_type_id').value;
	parameters += '&display=' + $('location_type_display').value;
	parameters += '&bild=' + $('location_type_bild').value;
	parameters += '&beschreibung=' + $('location_type_beschreibung').value;
	if ($('location_type_nav').checked == true)
	{
		parameters += '&in_nav=' + 1;
	}
	else
	{
		parameters += '&in_nav=' + 0;
	}
	
	new Ajax.Request(
		'/locations/admin/savetype.php',
		{
			method: 'get',
			parameters: parameters,
			onSuccess: setLocationsTypeSelect
		}
	);
	
	return true;
}



function getLocationType()
{
	parameters  = 'id=' + $('type').options[$('type').options.selectedIndex].value;
	
	new Ajax.Request(
		'/locations/admin/gettype.php',
		{
			method: 'get',
			parameters: parameters,
			onSuccess: setLocationsTypeOnEdit
		}
	);
	
	return true;
}

function setLocationsTypeOnEdit(req)
{
	Status 	= null;
	ChatLog	= null;
	ChatLock = false;
//	$('nfo').innerHTML = req.responseText
	eval(req.responseText);
	
	if (Status != 'OK')
	{
		alert('SomeThingWentWrong');
	}
	else
	{
		$('location_type_id').value 		 	= Type.id;
		$('location_type_display').value 		= Type.display;
		$('location_type_bild').value 			= Type.bild;
		$('location_type_beschreibung').value	= Type.beschreibung;
		
		if (Type.in_nav == '0')
		{
			$('location_type_nav').checked = false;
		}
		else
		{
			$('location_type_nav').checked = true;
		}
	}
}

function setLocationsTypeSelect(req)
{
	Status 	= null;
	ChatLog	= null;
	ChatLock = false;
//	$('nfo').innerHTML = req.responseText
	eval(req.responseText);
	
	if (Status != 'OK')
	{
		alert('SomeThingWentWrong');
	}
	else
	{
		TypeSelect = $('type');
        TypeSelect.options.length = Types.length;

        for (var i = 0; i < Types.length; i++)
        {
            TypeSelect.options[i].text  = Types[i];
            TypeSelect.options[i].value = Types[i];
        }

        TypeSelect.options.selectedIndex = Select;
	}
	
	toggleElement('location_type_edit');
}















function check_message(message)
{
 	var rueck 		= true;
 	var forentext 	= message;
 	var Ergebnis;

   	var smilies = TagScanner(forentext, ':');
   	if (smilies > 40)
   	{
    	return 'Du hast mehr als 20 Smilies in deinem Beitrag, bitte aendere das.';
   	}

   	var pictures = TagScanner(forentext, '[img]');
   	if (pictures > 4)
   	{
	    return 'Du hast mehr als 4 Bilder in deinem Beitrag, bitte aendere das.';
   	}


	for (i = 0; i < BadURLs.length; i ++)
	{
		SearchString = BadURLs[i];
		eval('Ergebnis = forentext.search(/' + SearchString + '/)');
		if (Ergebnis != -1)
		{
			return 'Die im Beitrag angegebene Internetadresse ' + SearchString + ' ist nicht zulaessig\n\n Der Betreiber der Website hat uns die Verlinkung auf Inhalte seiner Seite untersagt.';
		}
	}
	
	return false;
}

function TagScanner(Beitrag, Tag)
{
 	var Text_length = Beitrag.length;
	var Tag_length	 = Tag.length;
	var Tag_Num	 = 0;
	for (i = 0; i <= Text_length; i++)
	{
		if (Beitrag.charAt(i) == Tag.charAt(0))
		{
			var found = Beitrag.substr(i,Tag_length);
			if (found == Tag)
			{
				Tag_Num++;
			}
		}
	}
	return Tag_Num;
}


var BadURLs = [
'sunshine-familie.de',
'fuxshop.de',
'women-chat2000.de',
'dagmar-borchert.de',
'katzenstube.de',
'selber-backen.de',
'auf-dem-marktplatz.de',
'homepagestudio.de',
'heiko-hildebrandt.de',
'klassentreffen-esslingen.de',
'mayeruli.de',
'Diethelm-Glaser.de',
'Diethelm-Glaser.net',
'pedi-marketing.net',
'quasimodo52.de',
'didis-fotos.de',
'rysselchen.de',
'markuswesseling.de',
'people.freenet.de',
'amt-nennhausen.de',
'autos.cs.tu-berlin.de',
'funfire.de',
'allmystery.de',
'lustige-ecards.de',
'motordesktop.com',
'auto-sfondi-desktop.com',
'bofunk.com',
'perso.wanadoo.fr',
'seriouswheels.com',
'krankhaft.de',
'moviesanddvds.de',
'doberman.go.ro',
'bigbtv.com',
'bild.t-online.de',
'bunnys.de',
'vdownload.jubii.com',
'spass-24.com',
'victorian-music.com',
'chocopriveos.de',
'grafik-3d-portal.de',
'hotzeltopf.de',
'twoday.net',
'skyblog.com',
'pablotron.org',
'westbalkanonline.com',
'images.google.de',
'lustich.net',
'lustich.de',
'free.fr',
'natomic.com',
'advnt01.com',
'ibiblio.org',
'pp.ru',
'kwick.de',
'rotten.com',
'axellauer.de',
'cardus.com',
'smiley-channel.de',
'joy4yourlife.de',
'grandini.biz',
'kurspool.de',
'onlinepics24.de',
'szon.de',
'piccube.de',
'gehnicht.de',
'postkartenparadies.de',
'feuerwehr.de',
'faq-h.de',
'ampulove.com',
'fuchs-soest.de',
'mehr-schbass.de',
'art-foto-media.de',
'home.student.uu.se',
'uwe-dorn.de',
'sidecar-cz.com',
'ds-webtools.de',
'ohost.de',
'monstergame.de',
'monstergame.info',
'samtpfoetchen.de',
'monika.abeling',
'imagepuzzler.com',
'dala.de',
'gromith.ch',
'flowerdreams.de',
'sajonara.de',
'selk-stuttgart.de',
'zehner.ch',
'foolforfood.de',
'think-strange.de',
'b-oberholz.de',
'ircflirt.de',
'myasthenie-und-seele.de',
'hitzel.com',
'maztravel.com',
'kill-more-people.de',
'smiliemania.de',
'dopecash.com',
'ls-university.com',
'sextronix.com',
'porno.com',
'porno.de',
'poppen.de',
'ficken.de',
'poppen.com',
'ficken.com',
'epicgals.com',
'theroleplaying.com',
'702cash.com',
'filthynurses.com',
'teenflood.com',
'freehostedgallery.com',
'midnightprowl.com',
'exploitedteens.com',
'amateursgonebad.com',
'fvotd.com',
'apmhosteappealingpics.com',
'collegefuckfest.com',
'cheatinglesbians.com',
'seattlesorority.com',
'mipgals.com',
'picgals.com',
'adult.com',
'pregnantfux.com',
'pregnantschool.com',
'sweetmoney.com',
'pregnantgirlies.com',
'smutty-pages.com',
'lightspeedgirls.com',
'epicgals.com',
'pantymadness.com',
'payperscene.com',
'skintraffic.com',
'teenlabia.com',
'wannawatch.com',
'harlotgirl.com',
'asianpornoground.net',
'bethemask.com',
'jp18.com',
'spicymovies.com',
'asianschoolfuck.com',
'bustysites.com',
'amateurnest.com',
'justass.com',
'nsgalleries.com',
'makebling.com',
'momsanaladventure.com',
'dgalleries.com',
'pimpfreepics.com',
'freehotpics.com',
'nocumdodgingallowed.com',
'shegotswitched.com',
'analsuffering.com',
'analdestruction.com',
'appealingpics.com',
'pimpfreepics.com',
'porn-xxx-pictures.com',
'spunkpass.com',
'silicom.com',
'autobahnvw.net',
'nazi-lauck-nsdapao.com',
'eblogx.de',
'gronk.us',
'monstersofcock.com',
'swallowingsluts.com',
'shemalesins.com',
'tsclips.com',
'trannydestruction.com',
'pimpfreepics.com',
'freevideogallery.com',
'buttmachineboys.com',
'appealingpics.com',
'plumperfacials.com',
'fuckomat.com',
'tgppics.com',
'babes.tv',
'dildoaddicted.com',
'glamourmodelsgonebad.com',
'lonniewaters.com',
'bustycafe.net',
'easydrunkgirls.com',
'cockbrutality.com',
'brutaldildos.com',
'ravishingindians.net',
'ebonyfiesta.com',
'nastygrannies.com',
'crazypics.de',
'hell.pl',
'mikrobitti.fi',
'santabanta.com',
'drno.de',
'net-server5.de',
'jbcdetoss.nl',
'funpic.de',
'mycgiserver.com',
'friday-fun.com',
'warnet.ws',
'voak.at',
'thc-relaxer.de',
'playboard.de',
'bk-sportsmag.se',
'domula.de',
'mellesleg.hu',
'hinti.ch',
'musikverein-wiechs.de',
'yimg.com',
'scorn.com',
'scorn.us',
'break.com',
'inidia.de',
'kewl.ch',
'opeschka.de',
'starstore.com',
'lachstdu.de',
'msn.com',
'666kb.com',
'exs.cx',
'learntohate.net',
'burg-fehmarn.de',
'mk2448.de',
'burg-fehmarn.de',
'hurz.de',
'team-ulm.de',
'teamulm.de',
'el-ladies.com',
'217.160.17.126'
];


CC.Violation = {
	user: function(User)
	{
		CC.Violation.exec('User=' + User);
		return false;	
	}
	
	,profilbild: function(User)
	{
		CC.Violation.exec('Profilbild=' + User);
		return false;
	}
	
	,comment: function(Comment)
	{
		CC.Violation.exec('Comment=' + Comment);
		return false;	
	}
	
	,photo: function(Photo)
	{
		CC.Violation.exec('Photo=' + Photo);
		return false;
	}
	
	,userphoto: function(Photo)
	{
		CC.Violation.exec('Usergalerie=' + Photo);
		return false;
	}
	
	,exec: function(Request)
	{
		popUp('/includes/popups/verstoss/abuse.php?' + Request + '&Location=' + encodeURIComponent(document.location.href), 'width=520,height=450,resizable=yes,scrollbars=yes');
	}
}

function openGuestbook(User)
{
    GuestBook = openWindow('/includes/popups/community/addguestposting.php?User=' + User);
}
    
function openStats(User)
{
    Stats = openWindow('/includes/popups/community/yourprofile_stats.php?User=' + User);
}


function selectText(ID)
{
	var TA = $(ID);
	TA.focus();
	TA.select();
}





function changeTab(Tab, Tabs)
{
	var TabID = Tab.parentNode.parentNode.parentNode.id;
	
	var TabTrigger = $$('.' + TabID + '_trigger');

	for (i = 0; Node = TabTrigger[i]; i ++)
	{
		if (Node.id != Tab.id)
		{
			Node.removeClass('active');
		}
		else
		{
            Node.addClass('active');
		}
	}
	
	var TabContents = $$('.' + TabID);

	for (i = 0; Node = TabContents[i]; i ++)
	{
		if (Node.id != Tab.id)
		{
			Node.style.display = 'none';
			Node.removeClass('active');
		}
	}
	
	var TabContent = $('tab_content_' + Tab.id.split(/_/).pop());
	TabContent.style.display = 'block';
}



function geoLoadStates(Trigger)
{
	var Country = Trigger.options[Trigger.options.selectedIndex].value;

	new Ajax(
		'/plugin/de.newmedia-tech/ajax/getGeoSelect-States.php',
		{
			 method: 'post'
			,postBody: 'Country=' + Country
			,onComplete: geoLoadStatesReceive
		}
	).request();
}

function geoLoadCities()
{
	var State = this.options[this.options.selectedIndex].value;

	new Ajax(
		'/plugin/de.newmedia-tech/ajax/getGeoSelect-Cities.php',
		{
			 method: 'post'
			,postBody: 'State=' + State
			,onComplete: geoLoadCitiesReceive
		}
	).request();
}

function geoLoadCitiesReceive(Response)
{
	var Container = $('city_container');
//	Container.innerHTML = Response.responseText;
	Container.innerHTML = Response;
}

function geoLoadStatesReceive(Response)
{
//	console.log(Response);
	var Container = $('region_container');
	Container.innerHTML = Response;
	
	var SelectElem = $('state');
	SelectElem.onchange = geoLoadCities;
}



   function popUp(URL, Options, Unique)
{
	var width = Options.split(/,/)[0];
	var height = Options.split(/,/)[1];

	width	= width.split(/=/)[1];
	height 	= height.split(/=/)[1];

	var c = Util.centerScreen(width, height);

	Options	+=
		',screenX=' + c.x +
		',screenY=' + c.y;

//    if (true == Unique)
//    {
        window.open(URL, '', Options);
//    }
//    else
//    {
//        PopUp = window.open(URL, "Zweitfenster", Options);
//        PopUp.focus();
//    }
}



var Util = {
	
	ucFirst: function(Str)
	{
        var F = Str.substr(0, 1);
        var R = Str.substr(1, Str.length - 1);
	    return F.toUpperCase() + R.toLowerCase();
	},
	
    snapTo: function(Snap, To, Style, OffSet, Options)
    {
        if (!arguments[2])
        {
            Style = 'lud';
        }

        if (!arguments[3])
        {
            OffSet = {x: 0, Y: 0};
        }

        if (!arguments[4])
        {
            Options = {noTransition: false};
        }
            
		if (!OffSet.x)
		{
			OffSet = {x: OffSet, y: OffSet};
		}

        to      = {x: 0, y: 0};
        SnapTo  = To.getCoordinates();
        SnapTo.x = SnapTo.left;
        SnapTo.y = SnapTo.top;
        console.log(SnapTo);
//        c = getClientDimension();
        Screen = Util.innerDimension();
        Screen.x -= 30; // Scrollbar

        var Probe = {x: 0, y: 0};
        
        console.log('SNapStyle: ' + Style);
        
        switch (Style)
        {
            case 'ruh' :
                to.x    = OffSet.x;
                to.y    = SnapTo.y;
                break;
            case 'rud' :
                to.x    = SnapTo.x + To.offsetWidth + OffSet;
                Probe.x = to.x + Snap.offsetWidth;
                if (Probe.x > Screen.x)
                    to.x    = SnapTo.x + To.offsetWidth + OffSet - (Probe.x - Screen.x);

                to.y    = SnapTo.y - Snap.offsetHeight - OffSet;
                if (to.y < 1)
                    to.y    = SnapTo.y + To.offsetHeight + OffSet;
                break;

            case 'lud' :
                to.x    = SnapTo.x - Snap.offsetWidth - OffSet;
                if (to.x < 1)
                    to.x    = SnapTo.x - Snap.offsetWidth - OffSet + (Math.abs(to.x));

                to.y    = SnapTo.y - Snap.offsetHeight - OffSet;
                if (to.y < 1)
                    to.y    = SnapTo.y + To.offsetHeight + OffSet;
                break;

            case 'luh' :
                to.x    = SnapTo.x - Snap.offsetWidth - OffSet;
                if (to.x < 1)
                    to.x    = SnapTo.x - Snap.offsetWidth - OffSet + (Math.abs(to.x));

                to.y    = SnapTo.y;
                break;

            case 'luv' :
                to.x    = SnapTo.x;
                to.y    = SnapTo.y - OffSet - Snap.offsetHeight;
                break;

            case 'rbv' :
                to.x    = SnapTo.x + To.offsetWidth - Snap.offsetWidth;
                if (to.x < 1)
                    to.x    = 0;


                to.y    = SnapTo.y + To.offsetHeight + OffSet;
//                if (to.y > Screen.y)
//                    to.y    = SnapTo.y - Snap.offsetHeight - OffSet;
                break;

            case 'lbv' :
                to.x    = SnapTo.x;
                if (to.x + Snap.offsetWidth > Screen.x)
                    to.x    = Screen.x - Snap.offsetWidth;


                to.y    = SnapTo.y + To.offsetHeight + OffSet;
                if (to.y > Screen.y)
                    to.y    = SnapTo.y - Snap.offsetHeight - OffSet;
                break;

            case 'lu' :
                leftPos     = SnapTo.x + To.offsetWidth + Snap.offsetWidth;
                bottomPos   = SnapTo.y + To.offsetHeight + Snap.offsetHeight;
                
                if (leftPos > Screen.x)
                {
                    to.x = SnapTo.x - OffSet - Snap.offsetWidth;
                }
                else
                {
                    to.x = SnapTo.x + OffSet + To.offsetWidth;
                }
                
                if (bottomPos > Screen.y)
                {
                    to.y = SnapTo.y - Snap.offsetHeight + To.offsetHeight;
                }
                else
                {
                    to.y = SnapTo.y;
                }
                break;
                
            case 'lb' :
                leftPos = SnapTo.x + Snap.offsetWidth;
                bottomPos = SnapTo.y + To.offsetHeight + Snap.offsetHeight;
                
                if (leftPos > Screen.x)
                {
                    to.x = SnapTo.x + To.offsetWidth - OffSet - Snap.offsetWidth;
                }
                else
                {
                    to.x = SnapTo.x;
                }
                
                if (bottomPos > Screen.y)
                {
                    to.y = SnapTo.y - Snap.offsetHeight + To.offsetHeight;
                }
                else
                {
                    to.y = SnapTo.y + OffSet + To.offsetHeight;
                }
                break;
        }
        console.log(to);
        
        if (to.y < Util.scrollingOffset().y)
        {
            to.y = Util.scrollingOffset().y;
        }
        
        
        console.log(to);
        
        if (Options.noTransition)
        {
	        Snap.style.left     = parseInt(to.x) + 'px';
	        Snap.style.top      = parseInt(to.y) + 'px';
        }
        else
        {
			var exampleFx = new Fx.Styles(Snap);
			exampleFx.start({
				'left':[parseInt(Snap.style.left),to.x],
				'top':[parseInt(Snap.style.top),to.y]
			});
        }
    },

    pageDimension: function()
    {
        var x,y;
        var test1 = document.body.scrollHeight;
        var test2 = document.body.offsetHeight
        if (test1 > test2) // all but Explorer Mac
        {
        	x = document.body.scrollWidth;
        	y = document.body.scrollHeight;
        }
        else // Explorer Mac;
             //would also work in Explorer 6 Strict, Mozilla and Safari
        {
        	x = document.body.offsetWidth;
        	y = document.body.offsetHeight;
        }
		
		return {x: x, y: y};
    },

	scrollingOffset: function()
	{
		var x,y;
		if (self.pageYOffset) // all except Explorer
		{
			x = self.pageXOffset;
			y = self.pageYOffset;
		}
		else if (document.documentElement && document.documentElement.scrollTop)
			// Explorer 6 Strict
		{
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		}
		else if (document.body) // all other Explorers
		{
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
		
		return {x: x, y: y};
	},
	
	innerDimension: function()
	{
		var x,y;
		if (self.innerHeight) // all except Explorer
		{
			x = self.innerWidth;
			y = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight)
			// Explorer 6 Strict Mode
		{
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		}
		else if (document.body) // other Explorers
		{
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}
		
		return {x: x, y: y};
	},

	/**
	 * Einem Element eine (weitere) Klasse zuweisen.
	 * Bestehende Klassen werden nicht entfernt.
	 */
	addClass: function(Elem, addClassName) {
		if (Elem) {
			CurrentClass = $(Elem).className.split(' ');
			// nicht mehrfach hinzufuegen:
			isSet = false;
			for (ci = 0; ci < CurrentClass.length; ci++) {
				if (CurrentClass[ci] == addClassName) {
					isSet = true;
				}
			}
			if (!isSet) {
				CurrentClass.push(addClassName);
			}
			$(Elem).className = CurrentClass.join(' ');
		}
	},

	/**
	 * Einem Element gezielt eine Klasse entfernen, ohne eventuell
	 * weitere Klassen zu stoeren.
	 */
	stripClass: function(Elem, stripClassName) {
		if (Elem) {
			CurrentClass = $(Elem).className.split(' ');
			for (ci = 0; ci < CurrentClass.length; ci++) {
				if (CurrentClass[ci] == stripClassName) {
					CurrentClass.splice(ci, 1);
				}
			}
			$(Elem).className = CurrentClass.join(' ');
		}
	},
	
	
	
	
	centerScreen: function(width, height)
	{
		var X = (self.screen.width - width) / 2;
		var Y = (self.screen.height - height) / 2;

//		$('content').innerHTML =
//			'width: ' + width + '<br />' +
//			'height: ' + height + '<br />' +
//			'X: ' + X + '<br />' +
//			'Y: ' + Y + '<br />'
//			;
		return {x: X, y: Y};
	},
	
	getPos: function(obj)
	{
		return {
			x: Util.findPosX(obj),
			y: Util.findPosY(obj)
		}
	},
	
	findPosX: function(obj)
	{
		var curleft = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft;
//				obj.style.border = '1px solid green';
				obj = obj.offsetParent;
			}
		}
		else if (obj.x)
		{
			curleft += obj.x;   
//            obj.style.border = '1px solid blue';
		}
		return curleft;
	},
	
	findPosY: function(obj)
	{
		var curtop = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
		return curtop;
	},
	
	mousePos: function(e)
	{
		var posx = 0;
		var posy = 0;
		if (!e) var e = window.event;
		if (e.pageX || e.pageY)
		{
			posx = e.pageX;
			posy = e.pageY;
		}
		else if (e.clientX || e.clientY)
		{
			posx = e.clientX + document.body.scrollLeft;
			posy = e.clientY + document.body.scrollTop;
		}
		// posx and posy contain the mouse position relative to the document
		// Do something with this information
		
		return {x: posx, y: posy};
	},
	
	keepAlive: function() {
	    new ajax ('/plugin/de.masstisch.ajax/KeepAlive.php', {
	    });    
	}
	
}




NMT = {};

NMT.HelpBox = new Class();
NMT.HelpBox.prototype = {
	
	Floater: null
	
	,initialize: function(FormElem)
	{
		this.Floater = $('helpbox');
		this.Wrapper = $('site');
		this.Floater.parentNode.removeChild(this.Floater);
		document.getElementsByTagName('body')[0].appendChild(this.Floater);
		
		var Selector = '#' + FormElem.id + ' .input';
		var Elems = $$(Selector);
		for(var index=0; Elem = Elems[index]; index++)
		{
			Elem.Floater = this;
			Elem.onfocus = this.goToArea;
		}
	}

	,setText: function(ID)
	{
		this.Floater.innerHTML = this.Texte[ID];
	}

	,goToArea: function()
	{
		this.Floater.dockTo(this);
		this.removeClass('error');
	}
	
	,dockTo: function(Elem)
	{
		var WrapperCoords = this.Wrapper.getCoordinates();
		
		if (Elem.id == 'username' && Elem.UserExists && Elem.UserExists > 0)
		{
			NMT_HelpBox.setText('username-vergeben');
		}
		else if (this.Texte[Elem.id])
		{
			NMT_HelpBox.setText(Elem.id);
		}
		else
		{
			this.Floater.innerHTML = 'Hilfetext zu ' + Elem.id;
		}
		console.log(this.Floater);
		
		Elem = Elem;
		
		Util.snapTo(this.Floater, Elem, 'ruh', {x: WrapperCoords.left + 700});
	}
}


NMT.Comments = {
	postComment: function(Trigger)
	{
		console.log(Trigger);
		
		return false;
	}
};

NMT.Vote = {
	lastChildren: null
	
	,hover: function(Trigger)
	{
		if (!NMT.Vote.lastChildren)
		{
			NMT.Vote.lastChildren = $$('#' + Trigger.parentNode.id + ' a');	
		}
		Children = NMT.Vote.lastChildren;
		
		var InfoID = 'info_' + Trigger.parentNode.id.split(/_/)[1];
		var Info = $(InfoID);
		var Extractor = /Vote=(\d)/;
		var InfoNum = Extractor.exec(Trigger.href)[1];
		
		var Infos = [
			'Grauenhaft',
			'Schlecht',
			'Mittelmässig',
			'Passabel',
			'Gut',
			'Genial'
		];
		
		Info.innerHTML = Infos[InfoNum - 1];
		
		
		var Found = false;
		for (var i = 0; Child = Children[i]; i ++)
		{
			Child = $(Child);
			
			if (false == Found)
			{
				Child.addClass('hover');
				
				if (Child == Trigger)
				{
					Found = true;
				}
			}
			else
			{
				Child.removeClass('hover');
			}
		}
	}
	
	,off: function(Trigger)
	{
		
		var InfoID = 'info_' + Trigger.parentNode.id.split(/_/)[1];
		var Info = $(InfoID);
		Info.innerHTML = '';
		
		var Children = NMT.Vote.lastChildren;
		for (var i = 0; Child = Children[i]; i ++)
		{
			Child = $(Child);
			
			Child.removeClass('hover');
		}
	}
}





NMT.NotifyUse = false;
NMT.Notify = new Class();
NMT.Notify.prototype = {
	initialize: function()
	{
		this.Interval = window.setInterval(this.probe.bind(this), 10000);
	}
	
	,Interval: 0
	
	,probe: function()
	{
		var Jax = new Ajax('/plugin/de.newmedia-tech/ajax/probe-posteingang.php', {
			onComplete: this.receive.bind(this)
		}).request();
	}
	
	,receive: function(Response)
	{
		if (Response)
		{
			var Container = document.createElement('div');
			Container.style.position = 'absolute';
			Container.style.top = 0;
			Container.style.right = '-2px';
			Container.innerHTML = Response;
			
			$('wrapper').appendChild(Container);
			var mySlider = new Fx.Slide(Container, {duration: 1000});
			mySlider.hide(); 
//			mySlider.slideOut();
			mySlider.slideIn();

			var Closer = $('slider_closer');
			Closer.Slider = Container;
			Closer.onclick = function()
			{
				var mySlider = new Fx.Slide(this.Slider, {duration: 500});
				mySlider.slideOut();
			}
			
			window.clearInterval(this.Interval);
		}
	}
}




var BBCode_Floater = new Class();
BBCode_Floater.prototype = {
	initialize: function(Areas)
	{
		this.FloatBBs = $('bbcode_buttons');
		this.FloatBBs.parentNode.removeChild(this.FloatBBs);
		document.getElementsByTagName('body')[0].appendChild(this.FloatBBs);
		
		this.FloatBBCloser = $('bbcode_closer');
		this.FloatBBCloser.Floater = this.FloatBBs;
		this.FloatBBCloser.onclick = function()
		{
			var exampleFx = new Fx.Styles(this.Floater);
			exampleFx.start({
				'left':[parseInt(this.Floater.style.left),-500],
				'top':[parseInt(this.Floater.style.top),-500]
			});
		}
		
		for (i = 0; TArea = Areas[i]; i ++)
		{
			TArea.Floater = this;
			TArea.onfocus = this.goToArea;
		}
	}
	
	,FloatBBCloser: null
	,FloatBBs: null
	
	,goToArea: function()
	{
		this.Floater.dockTo(this);
	}
	
	,dockTo: function(Elem)
	{
		BBCode_Message = Elem;
		this.FloatBBs.style.width = (Elem.offsetWidth - 12) + 'px';
		Util.snapTo(this.FloatBBs, Elem, 'luv', 0);
	}
}



NMT.DropMenu = new Class();
NMT.DropMenu.prototype = {
	 Trigger: null
	,Menu: null
	,closed: true
	
	,initialize: function(el)
	{
		this.Trigger = el;
		this.Menu = $(el.id.replace(/_trigger_/, '_menu_'));
		
		this.Menu.parentNode.removeChild(this.Menu);
		$E('body').appendChild(this.Menu);
		this.Menu.setStyles({
			 'position': 'absolute'
			,'top': 0
			,'left': 0
			,'height': 0
			,'opacity': 0
			,'overflow': 'hidden'
		});
		
		this.Menu.$tmp.Fx = new Fx.Styles(this.Menu, {duration: 400});
		
		Closer = new Element('div');
		Closer.setStyles({
			 cursor: 'pointer'
			,padding: '10px 0 0 0'
			,'text-align': 'center'
		});
		Closer.innerHTML = 'schließen';
		Closer.addEvent('click', function()
		{
			this.Trigger.fireEvent('click');
		}.bind(this));
		this.Menu.appendChild(Closer);
		
		
		this.Menu.addEvent('show', function()
		{
			this.$tmp.Fx.stop().start({
				 height: this.scrollHeight
				,opacity: 1
			});
		});
		
		this.Menu.addEvent('hide', function()
		{
			this.$tmp.Fx.stop().start({
				 height: 0
				,opacity: 0
			});
		});
		
		
		this.Trigger.addEvent('click', function()
		{
			this.Trigger.blur();
			Coords = this.Trigger.getCoordinates();

			this.Menu.setStyles({
				 top: Coords.top + Coords.height
				,left: Coords.left
			});
			
			if (this.closed)
			{
				this.Menu.fireEvent('show');
				this.closed = false;
			
//				Scroller = new Fx.Scroll(window);
//				Scroller.toElement(this.Menu.getLast());
			}
			else
			{
				this.Menu.fireEvent('hide');
				this.closed = true;
			}
		}.bind(this));
	}
};


NMT.ToggleBox = new Class();
NMT.ToggleBox.prototype = {
	initialize: function(Box)
	{
		var Head = Box.getFirst();
		var Content = Head.getNext();
		
		Box.Head = Head;
		Box.Content = Content;
		Box.ContentRect = Content.getCoordinates();
		
		
		Box.refresh = function()
		{
			var ID = this.id.split(/_/)[1];
				
			new Ajax('/plugin/de.newmedia-tech/ajax/module/content-refresh.php', {
				postBody: 'Module=' + ID
				,onComplete: this.refreshDo.bind(this)
			}).request();
		}
		
		Box.refreshDo = function(Response)
		{
			console.log(Response);
			this.Content.getFirst().getNext().innerHTML = Response;
			this.doOpen(true);
		}
		
		var ConfigIcon = $$('#' + Box.id + ' .configicon');
		if (ConfigIcon.length)
		{
			ConfigIcon = ConfigIcon[0];
			ConfigIcon.Box = Box;
			
			ConfigIcon.doOpen = function(SettingPane)
			{
				if (SettingPane.hasClass('close'))
				{
					SettingPane.style.display = 'block';
					var myEffects = new Fx.Styles(SettingPane , {duration: 500, transition: Fx.Transitions.Bounce.easeOut});
				 
					myEffects.start({
						'opacity': [0, 1],
						'height': SettingPane.scrollHeight
					});
					
					SettingPane.toggleClass('open');
					SettingPane.toggleClass('close');
				}
			};
			
			ConfigIcon.doClose = function(SettingPane)
			{
				if (SettingPane.hasClass('open'))
				{
					var myEffects = new Fx.Styles(SettingPane , {duration: 500, transition: Fx.Transitions.Bounce.easeOut});
				 
					myEffects.start({
						'opacity': [1, 0],
						'height': 0
					});
				
//					SettingPane.style.display = 'none';	
					SettingPane.toggleClass('open');
					SettingPane.toggleClass('close');
				}
			};
			
			
			ConfigIcon.onclick = function(event)
			{
				var SettingPane = $$('#' + this.Box.id + ' .settingPane');
				SettingPane = SettingPane[0];

				if (SettingPane.hasClass('open'))
				{
					this.doClose(SettingPane);
				}
				else
				{
					
					console.log('Calling Config');
					this.Box.doOpen();
					
					var ID = this.Box.id.split(/_/)[1];
					
					new Ajax('/plugin/de.newmedia-tech/ajax/module/get-settingpane.php', {
						postBody: 'Module=' + ID
						,onComplete: this.takeResponse.bind(this)
					}).request();
				}
				
				event = new Event(event);
				event.stopPropagation();
			};
			
			ConfigIcon.takeResponse = function(Response)
			{
				var SettingPane = $$('#' + this.Box.id + ' .settingPane');
				SettingPane = SettingPane[0];

				SettingPane.style.overflow = 'hidden';
				SettingPane.style.height = 0;
				SettingPane.innerHTML = Response;

				this.doOpen(SettingPane);
				
				var SettingForm = $$('#' + this.Box.id + ' form');
				SettingForm = SettingForm[0];
				console.log(SettingForm);
				
				SettingForm.Box = this.Box;
				SettingForm.ConfigIcon = this;
				SettingForm.onsubmit = function()
				{
					var Inputs = this.getElementsBySelector('input');
					var Send = {};
					
					for(var index=0; Elem = Inputs[index]; index++)
					{
						if (Elem.name)
						{
							Send[Elem.name] = Elem.value;
						}
					}
					
					var ID = this.Box.id.split(/_/)[1];
						
					new Ajax('/plugin/de.newmedia-tech/ajax/module/save-configs.php', {
						postBody: 'Module=' + ID + '&Configs=' + Json.toString(Send)
					}).request();
					

					var SettingPane = $$('#' + this.Box.id + ' .settingPane');
					SettingPane = SettingPane[0];
					this.ConfigIcon.doClose(SettingPane);
					this.Box.refresh();
					
					return false;
				}
			}
		}

		if (!Box.hasClass('open'))
		{
			console.log('Should be closed');
			var fxClose = new Fx.Style(Box.Content, 'height', {duration:100});
			fxClose.start(0);
		}
		
		
		Box.SlideFx = new Fx.Style(Box.Content, 'height', {duration:800, transition: Fx.Transitions.Bounce.easeOut});
		Box.doOpen = function(Force)
		{
			if (this.hasClass('close') || Force)
			{
				if (this.hasClass('close'))
				{
					this.toggleClass('open');
					this.toggleClass('close');
				}
				
				this.style.overflow = 'hidden';
				this.SlideFx.stop();
				this.SlideFx.start(this.Content.scrollHeight);
				
				var ID = this.id.split(/_/)[1];
				
				new Ajax('/plugin/de.newmedia-tech/ajax/module/notify-openclose.php', {
					postBody: 'openedModule=' + ID
				}).request();
			}
		};
		
		Box.doClose = function()
		{
			if (this.hasClass('open'))
			{
				this.toggleClass('open');
				this.toggleClass('close');
				
				this.SlideFx.stop();
				this.SlideFx.start(0);
				
				var ID = this.id.split(/_/)[1];
				
				new Ajax('/plugin/de.newmedia-tech/ajax/module/notify-openclose.php', {
					postBody: 'closedModule=' + ID
				}).request();
			}
		};
		
		Box.toggleMe = function()
		{
			if (this.hasClass('open'))
			{
				this.doClose();
			}
			else
			{
				this.doOpen();
			}
		}
		
		
		Head.setStyle('cursor', 'pointer');
		Head.onclick = Box.toggleMe.bind(Box);
	}
};

NMT.Editor ={
	appendText: function(str)
	{
		var theBody = $('wysiwygmessage').contentWindow.document.body;
		theBody.innerHTML += str;
	}
}



window.addEvent('domready', function()
{
	
	if (Probe = $('instant_messanger'))
	{
//		,
//			overflown : [Probe.getElement('img.closer')]
		Probe.makeDraggable({
			handle: Probe.getElement('h2')
		});
		Probe.getElement('h2').setStyle('cursor', 'move');
		
		Probe.getElement('img.closer').setStyles({
			'cursor': 'pointer',
			'z-index': '100'
		});
		Probe.getElement('img.closer').addEvent('click', function(event)
		{
			event = new Event(event);
			event.stopPropagation();
			this.setStyle('display', 'none');
		}.bind(Probe))
	}
	
	var Tips2 = new Tips($$('.tip'), {
		initialize:function(){
			this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
		},
		onShow: function(toolTip) {
			this.fx.start(1);
		},
		onHide: function(toolTip) {
			this.fx.start(0);
		}
	})
	
	if (true == NMT.NotifyUse && $('wrapper'))
	{
		new NMT.Notify();
	}
	
	$$('.togglebox').each(function(el)
	{
		new NMT.ToggleBox(el);
	});
	
	
	
	
	
	
	
	
	
	$$('input.error, textarea.error').each(function(el)
	{
		el.addEvent('keyup', function()
		{
			this.removeClass('error');
			this.removeEvent('keyup');
		});
	});
	
	$$('select.error').each(function(el)
	{
		el.addEvent('change', function()
		{
			this.removeClass('error');
			this.removeEvent('change');
		});
	});
	
	
	
	
	$$('.togglepane_trigger').each(function(el)
	{
		console.log(el);
		console.log(el.id.replace(/toggle_/, 'togglepane_'));
		var TogglePane = $(el.id.replace(/toggle_/, 'togglepane_'));
		el.$tmp.TogglePane = TogglePane;
		
		el.$tmp.Slider = new Fx.Slide(TogglePane, {
			duration: 500
			,onComplete: function()
			{
				this.$tmp.Scroller.toElement(this.$tmp.TogglePane);
			}.bind(el)
		});
		el.$tmp.Scroller = new Fx.Scroll(window);
		el.$tmp.Slider.hide();
		
//		el.$tmp.Slider = new Fx.Styles(TogglePane, {
//			 duration: 500
//			,onComplete: function()
//			{
////				this.setStyles({
////					overflow: 'show'
////				});
//			}.bind(TogglePane)
//		});
//		
//		el.$tmp.Slider.set({
//			 height: 0
//			,opacity: 0
//			,overflow: 'hidden'
//		});
		
		Hider = el.$tmp.Hider = el.getElement('.hide');
		Screener = el.$tmp.Screener = el.getElement('.show');
		
		Screener.setStyle('cursor', 'pointer');
		Hider.setStyle('cursor', 'pointer');
		Hider.setStyle('display', 'none');
		
		Screener.addEvent('click', function()
		{
			this.$tmp.Slider.stop().slideIn();


//			this.$tmp.TogglePane.setStyles({
//				overflow: 'hidden'
//			});
//			
//			this.$tmp.Slider.start({
//				opacity: 1
//				,height: this.$tmp.TogglePane.scrollHeight
//			});

			this.$tmp.Hider.setStyle('display', 'block');
			this.$tmp.Screener.setStyle('display', 'none');
		}.bind(el));
		
		Hider.addEvent('click', function()
		{
			this.$tmp.Slider.stop().slideOut();

//			this.$tmp.Slider.set({
//				overflow: 'hidden'
//			});
//			
//			el.$tmp.Slider.start({
//				opacity: 0
//				,height: 0
//			});
			
			el.$tmp.Hider.setStyle('display', 'none');
			el.$tmp.Screener.setStyle('display', 'block');
		}.bind(el));
	});
//		startClock();
});