It was founded in AD 192. Around the 4th century AD, Champan polities began to absorb much of Indic influences, probably through its neighbour, Funan. Hinduism was established as Champa began to create Sanskrit stone inscriptions and erect red brick Hindu temples. The first king acknowledged in the inscriptions is Bhadravarman, who reigned from AD 380 to AD 413. At Mỹ Sơn, King Bhadravarman established a linga called Bhadresvara, whose name was a combination of the king's own name and that of the Hindu god of gods Shiva. The worship of the original god-king under the name Bhadresvara and other names continued through the centuries that followed. Rudravarman of Champa founded a new dynasty in 529 CE and was succeeded by his son, Shambhuvarman. He reconstructed the temple of Bhadravarman and renamed it to Shambhu-bhadreshvara. He died in 629 and was succeeded by his son, Kandarpadharma, who died in 630-31. Kandarpadharma was succeeded by his son, Prabhasadharma, who died in 645. Between the 7th to 10th centuries AD, the Cham polities rose to become a naval power; as Champan ports attracted local and foreign traders, Champan fleets also controlled the trade in spices and silk in the South China Sea, between China, the Indonesian archipelago and India. They supplemented their income from the trade routes not only by exporting ivory and aloe, but also by engaging in piracy and raiding. However, the rising influence of Champa caught the attention of a neighbouring thalassocracy that considered Champa as a rival, the Javanese (Javaka, probably refers to Srivijaya ruler of Malay Peninsula, Sumatra and Java). In AD 767, the Tonkin coast was raided by a Javanese fleet (Daba) and Kunlun pirates, Champa was subsequently assaulted by Javanese or Kunlun vessels in AD 774 and AD 787. In AD 774 an assault was launched on Po-Nagar in Nha-trang where the pirates demolished temples, while in AD 787 an assault was launched on Phang-rang. In the Cham–Vietnamese War (AD 1471), Champa suffered serious defeats at the hands of the Vietnamese, in which 120,000 people were either captured or killed, and the kingdom was reduced to a small enclave near Nha Trang with many Chams fleeing to Cambodia.