jQuery(function($) { 
    
    $('a.glossary dfn').glossify();
    
    // GLOSSAR
    $('.tx-billitonglossary-pi1 .azlist li').bind({
        click: function()
        {
            $('.tx-billitonglossary-pi1 .azlist li').removeClass('act');
            $(this).addClass('act');  
        }
        //~ mouseover: function()
        //~ {
            //~ $('.tx-billitonglossary-pi1 .azlist li').removeClass('act');
            //~ $(this).addClass('act');  
        //~ }
    });
    
    //~ $(".tx-billitonglossary-pi1 .azlist li").mouseover(function()
	//~ {
        //~ $(this).addClass('act');  
	//~ })
	//~ .mouseout(function(ev)
	//~ {
        //~ $(this).removeClass('act');  
	//~ }); 
    
    $('#lang').css({'zoom':'1'});
    
    $('a.lightbox').fancybox(
    {
        zoomSpeedIn:   300,
        zoomSpeedOut:  300,
        overlayShow:   true,
        titlePosition: 'inside' // alternativen: 'over' (transparent), 'outside' (achtung: nur einzeiliger text moeglich)
    });
    
    // empty input fields on click
    //$('#search-input, #c70 .mailform input').focus(function () {
    $('#search-input').focus(function () {
        $(this).attr('value','');
    });

    // make callback form input fields fancy
    $('#name, #tel').click(function() {
        if (this.value == this.defaultValue) {
            this.value = '';
        }
    });
    $('#name, #tel').blur(function() {
        if (this.value == '') {
            this.value = this.defaultValue;
        }
    });    

    /*
    $('.products-list-head').click(function() {
        var $itemcontent = $(this).next();
        $itemcontent.toggle('fast');
        $(this).toggleClass('no').toggleClass('act');
		return false;
	}).next().hide();
    */
    $('.products-list-head .toggle-btn, .no .toggle-button .csc-default, .act .toggle-button .csc-default').click(function(event){
        event.preventDefault();
        this.blur();
        $(this).parent().next().toggle('fast',function() {
            $(this).parent().toggleClass('no').toggleClass('act');
        });
    });
    
    
    
    
    $('#filter-button').click(function(event){
        //event.preventDefault();
        var value = $('#searchword-input').val();
        if(value == 'pdf' || value == '.pdf')
        {
            alert('Sie können nicht nur nach dem Wort PDF suchen');
            return false
        }
        else
        {
            
        }
    });
    
    
    $('#filter-button').attr("disabled", true);
    
    if($('#searchword-input').val() == ' ')
    {
        $('#searchword-input').attr('value', '');
    }
    
    $("#searchword-input").bind({
    
        keypress: function() 
        {
            if($(this).val().length < 2) 
            {
                $('#filter-button').attr("disabled", true);
                $('#filter-button').css("opacity", "0.3");
            } else {
                $('#filter-button').removeAttr("disabled");
                $('#filter-button').css("opacity", "1.0");
            }
        }
    });

    
    // $('#c70 .tx-pilmailform-pi1').hint();

    //$('#content').find(a.download).
    
    // Font Scale
    $("#plus").fontscale("#content","+",{unit:"percent",increment:5,useCookie:true});
    $("#reset").fontscale("#content","reset",{useCookie:true});
    $("#minus").fontscale("#content","-",{unit:"percent",increment:5,useCookie:true});
});



// usage: log('inside coolFunc',this,arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
	log.history = log.history || [];   // store logs to an array for reference
	log.history.push(arguments);
	if(this.console){
		console.log( Array.prototype.slice.call(arguments) );
	}
};

