
/*startpage*/

HugoBoss.startpage = {

    //initialize startpage 
    init: function(){
    
        HugoBoss.startpage.events.init();
        HugoBoss.startpage.utils.fadeFooter(0);
        HugoBoss.startpage.specials.hugoFashionshow();
        
    },
    
    specials: {
    
        hugoFashionshow: function(){
		
			if ($('#overlay').length !== 0) {
				setTimeout(function(){
				
					$('#overlay').animate({
						opacity: 0
					}, {
						duration: 500,
						complete: function(){
							$('#overlay').remove();
						}
					});
					
				}, 3000)
				
			}
			
		}
        
    },
    
    events: {
    
        init: function(){
        
            var height = $('#footer').height() - 51;
            
            $('#abdeckerFooter').css({
                height: height + 'px',
                opacity: 0.7
            });
            
            $('#onlineStoreTeaser .teaser1usa').hoverIntent(function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserEnter(on, off);
                
                
            }, function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserLeave(on, off);
                
            });
            
            $('#onlineStoreTeaser .teaser1').hoverIntent(function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserEnter(on, off);
                
                
            }, function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserLeave(on, off);
                
            });
            
            $('#onlineStoreTeaser .teaser2').hoverIntent(function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserEnter(on, off);
                
                
            }, function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserLeave(on, off);
                
            });
            
            $('#onlineStoreTeaser .teaser3').hoverIntent(function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserEnter(on, off);
                
                
            }, function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserLeave(on, off);
                
            });
            
            $('#onlineStoreTeaser .teaser4').hoverIntent(function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserEnter(on, off);
                
                
            }, function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserLeave(on, off);
                
            });
            
            $('#onlineStoreTeaser .teaser4usa').hoverIntent(function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserEnter(on, off);
                
                
            }, function(){
            
                var on = $(this).children('.on');
                var off = $(this).children('.off');
                HugoBoss.startpage.utils.onlineStoreTeaserLeave(on, off);
                
            });
            
            $('#lifestyleTeaser .teaser1').hoverIntent(function(){
            
                var on = $(this).children('.on');
                HugoBoss.startpage.utils.livestyleTeaserEnter(on);
                
                
            }, function(){
            
                var on = $(this).children('.on');
                HugoBoss.startpage.utils.livestyleTeaserLeave(on);
                
            });
            
            $('#lifestyleTeaser .teaser2').hoverIntent(function(){
            
                var on = $(this).children('.on');
                HugoBoss.startpage.utils.livestyleTeaserEnter(on);
                
                
            }, function(){
            
                var on = $(this).children('.on');
                HugoBoss.startpage.utils.livestyleTeaserLeave(on);
                
            });
            
        }
        
    },
    
    utils: {
    	
    	getCurrentTime: function(){
    		return currentTime;
    	},
    
        livestyleTeaserEnter: function(on){
        
            if (HugoBoss.utils.browserAndVersion() === 'ie8' || HugoBoss.utils.browserAndVersion() === 'ie7') {
            
                on.stop().css({
                    display: 'block'
                });
                
            }
            else {
            
                on.stop().css({
                    opacity: 0,
                    display: 'block'
                }).animate({
                    opacity: 1
                }, {
                    duration: 300
                });
                
            }
            
        },
        
        livestyleTeaserLeave: function(on){
        
            if (HugoBoss.utils.browserAndVersion() === 'ie8' || HugoBoss.utils.browserAndVersion() === 'ie7') {
            
                on.stop().css({
                    display: 'none'
                });
                
            }
            else {
            
                on.stop().css({
                    opacity: 1,
                    display: 'block'
                }).animate({
                    opacity: 0
                }, {
                    duration: 150
                });
                
            }
            
        },
        
        onlineStoreTeaserEnter: function(on, off){
        
            if (HugoBoss.utils.browserAndVersion() === 'ie8' || HugoBoss.utils.browserAndVersion() === 'ie7') {
            
                off.css({
                    display: 'none'
                });
                
                on.css({
                    display: 'block'
                });
                
            }
            else {
            
                on.stop();
                off.stop();
                
                off.animate({
                    opacity: 0
                }, {
                    duration: 200,
                    complete: function(){
                    
                        off.css({
                            display: 'none'
                        });
                        
                        on.css({
                            opacity: 0,
                            display: 'block'
                        }).animate({
                            opacity: 1
                        }, {
                            duration: 100
                        });
                        
                    }
                    
                });
                
            }
            
        },
        
        onlineStoreTeaserLeave: function(on, off){
        
            if (HugoBoss.utils.browserAndVersion() === 'ie8' || HugoBoss.utils.browserAndVersion() === 'ie7') {
            
                off.css({
                    display: 'block'
                });
                
                on.css({
                    display: 'none'
                });
                
            }
            else {
            
                on.stop();
                off.stop();
                
                on.animate({
                    opacity: 0
                }, {
                    duration: 200,
                    complete: function(){
                    
                        on.css({
                            display: 'none'
                        });
                        
                        off.css({
                            opacity: 0,
                            display: 'block'
                        }).animate({
                            opacity: 1
                        }, {
                            duration: 100
                        });
                        
                    }
                    
                });
                
            }
            
        },
        changeStartBgColor: function(param){
			$('#outerWrapper').animate({backgroundColor:'#' + param});			
			$('#footerNav').css({backgroundColor:'#' + param});
			$('body').css({backgroundColor:'#' + param});
			$('#abdeckerFooter').css({backgroundColor:'#' + param});	
					
		},
		animateStartBgColor: function(param){
			
			switch (param) {
				case'000000':
							$('#footer h1').animate({
								color: "#ffffff"
							}, 250 );
							break;
				case'ffffff':
							$('#footer h1').animate({
								color: "#000000"
							}, 250 );
							break;
			}
			
			switch (param) {
				case'000000':
							$('#footerNewsletter  #newsletterInput').animate({
								color: "#000000"
							}, 250 );
							break;
				case'ffffff':
							$('#footerNewsletter  #newsletterInput').animate({
								color: "#666666"
							}, 250 );
							break;
			}
			
			$('#outerWrapper').animate({
					backgroundColor: "#" + param
				}, 250 );
			$('body').animate({
					backgroundColor: "#" + param
				}, 250 );
			$('#footerNav').animate({
					backgroundColor: "#" + param
				}, 250 );
			$('#abdeckerFooter').animate({
					backgroundColor: "#" + param
				}, 250 );
		},
        footerFadeIn: function(){
        
            var target = $('#abdeckerFooter');
            
            target.stop().animate({
                opacity: 0
            }, {
                duration: 400,
                complete: function(){
                
                    target.css({
                        display: 'none'
                    });
                    
                }
                
            });
            
        },
        
        footerFadeOut: function(){
        
            var target = $('#abdeckerFooter');
            
            target.stop().css({
                display: 'block'
            }).animate({
                opacity: 0.7
            }, {
                duration: 400
            
            });
            
        },
        
        fadeFooter: function(offsetContentY){
        
            if (offsetContentY < -300) {
            
                HugoBoss.startpage.utils.footerFadeIn();
                HugoBoss.startpage.utils.footerScroll = true;
                
            }
            else {
            
                $('#footer').hoverIntent(function(){
                
                    HugoBoss.startpage.utils.footerFadeIn();
                    HugoBoss.startpage.utils.footerHover = true;
                    
                }, function(){
                
                    HugoBoss.startpage.utils.footerHover = false;
                    
                    if (!HugoBoss.startpage.utils.footerScroll) {
                        HugoBoss.startpage.utils.footerFadeOut();
                    }
                    
                });
                
                HugoBoss.startpage.utils.footerScroll = false;
                
                if (!HugoBoss.startpage.utils.footerHover) {
                    HugoBoss.startpage.utils.footerFadeOut();
                }
                
            }
            
        }
        
    }

};


//initialize all
$(document).ready(function(){

    HugoBoss.startpage.init();
});

