var ListNode = function(strTitle,strIntro,strUrl,strImg) {
	var strTitle;
	var strIntro;
	var strUrl;
	var strImg;
	
	var el;
	
	this.init(strTitle,strIntro,strUrl,strImg);
}

ListNode.prototype.init = function(strTitle,strIntro,strUrl,strImg) {
	this.setTitle(strTitle);
	this.setIntro(strIntro);
	this.setUrl(strUrl);
	this.setImg(strImg);
}

ListNode.prototype.renderTo = function(elementId) {
	var objElLi = $('<li />');
	this.el = objElLi;
	
  var strTitle = "";
  if( this.getTitle().length > 55 ) {
    strTitle = this.getTitle().substring(0,55).valueOf()+"...";
  } else {
    strTitle = this.getTitle().valueOf();
  }
  
	var objH2 = $('<h5 />').text(strTitle);
  
  var strText = new String(this.getIntro());
                         
  if( strText.length > 140 ) {
	  strText = strText.substring(0,140).valueOf()+"...";
  } else {
    strText = strText.valueOf();
  }
  var objP = $('<p />').text(strText);
	var objArrow = $('<div />').addClass('arrow');
	objElLi.prepend(objArrow).append(objH2).append(objP);
	
	var url = this.getUrl();
	var img = this.getImg();
	
	objElLi.click(function(){
		self.location = url;
	});
	
	objElLi.mouseover(function(){
		$('#'+elementId+' .preview-container img').attr('src',img);
		$(this).siblings().removeClass('active');
		$(this).addClass('active');
	});
	
	$('#'+elementId+' .list').append(objElLi);
}

ListNode.prototype.activate = function(elementId) {
	$('#'+elementId+' .preview-container img').attr('src',this.getImg());
	this.el.addClass('active');
}

ListNode.prototype.setTitle = function(strTitle) {
	this.strTitle = strTitle;
}

ListNode.prototype.getTitle = function() {
	return this.strTitle;
}

ListNode.prototype.setIntro = function(strIntro){
	this.strIntro = strIntro;
}

ListNode.prototype.getIntro = function() {
	return this.strIntro;
}

ListNode.prototype.setUrl = function(strUrl){
	this.strUrl = strUrl;
}

ListNode.prototype.getUrl = function(){
	return this.strUrl;
}

ListNode.prototype.setImg = function(strImg){
	this.strImg = strImg;
}

ListNode.prototype.getImg = function() {
	return this.strImg;
}
