$(document).ready(
function () {
		$('.moreabout').click(function() {
			$(this).hide().parent().find('.aboutusText').addClass('moreText');  	
				});
		$('.searchAd').click(function(event) {
					 var i=this.id.split("_");
					 var u="adClick?ruid=" + i[0] + "&class=" + i[1] + "&n=" + i[2];
					 $.ajax({type: "GET", url: ("/adlog/"+u),  async: false});
			 });
		$('.gradientAd').click(function(event) {
			 var i=this.id.split("_");
			 var u="adClick?ruid=" + i[0] + "&class=" + i[1] + "&n=" + i[2];
			 $.ajax({type: "GET", url: ("/adlog/"+u),  async: false});
				 });

		$('#cat_list_more').click(function() {
				$('#cat_list').find('li').removeClass('textOff');
				$(this).hide();
			});

		$('#sa_panel').click(function() {
        			var up = $('#search-analytics');
        			var sb = $('#bar_space');
        			var sa = $('#bar_ad_space');
				var state = up.css('display');
				//if (up.hasClass('hide')) {
				if (state == 'none') {
           				up.css('display', '');
           				sb.css('display', '');
           				sa.css('display', '');
           				$('#arrow-closed').css('display', 'none');
           				$('#arrow-open').css('display', 'block');
					$.cookie('alx_sa_state', 'open', { expires: 1 });
					//up.show();
					
        			} else {
           				up.css('display', 'none');
           				sb.css('display', 'none');
           				sa.css('display', 'none');
           				$('#arrow-closed').css('display', 'block');
           				$('#arrow-open').css('display', 'none');
					$.cookie('alx_sa_state', 'closed', { expires: 1 });
					//up.hide();
        			}
    		});
	$('.advanced-search').click(function() {
			$('#formContainer').show(); 
			$(this).hide();
			$('#threecolwrap').addClass('filter-gap');
            $.cookie('ai-advanced', 'on', { path: '/', expires: 30}); 
		});
	$('.close').click(function() {
    		var q = $('#searchbox').val();
			$('#formContainer').hide();
			$('.advanced-search').show();
			$('#threecolwrap').removeClass('filter-gap');
		    $.cookie('ai-advanced', 'off', { path: '/', expires: 30});
		    window.location.href = '/search?reset=true&q='+q;
		});
	$('#screenerForm').find('select').change(function () {
			var q = $('#searchbox').val();
			$('#screenerForm').attr('action','/search?q='+q);
            $('#screenerForm').submit();
        })
    

});

