
$(window).ready(function(){

    if ($('a[rel]').length>0) {
        $('a[rel]').each(function(){
            $(this).click(function(event){
                event.preventDefault();
            });
        });
    }

    if ($('img[overlay]').length>0) {
        $('img[overlay]').each(function(){
            $(this).css({
                'display':'none !important'
            });
        });
    }
	
	// Expand/Collapse Categories
    $("a.moreInfo").click(function() {
    	if($(this).next().is(":hidden")) {
    		$(this).next().slideDown("fast", function() {
    			$(this).parent().find("img").attr({
    				"alt": "Zuklappen",
    				"title": "Zuklappen",
    				"src": $(this).parent().find("img").attr("src").replace(/\/[\w-]+\.[\w]+/, "/slideUp.gif")
    			});
    		});
    	} else {
    		$(this).next().slideUp("fast", function() {
    			$(this).parent().find("img").attr({
    				"alt": "Aufklappen",
    				"title": "Aufklappen",
    				"src": $(this).parent().find("img").attr("src").replace(/\/[\w-]+\.[\w]+/, "/slideDown.gif")
    			});
    		});
    	}
    });
	
});


$(function() {
    $('a[rel]').overlay({
        speed : 'fast',
        fadeInSpeed : 'fast',
        // hide trigger when the overlay is opened
        onBeforeLoad: function() {
            $.each($.browser, function(i, val) {
                if(i=="msie" && jQuery.browser.version.substr(0,1)=="6")
                    $('select').css({
                        'display':'none'
                    });
            });
            $('img[overlay]').each(function(){
                $(this).attr('src','');
                $(this).css({
                    'width':'0'
                });
                $(this).css({
                    'height':'0'
                });
            });
        },
        onClose: function() {
            $.each($.browser, function(i, val) {
                if(i=="msie" && jQuery.browser.version.substr(0,1)=="6")
                    $('select').css({
                        'display':'block'
                    });
            });
        }
    });
        
    $("#accordion").tabs("#accordion div.pane", {
        tabs: 'h2',
        effect: 'slide'
    });
});


function decryptCharcode(n,start,end,offset)	{
    n = n + offset;
    if (offset > 0 && n > end)	{
        n = start + (n - end - 1);
    } else if (offset < 0 && n < start)	{
        n = end - (start - n - 1);
    }
    return String.fromCharCode(n);
}
// decrypt string
function decryptString(enc,offset)	{
    var dec = "";
    var len = enc.length;
    for(var i=0; i < len; i++)	{
        var n = enc.charCodeAt(i);
        if (n >= 0x2B && n <= 0x3A)	{
            dec += decryptCharcode(n,0x2B,0x3A,offset);	// 0-9 . , - + / :
        } else if (n >= 0x40 && n <= 0x5A)	{
            dec += decryptCharcode(n,0x40,0x5A,offset);	// A-Z @
        } else if (n >= 0x61 && n <= 0x7A)	{
            dec += decryptCharcode(n,0x61,0x7A,offset);	// a-z
        } else {
            dec += enc.charAt(i);
        }
    }
    return dec;
}
// decrypt spam-protected emails
function linkTo_UnCryptMailto(s)	{
    location.href = decryptString(s,-1);
}

// --- blurLink
function blurLink(obj) { 
	$(obj).blur();
} //end blur
