﻿/// <reference path="jquery-1.4.4.min.js" />
$(document).ready(function () {
    BindMouseEventsForMenu();
});

function BindMouseEventsForMenu() {
    var currentPage = getAbsolutePath().toLowerCase();

    if (currentPage != 'default.htm' && currentPage != '') { 
        //Home Menu
        $("img[id$=menuHomeImg]").mouseover(function () {
               $(this).attr("src", "images/bg_home_on.jpg");
        }).mouseout(function () {
            $(this).attr("src", "images/bg_home_off.jpg");
        });
    }

    if (currentPage != 'services.htm') {
        //Services Menu
        $("img[id$=menuServicesImg]").mouseover(function () {
            $(this).attr("src", "images/bg_services_on.jpg");
        }).mouseout(function () {
            $(this).attr("src", "images/bg_services_off.jpg");
        });
    }

    if (currentPage != 'aboutus.htm') {
        //About Us Menu
        $("img[id$=menuAboutUsImg]").mouseover(function () {
            $(this).attr("src", "images/bg_about_on.jpg");
        }).mouseout(function () {
            $(this).attr("src", "images/bg_about_off.jpg");
        });
    }

    if (currentPage != 'contactus.htm') {
        //Contact Us Menu
        $("img[id$=menuContactUsImg]").mouseover(function () {
            $(this).attr("src", "images/bg_contact_on.jpg");
        }).mouseout(function () {
            $(this).attr("src", "images/bg_contact_off.jpg");
        });
    }

    if(currentPage != 'coupons.htm'){
        //Coupons Menu
        $("img[id$=menuCouponsImg]").mouseover(function () {
            $(this).attr("src", "images/bg_coupons_on.jpg");
        }).mouseout(function () {
            $(this).attr("src", "images/bg_coupons_off.jpg");
        });
    }

    if (currentPage != 'vipservices.htm') {
        //Vip Services Menu
        $("img[id$=menuVipServicesImg]").mouseover(function () {
            $(this).attr("src", "images/bg_vip_on.jpg");
        }).mouseout(function () {
            $(this).attr("src", "images/bg_vip_off.jpg");
        });
    }
	if (currentPage != 'fundraisers.htm') {
        $("img[id$=menuFundRaisersImg]").mouseover(function () {
            $(this).attr("src", "images/bg_FundRaisers_on.jpg");
        }).mouseout(function () {
            $(this).attr("src", "images/bg_FundRaisers_off.jpg");
        });
    }
}

function getAbsolutePath() {
    var loc = window.location;
    var pathName = loc.pathname.substring(loc.pathname.lastIndexOf('/') + 1, loc.pathname.length); 
    return pathName;
}

