    /*
        Toggle User Feed
        ------------------------------------------------------------------------------------------------------*/  
        function toggle_user_feed(event){
            var $current_feed   = $(this).text().toLowerCase().replace(' ','_');
            
            if(!$(this).hasClass('current')){
                $('#user_feed a.tab:not(.'+$current_feed+')').removeClass('current');
                $('#user_feed span:not(.'+$current_feed+')').removeClass('current');
                
                $('#user_feed a.'+$current_feed).addClass('current');
                $('#user_feed span.'+$current_feed).addClass('current');
                
                $.post('/vegas_to_vermont/includes/functions/session.inc.php?function=user_feed_preference',{ pref : $current_feed});
                
                return false;
            }
        }
    
    /*
        Toggle Contact Us
        ------------------------------------------------------------------------------------------------------*/  
        function toggle_contact_us(event){
            var $contact_us     = $('#contact_us');
            
            if($contact_us.is(':hidden')){
                $('#contact_us').fade_in();
            } else {
                $('#contact_us').fade_out();
            }
        
            return false;
        }
    
    /*
        Contact Us
        ------------------------------------------------------------------------------------------------------*/  
        function contact_us(event){
            var $contact_name       = $('form#contact input[name=contact_name]').val();
            var $contact_email      = $('form#contact input[name=contact_email]').val();
            var $contact_message    = $('form#contact textarea[name=contact_message]').val();
            var $contact_ip_address = $(this).attr('ip_address').replace('ip_address_','');
            var $contact_browser    = $(this).attr('browser');
            
            if($contact_name && $contact_email && $contact_message){
                $.post(
                    '/vegas_to_vermont/includes/functions/user_contact.inc.php',
                    {
                        name        : $contact_name,
                        email       : $contact_email,
                        message     : $contact_message,
                        ip_address  : $contact_ip_address,
                        browser     : $contact_browser
                    },
                    toggle_contact_us
                );
            }
        
            return false;
        }
        
        
    
    /*
        External Link
        ------------------------------------------------------------------------------------------------------*/  
        function external_link(event){
	    	window.open($(this).attr('href'),'V2V',"toolbar=0,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=950,height=500");
	    	
	    	return false;
        }




$(document).ready(function(event){ 
    /*
        Initialize Events
        ------------------------------------------------------------------------------------------------------*/
        if(jQuery.browser.msie && parseInt(jQuery.browser.version,10) < 7 && parseInt(jQuery.browser.version,10) > 4){
            $('#page_header').supersleight();
        }
          
        $('#page_copy').jScrollPane({showArrows:true,scrollbarWidth:15,arrowSize:15});
        
        $('a[href*=http]').bind('click',external_link);
        
        $('form#user_login a.login').click(function(event){ $('form#user_login').submit(); return false; });
        $('form input[type=password]').keyup(function(event){ if(event.keyCode == 13){ $(this).parent().parent().parent().submit(); } });
        
        $('#user_feed a.tab').bind('click',toggle_user_feed);
        
        $('#site_footer ol a').bind('click',toggle_contact_us);
        $('#contact_us span').css('opacity',0.6);
        
        $('#contact_us a.send').bind('click',contact_us);
        $('#contact_us a.cancel').bind('click',toggle_contact_us);
});