// JavaScript Document
{
/*
'rss' being the class object, its elements are 'channel' and 'items'
'channel' elements:title,link,description,language,copyright,managingEditor,webMaster,pubDate,lastBuildDate
'items' element is an array of 'item' objects
'item' elements: title,link,description,author,category,comments,guid,pubDate,wid,siteURL,rateSum,rateClicks,rating
*/
  var CONTENT_NEWEST_MAXTOTAL = 30;
  var CONTENT_NEWEST_MAXDISPLAY = 6;
  var CONTENT_NEWEST_currentX = 0;
  var CONTENT_NEWEST_rss;
	var CONTENT_NEWEST_COUNT;
	var CONTENT_NEWEST_targetElement;
  function CONTENT_NEWEST_myCallback(rss, targetElement)
  {
    CONTENT_NEWEST_rss = rss;
    if(rss.items.length > CONTENT_NEWEST_MAXTOTAL)
			CONTENT_NEWEST_COUNT = CONTENT_NEWEST_MAXTOTAL;
		else
      CONTENT_NEWEST_COUNT = rss.items.length;
		CONTENT_NEWEST_targetElement = targetElement;
    CONTENT_NEWEST_write(targetElement);
  }
  function CONTENT_NEWEST_write(targetElement)
  {
		if(!targetElement)
		  targetElement = CONTENT_NEWEST_targetElement;

		var innerText = '<table border="0" cellspacing="0" cellpadding="0" style="margin:5px 5px 5px 5px;"><tr>';
		innerText += '<td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>';
		innerText += '<td height="25" align="left" valign="middle"><span class="style6">What\'s New?</span></td></tr><tr>';
		innerText += '<td align="center" class=""><table width="100%" border="0"><tr>';

		//PREVIOUS BUTTON
		if(CONTENT_NEWEST_currentX >= CONTENT_NEWEST_MAXDISPLAY)
		{
			innerText += '<td width="80" align="left" valign="middle"><a href="javascript:CONTENT_NEWEST_previous();"><< previous</a></td>';
		}
		else
		{
			innerText += '<td width="80" align="left" valign="middle" style="opacity:0.1;filter:Alpha(Opacity=20);"><< previous</td>';
		}
		innerText += '<td><table width="100%" border="0" cellpadding="2" cellspacing="0" class="outsidebox" style="font-size:11px;font-family:Tahoma,Verdana;"><tr>';

		var item;
    var s;
    var link;
    for(var x = CONTENT_NEWEST_currentX; x < CONTENT_NEWEST_COUNT && x < (CONTENT_NEWEST_MAXDISPLAY + CONTENT_NEWEST_currentX); x++)
    {
      item = CONTENT_NEWEST_rss.items[x];
      s = item.title;
      if(s.length > 18)
        s = s.substring(0, 15) + "..";
      link = CONTENTDOMAIN +'/content_tour/'+ item.studioName +'/'+ item.titleName +'/'+ item.sceneName;
      innerText += '<td align="center" valign="top"><a href="javascript:loadXMLDoc(\'/S/ContentSet?WID='+ WID +'&CID='+ item.guid +'\', featured_myCallback, \'MAIN\');">';
      innerText += '<img class="thumbstop" width="100" height="75" src="'+ link +'/tour/t2.jpg" alt="'+ item.title +'" onmouseover="startImageSwap(this)" onmouseout="stopImageSwap()"></a>';
      innerText += '<br /><a href="javascript:loadXMLDoc(\'/S/ContentSet?WID='+ WID +'&CID='+ item.guid +'\', featured_myCallback, \'MAIN\');">'+ s +'</a><br />';
      //innerText += '<span style="font-size:9px;font-family:Tahoma, Verdana;">'+ item.pubDate +'</span>';
      innerText += '</td>';
    }
    innerText += '</tr></table></td>';
		//NEXT BUTTON
		if((CONTENT_NEWEST_currentX + CONTENT_NEWEST_MAXDISPLAY) < CONTENT_NEWEST_COUNT && (CONTENT_NEWEST_currentX + CONTENT_NEWEST_MAXDISPLAY) < CONTENT_NEWEST_MAXTOTAL)
		{
			innerText += '<td width="80" align="right" valign="middle"><a href="javascript:CONTENT_NEWEST_next();">more >></a></td>';
		}
		else
		{
			innerText += '<td width="80" align="right" valign="middle" style="opacity: 0.1;filter:Alpha(Opacity=20);">more >></td>';
		}
		innerText += "</tr></table></td></tr></table>";

    var element = document.getElementById(targetElement);  //alert(innerText);
    element.innerHTML = innerText;
  }
  function CONTENT_NEWEST_previous()
  { // alert(currentX - (MAXDISPLAY));
    CONTENT_NEWEST_currentX = CONTENT_NEWEST_currentX - CONTENT_NEWEST_MAXDISPLAY;
    CONTENT_NEWEST_write();
  }
  function CONTENT_NEWEST_next()
  {
    CONTENT_NEWEST_currentX = CONTENT_NEWEST_currentX + CONTENT_NEWEST_MAXDISPLAY;
    CONTENT_NEWEST_write();
  }
  //loadXMLDoc('/S/ContentSet_Newest?WID='+ WID, CONTENT_NEWEST_myCallback);
}
