window.addEvent('domready', function() {


// Inputs
	if($('persoenliche_angaben') || $('login227')){ // select für Personal Data Seite
		$$('input[type=text]').each(function(item) { // array all inputs
		item.addEvents({ 'click': function() { this.select(); } });
		});
	}else{
	if(document.getElementById('f2') || document.getElementById('f1')){ 
		$$('input[type=text]').each(function(item) { // array all inputs
 	 	var save = item.value;
		item.addEvents({ 'focus': function() { if(this.value == save) this.value = '' ; this.setStyle('color','#ff0000'); } });
		item.addEvents({ 'blur': function() { if(item == $('ctrl_2')){ if(this.value=='') this.value = save }; this.setStyle('color','#666666'); } });
		});
	}
}
// Textarea
	if(document.getElementById('f1')){ 
	$$('textarea').each(function(item) { // array all inputs
 	 	var save = item.value;
		item.addEvents({ 'focus': function() { if(this.value == save) this.value = ''; this.setStyle('color','#ff0000'); } });
		item.addEvents({ 'blur': function() { if(this.value=='') this.value = save; this.setStyle('color','#666666'); } });
 	});
	}
// Räume
if(document.getElementById('mieter-atelierhaus')){
	$$('div.toggler').each(function(item) { // array all toggler
		item.addEvents({ 'mouseenter': function() { this.setStyle('color','#ff0000'); this.setStyle('cursor','pointer'); } });
		item.addEvents({ 'mouseleave': function() { this.setStyle('color','#666666'); } });
 	});
	$$('div.toggle_2').each(function(item) { // array all toggler
		item.addEvents({ 'mouseenter': function() { this.setStyle('border-bottom','4px solid #ff0000'); this.setStyle('cursor','pointer'); } });
		item.addEvents({ 'mouseleave': function() { this.setStyle('border-bottom','0px solid #ffffff'); } });
 	});
}


if(document.getElementById('f1')){
		$('ctrl_7').addEvents({ 'mouseenter': function() { this.setStyle('color','#ff0000'); this.setStyle('cursor','pointer'); } });
		$('ctrl_7').addEvents({ 'mouseleave': function() { this.setStyle('color','#666666'); } });
}

if(document.getElementById('mietersearch')){
		$('submit_mietersearch').addEvents({ 'mouseenter': function() { this.setStyle('color','#ff0000'); this.setStyle('cursor','pointer'); } });
		$('submit_mietersearch').addEvents({ 'mouseleave': function() { this.setStyle('color','#666666'); } });
}

// noobslide
              var references = document.getElementById("random_references_box");
                  if(references != null) {
                      var nS4 = new noobSlide({
			box: $('random_references_box'),
			items: $$('#random_references_box span'),
			size: 150,
			autoPlay: true,
			mode:'vertical'
		   });
                  }
// Projektbox
              var references = document.getElementById("p_box");
                  if(references != null) {
                      var nS4 = new noobSlide({
			box: $('p_box'),
			items: $$('#p_box div'),
			size: 140,
			autoPlay: true,
			mode:'vertical'
		   });
                  }
                  
});

// Ajax Box
function see(was,weg){
var wohin = 'loadcontent';
var bck = 'bck';

// reset nach erstem Wechsel
			$(wohin).setStyle('display','');		
			$(bck).setStyle('display','');		

		//We can use one Request object many times.
		var req = new Request.HTML({url:was, 
		onRequest: function() {  $(wohin).set('html', '<strong style="color:red;" >loading..</strong><br/><br/>'); },
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$(wohin).set('text', '');
			$(wohin).setStyle('background-image', 'none');
			$(wohin).setStyle('padding-left', '0');
			$(weg).setStyle('display','none');
			//Inject the new DOM elements into the results div.
			$(wohin).adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$(wohin).set('html', '<strong>Anfrage ohne Erfolg.</strong><br/><br/>');
		}
	});
return req.send();
}

function allbck(){
var wohin = 'loadcontent';
			$(wohin).set('text', '');
			$(wohin).setStyle('display','none');		
			$(wohin).setStyle('background-image', 'url(tl_files/WESTWERK/Layout/loading.gif)');
			$(wohin).setStyle('padding-left', '45px');
			$('bck').setStyle('display','none');		

	$$('div.ce_accordion div').each(function(item) { // array all toggler
	item.setStyle('display','');
 	});
// reset Cookie
var handle = Cookie.read('bck');
if(handle) Cookie.dispose('bck');
}

// set Back Cookie
function cset(v){
		var bckCookie = Cookie.write('bck',v);
}




