An interesting point to remember with 80 days left to the Presidential election, and just two days to August 20, precisely five months to the inauguration!
NEVER has a President in wartime been defeated, including two times when war clouds hovered, but we were not technically at war!
Witness the following:
James Madison, the War of 1812, reelected in 1812
Abraham Lincoln, the Civil War, reelected in 1864
Woodrow Wilson, World War I, not at war but nearing it, reelected in 1916
Franklin D. Roosevelt, World War II, not at war but nearing it, reelected in 1940, and then at war, reelected in 1944.
Lyndon B. Johnson, using the Vietnam War issue through the Gulf of Tonkin, elected in 1964
Richard Nixon, Vietnam War, reelected in 1972
George W. Bush, Iraq and Afghanistan Wars, reelected in 2004
This list does not include James K. Polk, who chose not to run for reelection AFTER the end of the Mexican War in 1848; William McKinley, reelected AFTER the Spanish American War’s end, in 1900; Harry Truman, who chose not to run in 1952 during the Korean War; Lyndon B. Johnson, who chose not to run during the Vietnam War in 1968; and George H. W. Bush, who was triumphant during the Persian Gulf War, but then lost 18 months later for reelection in 1992, due to the bad economy and the candidacy of Ross Perot helping Bill Clinton to win in a three way race.
So the odds of Barack Obama winning reelection with the Afghanistan War raging are excellent!