function ChangeProfilePicture() {
	var buttons = new Array(
		new Array("Save Changes", function() { 
			var profile_frame = document.getElementById('msg_iframe_popup_profile_picture');
			var profile_form = profile_frame.contentDocument.forms['profile_upload'];
			profile_form.submit();
			//HidePopup('profile_picture'); 
			//return(true);
		}),
		new Array("Cancel Changes", function() { HidePopup('profile_picture'); return(false); })
	);
	ShowPopupWithURL('profile_picture', 'Change Profile Picture', '/users/profile_picture', 750, 450, buttons);
}

function editProfileSection(section) {
	switch(section) {
		case 'portfolio':
			//document.location.href = '/portfolio';
			showPortfolioEditor();
			break;
		case 'teams':
			document.location.href = '/teams/index';
			break;

		case 'videos':
			document.location.href = '/videos';
			break;

		case 'info':
		case 'profile':
			showProfileEditor();
			break;
		default:
			showProfileEditor(section);
			break;		
	}
}

function showProfileEditor(section) {
	var buttons = new Array(
		new Array("Save Changes", function() { 
			var profile_frame = document.getElementById('msg_iframe_popup_edit_profile_section');
			var profile_form = profile_frame.contentDocument.forms['profile_edit'];
			profile_form.submit();
			HidePopup('edit_profile_section'); 
			parent.document.location.reload(true);
			return(true);
		}),
		new Array("Cancel Changes", function() { HidePopup('edit_profile_section'); return(false); })
	);
	if(section !== undefined && section !== '' && section != 'profile') {
		ShowPopupWithURL('edit_profile_section', 'Edit Profile', '/users/edit/0/' + section, 750, 450, buttons);
	}else{
		ShowPopupWithURL('edit_profile_section', 'Edit Profile', '/users/edit' , 750, 450, buttons);
	}
}


function showPortfolioEditor(item) {
	var buttons = new Array(
		new Array("Save Changes", function() { 
			var profile_frame = document.getElementById('msg_iframe_popup_edit_portfolio');
			var profile_form = profile_frame.contentDocument.forms['edit_portfolio'];
			profile_form.submit();
			HidePopup('edit_portfolio'); 
			parent.document.location.reload(true);
			return(true);
		}),
		new Array("Cancel Changes", function() { HidePopup('edit_portfolio'); return(false); })
	);
	if(item !== undefined && item !== '') {
		ShowPopupWithURL('edit_portfolio', 'Edit Portfolio', '/portfolio/edit/0/' + section, 750, 450, buttons);
	}else{
		ShowPopupWithURL('edit_portfolio', 'Edit Portfolio', '/portfolio/' , 750, 450, buttons);
	}
}

function showProfileSendDialog() {
	var buttons = new Array(
		new Array("Send Profile", function() { 
			var profile_frame = document.getElementById('msg_iframe_popup_profile_send');
			var profile_form = profile_frame.contentDocument.forms['profile_send'];
			profile_form.submit();
			return(true);
		}),
		new Array("Cancel", function() { HidePopup('profile_send'); return(false); })
	);
	
	ShowPopupWithURL('profile_send', 'Send Profile', '/profile/send' , 750, 450, buttons);
}

function showMessageDialog(msgid) {
	var buttons = new Array(
		new Array("Send Message", function() { 
			var profile_frame = document.getElementById('msg_iframe_popup_send_message');
			var profile_form = profile_frame.contentDocument.forms['send_message'];
			profile_form.submit();
			return(true);
		}),
		new Array("Discard Message", function() { HidePopup('send_message'); return(false); })
	);
	
	ShowPopupWithURL('send_message', 'Send Private Message', '/messages/send/' + msgid , 750, 450, buttons);
}

/*
(function($) {
  $(function() {
    var int_sideheight = $(window).height() - $('#header').height() - 10;
    $('#pinned').css('height',int_sideheight+'px');
    $(window).scroll(function() {
      if ($(this).scrollTop() > $('#header').height()) {
        $('#pinned').addClass('pin-set').css('height','100%');
      } else {
        var int_sideheight = $(window).height() - $('#header').height() - 10;
        $('#pinned').removeClass('pin-set').css('height',int_sideheight+'px');
      }
    });
  });
})(jQuery);


Read more: http://hereswhatidid.com/2011/02/28/google-news-style-floating-sidebar/#ixzz1Xs71wrzd

// ------------------------------------------------------------------------------------------------

var outerPane = $details.find(".details-pane-outer"),
    didScroll = false;
$(window).scroll(function() {
    didScroll = true;
});

setInterval(function() {
    if ( didScroll ) {
        didScroll = false;
        // Check your page position and then
        // Load in more results
    }
}, 250);
*/
