initializeWindows = function(){

  //Events fuer Links
  //Startseite
  $('HomeLink').addEvent('click', function(e){
		MochaUI.updateContent({
			'element': $('mainPanel'),
			'loadMethod': 'iframe',
			'url': 'php/page.php?mode=page&path=startseite',
			'title': 'Startseite'
		});
		//$('mainPanel').setStyle('background','#F8F8F8');
		$('mainPanel').setStyle('background','#D0D3F9');
	});

  //Firmenprofil
  $('ProfilLink').addEvent('click', function(e){
		MochaUI.updateContent({
			'element': $('mainPanel'),
			'loadMethod': 'iframe',
			'url': 'php/page.php?mode=page&path=firmenprofil',
			'title': 'Firmenprofil'
		});
		$('mainPanel').setStyle('background','#D0D3F9');
	});

  //Chronik
  $('ChronikLink').addEvent('click', function(e){
		MochaUI.updateContent({
			'element': $('mainPanel'),
			'loadMethod': 'iframe',
			'url': 'php/page.php?mode=page&path=chronik',
			'title': 'Chronik'
		});
		$('mainPanel').setStyle('background','#D0D3F9');
	});

  //Leistungen
  $('LeistungLink').addEvent('click', function(e){
		MochaUI.updateContent({
			'element': $('mainPanel'),
			'loadMethod': 'iframe',
			'url': 'php/page.php?mode=page&path=leistungen',
			'title': 'Leistungen'
		});
		$('mainPanel').setStyle('background','#D0D3F9');
	});
	
  //Referenzen
  $('ReferenzLink').addEvent('click', function(e){
		MochaUI.updateContent({
			'element': $('mainPanel'),
			'loadMethod': 'iframe',
			'url': 'php/page.php?mode=page&path=referenzen',
			'title': 'Referenzen'
		});
		$('mainPanel').setStyle('background','#D0D3F9');
	});

  //Galerie
  $('GalerieLink').addEvent('click', function(e){
		MochaUI.updateContent({
			'element': $('mainPanel'),
			'loadMethod': 'iframe',
			'url': 'galerie/galerie.html',
			'title': 'Galerie'
		});
		$('mainPanel').setStyle('background','#D0D3F9');
	});

  //Kontakt
  $('KontaktLink').addEvent('click', function(e){
		MochaUI.updateContent({
			'element': $('mainPanel'),
			'loadMethod': 'iframe',
			'url': 'php/page.php?mode=page&path=kontakt',
			'title': 'Kontakt'
		});
		$('mainPanel').setStyle('background','#D0D3F9');
	});

  //Impressum
  $('ImpressumLink').addEvent('click', function(e){
		MochaUI.updateContent({
			'element': $('mainPanel'),
			'loadMethod': 'iframe',
			'url': 'php/page.php?mode=page&path=impressum',
			'title': 'Impressum'
		});
		$('mainPanel').setStyle('background','#D0D3F9');
	});

  //Besucherzaehler
  var CounterWindow = function(){
      new MochaUI.Window({
          id: 'CounterWnd',
          title: 'Besucher',
          loadMethod: 'xhr',
          contentURL: 'php/counter.php',
          resizable: false,
          maximizable: false,
          width: 300,
          height: 100
      });
  }
  
  if ($('Counter')){
    $('Counter').addEvent('click', function(e) {
        new Event(e).stop();
        CounterWindow();
    });
  }


	//Menue-Links deaktivieren
	$$('a.returnFalse').each(function(el){
	 el.addEvents({
    'click': function(e){
    	new Event(e).stop();
    }
	 });
  });
}

// Initialize MochaUI when the DOM is ready
window.addEvent('domready', function(){

	MochaUI.Desktop = new MochaUI.Desktop();
	//MochaUI.Dock = new MochaUI.Dock();

	/* Create Columns
	 
	If you are not using panels then these columns are not required.
	If you do use panels, the main column is required. The side columns are optional.
	Create your columns from left to right. Then create your panels from top to bottom,
	left to right. New Panels are inserted at the bottom of their column.

	*/	

	new MochaUI.Column({
		id: 'mainColumn',
		placement: 'main',	
		width: null,
		resizeLimit: [100, 300]
	});

	// Add panels to main column
	new MochaUI.Panel({
		id: 'mainPanel',
		title: 'Startseite',
		loadMethod: 'iframe',
		contentURL: 'php/page.php?mode=page&path=startseite',
		column: 'mainColumn'
	});
		
	MochaUI.Modal = new MochaUI.Modal();
	
	MochaUI.Desktop.desktop.setStyles({
		'background': '#fff',
		'visibility': 'visible'
	});
	initializeWindows();

});


// This runs when a person leaves your page.
window.addEvent('unload', function(){
	if (MochaUI) MochaUI.garbageCleanUp();
});