// custom js-file for swisscontent.ch
$(document).ready(function() {

    //makes teaser invisible on frontpage (mouse-over image)
		$(".mainlinks a, #mainheaderText, .projectpic").hide();

		//fade mainlinks
	$(window).one("load",function(){
			$("#mainheaderText").slideDown(600);
			$(".mainlinks a, #mainheaderText").fadeIn(1000);
			$(".projectpic").fadeIn(350);
			
      //same like top just disabled for ie
		  if ($.browser.msie && $.browser.version.substr(0,1)<7) {
  			$("#mainheaderText").fadeIn(1000);
      }
		});

		
		$("#l1, #l2, #l3").hover(function() {
			$(this).stop(true).animate({bottom: '4px', duration:100});
		}, function() {
			$(this).stop().animate({bottom: '0px'});
		});
		
		$(".listlink a").hover(function() {
			$(this).stop(true).animate({left: '3px', duration:100});
		}, function() {
			$(this).stop().animate({left: '0px'});
		});
		
	  //anchor to the top
    $(".top").click(function(event){
        //prevent the default action for the click event
        event.preventDefault();
        
        //get the full url
        var full_url = this.href;
        
        //split the url by # and get the anchor target name
        var parts = full_url.split("#");
        var trgt = parts[1];
        
        //get the top offset of the target anchor
        var target_offset = $("#"+trgt).offset();
        var target_top = target_offset.top;
        
        //goto that anchor by setting the body scroll top to anchor top
        $('html, body').animate({scrollTop:target_top}, 500);
    });	
    
    //frontpage animation - random image with link
      			$('#referenzen').innerfade({
						animationtype: 'fade',
						speed: 1500,
						timeout: 5000,
						type: 'random',
						containerheight: '113px',
						containerwidth: '276px'
					});

});


