#Java 7,431 bytes

<!-- language-all: lang-java -->

    String f(String s){String v="";boolean z=0>1;String[]l=s.split(" ");String[]b={"a","an","the","at","by","for","in","of","on","to","up","and","as","but","or","and","nor"};int i,f=i=0;for(String c:l){for(f=0;f<b.length;++f)if(c.equals(b[f])){z=1>0;break;}else z=0>1;v+=z?(i==0|i++==l.length-1)?c.substring(0,1).toUpperCase()+c.substring(1,c.length())+" ":c+" ":c.substring(0,1).toUpperCase()+c.substring(1,c.length())+" ";++i;}return v;}

#ungolfed

first answer above 250 bytes

    String f(String s){
		String v = "";
		boolean z = 0 > 1;
	   String[] l = s.split(" ");
	   String[] b = {"a","an","the","at","by","for","in","of","on","to",
                              "up","and","as","but","or","and","nor"};
	   int i, f = i = 0;    
	  for (String c : l) {
	    	   for (f = 0; f < b.length; ++f)
	    		 if (c.equals( b[f] )) {
	        		z = 1 > 0;
	        		break;
                 }
	        		else
	        		z = 0 > 1;
	 v+=z?(i==0|i++==l.length-1)?c.substring(0,1).toUpperCase()+c.substring(1,c.length())+" "
              :c+" "
              :c.substring(0,1).toUpperCase()+c.substring(1,c.length())+" ";
	           }
      return v;
       }