function DoTopSearch(term){
	$("ajaxSearch_input").value = term;
	$("ajaxSearch_submit").click();
	return false;	
}

function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}


function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );


  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}


$(document).ready(function(){
        $("ul#news").liScroll({travelocity: 0.04}); 
        
        $("a#surveylaunchClick").fancybox();
        
        if(get_cookie ( "popup" ) == 'done'){
        
        } else {
                set_cookie ( "popup", "done" );
                $("a#surveylaunchClick").click();
        }
        
        $('.scroll-pane').jScrollPane({
            verticalDragMinHeight: 20,
        });    
        // validate newsletter sign up form
        $('#subForm').validate({
            submitHandler: function(form) {
                //  Send a post to the notification script so a notification can be sent.
                $.post('/assets/plugins/newsletter-signup/index.php', { name: $('#subForm #name').val(), email: $('#subForm #auiktd-auiktd').val()}, 
                    function(){
                        form.submit();
                    });

            }   
        });

});

