$(document).ready(function(){
	
	/* COLORBOX */
	$("a[rel='gallery']").colorbox();
	$("a.video").colorbox({iframe:true, innerWidth:480, innerHeight:385});	
	
	/* 	qTip */
	$.fn.qtip.styles.nav = {
/* 		width: 200, */
		background: '#c0c0c0',
		color: 'black',
		textAlign: 'left',
		border: {
			width: 5,
			radius: 3,
			color: '#c0c0c0'
		},
		tip: {
			corner: 'topMiddle',
			size: {
    	        x: 20,
        	    y : 8
         	}	
		},
		api: {
			beforeShow: function(event){
				this.elements.tooltip.css("width", "auto");
				this.updatePosition(event);
			}
		}
	}
	$.fn.qtip.styles.tip = {
/* 		width: 200, */
		background: '#c0c0c0',
		color: 'black',
		textAlign: 'left',
		border: {
			width: 5,
			radius: 3,
			color: '#c0c0c0'
		},
		tip: {
			corner: 'bottomMiddle',
			size: {
    	        x: 20,
        	    y : 8
         	}	
		},
		api: {
			beforeShow: function(event){
				this.elements.tooltip.css("width", "auto");
				this.updatePosition(event);
			}
		}
	}
	$.fn.qtip.styles.language = {
/* 		width: 200, */
		background: '#c0c0c0',
		color: 'black',
		textAlign: 'left',
		border: {
			width: 5,
			radius: 3,
			color: '#c0c0c0'
		},
		tip: {
			corner: 'topRight',
			size: {
    	        x: 20,
        	    y : 8
         	}	
		},
		api: {
			beforeShow: function(event){
				this.elements.tooltip.css("width", "auto");
				this.updatePosition(event);
			}
		}
	}	
	

	$('a.tooltip').each(function() {
		$(this).qtip({
			content: { text: false },
			position: {
				corner: { tooltip: 'bottomMiddle', target: 'topMiddle' },
				adjust: { x: 0, y: 0 }
			},
			hide: { fixed: true, delay: 1000, effect: 'slide' },
			show: { effect: { type: 'slide' } },
			style: 'tip'
		});
	});
	$('#language a[href][title]').each(function() {
		$(this).qtip({
			content: { text: false },
			position: {
				corner: { tooltip: 'topMiddle', target: 'bottomLeft' },
				adjust: { x: 0, y: 0 }
			},
			hide: { fixed: true, delay: 1000, effect: 'slide' },
			show: { effect: { type: 'slide' } },
			style: 'language'
		});
	});	
	
	/*TOGGLE*/
	$(".toggle_container").hide(); 

	$("h2.trigger").toggle(function(){
		$(this).addClass("active");
		}, function () {
		$(this).removeClass("active");
	});

	$("h2.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("slow");
	});

	
});




/*ALLGEMEIN*/
function popup(ziel,w,h) {
  h = h - 20; var x=0, y=0, parameter="";
  if (w < screen.availWidth || h < screen.availHeight) {
    x = (screen.availWidth - w - 12) / 2;
    y = (screen.availHeight - h - 104) / 2;
    if (window.opera) y = 0; // Opera positioniert unter den Symbolleisten
    if (x<0 || y<0) { x=0; y=0; }
    else parameter = "width=" + w + ",height=" + h + ",";
  }
  parameter += "left=" + x + ",top=" + y;
  parameter += ",menubar=0,location=0,toolbar=0,status=0";
  parameter += ",resizable=1,scrollbars=1";
  var Fenster = window.open(ziel,"",parameter);
  if (Fenster) Fenster.focus();
  return !Fenster;
}

function openLink(link) {
  location.href = link;
  return false;
}
