﻿/*.....funktion für Suckerfish-menu.........*/
			function sfHover() {
					$("#mainnavi li").hover(
					function(){
						$(this).addClass('sfhover');
						$(this).find('a:first').addClass('sfhovera');
					},
					function(){
						$(this).removeClass('sfhover');
						$(this).find('a:first').removeClass('sfhovera');
					})
				
			}
						/*sfHover = function() {
				var sfEls = document.getElementById("mainnavi").getElementsByTagName("LI");
				for (var i=0; i<sfEls.length; i++) {
					sfEls[i].onmouseover=function() {
						this.className+=" sfhover";
					}
					sfEls[i].onmouseout=function() {
						this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
					}
				}
			}*/			
			
function motivbildBig(el){
	var url = $(el).attr('href').split('/');
	if($(el).hasClass('current')){}else{
	$picname = url[url.length-1];
	desc ='';
	titles=$(el).attr('title').split(' - ');
	var html=	'<h2>&bdquo;'+titles[0]+'&rdquo;</h2>';
		html+=	'<h3>Kunde: '+titles[1]+'</h3>';
		html+=	'<div class="picmiddle"><img src="files/d_'+$picname+'" style="position:absolute;" alt="'+$(el).attr('title')+'" class="hidden" title="'+$(el).attr('title')+'" /><img src="./index.php?rex_resize=190w__'+$picname+'" alt="'+$(el).attr('title')+'" title="'+$(el).attr('title')+'" /></div>';
		html+= '<br /><div style="text-align:center" class="toolbox"><a href="files/'+$picname+'" title="'+$(el).attr('title')+'" class="lightbox nobg" target="_blank"><img src="files/images/icon-lupe.gif" title="größere Ansicht" alt="vergrößerte Ansicht" /></a><a href="http://api.addthis.com/oexchange/0.8/forward/email/offer?url=http://relaxmaxx.com/" class="addthis_button_email nobg iframe" title="per E-Mail weiterempfehlen"><img src="files/images/icon-mail.gif" alt="per E-Mail weiterempfehlen" /></a></div>';
		$('#Motiv').html(html);
	$.post("/yourdesign+liegestuehle/motivgalerie+referenzen/ansicht+holen.html?&picname="+$picname,function(data) {
		$('#Motiv').append('<p>'+data+'</p>');
		$("a.lightbox").colorbox({transition:"fade",current:'',previous:'zurück',next:'vor',close:'schließen'});
		$("a.iframe").colorbox({transition:"fade",iframe:true, innerWidth:480, innerHeight:570,scrolling:false,close:'schließen'});
		//$.getScript("http://s7.addthis.com/js/250/addthis_widget.js#pub=phillspider");
		//addthis.toolbox('.toolbox');
		});
		
	
	$(el).parent().parent().find('.current').removeClass('current');
	$(el).addClass('current');
	}
	
	
	$('.picmiddle').hover(function(){$(this).find('img:first').show()},function(){$(this).find('img:first').hide()});
	
}
/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.imagePreview = function(){	
	/* CONFIG */
		
		xOffset = 100;
		yOffset = 60;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		//$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");	
		$("body").append("<p id='preview'><img src='"+ this.rel +"' alt='Image preview' /></p>");		
		$("#preview")
			.css("top",(e.pageY + xOffset) + "px")
			.css("left",(e.pageX - (345-yOffset)) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX - (345+yOffset)) + "px");
	});			
};
//...........................................................
$(document).ready(function(){
//headertext
$("#mainnavi li").hover(
function(){
if($(this).find('.head a:first').hasClass('current')||$(this).find('.head a:first').hasClass('sfhovera')){

}else{
$(this).find('.head a:first').find('img:last').removeClass('hidden');
	$(this).find('.head a:first').find('img:first').addClass('hidden');

	
}
	},
function(){
	if($(this).find('.head a:first').hasClass('current')){	}else{
	$(this).find('.head a:first').find('img:first').removeClass('hidden');
	$(this).find('.head a:first').find('img:last').addClass('hidden');

}
});
$('.navi').fadeIn('500');
/* menu-suckerfish*/
sfHover();
$('#headertextcontainer').css({'margin-top':'-500px'}).animate({'opacity':.6,'marginTop':'50px'},900).animate({'opacity':1,'marginTop':'0px'},1000,function(){

});



/* input animation */
$('.weitergreen input[type=submit]').hover(
function(){
$(this).addClass('inputhover')},
function(){
$(this).removeClass('inputhover')
}
)
$('input:not(input[type=submit])').focus(function(){
$(this).css('background-color','#F4F8E6');
$(this).css('border-color','#003F1D');
}).blur(function(){
$(this).css('background-color','#fff');
$(this).css('border-color','#c5d882');

})
$('textarea').focus(function(){
$(this).css('background-color','#F4F8E6');
$(this).css('border-color','#003F1D');
}).blur(function(){
$(this).css('background-color','#fff');
$(this).css('border-color','#c5d882');

})
$('input[type=image]').hover(
function(){
var bildlink= $(this).attr('src');
var newlink = bildlink.replace('/btn_','/o_btn_');
$(this).attr('src',newlink);
},
function(){
var bildlink= $(this).attr('src');
var newlink = bildlink.replace('/o_btn_','/btn_');
$(this).attr('src',newlink);
}
)
/* news */
$(".hidden2").hide();

$('.weiter:not(.hidden)').fadeIn();


$(".more").click(function(){
	$(this).next().slideToggle();
	return false;
}).css({'cursor':'pointer','background':'url(\'files/images/pfeil_contenthead.gif\') no-repeat left 1px','padding-left':'23px'});	
$(".more2").click(function(){
	$('.m2').slideToggle();
	
})	

$(".weiter").click(function(){
	if($(this).hasClass('back')){
		$(this).parent().prev().slideUp(800);
		$(this).removeClass('back');
	}else{
		$(this).parent().prev().slideDown(200);
		$(this).addClass('back');
	}
	var title=$(this).text();
	$(this).text($(this).attr('rel'));
	$(this).attr('rel',title);
	return false;
});	

$('.picitem a').click(function(){
	motivbildBig(this);
	
	return false;
})
imagePreview();
$("a.lightbox").colorbox({transition:"fade",current:'',previous:'zurück',next:'vor',close:'schließen'});
$('.img').hover(
	function(){
		$('.hidden',this).show();
		$('.show',this).hide();},
	function(){
		$('.hidden',this).hide();
		$('.show',this).show();
		});
	
 $(".datumformat").mask("99.99.9999");
 $(".nexthide").change(function(){
	value = $(this).find('option:selected').attr('value');
	if(value=='nein')$(this).next().show();else $(this).next().hide();
 })
 $(".nexthide").next().hide();
 
 $(".kachel").hover(function(){
 $(this).addClass('kachelhover');
 },function(){
  $(this).removeClass('kachelhover');
 })
})
