﻿$(document).ready(function() {
    addMouseOverEvent();
    try {
        var manager = Sys.WebForms.PageRequestManager.getInstance();
        manager.add_endRequest(OnGridHelperEndRequest);
    }
    catch (Error) {
    }



});

function OnGridHelperEndRequest(sender, args) {
    try {
        addMouseOverEvent();
    }
    catch (err) {
        ;
    }
}
function addMouseOverEvent() {

    $(".recordList tr:odd").addClass("odd");
    $(".recordList tr:even").addClass("even");
    $(".recordList tr").mouseover(function() { $(this).addClass("over"); })
                  .mouseout(function() { $(this).removeClass("over"); });
}
function showBidStatusBackgroundColor() {
    $(".bidStatus > h4").each(function() {
//    if ($(this).hasClass("status1")) {
//        $(this).parents(".bidStatus").css({ "background": "#92d050" });
//    } else if ($(this).hasClass("status2")) {
//        $(this).parents(".bidStatus").css("background", "#9bbb59");
//    } else if ($(this).hasClass("status3")) {
//        $(this).parents(".bidStatus").css("background", "#c00000");
//        $(this).parents(".bidStatus").css("color", "#fff");
//    } else if ($(this).hasClass("status6")) {
//        $(this).parents(".bidStatus").css("background", "#00b0f0");
//    } else if ($(this).hasClass("status4")) {
//        $(this).parents(".bidStatus").css("background", "#538dd5");
//    } else if ($(this).hasClass("status7")) {
//        $(this).parents(".bidStatus").css("background", "#dce6f1");
//    } else if ($(this).hasClass("status5")) {
//        $(this).parents(".bidStatus").css("background", "#948a54");
//    };
    if ($(this).hasClass("status1")) {
        $(this).parents(".bidStatus").css("background", "#d3a300 url(../../themes/standard/images/won.gif) center left repeat-x", "width", "135px");
    } else if ($(this).hasClass("status2")) {
    $(this).parents(".bidStatus").css("background", "#33b713 url(../../themes/standard/images/leader.gif) center left repeat-x", "width", "135px");
    } else if ($(this).hasClass("status3")) {
    $(this).parents(".bidStatus").css("background", "#cc0000 url(../../themes/standard/images/outbid.gif) center left repeat-x", "width", "135px");
      $(this).parents(".bidStatus").css("color", "#000");
    } else if ($(this).hasClass("status6")) {
    $(this).parents(".bidStatus").css("background", "#aebbcd url(../../themes/standard/images/lost.gif) center left repeat-x", "width", "135px");
    } else if ($(this).hasClass("status4")) {
    $(this).parents(".bidStatus").css("background", "#aebbcd url(../../themes/standard/images/lost.gif) center left repeat-x", "width", "135px");
    } else if ($(this).hasClass("status7")) {
    $(this).parents(".bidStatus").css("background", "#e66b04 url(../../themes/standard/images/awaiting.gif) center left repeat-x", "width", "135px");
    } else if ($(this).hasClass("status5")) {
    $(this).parents(".bidStatus").css("background", "#408ece url(../../themes/standard/images/reserve.gif) center left repeat-x", "width", "135px");
        };
    });
    $(".evenAuctionInfo span[id$=LabelReserve]").each(function() {
        var reserveValue = $(this).text();
        if (reserveValue == "Reserve Not Met") {
            $(this).css("color", "gray");
        } else {
            $(this).css("color","#000");
        }
    });
    $(".oddAuctionInfo span[id$=LabelReserve]").each(function() {
        var reserveValue = $(this).text();
        if (reserveValue == "Reserve Not Met") {
            $(this).css("color", "gray");
        } else {
            $(this).css("color", "#000");
        }
    });
    $(".evenAuctionInfo > th >span").each(function() {
        var reserveValue = $(this).text();
        if (reserveValue == "Non-Franchise") {
            $(this).css("font-style", "italic");
        } else {
            $(this).css("font-style", "normal");
        }
    });
    $(".oddAuctionInfo > th >span").each(function() {
        var reserveValue = $(this).text();
        if (reserveValue == "Non-Franchise") {
            $(this).css("font-style", "italic");
        } else {
            $(this).css("font-style", "normal");
        }
    });
    $("td.deleteColumn").css("cursor","default");
    $("td.deleteColumn").click(function(event) {
        event.preventDefault();
        return false;
    });
    $("td.deleteColumn").mouseover(function(event) {
        event.preventDefault();
        return false;
    });
    $("td.deleteColumn").mouseout(function(event) {
        event.preventDefault();
        return false;
    });
    $("td.deleteField").css("cursor", "default");
    $("td.deleteField").mouseover(function(event) {
        event.preventDefault();
        return false;
    });
    $("td.deleteField").mouseout(function(event) {
        event.preventDefault();
        return false;
    });
}
function submitbid(e, id, type) {
    if (type == "m") {
        id = id.toString().replace("TextBoxMyBid", "ButtonBidManual");
    }
    else {
        id = id.toString().replace("TextBoxAutoBid", "ButtonAutoBid");
    }
    var keynum;
    var keychar;
    var numcheck;
    if (window.event) // IE
    {
        keynum = e.keyCode;
        if (keynum == 13) {
            e.keyCode = 9;
            var btn = document.getElementById(id);
            //btn.focus();
            btn.click();
        }
        else {
            return;
        }
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which;
        if (keynum == 13) {
            var btn = document.getElementById(id);
            btn.focus();
            btn.click();
        }
        else {
            return;
        }
    }

}
