(function($){   
  $.fn.paintWIY = function() {   
       
   
       
    return this.each(function() {   
  
   
      obj = $(this);
      var widgetHTML = "";
      var body = obj.html();
      var i =0;
      var blogURL = 'javascript:void(0)';
	  var authImage = '';
      if(WIYResponse.length > 0) {
            	if(WIYResponse[0].BlogURL.length > 0){
            		blogURL = WIYResponse[0].BlogURL;
					authImage = WIYResponse[0].EntryAuthorIMG;
      	}
      }
	   
      //widgetHTML = widgetHTML + '<a href="'+ blogURL +'" target="_blank"><img src="/en_US/Assets/Image/logos/promo-inside_scoop.jpg" alt="Intel&reg; Inside Scoop" title="Intel&reg; Inside Scoop" class="logo" border="0" /></a>' ;
      widgetHTML = widgetHTML + '<a href="'+ blogURL +'" target="_blank"><img src="' + authImage + '" class="logo" border="0" width="98" /></a>' ;
      if(WIYResponse) {
	for(i=0; i < WIYResponse.length; i++) {
	
	if(i < ((WIYResponse.length) -1))
	{	
          var wiyR = WIYResponse[i];
          widgetHTML = widgetHTML + '<div class="blog-desc">'+
            '<h4><a href="'+ wiyR.BlogURL + wiyR.EntryPermalink + '" target="_blank">' + wiyR.EntryTitle + '</a></h4>'+
            '<p>' + wiyR.EntrySummary + '</p> '+
            '<a href="'+ wiyR.BlogURL + wiyR.EntryPermalink + '" target="_blank">Read more</a> <img src="/en_US/Assets/Image/icons/gbl-link-plus.gif"/>'+
            '</div>' ;
			}
	
	else
	{
	var wiyR = WIYResponse[i];
	widgetHTML = widgetHTML + '<a href="'+ wiyR.BlogURL + wiyR.EntryPermalink +'" target="_blank"><img src="' + wiyR.EntryAuthorIMG + '" class="logo"  style="padding-left:5px;" border="0" width="98" /></a>' ;
	widgetHTML = widgetHTML + '<div class="blog-desc-last">'+
            '<h4><a href="'+ wiyR.BlogURL + wiyR.EntryPermalink + '" target="_blank">' + wiyR.EntryTitle + '</a></h4>'+
            '<p>' + wiyR.EntrySummary + '</p> '+
            '<a href="'+ wiyR.BlogURL + wiyR.EntryPermalink + '" target="_blank">Read more</a> <img src="/en_US/Assets/Image/icons/gbl-link-plus.gif"/>'+
            '</div>' ;
	}
			
	}
	
	
	
      }
	  
	
	
      widgetHTML = widgetHTML + '<div class="clear"></div>' ;
   
      obj.append(widgetHTML);
    });   
  };   
})(jQuery);


