/* arktis javascript datei */
(function($){
    $(document).ready(function($) {
        //Topseller
        if($('.topseller')) { $('.accordion').kwicks({min: 49,sticky: true,spacing: 0,isVertical: true,duration: 350}); }
        
        $('a.bt_twitter').click(function(event){
            event.preventDefault();
            var url = $(this).attr('href')+window.location.href;
            window.open(url);
            return false;    
        });
        
        // Social Bookmarks
        function setBookmark (where) 
        { burl = encodeURIComponent(location.href); btitle = encodeURIComponent(document.title); switch(where) 
            { 
            case 'Delicious': window.open('http://del.icio.us/post?url='+burl+'&title='+btitle); break; 
            case 'Digg': window.open('http://digg.com/submit?phase=2&url='+burl+'&title='+btitle); break; 
            case 'Folkd': window.open('http://www.folkd.com/submit/'+burl); break; 
            case 'Furl': window.open('http://www.furl.net/storeIt.jsp?u='+burl+'&t='+btitle); break; 
            case 'Icio': window.open('http://www.icio.de/add.php?url='+burl); break; 
            case 'Linkarena': window.open('http://linkarena.com/bookmarks/addlink/?url='+burl+'&title='+btitle); break; 
            case 'Magnolia': window.open('http://ma.gnolia.com/bookmarklet/add?url='+burl+'&title='+btitle); break; 
            case 'Mrwong': window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+burl+'&bm_notice=&bm_description='+btitle); break; 
            case 'Newsvine': window.open('http://www.newsvine.com/_tools/seed&save?u='+burl+'&h='+btitle); break; 
            case 'Reddit': window.open('http://reddit.com/submit?url='+burl+'&title='+btitle); break; 
            case 'Slashdot': window.open('http://slashdot.org/bookmark.pl?url='+burl+'&title='+btitle); break; 
            case 'Smarking': window.open('http://smarking.com/editbookmark/?url='+burl+'&description='+btitle); break; 
            case 'Spurl': window.open('http://www.spurl.net/spurl.php?title='+btitle+'&url='+burl); break; 
            case 'Stumbleupon': window.open('http://www.stumbleupon.com/submit?url='+burl+'&title='+btitle); break; 
            case 'Technorati': window.open('http://technorati.com/faves?add='+burl); break; 
            case 'Webnews': window.open('http://www.webnews.de/einstellen?url='+burl+'&title='+btitle); break; 
            case 'Yigg': window.open('http://yigg.de/neu?exturl='+burl); break; 
            case 'Infopirat': window.open('http://infopirat.com/node/add/userlink?edit[url]='+burl+'&edit[title]='+btitle); break; 
            case 'Oneview': window.open('http://www.oneview.de/quickadd/neu/addBookmark.jsf?URL='+burl+'&title='+btitle); break; 
            case 'Google': window.open('http://www.google.com/bookmarks/mark?op=add&bkmk='+burl+'&title='+btitle); break;
            case 'Yahoo': window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?t='+btitle+'&Webmasteru='+burl); break;
            } 
        };
        // leeren h1 Tag entfernen
        $('.catHeadline').each(function(){
            if($(this).html() == ''){
                $(this).remove();
            }    
        });
        // doppelte // aus href entfernen
        $('#left .categories .level2 a').each(function(){
            var newHref = $(this).attr('href');
            var s = newHref.substr(-2);
            if(s == '//'){
                var laenge = newHref.length - 1;
                var url = newHref.substr(0,laenge);    
            }
            $(this).attr('href', url);
        });
        //Use a lightbox instead of a zoom
        if(typeof(useZoom) != 'undefined' && useZoom == '0') {
            $("[rel^='lightbox']").slimbox({
                previousKeys: [37, 80],
                nextKeys: [39, 78],
                loop: true,
                counterText: "Bild {x} von {y}",
                closeKeys: [27, 88, 67],
            });
            $('div.thumb_box a').bind('click', function(event) {
                event.preventDefault();
                $('a#zoom1').hide().attr('href', $(this).attr('href')).children().attr('src', $(this).attr('rev'));
                $('a#zoom1').fadeIn('slow');
                return false;
            });
        }

    });
    
    // Verläufe IE
    if ($.browser.msie) {
        $(window).bind('load',function(){
            $('#center .slider .ajaxSlider').css({
                'background':'url(../templates/arktis/frontend/_resources/images/backgrounds/bg_slider_front_ie.png) no-repeat 0 0 transparent',
                'border':'none',
                'width':'523px'
            });
            $('#center .slider2 .ajaxSlider').css({
                'background':'url(../templates/arktis/frontend/_resources/images/backgrounds/bg_slider_front_ie.png) no-repeat 0 0 transparent',
                'border':'none',
                'width':'523px'
            });
            $('#center .supplier_slider .ajaxSlider').css({
                'background':'url(../templates/arktis/frontend/_resources/images/backgrounds/bg_supplier_slider_ie.png) no-repeat 0 0 transparent',
                'border':'none',
                'width':'523px'
            });
            $('#detailinfo .slider .ajaxSlider').css({
                'background':'url(../templates/arktis/frontend/_resources/images/backgrounds/bg_detail_slider_ie.png) no-repeat 0 0 transparent',
                'border':'none',
                'width':'785px',
                'height':'222px'
            });
            $('#detailinfo .slider2 .ajaxSlider').css({
                'background':'url(../templates/arktis/frontend/_resources/images/backgrounds/bg_detail_slider_ie.png) no-repeat 0 0 transparent',
                'border':'none',
                'width':'785px',
                'height':'222px'
            });               
        });                                    
    }
  
})(jQuery);
