﻿    $(document).ready(function(){
    
        $(".lnkNoticeLink").css({"color":"white"});
    
        $("#divNotice").mouseover(function() {
            $(this).css({"cursor":"pointer"});
        });
        
        $("#divNotice").mouseout(function() {
            $(this).css({"cursor":"default"});
        });
    
        $("#divNotice").click(function() {
            if ($("input[name=ctl00$ContentPlaceHolder1$hdnPromotionID]").attr("value") > 0)
            {
                window.location = "LogHomePromotions.aspx?pid=" + $("input[name=ctl00$ContentPlaceHolder1$hdnPromotionID]").attr("value");
            }
        });
               
        $(".tdLogHomePlans").click(function(e) {
            e.preventDefault();
            var newLocation = $(this).find("a").attr("href");
            SendRequest("Track","Plans and Pricing",$(this).attr("planID"),newLocation);
        });
    });
    
//sprites
$("#divBtnFloorPlans").mouseover(function() {
    $(this).css("background-position","left bottom");
});

$("#divBtnFloorPlans").mouseout(function() {
    $(this).css("background-position","left top");
});

$("#divBtnCostEstimate").mouseover(function() {
    $(this).css("background-position","left bottom");
});

$("#divBtnCostEstimate").mouseout(function() {
    $(this).css("background-position","left top");
});

$(".Track").click(function(e) {
    e.preventDefault();
    var newLocation = $(this).attr("href");
    var planID = newLocation.substring(newLocation.indexOf("=")+1,newLocation.length);
    SendRequest("Track","Worksheet",planID,newLocation);
});

//Plan Tracking
function SendRequest(action,origination,id,newLocation)
{
        $.ajax({
            type: "GET",
            url: "handlers/Tracking.ashx?action=" + action + "&origination=" + origination + "&id=" + id,
            success: function(msg){
                    window.location = newLocation;
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert(XMLHttpRequest.status);
                alert(textStatus);
                alert(errorThrown);
            }
        });
}