I am currently using the following code but its very slow for large numbers
static int divisor(int number)
{
int i;
The best algorithm will depend on how huge your numbers will really be.
This problem is basically as hard as factoring integers - if have some factoring algorithm, it will be rather easy to use it to construct the greatest non-trivial divisor. Again, which of all the known factoring algorithms you employ for a number should depend on its 'hugeness', as for different scales these fancy algorithms will likely have different performances.
You will probably find several (maybe different) answers to your question in good books on cryptography, algorithmics and computational number theory.
Again, depending on your scale, it might even be an option to simple precompute a large list a prime numbers, save it, and then given an input number search within this list for the smallest divisor - which will immediately have the greatest divisor pop up, too.