//////////////////////////////////////////////////////////
/// Class:   Ad
/// Version: 0.1 
/// Contact: Colin Elion
//////////////////////////////////////////////////////////
if(Ad == "undefined") var Ad = new Object();
function Ad(channel, category, site, zone) {
    var axel = Math.random() + ""; var ord = axel * 1000000000000000000;
    this.attributes = new Array(); 
    
    if (channel) this.setAttribute('channel',  channel);
    if (category)this.setAttribute('category', category);
    if (site)    this.setAttribute('site',     site);
    if (zone)    this.setAttribute('zone',     zone);
    this.setAttribute('ord', ord);
}
Ad.prototype =
{
	setAttribute: function(name, value)
		{
    this.attributes[name] = value;
  	}
  ,

  getAttribute: function(name)
  	{
    return this.attributes[name];
  	}
  ,
  write: function(size, tiles, direction)
  	{
    var tile=1;
    var str_tiles = "tile=" + tile;
    if (tiles)
    	{
      if (direction) {str_tiles = "tn="+tiles+";to="+direction+";tbw=0;tsw=0x0";}
      else           {str_tiles = "tn="+tiles+";to=v;tbw=0;tsw=0x0";}
    	}
		document.write('<SCR'+'IPT LANGUAGE="JavaScript1.1" SRC="http://ad.doubleclick.net/adj/' + this.getAttribute("site") + '.site112.tmus/' + this.getAttribute("zone") + ';genre=' + this.getAttribute("category") + ';page=' + window.location.pathname+ ';' + str_tiles + ';sz=' + size + ';ord=' + this.getAttribute("ord") + '?"><\/SCRIPT>');
    if ((!document.images && navigator.userAgent.indexOf("Mozilla/2.") >= 0)  || navigator.userAgent.indexOf("WebTV")>= 0)
    	{
      document.write('<A HREF="http://ad.doubleclick.net/jump/' + this.getAttribute("site") + '.site112.tmus/' + this.getAttribute("zone") +';genre=' + this.getAttribute("category") + ';tile=' + tile + ';sz=' + size + ';ord=' + this.getAttribute("ord") + '?">');
      document.write('<IMG SRC="http://ad.doubleclick.net/ad/' + this.getAttribute("site") + '.site112.tmus/' + this.getAttribute("zone") +  ';genre=' + this.getAttribute("category") + ';tile='+tile+';sz=' + size + ';ord=' + this.getAttribute("ord") + '?" BORDER="" ALT=""></A>');
    	}
  	}
  ,
  writeYTV: function(size, tiles, direction)
  	{
    var tile=1;
    var str_tiles = "tile=" + tile;
    if (tiles)
    	{
      if (direction) {str_tiles = "tn="+tiles+";to="+direction+";tbw=0;tsw=0x0;tr=2";}
      else           {str_tiles = "tn="+tiles+";to=v;tbw=0;tsw=0x0;tr=2";}
    	}
		document.write('<SCR'+'IPT LANGUAGE="JavaScript1.1" SRC="http://ad.doubleclick.net/adj/ytv.site112.tmus/' + this.getAttribute("zone") + ';genre=' + this.getAttribute("category") + ';page=' + window.location.pathname+ ';' + str_tiles + ';sz=' + size + ';ord=' + this.getAttribute("ord") + '?"><\/SCRIPT>');
    if ((!document.images && navigator.userAgent.indexOf("Mozilla/2.") >= 0)  || navigator.userAgent.indexOf("WebTV")>= 0)
    	{
      document.write('<A HREF="http://ad.doubleclick.net/jump/ytv.site112.tmus/' + this.getAttribute("zone") +';genre=' + this.getAttribute("category") + ';tile=' + tile + ';sz=' + size + ';ord=' + this.getAttribute("ord") + '?">');
      document.write('<IMG SRC="http://ad.doubleclick.net/ad/ytv.site112.tmus/' + this.getAttribute("zone") +  ';genre=' + this.getAttribute("category") + ';tile='+tile+';sz=' + size + ';ord=' + this.getAttribute("ord") + '?" BORDER="" ALT=""></A>');
    	}
  	}
  ,
  	writeYTVGamepad: function(size, tiles, tile, direction) {
  	    var str_tiles = "tile=" + tile;
  	    if (tiles != 1) {
  	        if (direction) { str_tiles = "tn=" + tiles + ";to=" + direction + ";tbw=0;tsw=0x0;tr=2"; }
  	        else { str_tiles = "tn=" + tiles + ";to=v;tbw=0;tsw=0x0;tr=2"; }
  	    }
  	    document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.1" SRC="http://ad.doubleclick.net/adj/ytv.site112.tmus/' + this.getAttribute("zone") + ';genre=' + this.getAttribute("category") + ';page=' + window.location.pathname + ';' + str_tiles + ';sz=' + size + ';ord=' + this.getAttribute("ord") + '?"><\/SCRIPT>');
  	    if ((!document.images && navigator.userAgent.indexOf("Mozilla/2.") >= 0) || navigator.userAgent.indexOf("WebTV") >= 0) {
  	        document.write('<A HREF="http://ad.doubleclick.net/jump/ytv.site112.tmus/' + this.getAttribute("zone") + ';genre=' + this.getAttribute("category") + ';tile=' + tile + ';sz=' + size + ';ord=' + this.getAttribute("ord") + '?">');
  	        document.write('<IMG SRC="http://ad.doubleclick.net/ad/ytv.site112.tmus/' + this.getAttribute("zone") + ';genre=' + this.getAttribute("category") + ';tile=' + tile + ';sz=' + size + ';ord=' + this.getAttribute("ord") + '?" BORDER="" ALT=""></A>');
  	    }
    }

}



 