//####################################
// Olympic Ad Tags
// Ad sizes:728x90 and 300x250
//===================================
// Usage:
//  MUST be at the top of the page for this javascript link
//  <script language="JavaScript" src="htt://your_host/oly_ad.js"></script>
//
//  <script language="JavaScript">
//  	ap_oly_ad('dynamic variable for member id or siteid','@x81'); // top banner 728, variable, @x81 needs to be changed
//  </script>
//
//  <script language="JavaScript">
//  	ap_oly_ad('dynamic variable for member id or siteid','@x06'); // image size 300x250, variable, @x06 needs to be changed
//  </script>
// ASSOCIATED PRESS
// 9/16/2009
//###################################

var ap_oly_custid;
var ap_oly_pos;
var ap_oly_section='OLY';
var ap_oly_adsection;
var ap_oly_adprimaryentity;
var ap_oly_adsport;


function ap_oly_ad(ap_oly_custid,ap_oly_pos,ap_oly_adsection,ap_oly_adprimaryentity,ap_oly_adsport)
{
   var RN = new String(Math.random());
   var RNS = RN.substring(2, 11);
   if (ap_oly_pos != '@x87')
   {
       document.write('<div align="center" valign="center"><font face="Arial,Helvetica,Sans Serif" color="#999999" size="1">Advertisement</font></div>');
   }

   ap_oly_adsection=(ap_oly_adsection)? ap_oly_adsection.toLowerCase() : '';
   ap_oly_adprimaryentity=(ap_oly_adprimaryentity)? ap_oly_adprimaryentity.toLowerCase() : '';
   ap_oly_adsport=(ap_oly_adsport)? ap_oly_adsport.toLowerCase() : '';
   
   var mySportList=new Array(ap_oly_adsection,ap_oly_adprimaryentity,ap_oly_adsport);
   if (mySportList.toString().match(/hockey/))
   {
   	ap_oly_section='NHL_Sec';
        //ap_oly_pos = ap_oly_pos +'?NHL';
   }
   document.write('<div align="center" valign="center">');
   document.write('<scr'+'ipt type="text/javascript" src="http://oascentral.hosted.ap.org/RealMedia/ads/adstream_jx.ads/'+ ap_oly_custid + '.hosted.ap.org/'+ ap_oly_section + '/1' + RNS + ap_oly_pos + '">');
   document.write('<a href="http://oascentral.hosted.ap.org/RealMedia/ads/click_nx.ads/' + ap_oly_custid + '.hosted.ap.org/' + ap_oly_section + '/1' + RNS + ap_oly_pos + '">');
   document.write('<img src="http://oascentral.hosted.ap.org/RealMedia/ads/adstream_nx.ads/'+ ap_oly_custid +'.hosted.ap.org/' + ap_oly_section + '/1' + RNS + ap_oly_pos + '"></a>');
   document.write('<\/scr'+'ipt>');
   document.write('\</div>');
}

function ap_oly_ad_pop(ap_oly_custid,ap_oly_pos)
{  
	    var RN = new String(Math.random());
	    var RNS = RN.substring(2, 11);
	    document.write('<div align="center"><script type="text/javascript" src="http://oascentral.hosted.ap.org/RealMedia/ads/adstream_jx.ads/'+ ap_oly_custid + '.hosted.ap.org/'+ ap_oly_section + '/1' + RNS + ap_oly_pos + '">');
	    document.write('<a href="http://oascentral.hosted.ap.org/RealMedia/ads/click_nx.ads/' + ap_oly_custid + '.hosted.ap.org/' + ap_oly_section + '/1' + RNS + ap_oly_pos + '">');
	    document.write('<img src="http://oascentral.hosted.ap.org/RealMedia/ads/adstream_nx.ads/'+ ap_oly_custid +'.hosted.ap.org/' + ap_oly_section + '/1' + RNS + ap_oly_pos + '"></a>');
	    document.write('<\/script>'+'\</div>');
}

function ap_oly_ad_video(ap_oly_custid,ap_oly_section,ap_oly_pos)
{
   var RN = new String(Math.random());
   var RNS = RN.substring(2, 11);
   document.write('<script type="text/javascript" src="http://oascentral.hosted.ap.org/RealMedia/ads/adstream_jx.ads/'+ ap_oly_custid + '.hosted.ap.org/'+ ap_oly_section + '/1' + RNS + ap_oly_pos + '">');
   document.write('<\/script>'+'\<\/div>');
}

//function ap_oly_ad_video_url(ap_oly_custid,ap_oly_section,ap_oly_pos)
function ap_oly_ad_video_url(ap_oly_custid,ap_oly_pos,ap_oly_adsection,ap_oly_adprimaryentity,ap_oly_adsport)
{
   var RN = new String(Math.random());
   var RNS = RN.substring(2, 11);
   //return "http://oascentral.hosted.ap.org/RealMedia/ads/adstream_nx.ads/" + ap_oly_custid + ".hosted.ap.org/"+ ap_oly_section + "/1" + RNS + ap_oly_pos;
   return "http://oascentral.hosted.ap.org/RealMedia/ads/adstream_sx.ads/" + ap_oly_custid + ".hosted.ap.org/"+ ap_oly_section + "/1" + RNS + ap_oly_pos;

}


