if(!doc) var doc = document; if(!win) var win = window;

/*--- cufon ---*/

Cufon.replace('h2,h3,#navi',{ fontFamily: 'CoolblueSecondSmall' , hover:'true'});

/*--- START FUNCTIONS ---*/

jQuery(doc).ready(function() {

/*--- settings fancybox ---*/

jQuery("a[class=zoom]").fancybox({
	'transitionIn'		: 'none',
	'transitionOut'		: 'none',
	'titlePosition' 	: 'over',
	'overlayOpacity'	:	0.4,
	'overlayColor': '#000000',
	'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
		return '<span id="fancybox-title-over">Bild ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
	}
});
jQuery("a.iframe").fancybox({
	'easingIn, easingOut': true,
	'width':700,
	'height':480,
	'overlayOpacity':0.4,
	'overlayColor': '#000000'
});
	noSpam();
});

/*--- to encrypt e-mail address ---*/
	
function noSpam() {
   
	if (doc.getElementById) {
		var at = "@";
	  	var links = doc.getElementsByTagName('a');
	  
	  	for (var i = 0; i < links.length; i++) {
		  	var linkElem = links[i];
			
		  	if (linkElem.className == 'email') {
		  		var mail = linkElem.firstChild; var domain = linkElem.lastChild;
		  		mail.nextSibling.firstChild.innerHTML = at;
		  		linkElem.href = "mailto:" + mail.data + at + domain.data;
		  	}
			
	  	} 
	  
    } 		
}

/*--- smooth-menu ---*/

/*$(doc).ready(function() {
	$("ul#navi li.haarstudio, ul#navi li.fingernagelstudio").mouseover(function(){ //When mouse over ...
    //Following event is applied to the subnav itself (making height of subnav 60px)
	$(this).find('ul.sub, ul.sub2').stop().animate({height: '122px', opacity:'1'},{queue:false, duration:1500, easing: 'easeOutElastic'})
});

$("ul#navi li.haarstudio, ul#navi li.fingernagelstudio").mouseout(function(){ //When mouse out ...
	//Following event is applied to the subnav itself (making height of subnav 0px)
	$(this).find('ul.sub, ul.sub2').stop().animate({height:'0px', opacity:'0'},{queue:false, duration:1600, easing: 'easeOutElastic'})
});

//menu itembackground color animation			
$("ul.sub li, ul.sub2 li").hover(function() {
	$(this).stop().animate({ backgroundColor: ""}, 600);},
    	function() {
    $(this).stop().animate({ backgroundColor: "" }, 600);
  	});	
});*/

/*--- smooth scroll ---*/
	 
$(function(){	    $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
				if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 800);
                return false;
            }
	        }
});
});

/*--- newsletter e-mail replace ---*/

$.fn.inputFill=function(settings){
	settings=$.extend({content:'Ihre E-Mail Adresse'},settings);
	return this.each(function(){
		var el=$(this);
		el.attr('value',settings.content).click(function(){
			if($(this).attr('value')==settings.content)$(this).attr('value','');
		}).blur(function(){
			if($(this).attr('value')=='')$(this).attr('value',settings.content);
		});
	});
};

$(function(){	    $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
				if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 800);
                return false;
            }
	        }
});
});
