﻿function assignBg(url) {
    var url = String(url).toLowerCase();
    if (url.indexOf('/member/') != -1 || url.indexOf('/privacy_policy/') != -1 || url.indexOf('/legal_notice/') != -1 || url.indexOf('/imprint/') != -1) {
        $(".product_top").attr("style", "background-image:url('/images/background/bg_blue_top_big.png'); width: 906px; height:297px");
        $(".product_middle").attr("style", "background-image:url('/images/background/bg_blue_middle_big.png'); width: 906px");
        $(".product_down").attr("style", "background-image:url('/images/background/bg_blue_down_big.png'); width: 906px;; height:169px");
    }
    else if (url.indexOf('/products/') != -1 || url.indexOf('/about_huggies/') != -1 || url.indexOf('/m_partner/') != -1) {
        $(".product_top").attr("style", "background-image:url('/images/products/bg_top.jpg')");
        $(".product_middle").attr("style", "background-image:url('/images/products/bg_middle.jpg')");
        $(".product_down").attr("style", "background-image:url('/images/products/bg_down.jpg')");
    }
    else if (url.indexOf('/know_how/') != -1) {
        if (url.indexOf('/know_how/tools/first_12_week_main.aspx') != -1 || url.indexOf('/know_how/tools/due_date_cal.aspx') != -1) {
            $(".product_top").attr("style", "background-image:url('/images/know_how/bg_top_big.png'); width: 906px; height:297px");
            $(".product_middle").attr("style", "background-image:url('/images/know_how/bg_middle_big.png'); width: 906px");
            $(".product_down").attr("style", "background-image:url('/images/know_how/bg_down_big.png'); width: 906px;; height:169px");
        }
        else {
            $(".product_top").attr("style", "background-image:url('/images/know_how/bg_top.png')");
            $(".product_middle").attr("style", "background-image:url('/images/know_how/bg_middle.png')");
            $(".product_down").attr("style", "background-image:url('/images/know_how/bg_down.png')");
        }
    }
    else if (url.indexOf('/blog') != -1)
    { }

    else if (url.indexOf('/entertainment/') != -1) {
        if (url.indexOf('/entertainment/ecard.aspx') != -1 || url.indexOf('/entertainment/bedtime_storys.aspx') != -1 || url.indexOf('/entertainment/wallpaper.aspx') != -1) {
            $(".product_top").attr("style", "background-image:url('/images/background/bg_orange_top_big.png'); width: 906px");
            $(".product_middle").attr("style", "background-image:url('/images/background/bg_orange_middle_big.png'); width: 906px");
            $(".product_down").attr("style", "background-image:url('/images/background/bg_orange_down_big.png'); width: 906px; height: 338px");
        }
        else {
            $(".product_top").attr("style", "background-image:url('/images/entertainment/bg_top.png')");
            $(".product_middle").attr("style", "background-image:url('/images/entertainment/bg_middle.png')");
            $(".product_down").attr("style", "background-image:url('/images/entertainment/bg_down.png')");
        }
    }
    else if (url.indexOf('/search/') != -1) {
        $(".product_top").attr("style", "background-image:url('/images/background/bg_blue_top_big.png'); width: 906px; 297px");
        $(".product_middle").attr("style", "background-image:url('/images/background/bg_blue_middle_big.png'); width: 906px; height:1085px");
        $(".product_down").attr("style", "background-image:url('/images/background/bg_blue_down_big.png'); width: 906px; height: 169px");
    }
}

function assignFooterBG(bgi) {
    $("#footer").attr("style", "background-image:url('/images/template/nav_footer_" + bgi + ".png')");
}
function nav_header_bg_change(url) {
    var url = String(url).toLowerCase();
    if (url.indexOf('/products/') == -1) {
        $(".products").hover(function() {
            $(".products").addClass("products_over");
        }, function() {
            $(".products").removeClass("products_over").addClass("products");
        });
    }
    else {
        $(".products").removeClass("products").addClass("products_over");
    }
    if (url.indexOf('/know_how/') == -1) {
        $(".know_how").hover(function() {
            $(".know_how").addClass("know_how_over");
        }, function() {
            $(".know_how").removeClass("know_how_over").addClass("know_how");
        });
    }
    else {
        $(".know_how").removeClass("know_how").addClass("know_how_over");
    }
    if (url.indexOf('/blog/') == -1) {
        $(".blog").hover(function() {
            $(".blog").addClass("blog_over");
        }, function() {
            $(".blog").removeClass("blog_over").addClass("blog");
        });
    }
    if (url.indexOf('/entertainment/') == -1 ) {
        $(".entertainment").hover(function() {
            $(".entertainment").addClass("entertainment_over");
        }, function() {
            $(".entertainment").removeClass("entertainment_over").addClass("entertainment");
        });
    }
    else {
        $(".entertainment").removeClass("entertainment").addClass("entertainment_over");
    }
    if (url.indexOf('/about_huggies/') == -1) {
        $(".about_huggies").hover(function() {
            $(".about_huggies").addClass("about_huggies_over");
        }, function() {
            $(".about_huggies").removeClass("about_huggies_over").addClass("about_huggies");
        });
    }
    else {
        $(".about_huggies").removeClass("about_huggies").addClass("about_huggies_over");
    }
    if (url.indexOf('/m_partner/') == -1) {
        $(".partner").hover(function() {
            $(".partner").addClass("partner_over");
        }, function() {
            $(".partner").removeClass("partner_over").addClass("partner");
        });
    }
    else {
        $(".partner").removeClass("partner").addClass("partner_over");
    }
}
function nav_current_cate() {

}
function assignLink() {
    var Root = "/";
    var SearchPage = Root + "Suche"
    var ProductPage = "/produkte/Produktübersicht/";
    var KnowHowPageLanding = "/Wissenswertes/";
    var KnowHowPageCategory = KnowHowPageLanding + "Ratgeber/";
    var KnowHowPageCategory_Care = KnowHowPageCategory + "Pflege/";
	var KnowHowPageCategory_Education = KnowHowPageCategory + "Lernen-und-Entwicklung/";
	var KnowHowPageCategory_Health = KnowHowPageCategory + "Gesundheit-und-Ernährung/";
	var KnowHowPageCategory_pregnancy = KnowHowPageCategory + "Schwangerschaft-und-Geburt/";
	var KnowHowPageCategory_Safety = KnowHowPageCategory + "Sicherheit/";
	var KnowHowPageCategory_Little_Swimmers = KnowHowPageCategory + "Babyschmimmen/";
	var KnowHowPageCategory_Potty_Training = KnowHowPageCategory + "Töpfchentraining/";
	var KnowHowPageCategory_first12Week = KnowHowPageLanding + "Hilfreiches/Die-ersten-Wochen/"
	var Login = "/Login/";
    
    var EntertainmentPage = "/Unterhaltung/";
    var AboutHuggiesPage = "/Über-Huggies/";
    var PartnerPage = "/Partner/";
    var Disney = "/produkte/Disney/";
    var Where2Buy = "/produkte/Erhältlich-bei/";

    //Home - Home, Site Map, Contact
    $("#navHome, #returnHome, .huggies_logo").click(function() { document.location = "/"; });
	$("#navSiteMap").click(function() { document.location = "/Sitemap"; });
    $("#navContact, #returnContact").click(function() { document.location = Root + "Über-Huggies/Kontakt"; });
    $("#divLogin").click(function() { });
    $("#divRegister, #pwd_remind_join , #sm_register, #login_page_to_register, #divRegister_L").click(function() { document.location = Root + "Registrieren"; });
    $("#navSearch").click(function() { document.location = SearchPage+"?q=" + $(".txtSearch").val(); });
    
    //Event handler when press enter
    $(".txtSearch").keypress(function(event) {
        //alert(event.which);
        if (event.which == '13') {
            event.preventDefault();
            $("#navSearch").click();
        }
    });

    //Login
    $("#divLogin, #pwd_remide_thank_login, #sm_login").click(function() { document.location = Login; });
    $("#divForgotPassword").click(function() { document.location = Login + "Passwort-vergessen"; });
    $("#register_thankyou_continue").click(function() { document.location = Root; });
    $("#sm_myprofile").click(function() { document.location = Root + "Mein-Profil" });
    


    // Landing page
    $("#baby_swimmer_L1, #link_little_swimmer1, #link_little_swimmer2, #link_little_swimmer3").click(function() { document.location = Root + "Babyschwimmen"; });
	$("#know_how_L2, #Neugeborene_wickeln").click(function() { document.location = Root + "Windelwechseln"; });
	$("#potty_training_L3, #Pottytrainin, #Töpfchentraining").click(function() { document.location = Root + "Töpfchentraining"; });
	$("#download_pdf").click(function() { window.open( Root + "PDF/Windelwechseln","",""); });


    //Products
	$(".btn_detail, #where2buy_13, #where2buy").click(function() { document.location = Where2Buy; });
    $("#products").click(function() { document.location = ProductPage; });
    $("#subNav_product ,#product1, #product2").click(function() { document.location = ProductPage; });
    $("#subNav_disney ,#huggies_disney_12").click(function() { document.location = Disney; });
    $("#subNav_wheretobuy").click(function() { document.location = Where2Buy; });
    $(".btn_products_back").click(function() { document.location = ProductPage; });
    $(".btn_disney_back").click(function() { document.location = Disney; });
    $("#btn_huggies_newborn, #windeln ,#newborn_111, #link_newborn, #lp_newborn").click(function() { document.location = ProductPage + "New-Born"; });
    $("#btn_huggies_superdry ,#super_dry_112, #lb_superdry").click(function() { document.location = ProductPage + "Super-Dry"; });
    $("#btn_Huggies_Feucht, #feucht ,#wipes_113, #lp_wipes").click(function() { document.location = ProductPage + "Feucht-Tücher"; });
    $("#btn_little_walkers, #walkers ,#little_walkers_114, #lp_little_walker").click(function() { document.location = ProductPage + "Little-Walkers"; });
    $("#btn_Pull_Ups, #pullups ,#pullUps_115, #lp_pullup").click(function() { document.location = ProductPage + "Pull-Ups"; });
    $("#btn_little_swimmers, #swimmers ,#little_swimmer_116, #lp_little_swimmer").click(function() { document.location = ProductPage + "Little-Swimmers"; });
    $("#lp_happy, #btn_happies, #happies").click(function() { document.location = ProductPage + "Huggies-Happies"; });
	
    //Products > Disney > Winnie the Pooh
    //products/disney/pooh.aspx
	$("#disney_pooh, #winnie_the_pooh, #pooh_121").click(function() { document.location = Disney + "Winne-the-Pooh"; });
	$("#disney_cars, #cars2 , #cars_123").click(function() { document.location = Disney + "Cars"; });
	$("#disney_nemo, #nemo, #nemo_122").click(function() { document.location = Disney + "Nemo"; });
	$("#disney_princess, #princess, #princess_124").click(function() { document.location = Disney + "Princess"; });
	
	

	$("#btn_coop").click(function() { window.open("http://www.coop.ch"); });
	$("#btn_migros").click(function() { window.open("http://www.migros.ch"); });
    $("#fu_facebook").click(function() { window.open("http://www.facebook.com/huggieswelt"); });
    $("#fu_youtube").click(function() { window.open("http://www.youtube.com/huggieswelt"); });

    //Sub Navigation
    //Products
    
    
    //Know How
    $("#subNav_knowledge_base, #sm_knowleadg_base").click(function() { document.location = KnowHowPageCategory; });
    $("#subNav_QA").click(function() { });
    $("#subNav_tools").click(function() { });
    $("#know_how, #sm_know_how").click(function() { document.location = KnowHowPageLanding; });

	//Know How > care > sub category
    $(".btn_know_how_care_back, #Pflege").click(function() { document.location = KnowHowPageCategory_Care; });
    $("#btnCare, #care").click(function() { document.location = KnowHowPageCategory_Care; });
    $("#btnCare_Detail, #Windeln_wechseln").click(function() { document.location = KnowHowPageCategory_Care + "Windelwechseln"; });
    $("#btnCare_Hygiene,#Hygiene, #link_Hygiene").click(function() { document.location = KnowHowPageCategory_Care + "Hygiene"; });
    $("#btnCare_bath_time, #Baden").click(function() { document.location = KnowHowPageCategory_Care + "Baden"; });
    $("#btnCare_crying_baby, #Trösten, #link_Trösten").click(function() { document.location = KnowHowPageCategory_Care + "Trösten"; });
    $("#btnCare_breast_feeding, #sm_Stillen").click(function() { document.location = KnowHowPageCategory_Care + "Stillen"; });
    $("#btnCare_Baden_for_Large, #sm_Baden_for_Large").click(function() { document.location = KnowHowPageCategory_Care + "Baden-für-Grosse"; });
    $("#Babyschwimmen").click(function() { document.location = KnowHowPageCategory + "Babyschmimmen"; });
	
	//Know How > learning_development > sub category
    $(".btn_know_how_learnign_back, #Lernen_und_Entwicklung").click(function() { document.location = KnowHowPageCategory_Education; });
	$("#btnLearning, #education").click(function() { document.location = KnowHowPageCategory_Education; });
	$("#btnLearning_Sleep, #Schlafen").click(function() { document.location = KnowHowPageCategory_Education + "Schlafen"; });
	$("#btnLearning_education, #Erziehung").click(function() { document.location = KnowHowPageCategory_Education + "Erziehung"; });
	$("#btnLearning_play_time, #Spielen").click(function() { document.location = KnowHowPageCategory_Education + "Spielen"; });
    $("#btnLearning_learning_to_speak, #sm_learning_to_speak").click(function() { document.location = KnowHowPageCategory_Education + "Sprechen-Lernen"; });
    $("#btnLearning_manners, #Manieren").click(function() { document.location = KnowHowPageCategory_Education + "Manieren"; });
    $("#btnLearning_fears, #Ängste").click(function() { document.location = KnowHowPageCategory_Education + "Ängste"; });
    $("#btnLearning_madness, #Tobsucht").click(function() { document.location = KnowHowPageCategory_Education + "Tobsucht"; });
    $("#btnLearning_messy_play, #Messy_Play").click(function() { document.location = KnowHowPageCategory_Education + "Chaos"; });
	$("#btnLearning_bedtime_story, #sm_bedtime_story").click(function() { document.location = KnowHowPageCategory_Education + "Gutenacht-Geschichten"; });

	//Know How > health_nutrition > sub category
	$(".btn_know_how_health_back").click(function() { document.location = KnowHowPageCategory_Health; });
	$("#btnHealth, #health").click(function() { document.location = KnowHowPageCategory_Health; });
	$("#btnHealth_Colic, #link_Colic, #sm_Colic").click(function() { document.location = KnowHowPageCategory_Health + "Kolik"; });
	$("#btnHealth_allergy_food, #sm_Allergien_Essen").click(function() { document.location = KnowHowPageCategory_Health + "Allergien-Essen"; });
    $("#btnHealth_Vegetarian, #sm_Vegetarian").click(function() { document.location = KnowHowPageCategory_Health + "Vegetarisch"; });
    $("#btnHealth_Teething, #sm_Teething").click(function() { document.location = KnowHowPageCategory_Health + "Zahnen"; });
    //$("#btnHealth_Vaccinations, #Impfungen").click(function() { document.location = KnowHowPageCategory_Health + "Impfungen"; });
    $("#btnHealth_food_fads, #Essen_nicht_mögen").click(function() { document.location = KnowHowPageCategory_Health + "Essen-nicht-mögen"; });


    //Know How > pregnancy_birth > sub category
    $(".btn_know_how_pregnancy_back, #Schwangerschaft_Geburt").click(function() { document.location = KnowHowPageCategory_pregnancy; });
    $("#btnPregnancy, #pregnancy").click(function() { document.location = KnowHowPageCategory_pregnancy; });
    $("#btnPregnancy_caesarean_section, #sm_caesarean_section").click(function() { document.location = KnowHowPageCategory_pregnancy + "Kaiserschnitt"; });
    $("#btnPregnancy_birth_process1, #sm_birth_process1").click(function() { document.location = KnowHowPageCategory_pregnancy + "Geburtsvorgang-1"; });
    $("#btnPregnancy_birth_process2, #sm_birth_process2").click(function() { document.location = KnowHowPageCategory_pregnancy + "Geburtsvorgang-2"; });
    $("#btnPregnancy_Labor, #sm_Labor").click(function() { document.location = KnowHowPageCategory_pregnancy + "Wehen"; });
    $("#btnPregnancy_packing_list, #sm_packing_list").click(function() { document.location = KnowHowPageCategory_pregnancy + "Packliste"; });
    $("#btnPregnancy_eating_for_two, #sm_eating_for_two").click(function() { document.location = KnowHowPageCategory_pregnancy + "Essen-für-zwei"; });
    $("#btnPregnancy_all_about_pregnancy, #all_about_pregnancy").click(function() { document.location = KnowHowPageCategory_pregnancy + "Alles-über-die-Schwangerschaft"; });
    $("#btnPregnancy_Q_and_A_pregnancy, #Fragen_AntwortenQ_A, #Allergien_Esse").click(function() { document.location = KnowHowPageCategory_pregnancy + "Q-und-A-Schwangerschaft"; });

    //Know How > safety > sub category
    $(".btn_know_how_safety_back").click(function() { document.location = KnowHowPageCategory_Safety; });
    $("#btnSafety, #safety, #sm_safety").click(function() { document.location = KnowHowPageCategory_Safety; });
    $("#btnSafety_bedroom_nursery, #sm_bedroom_nursery").click(function() { document.location = KnowHowPageCategory_Safety + "Schlafen-Krippe"; });
    $("#btnSafety_Security, #Sicherheit_zu_Hause, #Sicherheit").click(function() { document.location = KnowHowPageCategory_Safety + "Sicherheit"; });
    $("#btnSafety_home_safety_check, #sm_safety_check").click(function() { document.location = KnowHowPageCategory_Safety + "Sicherheit-zu-Hause"; });
    $("#btnSafety_fire_safety, #sm_fire_safety").click(function() { document.location = KnowHowPageCategory_Safety + "Sicherheit-krabbler"; });

    //Know How > swimming_with_babys >
    $(".btn_know_how_swimming_with_babys_back").click(function() { document.location = KnowHowPageCategory; });
    $("#btnSwimming_with_babys, #little_swimmers").click(function() { document.location = KnowHowPageCategory_Little_Swimmers; });

    //Know How > potty_training >
    $(".btn_know_how_potty_training_back").click(function() { document.location = KnowHowPageCategory; });
    $(".btnPotty_training, #potty_training").click(function() { document.location = KnowHowPageCategory_Potty_Training; });
    
    //Know How > Q & A
    $("#subNav_QA, #Fragen_Antworten").click(function() { document.location = KnowHowPageLanding + "Fragen-und-Antworten"; });
    //Know How > Tools
    $("#subNav_tools, #sm_tools").click(function() { document.location = KnowHowPageLanding + "Hilfreiches"; });
    //Know How > Tools > first 12 week
    $(".btn_know_how_first12week_back").click(function() { document.location = KnowHowPageCategory_first12Week; });
    $("#btn12week ,#12week").click(function() { document.location = KnowHowPageCategory_first12Week; });
    $("#btnduedate, #date_cal").click(function() { document.location = KnowHowPageLanding + "Hilfreiches/Geburtsterminrechner"; });
    $("#week1").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-1"; });
    $("#week2").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-2"; });
    $("#week3").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-3"; });
    $("#week4").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-4"; });
    $("#week5").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-5"; });
    $("#week6").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-6"; });
    $("#week7").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-7"; });
    $("#week8").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-8"; });
    $("#week9").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-9"; });
    $("#week10").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-10"; });
    $("#week11").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-11"; });
    $("#week12").click(function() { document.location = KnowHowPageCategory_first12Week + "Detail-Woche-12"; });
    
    //Entertainment
    $("#entertainment, #sm_entertainment").click(function() { document.location = EntertainmentPage; });
    $("#subNav_facebook ,#facebook_41").click(function() { document.location = EntertainmentPage + "Facebook"; });
    $("#subNav_downloads ,#disney_wallpaer_42a, #disney_wallpaer_42b").click(function() { document.location = EntertainmentPage + "Downloads"; });
    $("#subNav_movies ,#movie_43").click(function() { document.location = EntertainmentPage + "Filme"; });
    $("#subNav_ecard ,#ecard_44").click(function() { document.location = EntertainmentPage + "E-Card"; });
    $("#subNav_bedtime_story, #bedtime_45").click(function() { document.location = EntertainmentPage + "Gutenachtgeschichten"; });
    $("#subNav_personal_wallpaper, #btnWallpaper").click(function() { document.location = EntertainmentPage + "Wallpaper-erstellen"; });

    //About Huggies
    $("#about_huggies, #sm_about").click(function() { document.location = AboutHuggiesPage; });
    $("#btn_contact, #sm_contact").click(function() { document.location = AboutHuggiesPage + "Kontakt"; });
    $("#subNav_contact").click(function() { document.location = AboutHuggiesPage + "Kontakt"; });
    
    //Partnet
    $("#partner ,#btnPartner").click(function() { document.location = PartnerPage; });
    $("#btn_hirslanden_baby, #subNav_hirslanden").click(function() { document.location = PartnerPage + "Hirslanden"; })
    $("#btn_h2o, #subNav_h2o, #h20_02").click(function() { document.location = PartnerPage + "H2O-Wasser-erleben"; });

    //footer
    $("#btn_impressum, #ft_impressum").click(function() { document.location = Root + "Impressum"; });
    $("#btn_policy, #ft_policy").click(function() { document.location = Root + "Datenschutzrichtlinie"; });
    $("#showPrivacy").click(function() { window.open(Root + "Datenschutzrichtlinie"); });
    $("#btn_legal, #ft_legal").click(function() { document.location = Root + "Rechtlicher-Hinweis"; });

    //External site
    $("#facebook_Huggeis_FB").click(function() { window.open("http://www.facebook.com/huggieswelt","","",""); });
}

function disney_logo(url) {
    var url = String(url).toLowerCase();
    if (url.indexOf("/products/disney/") != -1) {
        $(".disney_logo").show();
        if (url.indexOf("/products/disney/pooh.aspx") != -1) {
            $(".disney_logo").removeClass("disney_logo").addClass("disney_detail");
        }
        if (url.indexOf("/products/disney/cars.aspx") != -1) {
            $(".disney_logo").removeClass("disney_logo").addClass("disney_detail");
        }
        if (url.indexOf("/products/disney/princess.aspx") != -1) {
            $(".disney_logo").removeClass("disney_logo").addClass("disney_detail");
        }
        if (url.indexOf("/products/disney/nemo.aspx") != -1) {
            $(".disney_logo").removeClass("disney_logo").addClass("disney_detail");
        }
    }
}
function go() {
    $(".go").click(function() {
        if ($(".txtSearch").val() != "") {
            var str = $(".txtSearch").val();
            document.location = "/Suche?q=" + str.replace(" ", "+");
        }
    });
}
