	var validator;
	$(document).ready(function () {
	    validator = $("#proForm").validate({ 
            errorLabelContainer: $("#errorcontainer"),
	        rules: { ZipCode: { required: true, minlength: 5, maxlength: 5, digits: true }, Provider: "required" },
	        submitHandler: function () { ShowLightboxNEO(); return false; },
	        messages: { ZipCode: "<div>Please enter a valid zip code</div>", Provider: "<div>Please select your provider</div>" }
	    });
	});
	$(document).ready(function () {
	    $('#ZipCode').textboxhint({ hint: 'Zip Code' });
	    $('#sZipCode').textboxhint({ hint: 'Zip' });
	    $('#ZipCode').click(function () { this.value = ''; });
	    $('#sZipCode').click(function () { this.value = ''; });
	});

    $(document).ready(function () {
        var txt
        var Safari
        var fileref = document.createElement("link")
        txt = navigator.appVersion
        Safari = txt.indexOf("Safari")
        fileref.setAttribute("rel", "stylesheet")
        fileref.setAttribute("type", "text/css")
        if (Safari == -1) {
            fileref.setAttribute("href", "http://cdn.k2usa.com/sundance/ie.css")
        }
        else {
            fileref.setAttribute("href", "http://cdn.k2usa.com/sundance/sfr.css")
        }
        document.getElementsByTagName("head")[0].appendChild(fileref)
    });
    
	function ShowLightboxNEO() {
	    var Zipcode = $("input[name='ZipCode']").val();
	    var Provider = $("select[name='Provider']").val();
	    if (Zipcode > '' && Zipcode.length == '5' && Provider > '') { tb_show('', 'http://sundance.viewerlink.tv/viewer_results.asp?height=500&width=410&ZipCode=' + Zipcode + '&Provider=' + Provider + '&TB_iframe=true', '') } else { return false }  };

	function showHint(x) {
	    if (x.toString().length == "5") {    
		    $(document).ready(function () {
	        $.ajax({
	            url: 'http://cdn.k2usa.com/inc/GetProviders.asp?zip='+x,
	            type: 'GET',
	            success: function (data) {              
	                var a = data.responseText
	                $('#txtHint').html(a.replace(/(\r\n|\n|\r)/gm, ""));
	            } }); }); } }

	function showHintSm(x) {
	    if (x.toString().length == "5") {    
		    $(document).ready(function () {
	        $.ajax({
	            url: 'http://cdn.k2usa.com/inc/GetProviders.asp?sz=1&zip='+x,
	            type: 'GET',
	            success: function (data) {              
	                var a = data.responseText
	                $('#txtHint').html(a.replace(/(\r\n|\n|\r)/gm, ""));
	            } }); }); } }



