jQuery(document).ready(function(){
	input(4);
	noSpam();
});


function noSpam() {
    if (document.getElementById) {
		var at = "@";
	  	var links = document.getElementsByTagName('a');
	  
	  	for (var i = 0; i < links.length; i++) {
		  	var linkElem = links[i];
			
		  	if (linkElem.className == 'escape') {
		  		var mail = linkElem.firstChild; var domain = linkElem.lastChild;
		  		mail.nextSibling.firstChild.innerHTML = at;
		  		linkElem.href = "mailto:" + mail.data + at + domain.data;
		  	}
			
	  	} // End for
	  
    } // End if
}

function input(topValue){
	jQuery('input[type=password], input[type=text]').each(function(){
		var $this = jQuery(this);
		if($this.attr('alt') !== '' && jQuery.trim($this.attr('value')) === ''){
			$this.after('<span class="label">'+$this.attr('alt')+'</span>');
			var $label = $this.next('.label');
			$label.css({
				'color':'#aaa',
				'font-family':'Georgia, "Times New Roman", Times, serif',
				'font-style':'italic',
				'font-size':'11px',
				'padding':'10px',
				'position':'absolute',
				'top':$this.position().top-topValue,
				'left':$this.position().left,
				'text-shadow':'none'
			});
			if($this.attr('value') !== ''){
				$this.next('.label').hide();
			}
		}
	});
	
	jQuery('.label').click(function(){
		jQuery(this).hide();
		jQuery(this).prev('input').focus();
	});
	
	jQuery('input[type=password], input[type=text]').focus(function(){
		if(jQuery(this).attr('alt') !== ''){
			jQuery(this).next('.label').hide();
		}
	});
	
	jQuery('input[type=password], input[type=text]').blur(function(){
		if(jQuery(this).attr('alt') !== '' && jQuery(this).attr('value') === ''){
			jQuery(this).next('.label').show();
		}
	});
}

jQuery(document).ready(function(){
	jQuery('#contentContainer img').hover(function(){
		jQuery(this).stop(true, true);
		jQuery(this).fadeTo(200, 0.7);
	},function(){
		jQuery(this).stop(true, true);
		jQuery(this).fadeTo(200, 1);
	});

});

jQuery(document).ready(function(){
	jQuery('ul#navi li.leistungen').hover(function(){
		jQuery('ul#naviSub').stop(true, true);
		jQuery('ul#naviSub').fadeIn(200);
	
	},function(){
		jQuery('ul#naviSub').stop(true, true);
		jQuery('ul#naviSub').fadeOut(200);
	
	});								
});
