
function User(){}
User.getIdentity=function(user,def){var name=$.trim(undefToBlank(user.firstname)+" "+undefToBlank(user.lastname));if(name.length>0)
return name;var title=undefToBlank(user.title);if(title.length>0)
return title;return def;}
User.getOccupation=function(user,def){var company=undefToBlank(user.company);if(company.length>0)
return company;var industry=undefToBlank(user.industry);if(industry.length>0)
return industry;return def;}
User.getLocation=function(user){var locationValue='';var delim='';var city=undefToBlank(user.city);if(city.length>0){locationValue=city;delim=', ';}
var state=undefToBlank(user.state);if(state.length>0){locationValue+=delim+state;delim=', ';}
var country=undefToBlank(user.country);if(country.length>0){locationValue+=delim+country;delim=', ';}
var zipCode=undefToBlank(user.zipCode);if(zipCode.length>0)
locationValue+=delim+zipCode;return locationValue;}
User.format=function(user){var str=User.getIdentity(user,"someone");var occupation=User.getOccupation(user,"");if(occupation.length>0)
str+=", "+occupation;var location=User.getLocation(user);if(location.length>0)
str+=" located in "+location;return str;}
User.basicValidation=function(user){if(undefToBlank(user.firstname)=='')return"Please enter your first name.";if(undefToBlank(user.lastname)=='')return"Please enter your last name.";if(!validateEmailID(undefToBlank(user.email)))return"Please enter a correct email address.";if(undefToBlank(user.title)=='')return"Please enter your title.";if(undefToBlank(user.industry)=='')return"Please enter your industry.";if(undefToBlank(user.company)=='')return"Please enter your company.";if(undefToBlank(user.city)=='')return"Please enter your city.";if(undefToBlank(user.country)=="United States"&&undefToBlank(user.state)=='')return"Please enter your state.";if(undefToBlank(user.country)=='')return"Please enter your country.";}
function parseUser(xml){var parser=new XML.ObjTree();var json=parser.parseDOM(xml);if(typeof json["#document"]!="undefined")
json=json["#document"];return json.user;}
function parseUsers(xml){var parser=new XML.ObjTree();parser.force_array=["user"];var json=parser.parseDOM(xml);if(typeof json["#document"]!="undefined")
json=json["#document"];if(typeof json.users=="undefined")
return[];return json.users.user;}
function parseTwitterRequestToken(xml){var parser=new XML.ObjTree();var json=parser.parseDOM(xml);if(typeof json["#document"]!="undefined")
json=json["#document"];return json.twitterRequestToken;}
