﻿$().ready(function () {
	$("li.category:last a:first").css({ borderRight: "none" });
	$(".search").bind("click", function () {
		window.location.href = "/search-results.aspx?term=" + $(".txtSearch").val();
	});
	$(".productSearch").keypress(function (e) {
		if (e.keyCode == 13) {
			$(".search").click();
			return false;
		}
	});
	$(['../Images/signupnow_over1.png']).preload();

	$(".oldBrowser .close").click(function () {
		$(".oldBrowser").hide();
	});

	//    var browser = window.navigator.userAgent;
	//    var fireFox = browser.substring(browser.indexOf("Firefox"));
	//    var msie = browser.substring(browser.indexOf("MSIE"));

	//    if (fireFox.length > 0) {
	//        var ffVersion = fireFox.split('/')[1].split('.')[0];
	//        if (ffVersion < 5) {
	//            alert("You are using a browser that is not supported.  Please update your browser to continue.");
	//        }
	//    }
	//    if (msie.length > 0) {
	//        var msieVersion = msie.split(' ')[1].split('.')[0];
	//        if (ffVersion < 7) {
	//            alert("You are using a browser that is not supported.  Please update your browser to continue.");
	//        }
	//    }
});

function getNearestLabelText(input) {
	var label = $(input).prev("label");
	return label.length ? label.contents().text().slice(0, -1) + " is required." : "";
}

//like returning false for a button, but works with IE
function cancelEvent() {
	if (window.event) window.event.cancelBubble = true;
	return false;
}

$.fn.preload = function () {
	this.each(function () {
		$('<img/>')[0].src = this;
	});
}

