var dsj = dsj || {} ;

dsj = {
    
    
    /**
     *
     *
     *init function
     *
     *this function calls all other init function
     */
    
    init : function() {
	
	this.cufonInit()
	this.initHeaderAnimation();
	this.menuSeperator();
	
    },
    
    /**
     *
     * cufon init
     *
     * init the font files
     *
     *
     *
     */
    
    cufonInit : function(){	
	
	Cufon.replace('h6');
	Cufon.replace('h5');
	Cufon.replace('h4');
	Cufon.replace('h3');
	Cufon.replace('.jot-subject');
	
	
	Cufon.replace('p#day');
	Cufon.replace('p#month');
	Cufon.replace('p#year');
	
    },
    
    /**
     *
     *init header animation
     *
     */
    
    initHeaderAnimation: function () {
	
		var repeation = undefined;
	   
		if ($('.header-slider-wrapper').length > 0 ) {
		
			function slideImages() {
				
				var currentActive = $('.header-slider-wrapper .active');
			  
				var nextImage = currentActive.next('img')
			 
				if (nextImage.length == 0) {
					nextImage = $('.header-slider-wrapper img:eq(0)');
				} 
			  
				nextImage.show();
				
				currentActive.css({
					'position' : 'absolute',
					'z-Index' : 1,
					'top': 0,
					'left' : 0,
					'opactiy' : 1
					});
				
				currentActive.fadeOut(1000,function(){
				$(this).attr('style',"");
				$(this).hide().toggleClass('active');
				nextImage.toggleClass('active');
				});
	
			setTimeout(function(){slideImages();},5000);
			  
			}
			
			setTimeout(function(){slideImages();},5000);
			  
		}
	    
    },
	
    /**
     *
     * inits the rounded corner support for ie 6-8
     */
    initRoundedCorners : function () {
	    if($.browser.msie) {
		    $('div.box-corners').corner('10px');
		    $('div.content-box1').corner('10px');
	    }
    },
    
    
    menuSeperator : function () {

	$('div.sub-menu-top', "ul.menu-top").each(function(){
	  if($(this).find('p.l2').length > 0 ) {  
	    var _height =  $(this).height();
	    var _$sep = $('<img class="sep" src="/assets/templates/dsj/image/footer/trenner_white.png" />');
	    _$sep.position({of : this, my : "center top" , at : "center top", offset : "-10 10" }).css({'position' :'absolute', height: _height, width: "2px"});
	    $(this).append(_$sep)
	  }
	});
	
    }
    
    
}
