/*

	javascript artus-website
	-------------------------

	@file 		thias.js
	@version 	1.0.0b
	@date 		2009-07-27 16:45:14 +0200 (Mon, 27 Jul 2009)
	@author 	Matthias Edler-Golla <meg@wachenfeld-golla.de>

	Copyright (c) 2009 Wachenfeld + Golla, Buero fuer Gestaltung <http://wachenfeld-golla.de>

*/

$(function(){
	$('html').addClass('jsAktiv');
});


// thias, neu 090727 
//automatische bildershow bei den realisierten-projekt-seiten
// http://www.malsup.com/jquery/cycle/
// das "slideExpr: 'img'" ist ganz wichtig, damit nur die bilder animiert werden
// nicht die div-soup von typo3
$(function(){
	$('div.Grossbilder').cycle({ 
    	fx:    'fade', 
    	speed:  3000,
    	random: 1,
    	slideExpr: 'img',
    	timeout:  5000
 	});
 	
 	// animation haelt an, wenn cursor darueber
 	$('div.Grossbilder').mouseenter(function(){
 		$('div.Grossbilder').cycle('pause');
 	});
 	
 	// animation laeuft weiter, wenn cursor wieder weg
 	$('div.Grossbilder').mouseleave(function(){
 		$('div.Grossbilder').cycle('resume');
 	});
});

//inhalt des suchfelds bei "focus" wegmachen und bei "blur" wieder sichtbar machen
$(function(){
	//hier das betroffene feld eintragen
	var suchfeld = 'form#suchFeld  input.searchbox';
	var startVal = $(suchfeld).val();
	
	//focus-aktion
	$(suchfeld).focus(function(){
		var jetztVal = $(suchfeld).val();
		if (jetztVal == startVal){
			$(suchfeld).val('');
		}
	});
	
	//blur-action
	$(suchfeld).blur(function(){
		var jetztVal = $(suchfeld).val();
		if (jetztVal == ''){
			$(suchfeld).val(startVal);
		}
	});
	
	$('#inhalt .csc-textpic-image a img').css({opacity:'1.0'});
	$('#inhalt .csc-textpic-image a img').hover(
		function(){ $(this).animate({opacity:'0.6'},'fast');},
		function(){ $(this).animate({opacity:'1.0'},'normal');}
	);
//	$('div.post div.bildText span,.csc-textpic-caption').css({opacity:'0.5','font-weight':'bold'});
//	$('div.post div.bildText span:hover,.csc-textpic-caption:hover').css({opacity:'1.0'});
});

//topNews ausblenden, wenn zu wenig platz auf der seite
$(document).ready(function(){
	// viewportH = Hoehe des Browser-Fensters
	var viewportH = (self.innerHeight) ? self.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : (document.body) ? document.body.clientHeight : 0;
	//alert (viewportH);
	if (viewportH < 650){
		$('div#topNews').hide();
	}
	if($('#wrap').height() < viewportH && (viewportH-360) > 350){
		$('#content').css({'min-height':(viewportH-360)+'px'});
	    $('#content').css({'padding-bottom':'90px'});
	} else {
		$('#content').css({'min-height':'0px'});
	    $('#content').css({'padding-bottom':'0px'});
	}
	
	jQuery(window).bind("load", resizeWindow);
	jQuery(window).bind("resize", resizeWindow);
	function resizeWindow(e) {
		var newViewportH = (self.innerHeight) ? self.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : (document.body) ? document.body.clientHeight : 0;
		if($('#wrap').height() < newViewportH && (newViewportH-360) > 350) {
		    $('#content').css({'min-height':(newViewportH-360)+'px'});
		    $('#content').css({'padding-bottom':'0px'});
		} else {
		    $('#content').css({'min-height':'0px'});
		    $('#content').css({'padding-bottom':'70px'});
		}
	}
	
	//3. Ebene Menue
	jQuery('.csc-frame-frame2 ul.csc-menu').hide();
	jQuery('.csc-frame-frame2').hover(
		function(){jQuery('.csc-frame-frame2 ul.csc-menu').show('500');},
		function(){jQuery('.csc-frame-frame2 ul.csc-menu').hide('500');}
	);
});

//submenus ein-/ausblenden
/*
$(function(){
	$('div#mainMenu ul li:not(.aktiv) ul').hide();
	$('div#mainMenu ul li:not(.aktiv) ul').css({'opacity':'0.95'});
	$('div#mainMenu ul#navmenu > li:not(.aktiv) > a').mouseover(
		function(){
			$('div#mainMenu ul li:not(.aktiv) ul').hide();
			$(this).siblings('ul').slideDown('fast');
		}
	);

	$(document).bind('click', function(e) {
                var clicked=$(e.target); 
                if(clicked.is('ul#navmenu') || clicked.parents().is('ul#navmenu')) { 
                        return true;
                } else { 
                        $('div#mainMenu ul li:not(.aktiv) ul').hide();
                }
     });
});
*/
/*
//submenus ein-/ausblenden
$(function(){
	$('div#mainMenu ul li:not(.aktiv) ul').hide();
	$('div#mainMenu ul li:not(.aktiv) ul').css({'opacity':'0.95'});
	$('div#mainMenu ul#navmenu > li:not(.aktiv) > a').mouseenter(
		function(){
			$('div#mainMenu ul li:not(.aktiv) ul').hide();
			//$(this).siblings('ul').slideDown('fast');
		}
	);
	
	$('div#mainMenu ul#navmenu > li:not(.aktiv) > a').mouseover(
		function(){
			//$('div#mainMenu ul li:not(.aktiv) ul').hide();
			$(this).siblings('ul').slideDown('fast');
		}
	);

	$(document).bind('click', function(e) {
                var clicked=$(e.target); 
                if(clicked.is('ul#navmenu') || clicked.parents().is('ul#navmenu')) { 
                        return true;
                } else { 
                        $('div#mainMenu ul li:not(.aktiv) ul').hide();
                }
     });
});
*/

$(function(){
	$('div#mainMenu ul li:not(.aktiv) ul').hide();
//	$('div#mainMenu ul li:not(.aktiv) ul').css({'opacity':'0.95'});	
	
	function show() {
         $(this).children('ul').slideDown('fast');
    }
      
    function hide() { 
          $('div#mainMenu ul li:not(.aktiv) ul').hide();
    }
    $('div#mainMenu ul#navmenu > li:not(.aktiv)').hoverIntent({
        sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
        interval: 50,   // number = milliseconds for onMouseOver polling interval
        over: show,     // function = onMouseOver callback (required)
        timeout: 300,   // number = milliseconds delay before onMouseOut
        out: hide       // function = onMouseOut callback (required)
    });


});
//hover mainmenue
$(function(){
	//fucking ie6
	if ($.browser.msie) {
	     var ieVersion = $.browser.version;
	     if (ieVersion < 7){
	        $('div#mainMenu ul li:not(.aktiv)').hover(
	        // function bei hover "over"
	        function(){
	            $(this).css({ 
				     'background-position': '0 -25px' 
				});
	        },
	        // function bei hover "out"
	        function(){
	             $(this).css({ 
				     'background-position': '0 0' 
				});
	        });
	     }
	}
});



