  
	var locked = false;
  
  function lock()
  {
  	locked = true;
  }
  
  function unlock()
  {
  	locked = false;
  }
  
  function is_locked()
  {
  	return locked;	  	
  }
  
  function scroll_top()
	{	
		window.scrollTo(0, 0);
	}
	
	function reload()
	{
		location.reload();
	}
	
	function goto_login()
	{
		self.location.href= '/login/?action=redirect';
	}
	
	
	function pos_center_alt(element)
	{	
		if (self.pageYOffset) 
			yPos = self.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop)
			yPos = document.documentElement.scrollTop; 
		else if (document.body) 
			yPos = document.body.scrollTop;
	
		$(element).style.marginTop = yPos - 165 +"px"; 
		$(element).style.display = 'inline';
	}
	
	function pos_center(element, margin_top)
	{	
		if(margin_top === undefined)
			margin_top = 195;
		
		$(element).setStyle({position: 'absolute', top: document.viewport.getScrollOffsets().top + margin_top +'px' , left: '50%', marginLeft: - ($(element).getWidth() / 2) +'px'})
	}	
	
	function pos_center_new(element)
	{	
		if (self.pageYOffset) 
			yPos = self.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop)
			yPos = document.documentElement.scrollTop; 
		else if (document.body) 
			yPos = document.body.scrollTop;
	
		$(element).style.marginTop = yPos + 250 +"px"; 
		$(element).style.marginLeft = (($('main').getWidth() - $(element).getWidth()) / 2) + "px";
		$(element).style.display = 'inline';
		
		//$('main').makePositioned();
	}
	
	function show_loader()
	{
		$('ajaxbox_content').innerHTML = $('ajaxbox_emptyloader').innerHTML;
	}	
 		
	function set_ajaxcontent_delay(res, id)
	{
		if(id === undefined)
			id='ajaxbox_content';
		set_ajaxcontent.delay(0.75, res, id);
		return true;
	}
	
	
	function set_ajaxcontent(res, id)
	{
		if(id === undefined)
			id='ajaxbox_content';
		$(''+id).innerHTML = res.responseText;
	}
	
	function showToolTip(content, element, opacity, x, y)
  {
  	if(opacity === undefined)
			opacity = 0.85;
		if(x === undefined)
			x = 60;
		if(y === undefined)
			y = 0;
		
		$(content).setStyle({left:($(element).cumulativeOffset().left + x)+'px', top:$(element).cumulativeOffset().top+'px'});
		$(content).setOpacity(0.85);
		$(content).show();			
  } 
    
 	function show_confirmBox(title, question, action, abortaction)
 	{
 		$('ajaxbox_title').innerHTML = title;
 		$('ajaxbox_question').innerHTML = question;
 		$('ajaxbox_btn').onclick = action;
 		if(abortaction != undefined)
 			$('ajaxbox_abort').onclick = abortaction;
 		$('ajaxbox_confirm').show();
 		pos_center('ajaxbox_confirm'); 
 	}
 	
 	function change_invisibility() 
	{  
		if ( !is_locked() )
  	{
  		new Ajax.Request('/account/index.ajax.php', {parameters:{action:'change_invisiblestatus'}, onLoading: function() {if ($('inv_status').innerHTML == 'Sichtbar') {$('inv_status').innerHTML = 'Unsichtbar';} else  {$('inv_status').innerHTML = 'Sichtbar'; unlock();} } } );
 		}
	}