
HomeHighlight.prototype.createView = createView;
HomeHighlight.prototype.setNumberOfInstances = setNumberOfInstances;
HomeHighlight.prototype.setTitle = setTitle;
HomeHighlight.prototype.setUrl = setUrl;
HomeHighlight.prototype.setAbbreviateTitle = setAbbreviateTitle;
HomeHighlight.prototype.setThumbnail = setThumbnail;
HomeHighlight.prototype.setDescription = setDescription;
HomeHighlight.prototype.setUser = setUser;
HomeHighlight.prototype.setCreationDate = setCreationDate;
HomeHighlight.prototype.setContentCategory = setContentCategory;
HomeHighlight.prototype.setNumberOfComments = setNumberOfComments;
HomeHighlight.prototype.setViewCount = setViewCount;
HomeHighlight.prototype.setIndex = setIndex;
HomeHighlight.prototype.setUserID = setUserID;
HomeHighlight.prototype.setRate = setRate;
HomeHighlight.prototype.setRateEnabled = setRateEnabled;
HomeHighlight.prototype.setViewType = setViewType;

function HomeHighlight(id) {
	this.id = id;
	this.out = null;
	this.viewType = 'basic';
	this.rateEnabled = 'false';
}

function setNumberOfInstances(numberOfInstances){
	this.numberOfInstances = numberOfInstances;
}

function setIndex(index){
	this.index = index;
}

function setUserID(userID){
	this.userID = userID;
}

function setTitle(title){
	this.title = title;
}

function setUrl(url){
	this.url = url;
}

function setAbbreviateTitle(abbreviateTitle){
	this.abbreviateTitle = abbreviateTitle;
}

function setThumbnail(thumbnail){
	this.thumbnail = thumbnail;
}

function setDescription(description){
	this.description = description;
}

function setUser(user){
	this.user = user;
}

function setCreationDate(creationDate){
	this.creationDate = creationDate;
}

function setContentCategory(contentCategory){
	this.contentCategory = contentCategory;
}

function setNumberOfComments(numberOfComments){
	if(numberOfComments==''){
		this.numberOfComments=0;
	}else{
		this.numberOfComments = numberOfComments;
	}
}

function setViewCount(viewCount){
	if(viewCount==''){
		this.viewCount=0;
	}else{
		this.viewCount = viewCount;
	}
}

function setRateEnabled(rateEnabled) {
	this.rateEnabled = rateEnabled;
}

function setRate(rate) {
	if(rate=='') {
		this.rate = 0;
	} else {
		this.rate = rate;
	}
}

function setViewType(viewType) {
	this.viewType = viewType;
}

function createView(_contID){
	if(this.viewType == 'basic') {
		if(_contID != 'highlightFixed') {
			_top = '';	
			_pagerStyle = '';	//style="margin-top:210px" ';
		} else {
			_top = '<h2><span>'+getWord('label.body.highlight')+'</span></h2>';
			_pagerStyle = '';
		}
		
		pager = '';
		if(this.numberOfInstances > 1) {
			pager = '<ul class="pager">';
			for(i=0; i < this.numberOfInstances; i=i+1){
				pager += '<li><a ';
				if(this.index == i) {
					pager += ' class="on" ';
				}
				pager += _pagerStyle + ' href="#" onclick="return changeHighlightHide(\''+_contID+'\','+ i +');">'+ (i+1) +'</a></li>';
			}
			pager += '</ul>';
		}
		
		this.out = '' + _top 
			+ pager
			+ '<a class="img_highlight" style="display: none;" href="'+this.url+'" title="'+this.title+'">' 
			+ this.thumbnail
			+ '</a>'
			+ '<h3 style="display: none;" ><a href="'+this.url+'" title="'+this.title+'">'+ this.abbreviateTitle +'</a></h3>'
			+ '<p style="display: none;">'+this.description+'</p>'
			+ '<p style="display: none;">' + this.user + '<br/>'
			+ this.creationDate + ' | ' + this.contentCategory + '<br/>'
			+ getWord('label.comment.zero')+'(<strong>' + this.numberOfComments 
			+ '</strong>) | '+getWord('label.body.views')+'(<strong>' + this.viewCount + '</strong>)</p>'
			+ '<sc'+'ript type=\"text/javascript\">'
			+ '	$(document).ready('
			+ '		 function() {'
			+ '		makeDraggableJoinChat(\''+this.userID+'\');'
			+ '		});'
			+ '</scr'+'ipt>';
		
		return this.out;
	} else if(this.viewType == 'advanced') {
		//REPLYSOCIALNETWORK PATCH
		if(_contID != 'highlightFixed') {
			_top = '';	
			_pagerStyle = '';	//style="margin-top:210px" ';
		} else {
			_top 	= 	'<h2><span>'+getWord('label.body.highlight')+'</span></h2>'
					+	'<p class="viewall_hightlight">'
					+	'	<a href="/tamtamy/content/listAllNetworkHighlights.action" class="viewall">'
					+	'		view all'
					+	'	</a>'
					+	'</p>';
			_pagerStyle = '';
		}
		
		pager = '';
		if(this.numberOfInstances > 1) {
			pager = '<ul class="pager">';
			for(i=0; i < this.numberOfInstances; i=i+1){
				pager += '<li><a ';
				if(this.index == i) {
					pager += ' class="on" ';
				}
				pager += _pagerStyle + ' href="#" onclick="return changeHighlightHide(\''+_contID+'\','+ i +');">'+ (i+1) +'</a></li>';
			}
			pager += '</ul>';
		}
		
		this.out = '' + _top
			+ '<div class="box_hightlight">'
			+ '<a style="display: none;" class="img_highlight" href="'+this.url+'" title="'+this.title+'">' 
			+ this.thumbnail
			+ '</a>'
			+ '<div style="display: none;" class="text_hightlight">'
			+ '	<h3><a href="'+this.url+'" title="'+this.title+'">'+ this.abbreviateTitle +'</a></h3>'
			+ '	<p class="pre_text">'+this.description+'</p>'
			+ '	<p>' + this.user + '<br/>'
			+ this.creationDate + ' | ' + this.contentCategory + '<br/>'
			+ getWord('label.comment.zero')+'(<strong>' + this.numberOfComments 
			+ '</strong>) | '+getWord('label.body.views')+'(<strong>' + this.viewCount + '</strong>)'
			+ '</p>';
		
		if(this.rateEnabled == 'true') {
			this.out +=	'<span>Rate</span>'
				+ '	<span class="inline-rating">'
				+ '	<ul title="open the detail page to rate it" class="star-rated">'
				+ '		<li style="width: '+(this.rate * 20.0)+'%;" class="current-rating"></li>'
				+ '		<li><a class="one-star">1</a></li>'
				+ '		<li><a class="two-stars">2</a></li>'
				+ '		<li><a class="three-stars">3</a></li>'
				+ '		<li><a class="four-stars">4</a></li>'
				+ '		<li><a class="five-stars">5</a></li>'
				+ '	</ul>'
				+ '</span>';
		}
		
		this.out += '</div>'
			+ '<sc'+'ript type=\"text/javascript\">'
			+ '	$(document).ready('
			+ '		 function() {'
			+ '		makeDraggableJoinChat(\''+this.userID+'\');'
			+ '		});'
			+ '</scr'+'ipt>'
			+ '</div>'
			+ pager;
		
		return this.out;
	}
}