jQuery(document).ready(function(){
	
	$.backstretch("fileadmin/grafik/20110517-BEHR-Web.jpg", {speed: 150});
	Shadowbox.init({
	    handleOversize: "resize",
	    modal: true
	});
	
	var searchdefault = $('.searchdefault').val();
	$('.searchinput input').DefaultValue(searchdefault);
	
	
	
	jQuery('ul.sf-menu').superfish({ 
	    delay:       800,
	    animation:   {height:'show'},
	    speed:       300,
	    autoArrows:  true	    
	});

	Cufon.replace('.leftcontentplacer h1', { fontFamily: 'Mister Spicy Dos' });
	Cufon.replace('.rightcontentplacer h1', { fontFamily: 'Mister Spicy Dos' });
	Cufon.replace('.contentplacer h1', { fontFamily: 'Mister Spicy Dos' });
	Cufon.replace('h1.spicy', { fontFamily: 'Mister Spicy Dos' });
	Cufon.replace('h1.small-spicy', { fontFamily: 'Mister Spicy Dos' });
	
	/*
	Cufon.CSS.ready(function() {
	  if($('.tx-behrproducts-pi9').length){
			var contHeight = $('.contentplacer').height();
			var leftHeight = $('.leftcontentplacer').height();
			if(contHeight > leftHeight){
				var marginTop = contHeight - leftHeight;
				$('.leftcontentitem:last').css({'padding-top' : marginTop+'px'});
			}
			
			
			//alert($('.contentplacer').height());
			//alert($('.leftcontentplacer').height());
			
			
		}
	});
	*/
	$('.tx-macinasearchbox-pi1 .searchsubmit').click(function() {
  		$('#searchform').submit();
	});
	
	$('.tx-indexedsearch-searchbox .searchsubmit').click(function() {
  		$('#tx_indexedsearch').submit();
	});
	

});



jQuery.fn.DefaultValue = function(text){
	return this.each(function(){		
		if(this.type != 'text' && this.type != 'password' && this.type != 'textarea')
			return;
		var fld_current=this;
    if(this.value=='') {
			this.value=text;
		} 
		else {
			return;
		}
		$(this).focus(function() {
			if(this.value==text || this.value=='')
				this.value='';
		});
		$(this).blur(function() {
			if(this.value==text || this.value=='')
				this.value=text;
		});
		$(this).parents("form").each(function() {	
			$(this).submit(function() {
				if(fld_current.value==text) {
					fld_current.value='';
				}
			});
		});
  });
};






