function formSubmit(d) {
    var f = document.forms.item(0);
    f.src = d;
    f.submit();
};

function AlertNoSubmit() {
    alert("unable to submit form.");
}

function SetProductTableEnroutes()
{
	var t = "table.ProductTable";
	var p = ":first";
	var x = "tr";
	
	$(t).each(function() {
	    var h = $(this).find("th"+p);
	    if (h.html() == "Qty" || h.html() == "QTY") return;
	    
	    h.hide();
	    var c = 0;
	    
	    $(this).find("tbody").children(x).each(function() {
	        var r = $(this);
	        var f = r.children("td"+p);
	        f.hide();
	        
	        var i = f.find("img");
	        //alert(i);
	        if (i) {
	            c++;
	            i.hover(function() {
	                r.after(''
                        + '<tr style="display:none;">'
                            + '<td colspan="' + r.children("td").length + '" style="padding: 10px;">'
                                + 'All or part of this product is currently enroute to our facility. ' + $(this).next("input").val()
                            + '</td>'
                        + '</tr>'
                    );
                    r.next(x).toggleClass(function() {
                        return r.hasClass("row1") ? "row2hlight" : "row1hlight";
                    });
                    r.next(x).animate({opacity: "show"}, 1000);
	            }, function() {
                    r.next(x).animate({opacity: "hide"}, 1000);
                    r.next(x).remove();
	            });
	        }
	    });
	    
        if (c > 0) {
            h.show();
            $(this).find("tbody").children(x).each(function() {
                $(this).children("td"+p).show();
            });
        }
	});
}

$(document).ready(function() {
    SetProductTableEnroutes();
    
    $("input#ctl00_pageCode_user").keyup(function(event) {
        if (event.keyCode == '13') {
            event.preventDefault();
            $("input#ctl00_pageCode_pass").focus();
        }
    });
    
    $("input#ctl00_pageCode_pass").keyup(function(event) {
        if (event.keyCode == '13') {
            event.preventDefault();
            __doPostBack('ctl00$pageCode$btnSubmit','');
        }
    });
});
