// HIGHSLIDE AUTO


$(function(){

    $('a[href*=#top],a[href*=#comment],a[href*=#comments]').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}, 500, '');;
                    
                return false;
                
            }
            
        }
        
    });
    
});



// CARROUSEL
carrouselHomePage = function(){
	if (jQuery("#slideShow").length) {
		jQuery("#slideShow").cycle({

			speed: '200',
			timeout: 4500,
			pager: '#navSlideShow',
			pagerEvent: 'mouseover',
			pauseOnPagerHover: true,
			pagerAnchorBuilder: function(idx, slide) {
				return '#navSlideShow li:eq(' + (idx) + ') a';
			}
		});
	}
}

// DOCUMENT READY CALLS
jQuery(document).ready(function(){
	carrouselHomePage();
});


// Z-INDEX

function swapImages(obj,z){
var theObj
	//ie4
	if(document.all){
		theObj=document.all(obj)
		theObj.style.zIndex=z
	}
	//ie5,6, Mozilla 1.0 and Opera 6
	if(document.getElementById){
		theObj=document.getElementById(obj)
		theObj.style.zIndex=z
	}
	//nn4x
	if(document.layers){
	theObj=document.layers[obj]
	theObj.zIndex=z
	}
}
//-->

/*
 * Tooltip 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.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("img.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("img.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});	
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};



// starting the script on page load
$(document).ready(function(){
	tooltip();
});



$('.infobutton').toggle(function() {
  $(".infokram").animate({height: "toggle", opacity: 'toggle'});
  $("img#nav1").hide();
  $('img#nav1').attr("src","http://www.abgeschirmt.com/wp-content/themes/abgeschirmtMAG/bilder/layout/icons/3eck_down.gif");
  $("img#nav1").fadeIn("slow");
}, function() {
	$(".infokram").animate({height: "toggle", opacity: 'toggle'});
	$("img#nav1").hide();
   $('img#nav1').attr("src","http://www.abgeschirmt.com/wp-content/themes/abgeschirmtMAG/bilder/layout/icons/3eck_up.gif");
   $("img#nav1").fadeIn("slow");
});


$(document).ready(function() {
	$('#tabvanilla > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle' } });
	$('#featuredvid > ul').tabs();
});

$(function(){

	$("#text img").lazyload({
	    placeholder : "http://www.abgeschirmt.com/wp-content/themes/abgeschirmtMAG/bilder/layout/blank.gif",       
	    effect      : "fadeIn",

	});
	$(".post_image img").lazyload({
	    placeholder : "http://www.abgeschirmt.com/wp-content/themes/abgeschirmtMAG/bilder/layout/blank.gif",       
	    effect      : "fadeIn",

	});
});







