jQuery(function() {
Cufon.replace('h1, h2, .NewsItemPreviewDate, #ShopContentIntroText p, #ShopInnerContentCenterNumber, #footer-menu, .Cufon', { hover: true, fontFamily: 'Colaborate-Regular' });
    Cufon.replace('#BottomWrapper h1', { hover: true, fontFamily: 'Colaborate-Medium' });
    Cufon.replace('#ShopContentTitel', { hover: true, fontFamily: 'Colaborate-Thin' });
    jQuery("#NavigationHorizontal li.current ul").addClass('current');
    jQuery("ul#NavigationHorizontal #Li_CatItem9 ul").append('<li class="liFocus"><a class="imgPrices" href="/smartweb-shop-priser/"></a></li><li class="liFocus"><a class="imgCMSprices" href="/smartweb-cms-priser/"></a></li><li class="liFocus"><a class="imgService" href="/service-priser/"></a></li><li class="liFocus"><a class="imgHosting" href="/hostingprodukter/"></a></li><li class="liFocus"><a class="imgServer" href="/egen-server/"></a></li><li id="demoBtn" style="padding:5px 10px 0 0; float:left; width: 117px; height: 60px;"><a class="imgDemo" href="/proev-gratis-demo/"></a></li><li id="bestilBtn" style="padding:4px 15px 0 0; float:right; width: 117px; height: 60px;"><a class="imgBestil" href="/bestil-smartweb/"></a></li>');
    jQuery("ul#NavigationHorizontal #Li_CatItem9_uk ul").append('<li class="liFocus"><a href="/smartweb-shop-prices/"><img style="padding:5px 8px 0 10px; float: left;" border="none" src="/upload_dir/themes/web/shop001_theme001/graphics/subNavMenuShop_uk.png" alt="" /></a></li><li class="liFocus"><a href="/smartweb-cms-prices/"><img style="padding:5px 8px 0 0; float: left;" border="none" src="/upload_dir/themes/web/shop001_theme001/graphics/subNavMenuCMS_uk.png" alt="" /></a></li><li class="liFocus"><a href="/service-prices"><img style="padding:5px 8px 0 0; float: left;" border="none" src="/upload_dir/themes/web/shop001_theme001/graphics/subNavMenuService.png" alt="" /></a></li><li class="liFocus"><a href="/hosting-products/"><img style="padding:5px 8px 0 0; float: left;" border="none" src="/upload_dir/themes/web/shop001_theme001/graphics/subNavMenuHosting_uk.png" alt="" /></a></li><li class="liFocus"><a href="/personal-server/"><img style="padding:5px 8px 0 0; float: left;" border="none" src="/upload_dir/themes/web/shop001_theme001/graphics/subNavMenuServer_uk.png" alt="" /></a></li><li id="demoBtn" style="padding:5px 10px 0 0; float:left; width: 117px; height: 60px;"><a href="/try-free-demo/"><img src="/upload_dir/themes/web/shop001_theme001/graphics/subNavMenuBtnDemo.png" alt="" /></a></li><li id="bestilBtn" style="padding:4px 15px 0 0; float:right; width: 117px; height: 60px;"><a href="/order-smartweb/"><img src="/upload_dir/themes/web/shop001_theme001/graphics/subNavMenuBtnBestil_uk.png" alt="" /></a></li>');

    /* jQuery("ul#NavigationHorizontal #Li_CatItem9 ul.current").css("display", "none"); */
    jQuery("ul#NavigationHorizontal li a.current").each(function() {
        jQuery(this).parent('li').addClass('current');
    });
    
    jQuery('ul#NavigationHorizontal li#Li_CatItem9 ul').addClass("focusUl");
    jQuery('ul#NavigationHorizontal li#Li_CatItem9_uk ul').addClass("focusUl");
    
    jQuery("body.bodyPageId1 #NewsWrapperPreviewContent >h1").click(function(e) {
            if (jQuery("body.bodyPageId1 #NewsWrapperPreviewContent >h1 >cufon >cufontext").html() == "Latest ") {
                window.location = '/RSS/?type=news&feed=18&language=UK';                  
            } else {            
                window.location = '/RSS/?type=news&feed=18&language=DK';
            }
    });
        
    /* jQuery TOOLS init */
    //Expose forms
    var form = jQuery(".expose").bind("click keydown", function() {
        jQuery(this).expose({

            // when exposing is done, change form's background color
            onLoad: function() {
                form.css({backgroundColor: '#999'});
            },

            // when "unexposed", return to original background color
            onClose: function() {
                form.css({backgroundColor: '#ccc'});
            }
        });
    });
    
    //Form validator
    var validator = jQuery("form.validate").validator({ lang: language_iso });
    jQuery.tools.validator.localize("DK", {
        '*'            : 'Indtast en gyldig v&aelig;rdi',
        ':email'      : 'Indtast en gyldig e-mail-adresse',
        ':number'     : 'Indtast et gyldigt nummer',
        ':url'         : 'Indtast en gyldig URL',
        '[max]'         : 'V&aelig;rdien m&aring, maksimalt v&aelig;re $1',
        '[min]'        : 'V&aelig;rdien skal mindst v&aelig;re $1',
        '[required]'    : 'Dette felt er p&aring;kr&aelig;vet'
    });
    /* ------------------------------------ */
    
    if (page_id == 'bestilling' && (bestilling_step == null || bestilling_step == '1')) {
        jQuery("#MainContentInner >p:first").remove();
        jQuery("div.button.buttonLeft dt.middle div.ahref a").attr('href', bestilling_link);
    }
    
    if (page_id == 'bestilling') {
        var table = jQuery("table.Checkout");
        if (bestilling_step == null || bestilling_step == '1') {
            //Step1
            var newEl = jQuery("<tbody><tr><td><img alt='' src='/upload_dir/themes/web/shop001_theme001/graphics/statusStep1.jpg' /></td></tr></tbody>");
            table.html(newEl);
            
            //Fjern nyhedsbrev
            jQuery("#MainContentInner form >table td.content table:last").remove();
        }
        else if (bestilling_step == '4') {
            //Step2
            var newEl = jQuery("<tbody><tr><td><img alt='' src='/upload_dir/themes/web/shop001_theme001/graphics/statusStep2.jpg' /></td></tr></tbody>");
            table.html(newEl);
        }
        else if (bestilling_step == '5') {
            //Step3
            var newEl = jQuery("<tbody><tr><td><img alt='' src='/upload_dir/themes/web/shop001_theme001/graphics/statusStep3.jpg' /></td></tr></tbody>");
            table.html(newEl);
        }
    }
    
    /*
    jQuery("ul#NavigationHorizontal li").hover(function() {
        jQuery('ul#NavigationHorizontal li#Li_CatItem9 ul').addClass("hideUl");
    }, function() {
    jQuery('ul#NavigationHorizontal li#Li_CatItem9 ul').removeClass("hideUl");
  
        
    });
    
    jQuery("ul#NavigationHorizontal li#Li_CatItem9").hover(function() {
        jQuery('ul#NavigationHorizontal li#Li_CatItem9 ul').removeClass("hideUl");
    }, function() {
           
    });
    
    jQuery("ul#NavigationHorizontal li").hover(function() {
        jQuery('ul#NavigationHorizontal li#Li_CatItem9_uk ul').addClass("hideUl");
    }, function() {
    jQuery('ul#NavigationHorizontal li#Li_CatItem9_uk ul').removeClass("hideUl");
  
        
    });
    
    jQuery("ul#NavigationHorizontal li#Li_CatItem9_uk").hover(function() {
        jQuery('ul#NavigationHorizontal li#Li_CatItem9_uk ul').removeClass("hideUl");
    }, function() {
           
    });
    */
    jQuery('.picMargin.p2').hover(
        function (e) {
            jQuery('.infoForRefWrapper.i1').addClass('show');
        },
        function (e) {
            jQuery('.infoForRefWrapper.i1').removeClass('show');
        }
    );
    
    jQuery('.picMargin.p3').hover(
        function (e) {
            jQuery('.infoForRefWrapper.i2').addClass('show');
        },
        function (e) {
            jQuery('.infoForRefWrapper.i2').removeClass('show');
        }
    );
    
    jQuery('.picMargin.p4').hover(
        function (e) {
            jQuery('.infoForRefWrapper.i3').addClass('show');
        },
        function (e) {
            jQuery('.infoForRefWrapper.i3').removeClass('show');
        }
    );
    
    // ##############
    // Slider function
    // ##############
    if (jQuery("#SliderWrapper img").length > 1) {
        jQuery("#SliderWrapper .slideshow").cycle({
            fx: 'fade',
            pause: 1,
            prev: '#previousLink',
            next: '#nextLink',
            pager: '#nav',
            speed:  800,
            timeout:  6000,
            before: function(current, next) {
                jQuery('.slideshow').height(parseInt(jQuery(next).height()));
            }
        });
        jQuery("#nav a").html('');
    }
    
    jQuery("#SliderWrapper").hover(function() {
        jQuery('#SliderWrapper #previousLink').addClass("focus");
    }, function() {
    jQuery('#SliderWrapper #previousLink').removeClass("focus");
    });
    
    jQuery("#SliderWrapper").hover(function() {
        jQuery('#SliderWrapper #nextLink').addClass("focus");
    }, function() {
    jQuery('#SliderWrapper #nextLink').removeClass("focus");
    });
       
});
