/* 
-----------------------------| jQuery Plugin: Insert
*/

jQuery.insert = function(file){
	var data	= [];	var data2	= [];
	if (typeof file == 'object')	{
		data = file;
		file = data.src !== undefined ? data.src : false;
		file = file === false && data.href !== undefined ? data.href : file;
		file = file === false ? file2 : false;
	}
	if (typeof file == 'string' && file.length)	{
		var index	= file.lastIndexOf('.');
		var index2	= file.replace('\\', '/').lastIndexOf('/') + 1;
		var ext		= file.substring(index + 1, file.length);
	}
	switch(ext)	{
		case 'js':	data2 = {elm:'script',	type:'text/javascript',src:file};	break;
		case 'css':	data2 = {elm:'link',	rel:	'stylesheet',	type:	'text/css',	href:	file};	break;
		default:	data2 = {elm: 'link'};	break;
	}
	data2.id = 'script-' + (typeof file == 'string' && file.length ?	file.substring(index2, index) : Math.round(Math.rand() * 100));
	for (var i in data)	{data2[i] = data[i];}
	data	= data2;var tag	= document.createElement(data.elm);
	delete data.elm; for (i in data)	{tag.setAttribute(i, data[i]);}
	jQuery('head').append(tag);	return jQuery('#' + data.id);
};




/* 
-----------------------------| jQuery Plugin: Scroll to Top, by Craig Wilson, Ph.Creative (http://www.ph-creative.com)
*/
$(function(){$.fn.scrollToTop=function(options){if(options.speed){var speed=options.speed;}else{var speed="slow";}if(options.ease){var ease=options.ease;}else{var ease="jswing";}if(options.start){var start=options.start;}else{var start="0";}var scrollDiv=$(this);$(this).hide().removeAttr("href");if($(window).scrollTop()>start){$(this).fadeIn("slow");}$(window).scroll(function(){if($(window).scrollTop()>start){$(scrollDiv).fadeIn("slow");}else{$(scrollDiv).fadeOut("slow");}});$(this).click(function(event){$("html, body").animate({scrollTop:"0px"},speed,ease);});}});  

			$(function() { $("#toTop").scrollToTop({speed:800,ease:"easeOutBounce",start:200}); }); // easeOutQuad			
/* 
-----------------------------| jQuery Plugin: vTip, by www.vertigo-project.com
*/
this.vtip = function() {    
    this.xOffset = 27; // x distance from mouse
    this.yOffset = -28; // y distance from mouse           
    $(".vtip").unbind().hover(    
        function(e) {
            this.t = this.title;
            this.title = ''; 
            this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);            
            $('body').append( '<p id="vtip">' + this.t + '</p>' );                        
            $('p#vtip #vtipArrow').attr("src", DEFAULT_TEMPLATE_PATH+'/images/vtip_arrow.png'); // path to image
            $('p#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");            
        },
        function() {
            this.title = this.t;
            $("p#vtip").fadeOut("slow").remove();
        }
    ).mousemove(
        function(e) {
            this.top = (e.pageY + yOffset);
            this.left = (e.pageX + xOffset);                         
            $("p#vtip").css("top", this.top+"px").css("left", this.left+"px");
        }
    );     
    // ZWEITE VARIANTE
    $(".tip").unbind().hover(    
        function(e) {
            this.t = this.title;
            this.title = ''; 
            this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);            
            $('body').append( '<p id="tip">' + this.t + '</p>' );                        
            $('p#tip #tipArrow').attr("src", ''); // path to image
            $('p#tip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");            
        },
        function() {
            this.title = this.t;
            $("p#tip").fadeOut("slow").remove();
        }
    ).mousemove(
        function(e) {
            this.top = (e.pageY + yOffset);
            this.left = (e.pageX + xOffset);                         
            $("p#tip").css("top", this.top+"px").css("left", this.left+"px");
        }
    );                
};
jQuery(document).ready(function($){vtip();}) 
	
	
	

	
	
// Preload Image Effekt
	$(function () {
		$('img').hide();//hide all the images on the page
	});
	var i = 0;//initialize
	var int=0;//Internet Explorer Fix
	$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
		var int = setInterval("doThis(i)",70);//500 is the fade in speed in milliseconds
	});
	function doThis() {
		var images = $('img').length;//count the number of images on the page
		if (i >= images) {// Loop the images
			clearInterval(int);//When it reaches the last image the loop ends
		}
		$('img:hidden').eq(0).fadeIn(900);//fades in the hidden images one by one
		i++;//add 1 to the count
	}



