/**
 * @class ProfileUI: UI component to display profile
 * @constructor
 * @param {Object} props includes imageURL, titles, specifications 
 */
function ProfileUI(props) {

	/**
     * imageURL
     * @type String
     */		
	this.imageURL = props.imageURL;
	
	/**
     * titles
     * @type Array
     */		
	this.titles = props.titles;

	/**
     * specifications
     * @type Array
     */		
	this.specs = props.specs;

	/**
     * new line char
     * @type String
     */	
	this.newLine = "\n";
	
	/**
	 * constructin HTML 
	 * @return {String} constructed HTML
	 */
	this.display = function() {
		var str = "<table width='100%' cellspacing='0' cellpadding='0'  style='margin: 0 4px 0 4px;border: 1px solid #D9E0E6' >" + this.newLine;
		str = str + "<td align='center' width='140' height='140' style='padding: 4px; border: 4px solid #683d2a; background: #efefff'>" + this.newLine;
		var imageURL = this.imageURL || image;
		str = str + "<img style='margin: 3px 10px 3px 6px;padding: 4px; border: 1px solid #D9E0E6;border-bottom-color: #C8CDD2;border-right-color: #C8CDD2;background: #fff;'" + this.newLine;
		str = str + "src='" + imageURL + "' alt='No photo' />" + this.newLine;
		str = str + "</td>" + this.newLine;
		str = str + "<td style=' padding: 4px; border: 4px solid #683d2a;background:#efefff; valign='top'>" + this.newLine;
		if (this.titles) {
			str = str + "<ul style='list-style: none; margin: 0; padding: 4px; font-size: 130%; letter-spacing: 1px; color: #627081;'>" + this.newLine;
			if ( com.ebay.widgets.typeOf(this.titles) == 'array') {
				for (var i = 0; i< this.titles.length; ++i) {
					if (this.titles[i].url) {
						str = str + "<li><a href='" + this.titles[i].url + "'>" + this.titles[i].value + "</a></li>" + this.newLine;
					} else {
						str = str + "<li>" + this.titles[i].value + "</li>" + this.newLine;						
					}
				}
			} else {
				if (titles.url) {
					str = str + "<li><a href='" + this.titles.url + "'>" + this.titles[i].value + "</a></li>" + this.newLine;
				} else {
					str = str + "<li>" + this.titles.value + "</li>" + this.newLine;						
				}				
			}
			str = str + "</ul>" + this.newLine;
		}
		str = str + "<br>" + this.newLine;
		if (this.specs) {
			str = str + "<ul style='list-style: none; margin: 0; padding: 4px; font-size: 100%; letter-spacing: 1px; color: #666;'>" + this.newLine;
			if ( com.ebay.widgets.typeOf(this.specs) == 'array') {
				for (i = 0; i< this.specs.length; i++) {
					str = str + "<li>" + this.specs[i].key + ":		<span style='font-weight:bold;'>" + this.specs[i].value + "</span></li>" + this.newLine;						
				}
			} else {
					str = str + "<li>" + this.specs.key + ":	<span style='font-weight:bold;'>" + this.specs.value + "</span></li>" + this.newLine;										
			}
			str = str + "</ul>" + this.newLine;			
		}
		str = str + "</td>" + this.newLine;				
		str = str + "</table>" + this.newLine;
		return str;
	}
}