  /**
   * dispatcher.js   dispatch div-layers
   *
   *  DON'T FORGET var IN IE!  - NEVER!
   */

  // detect iPhone client
  if (navigator.userAgent.indexOf('iPhone') != -1) {
    $('css_screen').writeAttribute('href', 'stylesheets/iphone.css');
  }

	var active_pane = 'about';
  var C = new Array ('dynamic_hide', 'dynamic_show');
  var I = new Array ('image', 'active');
	var langs = new Array ('de', 'en');
  var ITEMS = new Array (
			'about', 'development', 'design', 'photography', 'hosting', 'ror'
//			'about_en', 'development_en', 'design_en', 'photography_en', 'hosting_en', 'ror_en',
//			'about_de', 'development_de', 'design_de', 'photography_de', 'hosting_de', 'ror_de'
			);

  function alerto(msg) {
    $('msg').innerHTML = $('msg').innerHTML + "<br/>" + msg;
  }

  function nav(target) {    
		window.active_pane = target;
		hide_em();
		turn(target + '_' + window.lang, 1);
		bt_dispatch(target, 1);
		return true;
  }

	function hide_em() {
		if (a = $$('#content div.dynamic_show')[0])
			a.writeAttribute('class','dynamic_hide');
		if (a = $$('#navigation li div.active')[0])
			a.writeAttribute('class','image');
	}
	
	// set lang
	function sl(l) {
		window.lang = l;
		nav(window.active_pane);				
	}

function bt_dispatch(id, state) {
	var button = null;
	var bt_child = null;
//	var target = id.replace(/_[^_]*$/,'');
	var target = id;
	if (button = $('nav_' + target))
		if (bt_child = button.childElements()[0])
			set_bt(bt_child, state);
}

function set_bt(button, state) {
	var cl = 'image';
	if (state == 1)
		cl = 'active';
	button.writeAttribute('class',cl);
}

function turn(element,state) {
	element = $(element);
  element.writeAttribute('class',C[state]);
//	alerto(element.id + state);
  if (state == 1) {
    element.writeAttribute('style', 'display:none;');
    Effect.SlideDown(element, {duration: 0.13});
    }
}

