

jQuery(document).ready(function () {

	//--Projektnavigations DropDown
	jQuery(".projnav select").chosen({});

	var selid = jQuery(".projnav select").attr("data-sel");
	var nam = jQuery(".projnav select option[value=" + selid + "]").html();
	jQuery(".projnav li:contains('" + nam + "')").css("color", "#7fbe00");


	//--Debug Panel
	jQuery(".debug h3").click(function () { jQuery(".debug p").toggle(); });

	//--Thickbox
	jQuery("a.thickbox").fancybox({
		'hideOnContentClick': false,
		'overlayShow': true
	});

	//--Mainmenu Mouseover
	jQuery("#mainnav li,#subnav li").hoverClass("hover");


	//--Image Sliders
	// http://www.pixedelic.com/plugins/diapo/
	// http://fancyapps.com/fancybox/

	if (jQuery("div.gallery").length > 0) {

		jQuery("div.gallery").diapo({
			fx: 'scrollHorz',
			time: '5000',
			loader: 'none',
			pagination: true,
			thumbs: false,
			easing: 'easeOutQuart',
			onLoaded: function () {

				jQuery("#pix_pag_ul span span").each(function () {
					var id = jQuery(this).html();
					jQuery(this).html(parseInt(id) + 1);
				});

				jQuery("div.gallery a[rel=gallery]").fancybox({

					width: 1020,
					height: 680,


					minWidth: 400,
					minHeight: 300,


					autoSize: true,
					fitToView: true,

					openEffect: 'fade',
					closeEffect: 'fade',
					nextEffect: 'fade',
					prevEffect: 'fade',

					helpers: {
						title: {
							type: 'inside'
						}
					},

					beforeShow: function () {
						jQuery("#contentpage object").hide();
						jQuery("#pix_pag").hide();
						jQuery("div.gallery").diapoStop();
					},
					afterClose: function () {
						jQuery("div.gallery").diapoPlay();
						jQuery("#pix_pag").show();
						jQuery("#contentpage object").show();
					}
				});

			}
		});

	}


});


jQuery.fn.hoverClass = function(c) {
	return this.each(function() {
		jQuery(this).hover(
			function() { jQuery(this).addClass(c); },
			function() { jQuery(this).removeClass(c); }
		);
	});
};




//=====================================
//
//=====================================



