var ad_56com_client_area="";
var ad_56com_client_time="1258915734";
var ad_56com_ads = new Array(new Array());

var corplist=",rison,nba,disney,four49812,byd5665,";

google_hints="";
if(document.title.indexOf('56Íø')> -1)
{
  google_hints=document.title.substring(0,document.title.indexOf('56Íø'))+google_hints;
}
function acs_getcookie(name)
{
  var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
  if(arr!=null)return unescape(arr[2]);
  return "";
};
function acs_setcookie(name,value)
{
  var exp=new Date();
  exp.setUTCDate((exp.getUTCDate()+1));
  exp.setUTCHours(0);
  exp.setUTCMinutes(0);
  document.cookie=name+"="+escape(value)+"; domain=56.com; path=/; expires="+exp.toGMTString();
};
function acs_checklocation(adlocation,clientlocation)
{
  if(adlocation=="")
  {
    return true;
  }
  if(clientlocation=="")
  {
    return false;
  }
  var bb=adlocation.split("_");
  for(var cc=0;cc<bb.length;cc++)
  {
    if(clientlocation.indexOf(bb[cc])>=0)
    {
      return true;
    }
  }
  return false;
};
function acs_checktag(tags)
{

  if ( typeof(oFlv) !="undefined" && oFlv.o.user_id && corplist.indexOf(','+oFlv.o.user_id+',')>-1 )
  {
	if(tags.indexOf('u:'+oFlv.o.user_id)>-1)
	 {return true;} 
	else 
	{return false;}
  }

  if(tags=="")
  {
    return true;
  }
  var acs_tags=tags.split("_");
  for(var cc=0;cc<acs_tags.length;cc++)
  {
    if(google_hints.indexOf(acs_tags[cc])>=0)
    {
      return true;
    }
  }
  return false;
};
function acs_checkchannel(channelid)
{
  if(channelid=="")
  {
    return true;
  }
  var acs_channels=channelid.split("_");
  for(var cc=0;cc<acs_channels.length;cc++)
  {
    if(typeof(oFlv) != "undefined" &&oFlv.o&&oFlv.o.channel>0&&oFlv.o.channel==acs_channels[cc])
    {
      return true;
    }
  }
  return false;
};



try
{
  var cook=acs_getcookie("ads");
  var ad_56com_ads_new=[];
  var j=0;
  var tmp=new Array();
  for(i=0;i<ad_56com_ads.length;i++)
  {
    var check_cook="z"+ad_56com_ads[i][0]+"c"+ad_56com_ads[i][9]+"-";
    if(ad_56com_ads[i][9]==0||cook.indexOf(check_cook)<0)
    {
      if(ad_56com_client_time>=ad_56com_ads[i][5]&&ad_56com_client_time<=ad_56com_ads[i][6])
      {
        if(acs_checklocation(ad_56com_ads[i][3],ad_56com_client_area)&&acs_checktag(ad_56com_ads[i][10])&&acs_checkchannel(ad_56com_ads[i][8]))
        {
          ad_56com_ads_new[j]=ad_56com_ads[i];
          for(k=0;k<ad_56com_ads[i][4];k++)
          {
            tmp.push(j);
          }
          j++;
        }
      }
    }
  }
  randomNumber=Math.floor(Math.random()*tmp.length);
  randomNumber=tmp[randomNumber];
  j=ad_56com_ads_new[randomNumber][9];
  i=1;
  if(j>0)
  {
    var arr=cook.match(new RegExp("z"+ad_56com_ads_new[randomNumber][0]+"c([0-9]*)-"));
    if(arr!=null)
    {
      i=parseInt(arr[1]);
      i++;
      if(i>=j)
      {
        i=j;
      }
      cook=cook.replace(new RegExp("z"+ad_56com_ads_new[randomNumber][0]+"c([0-9]*)-","g"),"");
    }
    cook=cook+"z"+ad_56com_ads_new[randomNumber][0]+"c"+i+"-";
    acs_setcookie("ads",cook);
  }
  htmlcode=ad_56com_ads_new[randomNumber][11];
  htmlcode=htmlcode.replace(/WIDTH_VAR/g,ad_56com_width);
  htmlcode=htmlcode.replace(/HEIGHT_VAR/g,ad_56com_height);

  if(typeof(acs_slide_show) == "undefined") { acs_slide_show = 0;}
  if(typeof(acs_slide_show_max) == "undefined") { acs_slide_show_max = 0;}
  if(acs_slide_show == 1 && tmp.length>0) {
	ad_56com_ads_new.sort(function(){return Math.random()>0.5?1:-1;});
        for(i=0;i<tmp.length;i++) {
          if (acs_slide_show_max > 0 && i >= acs_slide_show_max) { break;}
          htmlcode=ad_56com_ads_new[i][11];
          htmlcode=htmlcode.replace(/WIDTH_VAR/g,ad_56com_width);
          htmlcode=htmlcode.replace(/HEIGHT_VAR/g,ad_56com_height);
          document.write(htmlcode);
        }
    acs_slide_show = 0;
    acs_slide_show_max = 0;

  } else { 
  if(tmp.length>0)
  {
    document.write(htmlcode)
  }
  }

}
catch(e)
{
}

