/* Ads Links+Rechts */
var test = "0";
var speed = "fast";
var browserWidth;
var blendOutWidhtAds = '1470';
var blendOutWidhtPagePeel = '1613';

$(document).ready(function() {

	function elementResizeFirstPageLoad() {
	
	if (test == "0") {
		browserWidth = $(window).width();
			if ((browserWidth) < blendOutWidhtPagePeel){
				$('#pageflip').addClass('pageflip_hide');
				$('#pageflip').removeClass('pageflip_show');
				
				$('#ads_right').addClass('ads_right_hide');
				$('#ads_left').addClass('ads_left_hide');
			} 
			if ((browserWidth) < blendOutWidhtPagePeel){
				$('#pageflip').addClass('pageflip_hide');
				$('#pageflip').removeClass('pageflip_show');
			}
			test="1";
		}
    }

  function elementResize() {
	
		if (test == "1") {
			browserWidth = $(window).width();
			$('#ads_right').removeClass('ads_right_show');
			if ((browserWidth) < blendOutWidhtAds){
				$('#ads_right').fadeOut(speed, function() {
					// Animation complete.
				});
				
				$('#ads_left').removeClass('ads_left_show');
				$('#ads_left').fadeOut(speed, function() {
					// Animation complete.
				});
				
		   
			} else {
	
				$('#ads_right').removeClass('ads_right_hide');
		
				$('#ads_right').fadeIn(speed, function() {
					// Animation complete.
				});
				
				$('#ads_left').removeClass('ads_left_hide');

				$('#ads_left').fadeIn(speed, function() {
					// Animation complete.
				});
			}
		
			
		}
    }

  
	elementResizeFirstPageLoad();
    elementResize();
	
    $(window).bind("resize", function(){
		elementResizeFirstPageLoad();
		elementResize();
    });
});
/**********************************************
BLENDOUTS END
**********************************************/


/*
 * Url preview 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.screenshotPreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.screenshot").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");								 
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#screenshot").remove();
    });	
	$("a.screenshot").mousemove(function(e){
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
$(document).ready(function(){
	screenshotPreview();
});


// Random BackgroundImage
	var currentPage;
	
	// Function Load Random Background Images
	function loadRandomBg () {
		
		// Array of Classes
		var classes = ['bg1','bg2','bg3','bg4'];
		
		// Get Random Number
		var randomNumber=Math.floor(Math.random()*classes.length);
		
		// Get Random Class
		var bdClass = classes[randomNumber];
		
		// Get Body Tag Element
		var bd = document.getElementById('bd');
		
		// Set Body Class
		bd.className = bdClass;
	
	}


// SOLZIAL NETWORK BUTTONS 
/* Author:      Marco Kuiper (http://www.marcofolio.net/) */

$(document).ready(function()
{
	// Hide all the tooltips
	$("#jquery li").each(function() {
		$("a strong", this).css("opacity", "0");
	});
	
	$("#jquery li").hover(function() { // Mouse over
		$(this)
			.stop().fadeTo(500, 1)
			.siblings().stop().fadeTo(500, 0.2);
			
		$("a strong", this)
			.stop()
			.animate({
				opacity: 1,
				top: "-10px"
			}, 300);
		
	}, function() { // Mouse out
		$(this)
			.stop().fadeTo(500, 1)
			.siblings().stop().fadeTo(500, 1);
			
		$("a strong", this)
			.stop()
			.animate({
				opacity: 0,
				top: "-1px"
			}, 300);
	});
	
});
<!-- SOLZIAL NETWORK BUTTONS -->

// JavaScript Document
<!-- vertical toggle tabs -->
$(document).ready(function(){
	
	$(".toggle_container").hide();

	$("h2.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
	});

});


<!-- jQuery TabedContent -->
$(document).ready(function() {

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});

});

<!-- image hover slide in title / text effect -->
    $(function() {
    	$("#capslide_img_cont11").capslide({
    		caption_color	: '',
    		caption_bgcolor	: '#000',
    		overlay_bgcolor : '#000',
    		border			: '10px solid #F2F2F2',
    		showcaption	    : true
    	});
    });


<!-- little Boxes Script -->
    $(function() {
/* object to save the initial positions of each box */
    var divinfo = {"initial": []};
/* index of the selected / clicked box */
    var current = -1;
/* we save the index,top and left of each one of the boxes */
    $('#littleBoxes > div').each(function(){
    var $this = $(this);
    var initial = {
    'index' : $this.index(),
    'top'     : $this.css('top'),
    'left'     : $this.css('left')
    };
    divinfo.initial.push(initial);
    });
/* clcik event for the anchors inside of the boxes */
    $('#littleBoxes .hack').bind('click',function(e){ /* !!!! a tag hack -> ('#littleBoxes a') ==> ('#littleBoxes .hack') !!! !important! */
    var $this         = $(this);
    var $currentBox    = $this.parent();
    /* set a z-index lower than all the other boxes,
    to see the other boxes animation on the top*/
    $currentBox.css('z-index','1');
/* if we are clicking on a expanded box : */
    if(current == $currentBox.index()){
/* put it back (decrease width,height, and set the top and left like it was before).
the previous positions are saved in the divinfo obj*/
    $currentBox.stop().animate({
    'top'         : divinfo.initial[$currentBox.index()].top,
    'left'        : divinfo.initial[$currentBox.index()].left,
    'width'     : '90px',
    'height'    : '90px'
    },40,'easeOutBack').find('.boxcontent').fadeOut();

    $('#littleBoxes > div').not($currentBox).each(function(){
    var $ele         = $(this);
    var elemTop     = divinfo.initial[$ele.index()].top;
    var elemLeft     = divinfo.initial[$ele.index()].left;
    $ele.stop().show().animate({
    'top'         : elemTop,
    'left'        : elemLeft,
    'opacity'    : 1
    },1800);
    });
    current = -1;
    }
/* if we are clicking on a small box : */
    else{
/* randomly animate all the other boxes.
Math.floor(Math.random()*601) - 150 gives a random number between -150 and 450.
This range is considering the initial lefts/tops of the elements. It's not the exact right
range, since we would have to calculate the range based on each one of the boxes. Anyway, it
 fits our needs...*/
    $('#littleBoxes > div').not($currentBox).each(function(){
    var $ele = $(this);
    $ele.stop().animate({
    'top' : (Math.floor(Math.random()*601) - 600) +'px',
    'left': (Math.floor(Math.random()*601) - 0) +'px',
    'opacity':0
    },1800,function(){
    $(this).hide();
    });
    });
/* expand the clicked one. Also, fadeIn the content (boxcontent)
if you want it to fill the space of the littleBoxes container,
then these are the right values */
    var newwidth     = 755;
    var newheight     = 375;
    $currentBox.stop().animate({
    'top'     : '0px',
    'left'    : '0px',
    'width' : newwidth +'px',
    'height': newheight+'px'
    },1800,'easeOutBack',function(){
    current = $currentBox.index();
    $(this).find('.boxcontent').fadeIn();
    });

    }
    e.preventDefault();
    });
    });

<!-- Impressum/Kontakt Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".kontakt_trigger").click(function(){
		$(".kontakt_panel").toggle("slow");
		$(this).toggleClass("active");
		return false;
	});
});
<!-- Impressum/Kontakt Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".kontakt_trigger2").click(function(){
		$(".kontakt_panel").toggle("slow");
		$(this).toggleClass("active");
		return false;
	});
});
<!-- Twitter Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".twitter_trigger").click(function(){
		$(".twitter_panel").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
});
<!-- Facebook Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".facebook_trigger").click(function(){
		$(".facebook_panel").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
});
<!-- YouTube Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".youtube_trigger").click(function(){
		$(".youtube_panel").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
});
<!-- DailyMotion Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".dailymotion_trigger").click(function(){
		$(".dailymotion_panel").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
});
<!-- MySpace Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".myspace_trigger").click(function(){
		$(".myspace_panel").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
});
<!-- Xing Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".xing_trigger").click(function(){
		$(".xing_panel").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
});
<!-- WDN Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".ning_trigger").click(function(){
		$(".ning_panel").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
});
<!-- Skype Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".skype_trigger").click(function(){
		$(".skype_panel").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
});

<!-- RSS Toggle Trigger / Panel -->
$(document).ready(function(){
	$(".rss_trigger").click(function(){
		$(".rss_panel").toggle("fast");
		$(this).toggleClass("active");
		return false;
	});
});
