	// set up tablesorter grid
	$(document).ready(function() {
        $("#myTable").tablesorter({widgets: ['cookie'],widthFixed: true});
		$("#myTable").tablesorterPager({container: $("#pager"),positionFixed: false});
		$("#myTable").tablesorterFilter({filterContainer: $("#filter-box")
						,filterClearContainer: $("#filter-clear-button")
						,filterColumns: [0,1,2,3]
						,filterCaseSensitive: false});
		$("#myTable").tablesorterCheckboxOnTheHouse();
		
		// ajax event to post research panel form
		$('#researchForm').submit(function() {
			var email  = $('input.email',this).val();
			var postal = $('input.postal',this).val();

			var obj = {
				url: '/?event=action.researchpaneladd',
				post: { email: email, postal: postal, type: 'wrw 2009' }
			}
			$.post(obj.url, obj.post);
			$('#panelMessage').html('Thank you.<br />' + email + ' has been added to the NYC Research panel list.<br />');
			$('#researchPanelEmail').fadeOut();
			$('#researchPanelPostal').fadeOut();
			$('#researchSubmit').fadeOut();

			return false;
		});
		
		$("#printGrid").click(function() {
			$('#resizeGrid a.expand').click();
			
	        var WindowObject = window.open('',"","width=620,height=450,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");
			WindowObject.document.writeln('<html><head><title>On The House 2009</title>');
			WindowObject.document.writeln('<style type="text/css" media="screen, projection, print">@import "/stylesheets/programs/on_the_house.css";</style>');
			WindowObject.document.writeln('</head><body>');
			WindowObject.document.writeln('<img src="images/programs/onthehouse/OTH_09_carousel1_460x285px.jpg"><br />');
			WindowObject.document.writeln('<table id="myTable" width="620" class="tablesorter" border="0" cellpadding="0" cellspacing="0">');
			WindowObject.document.writeln($('#myTable').html());
			WindowObject.document.writeln('</table></body></html>');
	        WindowObject.document.close();
	        WindowObject.focus();
	        WindowObject.print();
	        WindowObject.close();
			
			$('#resizeGrid a.shrink').click();
			return false;
		});
		$("#printContest").click(function() {
			window.print();
			return false;
		});
	});
	// input clear text event 
	function textClear() {
		$("input.clearText").focus(function() {
			if(this.value == this.defaultValue) {
				this.value = '';
			}
		}).blur(function() {
			if(!this.value.length) {
				this.value = this.defaultValue;
			}
		});	
	}