changed php to javascript and added purl jquery plugin