/*

Ajax.Responders.register({
	onCreate: function() {
		if(Ajax.activeRequestCount > 0)
		{
			if($('ajax_indicator'))
				Effect.Appear('ajax_indicator',{duration: 0.25, queue: 'end'});

			//if ($('ajax_status'))
			//	$('ajax_status').className='loading';
		}
	},
	onComplete: function() {
		if(Ajax.activeRequestCount == 0)
		{
			if($('ajax_indicator'))
				Effect.Fade('ajax_indicator',{duration: 0.25, queue: 'end'});

			if ($('ajax_status'))
				$('ajax_status').className='';
		}
	}
});
*/

function references_load(ref_id){

			new Ajax.Updater('ref_out','/v2/ajax.php?jump=referenzen',
			{
				method:'post',
				parameters: 'ref_id='+ref_id,
				evalScripts: true,
				onFailure: function()
				{
					alert('ajax failed');
				}
			});
}


// Menu System

submenu_timeout = false;

function submenu_mouseover(id)
{
  window.clearTimeout(submenu_timeout);
  $$("div.submenu").each(function(my_element){
      Element.hide(my_element);
  });

  $$("div.navigation_top a").each(function(my_element){
      Element.removeClassName(my_element,'selected');
  });
  Element.addClassName($('menu_'+id),'selected'); /*,'selected');*/

  Element.show($('submenu_'+id)); /*,'selected');*/
}

function submenu_mouseout()
{
  window.clearTimeout(submenu_timeout);
  submenu_timeout=window.setTimeout("submenu_reset()",1000);
}

function submenu_reset()
{
   $$("div.submenu").each(function(my_element){
      Element.hide(my_element);
  });

  $$("div.navigation_top a").each(function(my_element){
      Element.removeClassName(my_element,'selected');
  });

  $$("div.submenu.current").each(function(my_element){
       Element.addClassName(my_element,'selected');
        Element.show(my_element);
  });

  $$("div.navigation_top a.current").each(function(my_element){
      Element.addClassName(my_element,'selected');
  });
}

// Network Map

function display_dot_details(dot,event)
{
	domTT_activate(dot, event, 'caption',dot.getAttribute('label'),'content', dot.getAttribute('content'), 'trail', true, 'delay', 0, 'fade', 'in');
  if (zoom_map_active)
    display_zoom_map();
}

function open_dot_url(dot)
{
	document.location = dot.getAttribute('url');
}

zoom_map = false;
zoom_map_active=false;

function display_zoom_map()
{
  // Display Zoom Map
  window.clearTimeout(zoom_map);
  zoom_map_active=true;
  $$("div#network_map .zoom_map").each(function(my_element){
        Element.show(my_element);
  });
  $$("div#network_map .unzoom").each(function(my_element){
        Element.hide(my_element);
  });
}

function hide_zoom_map()
{
  // Display Zoom Map
  window.clearTimeout(zoom_map);
  zoom_map=window.setTimeout("reset_zoom_map()",300);
}

function reset_zoom_map()
{
 $$("div#network_map .zoom_map").each(function(my_element){
        Element.hide(my_element);
  });
  $$("div#network_map .unzoom").each(function(my_element){
        Element.show(my_element);
  });
  zoom_map_active=false;
}

// Newsletter View
function show_nl(url)
{
   fenster = window.open(url, "cb_newsletter", "width=690,height=550,status=false,scrollbars=yes,resizable=yes");
 	 fenster.focus();
}

function image_swap()
{
  $$("img.swap_image").each(function(my_element){
		new imageswapper(my_element);
	}
 );
}

var imageswapper= Class.create();
imageswapper.prototype = {
	initialize:function(image_obj)
	{
		this.image = image_obj;
		this.src = this.image.src;
		this.swapsrc = this.image.src.replace(/_on/,'_off');
		this.tmp_image = new Image();
    this.tmp_image.src = this.swapsrc;
		this.image.onmouseover = this.swap.bindAsEventListener(this);
		this.image.onmouseout = this.reset_swap.bindAsEventListener(this);
	},
	swap:function()
	{
		this.image.src = this.swapsrc;
	},
	reset_swap:function()
	{
		this.image.src = this.src;
	}
}
